source: project/release/4/rfc3339/trunk/tests/run.scm @ 22039

Last change on this file since 22039 was 22039, checked in by Jim Ursetto, 10 years ago

rfc3339: test-depends test; test-exit; 0.1.1

File size: 1.3 KB
Line 
1(use test rfc3339 posix)
2
3(test-begin "rfc3339->seconds")
4(test "1970-01-01T00:00:00-00:00" 0.0 (rfc3339->seconds (rfc3339 "1970-01-01T00:00:00-00:00")))
5(test "1969-12-31T20:40:00-03:20" 0.0 (rfc3339->seconds (rfc3339 "1969-12-31T20:40:00-03:20")))
6(test "1970-01-01T03:01:00+03:00" 60.0 (rfc3339->seconds (rfc3339 "1970-01-01T03:01:00+03:00")))
7(test "2000-02-28T23:00:00-01:00" 951782400.0 (rfc3339->seconds (rfc3339 "2000-02-28T23:00:00-01:00")))
8(test-end)
9
10(test-begin "seconds->rfc3339")
11(test "1970-01-01T00:00:00Z" "1970-01-01T00:00:00Z" (rfc3339->string (seconds->rfc3339 0)))
12(test "2000-02-29T00:00:00Z" "2000-02-29T00:00:00Z" (rfc3339->string (seconds->rfc3339 951782400.0)))
13(test-end)
14
15(test-begin "round-trip")
16(let ((str "1969-12-31T20:40:00+03:21"))
17  (test str str (rfc3339->string (rfc3339 str))))
18(test-end)
19
20(test-begin "normalization")
21(test "2000-02-28T23:00:00-01:00 utc-time->rfc3339"
22      "2000-02-29T00:00:00Z"
23      (rfc3339->string
24       (time->rfc3339
25        (seconds->utc-time
26         (rfc3339->seconds
27          (rfc3339 "2000-02-28T23:00:00-01:00"))))))
28(test "2000-02-28T23:00:00-01:00 time->rfc3339 (may fail on older Chicken)"
29      "2000-02-29T00:00:00Z"
30      (rfc3339->string
31       (utc-time->rfc3339
32        (seconds->utc-time
33         (rfc3339->seconds
34          (rfc3339 "2000-02-28T23:00:00-01:00"))))))
35(test-end)
36
37(test-exit)
Note: See TracBrowser for help on using the repository browser.