add a test

This commit is contained in:
Mylloon 2023-06-05 20:46:02 +02:00
parent 53668483bb
commit b16cf6df7c
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -10,9 +10,12 @@ let () =
; num_additionals = 0 ; num_additionals = 0
} }
in in
(* Header *)
assert ( assert (
"\\x13\\x14\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00" "\\x13\\x14\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00"
= Utils.get_bytecode (Query.header_to_bytes data)); = Utils.get_bytecode (Query.header_to_bytes data));
assert ( (* Dns name *)
"\\x06google\\x03com\\x00" = Utils.get_bytecode (Query.encode_dns_name "google.com")) let dns_name = Query.encode_dns_name "google.com" in
assert ("\\x06google\\x03com\\x00" = Utils.get_bytecode dns_name);
assert (6 = Char.code (Bytes.get dns_name 0))
;; ;;