summaryrefslogtreecommitdiff
path: root/sid_test.ml
diff options
context:
space:
mode:
Diffstat (limited to 'sid_test.ml')
-rw-r--r--sid_test.ml20
1 files changed, 18 insertions, 2 deletions
diff --git a/sid_test.ml b/sid_test.ml
index 97af2a3..9b61b40 100644
--- a/sid_test.ml
+++ b/sid_test.ml
@@ -31,12 +31,21 @@ let create_ok () =
(Printf.sprintf "[%s] ≠ [%s]" (Sid.to_string s) (Sid.to_string w))
(Sid.equal s w)
-let create_fail () =
+let create_etoomany_fail () =
let sas = Array.make 16 U32.one in
match Sid.create ~sa:sas U64.zero with
| None -> ()
| Some s -> assert_failure ("Sid.create succeeded on invalid sa array")
+let max_ident_auth = U64.of_string "0x0000_ffff_ffff_ffff"
+
+let create_iatoobig_fail () =
+ let sas = Array.make 2 U32.one in
+ let ia = U64.add max_ident_auth U64.one in
+ match Sid.create ~sa:sas ia with
+ | None -> ()
+ | Some s -> assert_failure ("Sid.create succeeded on invalid ident auth")
+
let unwrap_of_string s =
match Sid.of_string s with
| Error e ->
@@ -345,7 +354,14 @@ let packet_rep_test = "packet-rep" >:::
; "decode-odd-fail" >:: pr_decode_odd_fail
]
+let toplevel_test = "toplevel" >:::
+ [ "create-ok" >:: create_ok
+ ; "create-etoomany-fail" >:: create_etoomany_fail
+ ; "create-iatoobig-fail" >:: create_iatoobig_fail
+ ]
+
let () =
ignore (run_test_tt_main string_format_test);
- ignore (run_test_tt_main packet_rep_test )
+ ignore (run_test_tt_main packet_rep_test );
+ ignore (run_test_tt_main toplevel_test )