Skip to content

Commit

Permalink
add test max values from_bytes rrsig
Browse files Browse the repository at this point in the history
  • Loading branch information
konegoro committed Jan 12, 2024
1 parent 6d3bc4c commit 50a476b
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/message/rdata/rrsig_rdata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,4 +471,33 @@ mod rrsig_rdata_test{

assert_eq!(result, Err("Format Error"));
}

#[test]
fn from_bytes_max_values() {
let bytes_test: Vec<u8> = vec![255, 255, //typed covered
255, //algorithm
2, //labels
255, 255, 255, 255, //TTL
255, 255, 255, 255, //Signature expiration
255, 255, 255, 255, //Signature Inception
255, 255, // key tag
7, 101, 120, 97, 109, 112, 108, //domain name
101, 3, 99, 111, 109, 0,
97, 98, 99, 100, 101, 102, 103]; //signature

let mut rrsig_rdata = RRSIGRdata::new();
rrsig_rdata.set_type_covered(Rtype::UNKNOWN(65535));
rrsig_rdata.set_algorithm(255);
rrsig_rdata.set_labels(2);
rrsig_rdata.set_original_ttl(4294967295);
rrsig_rdata.set_signature_expiration(4294967295);
rrsig_rdata.set_signature_inception(4294967295);
rrsig_rdata.set_key_tag(65535);
rrsig_rdata.set_signer_name(DomainName::new_from_str("example.com"));
rrsig_rdata.set_signature(String::from("abcdefg"));

let result = RRSIGRdata::from_bytes(&bytes_test, &bytes_test).unwrap();

assert_eq!(result, rrsig_rdata);
}
}

0 comments on commit 50a476b

Please sign in to comment.