diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2018-10-30 23:33:08 +0100 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2018-10-30 23:33:08 +0100 |
commit | 8b89c516c814e9626a294eb74cf72a9a863eec46 (patch) | |
tree | f793fca0d0fca734e5ca17aac27739f526c04184 | |
parent | 682f7b9002a09e7b5adfbb8cce788eb7302bc92b (diff) | |
download | ocaml-sid-8b89c516c814e9626a294eb74cf72a9a863eec46.tar.gz |
sid_test: unit test string format version numbers some more
-rw-r--r-- | sid_test.ml | 20 |
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 |