@@ -496,8 +496,41 @@ mod rrsig_rdata_test{
496
496
rrsig_rdata. set_signer_name ( DomainName :: new_from_str ( "example.com" ) ) ;
497
497
rrsig_rdata. set_signature ( String :: from ( "abcdefg" ) ) ;
498
498
499
- let result = RRSIGRdata :: from_bytes ( & bytes_test, & bytes_test) . unwrap ( ) ;
499
+ if let Ok ( result) = RRSIGRdata :: from_bytes ( & bytes_test, & bytes_test) {
500
+ assert_eq ! ( result, rrsig_rdata) ;
501
+ }
502
+ else {
503
+ assert ! ( false , "error" ) ;
504
+ }
500
505
501
- assert_eq ! ( result, rrsig_rdata) ;
506
+ }
507
+
508
+ #[ test]
509
+ fn to_bytes_max_values ( ) {
510
+ let bytes_test: Vec < u8 > = vec ! [ 255 , 255 , //typed covered
511
+ 255 , //algorithm
512
+ 2 , //labels
513
+ 255 , 255 , 255 , 255 , //TTL
514
+ 255 , 255 , 255 , 255 , //Signature expiration
515
+ 255 , 255 , 255 , 255 , //Signature Inception
516
+ 255 , 255 , // key tag
517
+ 7 , 101 , 120 , 97 , 109 , 112 , 108 , //domain name
518
+ 101 , 3 , 99 , 111 , 109 , 0 ,
519
+ 97 , 98 , 99 , 100 , 101 , 102 , 103 ] ; //signature
520
+
521
+ let mut rrsig_rdata = RRSIGRdata :: new ( ) ;
522
+ rrsig_rdata. set_type_covered ( Rtype :: UNKNOWN ( 65535 ) ) ;
523
+ rrsig_rdata. set_algorithm ( 255 ) ;
524
+ rrsig_rdata. set_labels ( 2 ) ;
525
+ rrsig_rdata. set_original_ttl ( 4294967295 ) ;
526
+ rrsig_rdata. set_signature_expiration ( 4294967295 ) ;
527
+ rrsig_rdata. set_signature_inception ( 4294967295 ) ;
528
+ rrsig_rdata. set_key_tag ( 65535 ) ;
529
+ rrsig_rdata. set_signer_name ( DomainName :: new_from_str ( "example.com" ) ) ;
530
+ rrsig_rdata. set_signature ( String :: from ( "abcdefg" ) ) ;
531
+
532
+ let result = rrsig_rdata. to_bytes ( ) ;
533
+
534
+ assert_eq ! ( result, bytes_test) ;
502
535
}
503
536
}
0 commit comments