Skip to content

Commit

Permalink
Adding date time tests
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenldl committed Apr 27, 2024
1 parent 55feaee commit dad4fb5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions timedesc-tests/date_time_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,30 @@ module Alco = struct
|> CCResult.get_exn
|> Timedesc.to_string ~format:"{sec-frac:.6}")

let to_string_tzoff_sign_case0 () =
Alcotest.(check string)
"same string"
"+"
(Timedesc.of_iso8601 "2020-01-02T10:30:40.1234Z"
|> CCResult.get_exn
|> Timedesc.to_string ~format:"{tzoff-sign}")

let to_string_tzoff_sign_case1 () =
Alcotest.(check string)
"same string"
"+"
(Timedesc.of_iso8601 "2020-01-02T10:30:40.123456789+10"
|> CCResult.get_exn
|> Timedesc.to_string ~format:"{tzoff-sign}")

let to_string_tzoff_sign_case2 () =
Alcotest.(check string)
"same string"
"-"
(Timedesc.of_iso8601 "2020-01-02T10:30:40.123456789-10"
|> CCResult.get_exn
|> Timedesc.to_string ~format:"{tzoff-sign}")

let suite =
[
Alcotest.test_case "leap_second0" `Quick leap_second0;
Expand Down Expand Up @@ -1307,6 +1331,9 @@ module Alco = struct
Alcotest.test_case "to_string_sec_frac_case_b1" `Quick to_string_sec_frac_case_b1;
Alcotest.test_case "to_string_sec_frac_case_c0" `Quick to_string_sec_frac_case_c0;
Alcotest.test_case "to_string_sec_frac_case_c1" `Quick to_string_sec_frac_case_c1;
Alcotest.test_case "to_string_tzoff_sign_case0" `Quick to_string_tzoff_sign_case0;
Alcotest.test_case "to_string_tzoff_sign_case1" `Quick to_string_tzoff_sign_case1;
Alcotest.test_case "to_string_tzoff_sign_case2" `Quick to_string_tzoff_sign_case2;
]
end

Expand Down

0 comments on commit dad4fb5

Please sign in to comment.