This repository has been archived on 2024-05-23. You can view files and clone it, but cannot push or open issues or pull requests.
dns-toy/test/test.ml

19 lines
435 B
OCaml
Raw Normal View History

2023-06-05 20:38:10 +02:00
open Dnstoy
2023-06-05 19:57:20 +02:00
let () =
2023-06-05 20:38:10 +02:00
let data : Types.dns_header =
2023-06-05 19:57:20 +02:00
{ id = 0x1314
; flags = 0
; num_questions = 1
; num_answers = 0
; num_authorities = 0
; num_additionals = 0
}
in
assert (
"\\x13\\x14\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00"
2023-06-05 20:38:10 +02:00
= Utils.get_bytecode (Query.header_to_bytes data));
assert (
"\\x06google\\x03com\\x00" = Utils.get_bytecode (Query.encode_dns_name "google.com"))
2023-06-05 19:57:20 +02:00
;;