iso8601 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,100 @@
1
+ require "test/unit"
2
+ require "iso8601"
3
+
4
+
5
+ class TestAtom < Test::Unit::TestCase
6
+ def test_arguments
7
+ assert_raise(TypeError) { ISO8601::Atom.new("1") }
8
+ assert_raise(TypeError) { ISO8601::Atom.new(true) }
9
+ assert_nothing_raised() { ISO8601::Atom.new(-1) }
10
+ assert_nothing_raised() { ISO8601::Atom.new(0) }
11
+ assert_nothing_raised() { ISO8601::Atom.new(1) }
12
+ assert_nothing_raised() { ISO8601::Atom.new(1.1) }
13
+ assert_nothing_raised() { ISO8601::Atom.new(-1.1) }
14
+ end
15
+ end
16
+ class TestYears < Test::Unit::TestCase
17
+ def test_factor
18
+ assert_equal(31536000, ISO8601::Years.new(2).factor)
19
+ assert_equal(31536000, ISO8601::Years.new(1, ISO8601::DateTime.new("2010-01-01")).factor, "common year")
20
+ assert_equal(31622400, ISO8601::Years.new(1, ISO8601::DateTime.new("2000-01-01")).factor, "leap year")
21
+ end
22
+ def test_to_seconds
23
+ assert_equal(63072000, ISO8601::Years.new(2).to_seconds)
24
+ assert_equal(-63072000, ISO8601::Years.new(-2).to_seconds)
25
+ assert_equal(63072000, ISO8601::Years.new(2, ISO8601::DateTime.new("2010-01-01")).to_seconds, "common year")
26
+ assert_equal(378691200, ISO8601::Years.new(12, ISO8601::DateTime.new("2010-01-01")).to_seconds, "common year")
27
+ assert_equal(473385600, ISO8601::Years.new(15, ISO8601::DateTime.new("2010-01-01")).to_seconds, "common year")
28
+ assert_equal(63158400, ISO8601::Years.new(2, ISO8601::DateTime.new("2000-01-01")).to_seconds, "leap year")
29
+ end
30
+ end
31
+ class TestMonths < Test::Unit::TestCase
32
+ def test_factor
33
+ assert_equal(2628000, ISO8601::Months.new(2).factor)
34
+ assert_equal(2678400, ISO8601::Months.new(1, ISO8601::DateTime.new("2010-01-01")).factor, "common year")
35
+ assert_equal(2678400, ISO8601::Months.new(1, ISO8601::DateTime.new("2000-01-01")).factor, "leap year")
36
+ assert_equal(2419200, ISO8601::Months.new(1, ISO8601::DateTime.new("2010-02-01")).factor, "common year, february")
37
+ assert_equal(2505600, ISO8601::Months.new(1, ISO8601::DateTime.new("2000-02-01")).factor, "leap year, february")
38
+
39
+ end
40
+ def test_to_seconds
41
+ assert_equal(5256000, ISO8601::Months.new(2).to_seconds)
42
+ assert_equal(-5256000, ISO8601::Months.new(-2).to_seconds)
43
+ assert_equal(5097600, ISO8601::Months.new(2, ISO8601::DateTime.new("2010-01-01")).to_seconds, "common year")
44
+ assert_equal(5184000, ISO8601::Months.new(2, ISO8601::DateTime.new("2000-01-01")).to_seconds, "leap year")
45
+ assert_equal(5097600, ISO8601::Months.new(2, ISO8601::DateTime.new("2010-02-01")).to_seconds, "common year, february")
46
+ assert_equal(5184000, ISO8601::Months.new(2, ISO8601::DateTime.new("2000-02-01")).to_seconds, "leap year, february")
47
+
48
+ assert_equal(31622400, ISO8601::Months.new(12, ISO8601::DateTime.new("2000-02-01")).to_seconds, "leap year, february")
49
+ assert_equal(ISO8601::Years.new(1, ISO8601::DateTime.new("2000-02-01")).to_seconds, ISO8601::Months.new(12, ISO8601::DateTime.new("2000-02-01")).to_seconds, "leap year, february")
50
+ end
51
+ end
52
+
53
+ class TestWeeks < Test::Unit::TestCase
54
+ def test_factor
55
+ assert_equal(604800, ISO8601::Weeks.new(2).factor)
56
+ end
57
+ def test_to_seconds
58
+ assert_equal(1209600, ISO8601::Weeks.new(2).to_seconds)
59
+ assert_equal(-1209600, ISO8601::Weeks.new(-2).to_seconds)
60
+ end
61
+ end
62
+
63
+ class TestDays < Test::Unit::TestCase
64
+ def test_factor
65
+ assert_equal(86400, ISO8601::Days.new(2).factor)
66
+ end
67
+ def test_to_seconds
68
+ assert_equal(172800, ISO8601::Days.new(2).to_seconds)
69
+ assert_equal(-172800, ISO8601::Days.new(-2).to_seconds)
70
+ end
71
+ end
72
+ class TestHours < Test::Unit::TestCase
73
+ def test_factor
74
+ assert_equal(3600, ISO8601::Hours.new(2).factor)
75
+ end
76
+ def test_to_seconds
77
+ assert_equal(7200, ISO8601::Hours.new(2).to_seconds)
78
+ assert_equal(-7200, ISO8601::Hours.new(-2).to_seconds)
79
+ end
80
+ end
81
+ class TestMinutes < Test::Unit::TestCase
82
+ def test_factor
83
+ assert_equal(60, ISO8601::Minutes.new(2).factor)
84
+ end
85
+ def test_to_seconds
86
+ assert_equal(120, ISO8601::Minutes.new(2).to_seconds)
87
+ assert_equal(-120, ISO8601::Minutes.new(-2).to_seconds)
88
+ end
89
+ end
90
+ class TestSeconds < Test::Unit::TestCase
91
+ def test_factor
92
+ assert_equal(1, ISO8601::Seconds.new(2).factor)
93
+ end
94
+ def test_to_seconds
95
+ assert_equal(2, ISO8601::Seconds.new(2).to_seconds)
96
+ assert_equal(-2, ISO8601::Seconds.new(-2).to_seconds)
97
+ end
98
+ end
99
+
100
+
@@ -0,0 +1,72 @@
1
+ require "test/unit"
2
+ require "iso8601"
3
+
4
+ class TestDateTime < Test::Unit::TestCase
5
+ def test_patterns
6
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::DateTime.new("2") }
7
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::DateTime.new("201") }
8
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::DateTime.new("2010-") }
9
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::DateTime.new("20-05") }
10
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::DateTime.new("2010-0") }
11
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::DateTime.new("2010-0-09") }
12
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::DateTime.new("2010-1-09") }
13
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::DateTime.new("20101-09") }
14
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::DateTime.new("201-0109") }
15
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::DateTime.new("2010-05-09T103012+0400") }
16
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::DateTime.new("20100509T10:30:12+04:00") }
17
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::DateTime.new("2010-05-09T10:30:12+0400") }
18
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::DateTime.new("2010-05-09T10:3012+0400") }
19
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::DateTime.new("2010-05-09T10:3012") }
20
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::DateTime.new("2010:05:09T10:30:12+04:00") }
21
+
22
+ assert_raise(RangeError) { ISO8601::DateTime.new("2010-01-32") }
23
+ assert_raise(RangeError) { ISO8601::DateTime.new("2010-02-31") }
24
+ assert_raise(RangeError) { ISO8601::DateTime.new("2010-13-31") }
25
+ #assert_raise(RangeError) { ISO8601::DateTime.new("1901-12-13T20:45:52Z") - 1 }
26
+ #assert_raise(RangeError) { ISO8601::DateTime.new("2038-01-19T03:14:07Z") + 1 }
27
+ #assert_raise(RangeError) { ISO8601::DateTime.new("2038-01-19T02:14:07+01:00") + 1 }
28
+
29
+ assert_nothing_raised() { ISO8601::DateTime.new("20") }
30
+ assert_nothing_raised() { ISO8601::DateTime.new("2010") }
31
+ assert_nothing_raised() { ISO8601::DateTime.new("2010-05") }
32
+ assert_nothing_raised() { ISO8601::DateTime.new("2010-05-09") }
33
+ assert_nothing_raised() { ISO8601::DateTime.new("2010-05-09") }
34
+ assert_nothing_raised() { ISO8601::DateTime.new("2010-05-09T10") }
35
+ assert_nothing_raised() { ISO8601::DateTime.new("2010-05-09T10:30") }
36
+ assert_nothing_raised() { ISO8601::DateTime.new("2010-05-09T10:30:12") }
37
+ assert_nothing_raised() { ISO8601::DateTime.new("2010-05-09T10:30:12Z") }
38
+ assert_nothing_raised() { ISO8601::DateTime.new("2010-05-09T10:30:12+04:00") }
39
+ assert_nothing_raised() { ISO8601::DateTime.new("2010-05-09T10:30:12-04:00") }
40
+ assert_nothing_raised() { ISO8601::DateTime.new("2010-05-09T10:30:12+04") }
41
+ assert_nothing_raised() { ISO8601::DateTime.new("201005") }
42
+ assert_nothing_raised() { ISO8601::DateTime.new("20100509") }
43
+ assert_nothing_raised() { ISO8601::DateTime.new("20100509T103012") }
44
+ assert_nothing_raised() { ISO8601::DateTime.new("20100509T103012Z") }
45
+ assert_nothing_raised() { ISO8601::DateTime.new("20100509T103012+0400") }
46
+ assert_nothing_raised() { ISO8601::DateTime.new("20100509T103012-0400") }
47
+ assert_nothing_raised() { ISO8601::DateTime.new("20100509T103012+04") }
48
+ end
49
+
50
+ def test_atom_methods
51
+ assert_equal(20, ISO8601::DateTime.new("2010-05-09").century)
52
+ assert_equal(2010, ISO8601::DateTime.new("2010-05-09").year)
53
+ assert_equal(5, ISO8601::DateTime.new("2010-05-09").month)
54
+ assert_equal(9, ISO8601::DateTime.new("2010-05-09").day)
55
+ assert_equal(10, ISO8601::DateTime.new("2010-05-09T10:05:01").hour)
56
+ assert_equal(5, ISO8601::DateTime.new("2010-05-09T10:05:01").minute)
57
+ assert_equal(1, ISO8601::DateTime.new("2010-05-09T10:05:01").second)
58
+ end
59
+
60
+ def test_to_time
61
+ assert_instance_of(Time, ISO8601::DateTime.new("2010-05-09T10:05:01-01:00").to_time)
62
+ assert_instance_of(Time, ISO8601::DateTime.new("2010-05-09T10:05:01+01:00").to_time)
63
+ assert_instance_of(Time, ISO8601::DateTime.new("2010-05-09T10:05:01Z").to_time)
64
+ assert_instance_of(Time, ISO8601::DateTime.new("2010-05-09T10:05:01").to_time)
65
+ assert_instance_of(Time, ISO8601::DateTime.new("2010-05-09T10:05").to_time)
66
+ assert_instance_of(Time, ISO8601::DateTime.new("2010-05-09T10").to_time)
67
+ assert_instance_of(Time, ISO8601::DateTime.new("2010-05-09").to_time)
68
+ assert_instance_of(Time, ISO8601::DateTime.new("2010-05").to_time)
69
+ assert_instance_of(Time, ISO8601::DateTime.new("2010").to_time)
70
+ assert_instance_of(Time, ISO8601::DateTime.new("20").to_time)
71
+ end
72
+ end
@@ -0,0 +1,91 @@
1
+ require "test/unit"
2
+ require "iso8601"
3
+
4
+
5
+ class TestDuration < Test::Unit::TestCase
6
+ def test_patterns
7
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::Duration.new("P") }
8
+ assert_nothing_raised() { ISO8601::Duration.new("P1Y") }
9
+ assert_nothing_raised() { ISO8601::Duration.new("P1Y1M") }
10
+ assert_nothing_raised() { ISO8601::Duration.new("P1Y1M1D") }
11
+ assert_nothing_raised() { ISO8601::Duration.new("P2W") }
12
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::Duration.new("P1Y1M1DT") }
13
+ assert_nothing_raised() { ISO8601::Duration.new("P1Y1M1DT1H") }
14
+ assert_nothing_raised() { ISO8601::Duration.new("P1Y1M1DT1H1M") }
15
+ assert_nothing_raised() { ISO8601::Duration.new("P1Y1M1DT1H1M1S") }
16
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::Duration.new("PT") }
17
+ assert_nothing_raised() { ISO8601::Duration.new("PT1H") }
18
+ assert_nothing_raised() { ISO8601::Duration.new("PT1H1M") }
19
+ assert_nothing_raised() { ISO8601::Duration.new("PT1H1S") }
20
+ assert_nothing_raised() { ISO8601::Duration.new("PT1H1M1S") }
21
+ assert_nothing_raised() { ISO8601::Duration.new("+PT1H1M1S") }
22
+ assert_nothing_raised() { ISO8601::Duration.new("-PT1H1M1S") }
23
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::Duration.new("~PT1H1M1S") }
24
+ assert_raise(ISO8601::Errors::UnknownPattern) { ISO8601::Duration.new("T") }
25
+ end
26
+ def test_base
27
+ assert_nothing_raised() { ISO8601::Duration.new("P1Y1M1DT1H1M1S", ISO8601::DateTime.new("2010-01-01")) }
28
+ assert_raise(TypeError) { ISO8601::Duration.new("P1Y1M1DT1H1M1S", "2010-01-01") }
29
+ assert_raise(TypeError) { ISO8601::Duration.new("P1Y1M1DT1H1M1S", 2010) }
30
+ assert_instance_of(ISO8601::DateTime, ISO8601::Duration.new("P1Y1M1DT1H1M1S", ISO8601::DateTime.new("2010-01-01")).base)
31
+ assert_instance_of(NilClass, ISO8601::Duration.new("P1Y1M1DT1H1M1S").base)
32
+ assert_instance_of(ISO8601::DateTime, (ISO8601::Duration.new("P1Y1M1DT1H1M1S").base = ISO8601::DateTime.new("2010-01-01")))
33
+ end
34
+ def test_addition
35
+ assert_equal("P1YT2M24S", (ISO8601::Duration.new("P1YT2M12S") + ISO8601::Duration.new("PT12S")).to_s, "d1 + d2")
36
+ assert_instance_of(ISO8601::Duration, ISO8601::Duration.new("P1YT2M12S") + ISO8601::Duration.new("PT12S"))
37
+ end
38
+ def test_substraction
39
+ assert_equal("P1YT2M", (ISO8601::Duration.new("P1YT2M12S") - ISO8601::Duration.new("PT12S")).to_s, "d1 - d2 > 0")
40
+ assert_equal("PT0S", (ISO8601::Duration.new("PT12S") - ISO8601::Duration.new("PT12S")).to_s, "d1 - d2 = 0")
41
+ assert_equal("-P1YT1M", (ISO8601::Duration.new("PT12S") - ISO8601::Duration.new("P1YT1M12S")).to_s, "d1 - d2 < 0")
42
+ assert_instance_of(ISO8601::Duration, ISO8601::Duration.new("P1YT2M12S") - ISO8601::Duration.new("PT12S"))
43
+ end
44
+ def test_abs
45
+ assert_equal("P1YT2M", ISO8601::Duration.new("-P1YT2M").abs)
46
+ assert_equal("P1YT1M", (ISO8601::Duration.new("PT12S") - ISO8601::Duration.new("P1YT1M12S")).abs)
47
+ end
48
+ def test_date_to_seconds
49
+ assert_equal(63072000, ISO8601::Duration.new("P2Y").to_seconds, "P[n]Y form")
50
+ assert_equal(63158400, ISO8601::Duration.new("P2Y", ISO8601::DateTime.new("2000-01-01")).to_seconds, "P[n]Y form in leap year")
51
+ assert_equal(70956000, ISO8601::Duration.new("P2Y3M").to_seconds, "P[n]Y[n]M form")
52
+ assert_equal(70934400, ISO8601::Duration.new("P2Y3M", ISO8601::DateTime.new("2000-01-01")).to_seconds, "P[n]Y[n]M form in leap year")
53
+ assert_equal(71107200, ISO8601::Duration.new("P2Y3M", ISO8601::DateTime.new("2000-06-01")).to_seconds, "P[n]Y[n]M form in leap year")
54
+ assert_equal(65577600, ISO8601::Duration.new("P1Y13M", ISO8601::DateTime.new("2010-02-01")).to_seconds, "P[n]Y[n]M form with months > 12")
55
+ assert_equal(ISO8601::Duration.new("P2Y1M", ISO8601::DateTime.new("2010-02-01")).to_seconds, ISO8601::Duration.new("P1Y13M", ISO8601::DateTime.new("2010-02-01")).to_seconds)
56
+ assert_equal(Time.utc(2001, 4) - Time.utc(2000, 2), ISO8601::Duration.new("P14M", ISO8601::DateTime.new("2000-02-01")).to_seconds)
57
+
58
+ assert_equal(64022400, ISO8601::Duration.new("P2Y11D").to_seconds, "P[n]Y[n]D form")
59
+ assert_equal(71906400, ISO8601::Duration.new("P2Y3M11D").to_seconds, "P[n]Y[n]M[n]D form")
60
+ assert_equal(7884000, ISO8601::Duration.new("P3M").to_seconds, "P[n]M form")
61
+ assert_equal(8834400, ISO8601::Duration.new("P3M11D").to_seconds, "P[n]M[n]D form")
62
+ assert_equal(950400, ISO8601::Duration.new("P11D").to_seconds, "P[n]D form")
63
+ assert_equal(1209600, ISO8601::Duration.new("P2W").to_seconds, "P[n]W form")
64
+ end
65
+
66
+ def test_time_to_seconds
67
+ assert_equal(18000, ISO8601::Duration.new("PT5H").to_seconds, "PT[n]H form")
68
+ assert_equal(26400, ISO8601::Duration.new("PT7H20M").to_seconds, "PT[n]H[n]M form")
69
+ assert_equal(144034, ISO8601::Duration.new("PT40H34S").to_seconds, "PT[n]H[n]S form")
70
+ assert_equal(27003, ISO8601::Duration.new("PT7H30M3S").to_seconds, "PT[n]H[n]M[n]S form")
71
+ assert_equal(2040, ISO8601::Duration.new("PT34M").to_seconds, "PT[n]M form")
72
+ assert_equal(2050, ISO8601::Duration.new("PT34M10S").to_seconds, "PT[n]M[n]S form")
73
+ assert_equal(10, ISO8601::Duration.new("PT10S").to_seconds, "PT[n]S form")
74
+ assert_equal(ISO8601::Duration.new("PT1H15M").to_seconds, ISO8601::Duration.new("PT75M").to_seconds, "PT[n]H[n]M equivalent to PT[n]M")
75
+ end
76
+
77
+ def test_dateTime_to_seconds
78
+ assert_equal(71965843, ISO8601::Duration.new("P2Y3M11DT16H30M43S").to_seconds, "P[n]Y[n]M[n]DT[n]H[n]M[n]S form")
79
+ assert_equal(71965800, ISO8601::Duration.new("P2Y3M11DT16H30M").to_seconds, "P[n]Y[n]M[n]DT[n]H[n]M form")
80
+ assert_equal(71964000, ISO8601::Duration.new("P2Y3M11DT16H").to_seconds, "P[n]Y[n]M[n]DT[n]H form")
81
+ assert_equal(71964043, ISO8601::Duration.new("P2Y3M11DT16H43S").to_seconds, "P[n]Y[n]M[n]DT[n]H[n]S form")
82
+ assert_equal(71908243, ISO8601::Duration.new("P2Y3M11DT30M43S").to_seconds, "P[n]Y[n]M[n]DT[n]M[n]S form")
83
+ assert_equal(71908200, ISO8601::Duration.new("P2Y3M11DT30M").to_seconds, "P[n]Y[n]M[n]DT[n]M form")
84
+ assert_equal(71906443, ISO8601::Duration.new("P2Y3M11DT43S").to_seconds, "P[n]Y[n]M[n]DT[n]S form")
85
+ assert_equal(ISO8601::Duration.new("P1DT12H").to_seconds, ISO8601::Duration.new("PT36H").to_seconds, "P[n]DT[n]H equivalent to PT[n]H")
86
+ end
87
+
88
+ def test_seconds_to_iso
89
+ assert_equal(ISO8601::Duration.new("P1Y2M3DT4H5M6S").to_seconds, ISO8601::Duration.seconds_to_iso(37065906).to_seconds)
90
+ end
91
+ end
@@ -0,0 +1,4 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
+
3
+
4
+ Dir["iso8601/**/test_*.rb"].each { |test| load test }
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: iso8601
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 1
9
+ version: 0.1.1
10
+ platform: ruby
11
+ authors:
12
+ - Arnau Siches
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-01-30 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: |-
22
+ ISO8601 is a simple implementation of the ISO 8601 (Data elements and
23
+ interchange formats - Information interchange - Representation of dates and
24
+ times) standard.
25
+ email:
26
+ - arnau.siches@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files: []
32
+
33
+ files:
34
+ - .gitignore
35
+ - Gemfile
36
+ - LICENSE
37
+ - README.md
38
+ - Rakefile
39
+ - iso8601.gemspec
40
+ - lib/iso8601.rb
41
+ - lib/iso8601/atoms.rb
42
+ - lib/iso8601/dateTime.rb
43
+ - lib/iso8601/duration.rb
44
+ - lib/iso8601/errors.rb
45
+ - test/iso8601/test_atoms.rb
46
+ - test/iso8601/test_dateTime.rb
47
+ - test/iso8601/test_duration.rb
48
+ - test/test_iso8601.rb
49
+ has_rdoc: true
50
+ homepage: https://github.com/arnau/ISO8601
51
+ licenses: []
52
+
53
+ post_install_message:
54
+ rdoc_options: []
55
+
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ segments:
63
+ - 0
64
+ version: "0"
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ segments:
70
+ - 0
71
+ version: "0"
72
+ requirements: []
73
+
74
+ rubyforge_project: iso8601
75
+ rubygems_version: 1.3.6
76
+ signing_key:
77
+ specification_version: 3
78
+ summary: Ruby parser to work with ISO8601 dateTimes and durations - http://en.wikipedia.org/wiki/ISO_8601
79
+ test_files:
80
+ - test/iso8601/test_atoms.rb
81
+ - test/iso8601/test_dateTime.rb
82
+ - test/iso8601/test_duration.rb
83
+ - test/test_iso8601.rb