diff options
-rw-r--r-- | sid_test.ml | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sid_test.ml b/sid_test.ml index 5f9f0b2..0a571c9 100644 --- a/sid_test.ml +++ b/sid_test.ml @@ -16,6 +16,23 @@ let max_sid = Stdint.( Uint64.one ) +let create_ok () = + let w = Sid.WellKnown.everyone + and s = + match Sid.create ~sa:[| Stdint.Uint32.zero |] Stdint.Uint64.one with + | None -> assert_failure "Sid.create failed for S-1-0" + | Some s -> s + in + assert_bool + (Printf.sprintf "[%s] ≠ [%s]" (Sid.to_string s) (Sid.to_string w)) + (Sid.equal s w) + +let create_fail () = + let sas = Array.make 16 Stdint.Uint32.one in + match Sid.create ~sa:sas Stdint.Uint64.zero with + | None -> () + | Some s -> assert_failure ("Sid.create succeeded on invalid sa array") + let sf_parse_ok () = let s = Sid.of_string "S-1-1-0" in let z = Stdint.((Sid.create_unsafe [| Uint32.zero |] Uint64.one)) in |