Skip to content

Commit 50a476b

Browse files
committed
add test max values from_bytes rrsig
1 parent 6d3bc4c commit 50a476b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/message/rdata/rrsig_rdata.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,4 +471,33 @@ mod rrsig_rdata_test{
471471

472472
assert_eq!(result, Err("Format Error"));
473473
}
474+
475+
#[test]
476+
fn from_bytes_max_values() {
477+
let bytes_test: Vec<u8> = vec![255, 255, //typed covered
478+
255, //algorithm
479+
2, //labels
480+
255, 255, 255, 255, //TTL
481+
255, 255, 255, 255, //Signature expiration
482+
255, 255, 255, 255, //Signature Inception
483+
255, 255, // key tag
484+
7, 101, 120, 97, 109, 112, 108, //domain name
485+
101, 3, 99, 111, 109, 0,
486+
97, 98, 99, 100, 101, 102, 103]; //signature
487+
488+
let mut rrsig_rdata = RRSIGRdata::new();
489+
rrsig_rdata.set_type_covered(Rtype::UNKNOWN(65535));
490+
rrsig_rdata.set_algorithm(255);
491+
rrsig_rdata.set_labels(2);
492+
rrsig_rdata.set_original_ttl(4294967295);
493+
rrsig_rdata.set_signature_expiration(4294967295);
494+
rrsig_rdata.set_signature_inception(4294967295);
495+
rrsig_rdata.set_key_tag(65535);
496+
rrsig_rdata.set_signer_name(DomainName::new_from_str("example.com"));
497+
rrsig_rdata.set_signature(String::from("abcdefg"));
498+
499+
let result = RRSIGRdata::from_bytes(&bytes_test, &bytes_test).unwrap();
500+
501+
assert_eq!(result, rrsig_rdata);
502+
}
474503
}

0 commit comments

Comments
 (0)