edtf 3.3.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +143 -117
- data/lib/edtf/date.rb +39 -2
- data/lib/edtf/epoch.rb +3 -1
- data/lib/edtf/interval.rb +40 -15
- data/lib/edtf/parser.rb +33 -33
- data/lib/edtf/parser.y +32 -32
- data/lib/edtf/season.rb +10 -2
- data/lib/edtf/set.rb +15 -1
- data/lib/edtf/uncertainty.rb +7 -8
- data/lib/edtf/version.rb +1 -1
- metadata +26 -57
- data/.github/workflows/ci.yml +0 -44
- data/.gitignore +0 -8
- data/.rspec +0 -3
- data/.simplecov +0 -19
- data/Gemfile +0 -20
- data/Rakefile +0 -41
- data/cucumber.yml +0 -1
- data/edtf.gemspec +0 -29
- data/features/parser/date_times.feature +0 -41
- data/features/parser/dates.feature +0 -89
- data/features/parser/intervals.feature +0 -18
- data/features/parser/precision.feature +0 -14
- data/features/parser/uncertain_or_approximate.feature +0 -129
- data/features/parser/unspecified.feature +0 -34
- data/features/print/level_0_edtf.feature +0 -79
- data/features/print/level_1_edtf.feature +0 -137
- data/features/print/level_2_edtf.feature +0 -39
- data/features/print/uncertain_or_approximate.feature +0 -131
- data/features/step_definitions/edtf_steps.rb +0 -150
- data/features/support/env.rb +0 -13
- data/spec/edtf/date_spec.rb +0 -245
- data/spec/edtf/epoch_spec.rb +0 -88
- data/spec/edtf/interval_spec.rb +0 -308
- data/spec/edtf/parser_spec.rb +0 -427
- data/spec/edtf/season_spec.rb +0 -111
- data/spec/edtf/set_spec.rb +0 -107
- data/spec/edtf/uncertainty_spec.rb +0 -296
- data/spec/spec_helper.rb +0 -15
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
Feature: Print Date/Time objects as Level 0 EDTF strings
|
|
2
|
-
As a Ruby programmer
|
|
3
|
-
I want to convert Date/Time objects to EDTF strings
|
|
4
|
-
|
|
5
|
-
@001 @level0
|
|
6
|
-
Scenario: Convert simple dates
|
|
7
|
-
Given the date "2004-08-12"
|
|
8
|
-
When I convert the date
|
|
9
|
-
Then the EDTF string should be "2004-08-12"
|
|
10
|
-
|
|
11
|
-
@001 @level0
|
|
12
|
-
Scenario: Convert simple negative dates
|
|
13
|
-
Given the date "-0300-08-12"
|
|
14
|
-
When I convert the date
|
|
15
|
-
Then the EDTF string should be "-0300-08-12"
|
|
16
|
-
|
|
17
|
-
@001 @level0
|
|
18
|
-
Scenario: Convert simple dates with precision
|
|
19
|
-
Given the date "1980-08-24" with precision set to "day"
|
|
20
|
-
When I convert the date
|
|
21
|
-
Then the EDTF string should be "1980-08-24"
|
|
22
|
-
Given the date "1980-08-24" with precision set to "month"
|
|
23
|
-
When I convert the date
|
|
24
|
-
Then the EDTF string should be "1980-08"
|
|
25
|
-
Given the date "1980-08-24" with precision set to "year"
|
|
26
|
-
When I convert the date
|
|
27
|
-
Then the EDTF string should be "1980"
|
|
28
|
-
|
|
29
|
-
@001 @level0
|
|
30
|
-
Scenario: Date Roundtrips
|
|
31
|
-
When I parse the string "2001-02-03"
|
|
32
|
-
When I convert the date
|
|
33
|
-
Then the EDTF string should be "2001-02-03"
|
|
34
|
-
When I parse the string "2001-02"
|
|
35
|
-
When I convert the date
|
|
36
|
-
Then the EDTF string should be "2001-02"
|
|
37
|
-
When I parse the string "2001"
|
|
38
|
-
When I convert the date
|
|
39
|
-
Then the EDTF string should be "2001"
|
|
40
|
-
When I parse the string "-9909"
|
|
41
|
-
When I convert the date
|
|
42
|
-
Then the EDTF string should be "-9909"
|
|
43
|
-
When I parse the string "0000"
|
|
44
|
-
When I convert the date
|
|
45
|
-
Then the EDTF string should be "0000"
|
|
46
|
-
|
|
47
|
-
@002 @level0
|
|
48
|
-
Scenario: DateTime Roundtrips
|
|
49
|
-
When I parse the string "2001-02-03T09:30:01"
|
|
50
|
-
When I convert the date
|
|
51
|
-
Then the EDTF string should be "2001-02-03T09:30:01"
|
|
52
|
-
When I parse the string "2004-01-01T10:10:10Z"
|
|
53
|
-
When I convert the date
|
|
54
|
-
Then the EDTF string should be "2004-01-01T10:10:10+00:00"
|
|
55
|
-
When I parse the string "2004-01-01T10:10:10+05:00"
|
|
56
|
-
When I convert the date
|
|
57
|
-
Then the EDTF string should be "2004-01-01T10:10:10+05:00"
|
|
58
|
-
|
|
59
|
-
@004 @level0
|
|
60
|
-
Scenario: Interval Roundtrips
|
|
61
|
-
When I parse the string "1964/2008"
|
|
62
|
-
When I convert the date
|
|
63
|
-
Then the EDTF string should be "1964/2008"
|
|
64
|
-
When I parse the string "2004-06/2006-08"
|
|
65
|
-
When I convert the date
|
|
66
|
-
Then the EDTF string should be "2004-06/2006-08"
|
|
67
|
-
When I parse the string "2004-02-01/2005-02-08"
|
|
68
|
-
When I convert the date
|
|
69
|
-
Then the EDTF string should be "2004-02-01/2005-02-08"
|
|
70
|
-
When I parse the string "2004-02-01/2005-02"
|
|
71
|
-
When I convert the date
|
|
72
|
-
Then the EDTF string should be "2004-02-01/2005-02"
|
|
73
|
-
When I parse the string "2004-02-01/2005"
|
|
74
|
-
When I convert the date
|
|
75
|
-
Then the EDTF string should be "2004-02-01/2005"
|
|
76
|
-
When I parse the string "2005/2006-02"
|
|
77
|
-
When I convert the date
|
|
78
|
-
Then the EDTF string should be "2005/2006-02"
|
|
79
|
-
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
Feature: Print Date/Time objects as Level 1 EDTF strings
|
|
2
|
-
As a Ruby programmer
|
|
3
|
-
I want to convert Date/Time objects to EDTF strings
|
|
4
|
-
|
|
5
|
-
@101 @level1
|
|
6
|
-
Scenario: Uncertain or approximate dates
|
|
7
|
-
When I parse the string "2001?"
|
|
8
|
-
When I convert the date
|
|
9
|
-
Then the EDTF string should be "2001?"
|
|
10
|
-
|
|
11
|
-
When I parse the string "2004-06?"
|
|
12
|
-
When I convert the date
|
|
13
|
-
Then the EDTF string should be "2004-06?"
|
|
14
|
-
|
|
15
|
-
When I parse the string "2004-06-11?"
|
|
16
|
-
When I convert the date
|
|
17
|
-
Then the EDTF string should be "2004-06-11?"
|
|
18
|
-
|
|
19
|
-
When I parse the string "1984~"
|
|
20
|
-
When I convert the date
|
|
21
|
-
Then the EDTF string should be "1984~"
|
|
22
|
-
|
|
23
|
-
When I parse the string "1984?~"
|
|
24
|
-
When I convert the date
|
|
25
|
-
Then the EDTF string should be "1984?~"
|
|
26
|
-
|
|
27
|
-
@102 @level1 @draft
|
|
28
|
-
Scenario: Unspecified dates
|
|
29
|
-
When I parse the string "199u"
|
|
30
|
-
When I convert the date
|
|
31
|
-
Then the EDTF string should be "199X"
|
|
32
|
-
|
|
33
|
-
When I parse the string "19uu"
|
|
34
|
-
When I convert the date
|
|
35
|
-
Then the EDTF string should be "19XX"
|
|
36
|
-
|
|
37
|
-
When I parse the string "1999-uu"
|
|
38
|
-
When I convert the date
|
|
39
|
-
Then the EDTF string should be "1999-XX"
|
|
40
|
-
|
|
41
|
-
When I parse the string "1999-01-uu"
|
|
42
|
-
When I convert the date
|
|
43
|
-
Then the EDTF string should be "1999-01-XX"
|
|
44
|
-
|
|
45
|
-
When I parse the string "1999-XX-XX"
|
|
46
|
-
When I convert the date
|
|
47
|
-
Then the EDTF string should be "1999-XX-XX"
|
|
48
|
-
|
|
49
|
-
@102 @level1 @final
|
|
50
|
-
Scenario: Unspecified dates
|
|
51
|
-
When I parse the string "199X"
|
|
52
|
-
When I convert the date
|
|
53
|
-
Then the EDTF string should be "199X"
|
|
54
|
-
|
|
55
|
-
When I parse the string "19XX"
|
|
56
|
-
When I convert the date
|
|
57
|
-
Then the EDTF string should be "19XX"
|
|
58
|
-
|
|
59
|
-
When I parse the string "1999-XX"
|
|
60
|
-
When I convert the date
|
|
61
|
-
Then the EDTF string should be "1999-XX"
|
|
62
|
-
|
|
63
|
-
When I parse the string "1999-01-XX"
|
|
64
|
-
When I convert the date
|
|
65
|
-
Then the EDTF string should be "1999-01-XX"
|
|
66
|
-
|
|
67
|
-
When I parse the string "1999-XX-XX"
|
|
68
|
-
When I convert the date
|
|
69
|
-
Then the EDTF string should be "1999-XX-XX"
|
|
70
|
-
|
|
71
|
-
@103 @level1 @interval
|
|
72
|
-
Scenario: Prints L1 Extended Intervals
|
|
73
|
-
When I parse the string "unknown/2006"
|
|
74
|
-
When I convert the date
|
|
75
|
-
Then the EDTF string should be "unknown/2006"
|
|
76
|
-
|
|
77
|
-
When I parse the string "2004-06-01/unknown"
|
|
78
|
-
When I convert the date
|
|
79
|
-
Then the EDTF string should be "2004-06-01/unknown"
|
|
80
|
-
|
|
81
|
-
When I parse the string "2004-01-01/open"
|
|
82
|
-
When I convert the date
|
|
83
|
-
Then the EDTF string should be "2004-01-01/open"
|
|
84
|
-
|
|
85
|
-
When I parse the string "1984~/2004-06"
|
|
86
|
-
When I convert the date
|
|
87
|
-
Then the EDTF string should be "1984~/2004-06"
|
|
88
|
-
|
|
89
|
-
When I parse the string "1984/2004-06~"
|
|
90
|
-
When I convert the date
|
|
91
|
-
Then the EDTF string should be "1984/2004-06~"
|
|
92
|
-
|
|
93
|
-
When I parse the string "1984~/2004~"
|
|
94
|
-
When I convert the date
|
|
95
|
-
Then the EDTF string should be "1984~/2004~"
|
|
96
|
-
|
|
97
|
-
When I parse the string "1984?/2004?~"
|
|
98
|
-
When I convert the date
|
|
99
|
-
Then the EDTF string should be "1984?/2004?~"
|
|
100
|
-
|
|
101
|
-
When I parse the string "1984-06?/2004-08?"
|
|
102
|
-
When I convert the date
|
|
103
|
-
Then the EDTF string should be "1984-06?/2004-08?"
|
|
104
|
-
|
|
105
|
-
When I parse the string "1984-06-02?/2004-08-08~"
|
|
106
|
-
When I convert the date
|
|
107
|
-
Then the EDTF string should be "1984-06-02?/2004-08-08~"
|
|
108
|
-
|
|
109
|
-
When I parse the string "1984-06-02?/unknown"
|
|
110
|
-
When I convert the date
|
|
111
|
-
Then the EDTF string should be "1984-06-02?/unknown"
|
|
112
|
-
|
|
113
|
-
@104 @level1 @draft
|
|
114
|
-
Scenario: Prints years with more than four digits
|
|
115
|
-
When I parse the string "y170000002"
|
|
116
|
-
When I convert the date
|
|
117
|
-
Then the EDTF string should be "Y170000002"
|
|
118
|
-
|
|
119
|
-
When I parse the string "y-170000002"
|
|
120
|
-
When I convert the date
|
|
121
|
-
Then the EDTF string should be "Y-170000002"
|
|
122
|
-
|
|
123
|
-
@104 @level1 @final
|
|
124
|
-
Scenario: Prints years with more than four digits
|
|
125
|
-
When I parse the string "Y170000002"
|
|
126
|
-
When I convert the date
|
|
127
|
-
Then the EDTF string should be "Y170000002"
|
|
128
|
-
|
|
129
|
-
When I parse the string "Y-170000002"
|
|
130
|
-
When I convert the date
|
|
131
|
-
Then the EDTF string should be "Y-170000002"
|
|
132
|
-
|
|
133
|
-
@105 @level1 @season
|
|
134
|
-
Scenario: Prints seasons
|
|
135
|
-
When I parse the string "2001-21"
|
|
136
|
-
When I convert the date
|
|
137
|
-
Then the EDTF string should be "2001-21"
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
Feature: Print Date/Time objects as Level 2 EDTF strings
|
|
2
|
-
As a Ruby programmer
|
|
3
|
-
I want to convert Date/Time objects to EDTF strings
|
|
4
|
-
|
|
5
|
-
@202 @level2
|
|
6
|
-
Scenario: Prints internal unspecified dates
|
|
7
|
-
When I parse the string "156u-12-25"
|
|
8
|
-
When I convert the date
|
|
9
|
-
Then the EDTF string should be "156X-12-25"
|
|
10
|
-
|
|
11
|
-
When I parse the string "156X-12-25"
|
|
12
|
-
When I convert the date
|
|
13
|
-
Then the EDTF string should be "156X-12-25"
|
|
14
|
-
|
|
15
|
-
@205 @level2 @interval
|
|
16
|
-
Scenario: Prints L2 extended intervals
|
|
17
|
-
# When I parse the string "2004-06-(01)~/2004-06-(20)~"
|
|
18
|
-
# When I convert the date
|
|
19
|
-
# Then the EDTF string should be "2004-06-(01)~/2004-06-(20)~"
|
|
20
|
-
|
|
21
|
-
When I parse the string "2004-06-uu/2004-07-03"
|
|
22
|
-
When I convert the date
|
|
23
|
-
Then the EDTF string should be "2004-06-XX/2004-07-03"
|
|
24
|
-
|
|
25
|
-
When I parse the string "2004-06-XX/2004-07-03"
|
|
26
|
-
When I convert the date
|
|
27
|
-
Then the EDTF string should be "2004-06-XX/2004-07-03"
|
|
28
|
-
|
|
29
|
-
@209 @level2 @season
|
|
30
|
-
Scenario: Prints qualified seasons
|
|
31
|
-
When I parse the string "2001-21^southernHemisphere"
|
|
32
|
-
When I convert the date
|
|
33
|
-
Then the EDTF string should be "2001-21^southernHemisphere"
|
|
34
|
-
|
|
35
|
-
@207 @level2 @calendar
|
|
36
|
-
Scenario: Prints calendar string
|
|
37
|
-
When I parse the string "2001-02-03^xyz"
|
|
38
|
-
When I convert the date
|
|
39
|
-
Then the EDTF string should be "2001-02-03^xyz"
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
Feature: Print uncertain or approximate dates
|
|
2
|
-
As a Ruby programmer
|
|
3
|
-
I want to convert Date/Time objects to EDTF strings
|
|
4
|
-
|
|
5
|
-
@201 @level2
|
|
6
|
-
Scenario Outline: Prints uncertain or approximate dates
|
|
7
|
-
Given the date "<date>" with precision set to "<precision>"
|
|
8
|
-
When the year is uncertain: "<?-year>"
|
|
9
|
-
And the month is uncertain: "<?-month>"
|
|
10
|
-
And the day is uncertain: "<?-day>"
|
|
11
|
-
And the year is approximate: "<~-year>"
|
|
12
|
-
And the month is approximate: "<~-month>"
|
|
13
|
-
And the day is approximate "<~-day>"
|
|
14
|
-
When I convert the date
|
|
15
|
-
Then the EDTF string should be "<string>"
|
|
16
|
-
|
|
17
|
-
Scenarios: Uncertain or approximate dates, day precision
|
|
18
|
-
| date | precision | string | ?-year | ?-month | ?-day | ~-year | ~-month | ~-day |
|
|
19
|
-
| 2004-06-01 | day | 2004-06-01?~ | yes | yes | yes | yes | yes | yes |
|
|
20
|
-
| 2004-06-01 | day | 2004-06~-01? | yes | yes | yes | yes | yes | no |
|
|
21
|
-
# | 2004-06-01 | day | (2004~-06-(01)~)? | yes | yes | yes | yes | no | yes |
|
|
22
|
-
| 2004-06-01 | day | 2004~-06?-(01)?~ | yes | yes | yes | yes | no | yes |
|
|
23
|
-
| 2004-06-01 | day | 2004~-06-01? | yes | yes | yes | yes | no | no |
|
|
24
|
-
# | 2004-06-01 | day | (2004-(06-01)~)? | yes | yes | yes | no | yes | yes |
|
|
25
|
-
| 2004-06-01 | day | 2004?-(06-01)?~ | yes | yes | yes | no | yes | yes |
|
|
26
|
-
# | 2004-06-01 | day | (2004-(06)~-01)? | yes | yes | yes | no | yes | no |
|
|
27
|
-
| 2004-06-01 | day | 2004?-(06)?~-01? | yes | yes | yes | no | yes | no |
|
|
28
|
-
# | 2004-06-01 | day | (2004-06-(01)~)? | yes | yes | yes | no | no | yes |
|
|
29
|
-
| 2004-06-01 | day | 2004-06?-(01)?~ | yes | yes | yes | no | no | yes |
|
|
30
|
-
| 2004-06-01 | day | 2004-06-01? | yes | yes | yes | no | no | no |
|
|
31
|
-
| 2004-06-01 | day | 2004-06?-01~ | yes | yes | no | yes | yes | yes |
|
|
32
|
-
| 2004-06-01 | day | 2004-06?~-01 | yes | yes | no | yes | yes | no |
|
|
33
|
-
| 2004-06-01 | day | 2004~-06?-(01)~ | yes | yes | no | yes | no | yes |
|
|
34
|
-
| 2004-06-01 | day | 2004~-06?-01 | yes | yes | no | yes | no | no |
|
|
35
|
-
# | 2004-06-01 | day | 2004-(06?-01)~ | yes | yes | no | no | yes | yes | is this correct?
|
|
36
|
-
# | 2004-06-01 | day | 2004?-((06)?-01)~ | yes | yes | no | no | yes | yes |
|
|
37
|
-
| 2004-06-01 | day | 2004?-(06)?~-01~ | yes | yes | no | no | yes | yes |
|
|
38
|
-
# | 2004-06-01 | day | (2004-(06)~)?-01 | yes | yes | no | no | yes | no |
|
|
39
|
-
| 2004-06-01 | day | 2004?-(06)?~-01 | yes | yes | no | no | yes | no |
|
|
40
|
-
| 2004-06-01 | day | 2004-06?-(01)~ | yes | yes | no | no | no | yes |
|
|
41
|
-
| 2004-06-01 | day | 2004-06?-01 | yes | yes | no | no | no | no |
|
|
42
|
-
# | 2004-06-01 | day | (2004?-06-(01)?)~ | yes | no | yes | yes | yes | yes |
|
|
43
|
-
| 2004-06-01 | day | 2004?-06~-(01)?~ | yes | no | yes | yes | yes | yes |
|
|
44
|
-
| 2004-06-01 | day | 2004?-06~-(01)? | yes | no | yes | yes | yes | no |
|
|
45
|
-
| 2004-06-01 | day | 2004?~-06-(01)?~ | yes | no | yes | yes | no | yes |
|
|
46
|
-
| 2004-06-01 | day | 2004?~-06-(01)? | yes | no | yes | yes | no | no |
|
|
47
|
-
# | 2004-06-01 | day | 2004?-(06-(01)?)~ | yes | no | yes | no | yes | yes |
|
|
48
|
-
| 2004-06-01 | day | 2004?-(06)~-01?~ | yes | no | yes | no | yes | yes |
|
|
49
|
-
| 2004-06-01 | day | 2004?-(06)~-01? | yes | no | yes | no | yes | no |
|
|
50
|
-
| 2004-06-01 | day | 2004?-06-(01)?~ | yes | no | yes | no | no | yes |
|
|
51
|
-
| 2004-06-01 | day | 2004?-06-(01)? | yes | no | yes | no | no | no |
|
|
52
|
-
| 2004-06-01 | day | 2004?-06-01~ | yes | no | no | yes | yes | yes |
|
|
53
|
-
| 2004-06-01 | day | 2004?-06~-01 | yes | no | no | yes | yes | no |
|
|
54
|
-
| 2004-06-01 | day | 2004?~-06-(01)~ | yes | no | no | yes | no | yes |
|
|
55
|
-
| 2004-06-01 | day | 2004?~-06-01 | yes | no | no | yes | no | no |
|
|
56
|
-
| 2004-06-01 | day | 2004?-(06-01)~ | yes | no | no | no | yes | yes |
|
|
57
|
-
| 2004-06-01 | day | 2004?-(06)~-01 | yes | no | no | no | yes | no |
|
|
58
|
-
| 2004-06-01 | day | 2004?-06-(01)~ | yes | no | no | no | no | yes |
|
|
59
|
-
| 2004-06-01 | day | 2004?-06-01 | yes | no | no | no | no | no |
|
|
60
|
-
# | 2004-06-01 | day | (2004-(06-01)?)~ | no | yes | yes | yes | yes | yes |
|
|
61
|
-
| 2004-06-01 | day | 2004~-(06-01)?~ | no | yes | yes | yes | yes | yes |
|
|
62
|
-
# | 2004-06-01 | day | 2004-(06~-01)? | no | yes | yes | yes | yes | no | is this correct?
|
|
63
|
-
# | 2004-06-01 | day | 2004~-((06)~-01)? | no | yes | yes | yes | yes | no |
|
|
64
|
-
| 2004-06-01 | day | 2004~-(06)?~-01? | no | yes | yes | yes | yes | no |
|
|
65
|
-
# | 2004-06-01 | day | 2004~-(06-(01)~)? | no | yes | yes | yes | no | yes |
|
|
66
|
-
| 2004-06-01 | day | 2004~-(06)?-01?~ | no | yes | yes | yes | no | yes |
|
|
67
|
-
| 2004-06-01 | day | 2004~-(06-01)? | no | yes | yes | yes | no | no |
|
|
68
|
-
| 2004-06-01 | day | 2004-(06-01)?~ | no | yes | yes | no | yes | yes |
|
|
69
|
-
# | 2004-06-01 | day | 2004-((06)~-01)? | no | yes | yes | no | yes | no |
|
|
70
|
-
| 2004-06-01 | day | 2004-(06)?~-01? | no | yes | yes | no | yes | no |
|
|
71
|
-
# | 2004-06-01 | day | 2004-(06-(01)~)? | no | yes | yes | no | no | yes |
|
|
72
|
-
| 2004-06-01 | day | 2004-(06)?-01?~ | no | yes | yes | no | no | yes |
|
|
73
|
-
| 2004-06-01 | day | 2004-(06-01)? | no | yes | yes | no | no | no |
|
|
74
|
-
# | 2004-06-01 | day | (2004-(06)?-01)~ | no | yes | no | yes | yes | yes |
|
|
75
|
-
| 2004-06-01 | day | 2004~-(06)?~-01~ | no | yes | no | yes | yes | yes |
|
|
76
|
-
# | 2004-06-01 | day | (2004-(06)?)~-01 | no | yes | no | yes | yes | no |
|
|
77
|
-
| 2004-06-01 | day | 2004~-(06)?~-01 | no | yes | no | yes | yes | no |
|
|
78
|
-
| 2004-06-01 | day | 2004~-(06)?-01~ | no | yes | no | yes | no | yes |
|
|
79
|
-
| 2004-06-01 | day | 2004~-(06)?-01 | no | yes | no | yes | no | no |
|
|
80
|
-
# | 2004-06-01 | day | 2004-((06)?-01)~ | no | yes | no | no | yes | yes |
|
|
81
|
-
| 2004-06-01 | day | 2004-(06)?~-01~ | no | yes | no | no | yes | yes |
|
|
82
|
-
| 2004-06-01 | day | 2004-(06)?~-01 | no | yes | no | no | yes | no |
|
|
83
|
-
| 2004-06-01 | day | 2004-(06)?-01~ | no | yes | no | no | no | yes |
|
|
84
|
-
| 2004-06-01 | day | 2004-(06)?-01 | no | yes | no | no | no | no |
|
|
85
|
-
# | 2004-06-01 | day | (2004-06-(01)?)~ | no | no | yes | yes | yes | yes |
|
|
86
|
-
| 2004-06-01 | day | 2004-06~-(01)?~ | no | no | yes | yes | yes | yes |
|
|
87
|
-
| 2004-06-01 | day | 2004-06~-(01)? | no | no | yes | yes | yes | no |
|
|
88
|
-
| 2004-06-01 | day | 2004~-06-(01)?~ | no | no | yes | yes | no | yes |
|
|
89
|
-
| 2004-06-01 | day | 2004~-06-(01)? | no | no | yes | yes | no | no |
|
|
90
|
-
# | 2004-06-01 | day | 2004-(06-(01)?)~ | no | no | yes | no | yes | yes |
|
|
91
|
-
| 2004-06-01 | day | 2004-(06)~-01?~ | no | no | yes | no | yes | yes |
|
|
92
|
-
| 2004-06-01 | day | 2004-(06)~-01? | no | no | yes | no | yes | no |
|
|
93
|
-
| 2004-06-01 | day | 2004-06-(01)?~ | no | no | yes | no | no | yes |
|
|
94
|
-
| 2004-06-01 | day | 2004-06-(01)? | no | no | yes | no | no | no |
|
|
95
|
-
| 2004-06-01 | day | 2004-06-01~ | no | no | no | yes | yes | yes |
|
|
96
|
-
| 2004-06-01 | day | 2004-06~-01 | no | no | no | yes | yes | no |
|
|
97
|
-
| 2004-06-01 | day | 2004~-06-(01)~ | no | no | no | yes | no | yes |
|
|
98
|
-
| 2004-06-01 | day | 2004~-06-01 | no | no | no | yes | no | no |
|
|
99
|
-
| 2004-06-01 | day | 2004-(06-01)~ | no | no | no | no | yes | yes |
|
|
100
|
-
| 2004-06-01 | day | 2004-(06)~-01 | no | no | no | no | yes | no |
|
|
101
|
-
| 2004-06-01 | day | 2004-06-(01)~ | no | no | no | no | no | yes |
|
|
102
|
-
| 2004-06-01 | day | 2004-06-01 | no | no | no | no | no | no |
|
|
103
|
-
|
|
104
|
-
Scenarios: Uncertain or approximate dates, month precision
|
|
105
|
-
| date | precision | string | ?-year | ?-month | ?-day | ~-year | ~-month | ~-day |
|
|
106
|
-
| 2004-06-01 | month | 2004-06?~ | yes | yes | no | yes | yes | no |
|
|
107
|
-
| 2004-06-01 | month | 2004~-06? | yes | yes | no | yes | no | no |
|
|
108
|
-
# | 2004-06-01 | month | (2004-(06)~)? | yes | yes | no | no | yes | no |
|
|
109
|
-
| 2004-06-01 | month | 2004?-(06)?~ | yes | yes | no | no | yes | no |
|
|
110
|
-
| 2004-06-01 | month | 2004-06? | yes | yes | no | no | no | no |
|
|
111
|
-
| 2004-06-01 | month | 2004?-06~ | yes | no | no | yes | yes | no |
|
|
112
|
-
| 2004-06-01 | month | 2004?~-06 | yes | no | no | yes | no | no |
|
|
113
|
-
| 2004-06-01 | month | 2004?-(06)~ | yes | no | no | no | yes | no |
|
|
114
|
-
| 2004-06-01 | month | 2004?-06 | yes | no | no | no | no | no |
|
|
115
|
-
# | 2004-06-01 | month | (2004-(06)?)~ | no | yes | no | yes | yes | no |
|
|
116
|
-
| 2004-06-01 | month | 2004~-(06)?~ | no | yes | no | yes | yes | no |
|
|
117
|
-
| 2004-06-01 | month | 2004~-(06)? | no | yes | no | yes | no | no |
|
|
118
|
-
| 2004-06-01 | month | 2004-(06)?~ | no | yes | no | no | yes | no |
|
|
119
|
-
| 2004-06-01 | month | 2004-(06)? | no | yes | no | no | no | no |
|
|
120
|
-
| 2004-06-01 | month | 2004-06~ | no | no | no | yes | yes | no |
|
|
121
|
-
| 2004-06-01 | month | 2004~-06 | no | no | no | yes | no | no |
|
|
122
|
-
| 2004-06-01 | month | 2004-(06)~ | no | no | no | no | yes | no |
|
|
123
|
-
| 2004-06-01 | month | 2004-06 | no | no | no | no | no | no |
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
Scenarios: Uncertain or approximate dates, year precision
|
|
127
|
-
| date | precision | string | ?-year | ?-month | ?-day | ~-year | ~-month | ~-day |
|
|
128
|
-
| 2004-06-01 | year | 2004?~ | yes | no | no | yes | no | no |
|
|
129
|
-
| 2004-06-01 | year | 2004? | yes | no | no | no | no | no |
|
|
130
|
-
| 2004-06-01 | year | 2004~ | no | no | no | yes | no | no |
|
|
131
|
-
| 2004-06-01 | year | 2004 | no | no | no | no | no | no |
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
Given('the date {string}') do |date|
|
|
2
|
-
@date = Date.parse(date)
|
|
3
|
-
end
|
|
4
|
-
|
|
5
|
-
Given('the date {string} with precision set to {string}') do |date, precision|
|
|
6
|
-
@date = Date.parse(date)
|
|
7
|
-
@date.precision = precision
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
When('I convert the date') do
|
|
11
|
-
@string = @date.edtf
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
Then('the EDTF string should be {string}') do |edtf|
|
|
15
|
-
expect(@string).to eq(edtf)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
When('I parse the string {string}') do |string|
|
|
19
|
-
@date = EDTF.parse!(string)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
Then('the year should be {string}') do |year|
|
|
23
|
-
expect(@date.year).to eq(year.to_i)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
Then('the month should be {string}') do |month|
|
|
27
|
-
expect(@date.month).to eq(month.to_i)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
Then('the day should be {string}') do |day|
|
|
31
|
-
expect(@date.day).to eq(day.to_i)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
Then('the hours should be {string}') do |hours|
|
|
35
|
-
expect(@date.hour).to eq(hours.to_i)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
Then('the year should be {string} \(UTC)') do |year|
|
|
39
|
-
expect(@date.to_time.utc.year).to eq(year.to_i)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
Then('the month should be {string} \(UTC)') do |month|
|
|
43
|
-
expect(@date.to_time.utc.month).to eq(month.to_i)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
Then('the day should be {string} \(UTC)') do |day|
|
|
47
|
-
expect(@date.to_time.utc.day).to eq(day.to_i)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
Then('the hours should be {string} \(UTC)') do |hours|
|
|
51
|
-
expect(@date.to_time.utc.hour).to eq(hours.to_i)
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
Then('the minutes should be {string}') do |minutes|
|
|
55
|
-
expect(@date.min).to eq(minutes.to_i)
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
Then('the seconds should be {string}') do |seconds|
|
|
59
|
-
expect(@date.sec).to eq(seconds.to_i)
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
Then('the duration should range from {string} to {string}') do |from, to|
|
|
63
|
-
expect([@date.begin.year.to_s, @date.end.year.to_s]).to eq([from, to])
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
Then('the interval should start at {string}') do |date|
|
|
67
|
-
expect(@date.begin.to_s).to eq(date)
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
Then('the interval should end at {string}') do |date|
|
|
71
|
-
expect(@date.end.to_s).to eq(date)
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
Then('the interval should include the date {string}') do |date|
|
|
75
|
-
expect(@date).to include(Date.parse(date))
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
Then('the interval should cover the date {string}') do |date|
|
|
79
|
-
expect(@date).to be_cover(Date.parse(date))
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
Then('the date should be uncertain? {string}') do |answer|
|
|
83
|
-
expect(@date.uncertain?).to eq(!!(answer =~ /y(es)?/i))
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
Then('the year should be uncertain? {string}') do |answer|
|
|
87
|
-
expect(@date.uncertain?(:year)).to eq(!!(answer =~ /y(es)?/i))
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
Then('the month should be uncertain? {string}') do |answer|
|
|
91
|
-
expect(@date.uncertain?(:month)).to eq(!!(answer =~ /y(es)?/i))
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
Then('the day should be uncertain? {string}') do |answer|
|
|
95
|
-
expect(@date.uncertain?(:day)).to eq(!!(answer =~ /y(es)?/i))
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
Then('the date should be approximate? {string}') do |answer|
|
|
99
|
-
expect(@date.approximate?).to eq(!!(answer =~ /y(es)?/i))
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
Then('the year should be approximate? {string}') do |answer|
|
|
103
|
-
expect(@date.approximate?(:year)).to eq(!!(answer =~ /y(es)?/i))
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
Then('the month should be approximate? {string}') do |answer|
|
|
107
|
-
expect(@date.approximate?(:month)).to eq(!!(answer =~ /y(es)?/i))
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
Then('the day should be approximate? {string}') do |answer|
|
|
111
|
-
expect(@date.approximate?(:day)).to eq(!!(answer =~ /y(es)?/i))
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
Then('the result should be an Unknown') do
|
|
115
|
-
expect(@date).to be_an(EDTF::Unknown)
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
Then('the unspecified string code be {string}') do |code|
|
|
119
|
-
expect(@date.unspecified.to_s).to eq(code)
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
When('I parse the following strings an error should be raised:') do |table|
|
|
123
|
-
table.raw.each do |row|
|
|
124
|
-
expect { Date.edtf!(row[0]) }.to raise_error(ArgumentError)
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
When('the year is uncertain: {string}') do |answer|
|
|
129
|
-
@date.uncertain!(:year) if answer =~ /y(es)?/i
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
When('the month is uncertain: {string}') do |answer|
|
|
133
|
-
@date.uncertain!(:month) if answer =~ /y(es)?/i
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
When('the day is uncertain: {string}') do |answer|
|
|
137
|
-
@date.uncertain!(:day) if answer =~ /y(es)?/i
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
When('the year is approximate: {string}') do |answer|
|
|
141
|
-
@date.approximate!(:year) if answer =~ /y(es)?/i
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
When('the month is approximate: {string}') do |answer|
|
|
145
|
-
@date.approximate!(:month) if answer =~ /y(es)?/i
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
When('the day is approximate {string}') do |answer|
|
|
149
|
-
@date.approximate!(:day) if answer =~ /y(es)?/i
|
|
150
|
-
end
|