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 ec4913a..686e7aa 100644
--- a/sid_test.ml
+++ b/sid_test.ml
@@ -67,13 +67,27 @@ let sf_parse_junk_fail () =
assert_equal
e "Invalid SID [not a sid]: expected ‘S’ at position 0, found ‘n’"
-let sf_parse_ia_junk_fail () =
+let sf_parse_ver_junk_fail () =
match Sid.of_string "S-I-3-3-7" with
| Ok _ -> assert_failure "unexpectedly parsed junk inputs as SID"
| Error e ->
assert_equal
e "Invalid SID [S-I-3-3-7]: expected ‘1’ at position 2, found ‘I’"
+let sf_parse_ver_inval_fail () =
+ match Sid.of_string "S-2-3-3-7" with
+ | Ok _ -> assert_failure "unexpectedly parsed junk inputs as SID"
+ | Error e ->
+ assert_equal
+ e "Invalid SID [S-2-3-3-7]: expected ‘1’ at position 2, found ‘2’"
+
+let sf_parse_ver_inval2_fail () =
+ match Sid.of_string "S-10-0" with
+ | Ok _ -> assert_failure "unexpectedly parsed junk inputs as SID"
+ | Error e ->
+ assert_equal
+ e "Invalid SID [S-10-0]: expected ‘-’ at position 3, found ‘0’"
+
let sf_parse_trailing_ok () =
let s = unwrap_of_string "S-1-0-0-" in
assert_equal (Sid.to_string s) "S-1-0-0"
@@ -305,7 +319,9 @@ let string_format_test = "string-format-syntax" >:::
[ "parse-ok" >:: sf_parse_ok
; "parse-empty-fail" >:: sf_parse_empty_fail
; "parse-junk-fail" >:: sf_parse_junk_fail
- ; "parse-ia-junk-fail" >:: sf_parse_ia_junk_fail
+ ; "parse-ver-junk-fail" >:: sf_parse_ver_junk_fail
+ ; "parse-ver-inval-fail" >:: sf_parse_ver_inval_fail
+ ; "parse-ver-inval2-fail" >:: sf_parse_ver_inval2_fail
; "parse-trailing-ok" >:: sf_parse_trailing_ok
; "parse-maxint-ok" >:: sf_parse_maxint_ok
; "parse-oobia-fail" >:: sf_parse_oobia_fail