Skip to content

Commit f48d397

Browse files
Add test cases
1 parent 338fc9c commit f48d397

File tree

2 files changed

+43
-23
lines changed

2 files changed

+43
-23
lines changed

exercises/swift-scheduling/canonical-data.json

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"description": "EOW on Monday translates to Friday at five in the afternoon",
4545
"property": "deliveryDate",
4646
"input": {
47-
"meetingStart": "2025-02-03T00:00:00",
47+
"meetingStart": "2025-02-03T16:00:00",
4848
"description": "EOW"
4949
},
5050
"expected": "2025-02-07T17:00:00"
@@ -54,7 +54,7 @@
5454
"description": "EOW on Tuesday translates to Friday at five in the afternoon",
5555
"property": "deliveryDate",
5656
"input": {
57-
"meetingStart": "1997-04-29T00:00:00",
57+
"meetingStart": "1997-04-29T10:50:00",
5858
"description": "EOW"
5959
},
6060
"expected": "1997-05-02T17:00:00"
@@ -64,7 +64,7 @@
6464
"description": "EOW on Wednesday translates to Friday at five in the afternoon",
6565
"property": "deliveryDate",
6666
"input": {
67-
"meetingStart": "2005-09-14T00:00:00",
67+
"meetingStart": "2005-09-14T11:00:00",
6868
"description": "EOW"
6969
},
7070
"expected": "2005-09-16T17:00:00"
@@ -74,7 +74,7 @@
7474
"description": "EOW on Thursday translates to Sunday at eight in the evening",
7575
"property": "deliveryDate",
7676
"input": {
77-
"meetingStart": "2011-05-19T00:00:00",
77+
"meetingStart": "2011-05-19T8:30:00",
7878
"description": "EOW"
7979
},
8080
"expected": "2011-05-22T20:00:00"
@@ -84,50 +84,70 @@
8484
"description": "EOW on Friday translates to Sunday at eight in the evening",
8585
"property": "deliveryDate",
8686
"input": {
87-
"meetingStart": "2022-08-05T00:00:00",
87+
"meetingStart": "2022-08-05T12:00:00",
8888
"description": "EOW"
8989
},
9090
"expected": "2022-08-07T20:00:00"
9191
},
9292
{
9393
"uuid": "439bf09f-3a0e-44e7-bad5-b7b6d0c4505a",
94-
"description": "2M translates to the first workday of the second month",
94+
"description": "2M before the second month of this year translates to the first workday of the second month of this year",
9595
"property": "deliveryDate",
9696
"input": {
97-
"meetingStart": "2007-01-02T00:00:00",
97+
"meetingStart": "2007-01-02T14:15:00",
9898
"description": "2M"
9999
},
100100
"expected": "2007-02-01T08:00:00"
101101
},
102102
{
103103
"uuid": "86d82e83-c481-4fb4-9264-625de7521340",
104-
"description": "5M translates to the first workday of the fifth month",
104+
"description": "11M in the eleventh month translates to the first workday of the eleventh month of next year",
105105
"property": "deliveryDate",
106106
"input": {
107-
"meetingStart": "2013-02-11T00:00:00",
108-
"description": "5M"
107+
"meetingStart": "2013-11-21T15:30:00",
108+
"description": "11M"
109109
},
110-
"expected": "2013-05-01T08:00:00"
110+
"expected": "2014-11-03T08:00:00"
111+
},
112+
{
113+
"uuid": "0d0b8f6a-1915-46f5-a630-1ff06af9da08",
114+
"description": "4M in the ninth month translates to the first workday of the fourth month of next year",
115+
"property": "deliveryDate",
116+
"input": {
117+
"meetingStart": "2019-11-18T15:15:00",
118+
"description": "4M"
119+
},
120+
"expected": "2020-04-01T08:00:00"
111121
},
112122
{
113123
"uuid": "06d401e3-8461-438f-afae-8d26aa0289e0",
114-
"description": "Q1 translates to the last workday of the first quarter",
124+
"description": "Q1 in the first quarter translates to the last workday of the first quarter of this year",
115125
"property": "deliveryDate",
116126
"input": {
117-
"meetingStart": "2011-02-23T00:00:00",
127+
"meetingStart": "2003-01-01T10:45:00",
118128
"description": "Q1"
119129
},
120-
"expected": "2011-03-31T08:00:00"
130+
"expected": "2003-03-31T08:00:00"
131+
},
132+
{
133+
"uuid": "eebd5f32-b16d-4ecd-91a0-584b0364b7ed",
134+
"description": "Q4 in the second quarter translates to the last workday of the fourth quarter of this year",
135+
"property": "deliveryDate",
136+
"input": {
137+
"meetingStart": "2001-04-09T09:00:00",
138+
"description": "Q4"
139+
},
140+
"expected": "2001-12-28T08:00:00"
121141
},
122142
{
123143
"uuid": "eebd5f32-b16d-4ecd-91a0-584b0364b7ed",
124-
"description": "Q4 translates to the last workday of the fourth quarter",
144+
"description": "Q3 in the fourth quarter translates to the last workday of the third quarter of this year",
125145
"property": "deliveryDate",
126146
"input": {
127-
"meetingStart": "2023-04-19T00:00:00",
147+
"meetingStart": "2022-10-06T11:00:00",
128148
"description": "Q4"
129149
},
130-
"expected": "2023-12-29T08:00:00"
150+
"expected": "2023-09-29T08:00:00"
131151
}
132152
]
133153
}

exercises/swift-scheduling/instructions.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ There are two variable delivery date description patterns:
3232
- `"<N>M"` (N-th month)
3333
- `"Q<N>"` (N-th quarter)
3434

35-
| Description | Meeting start | Delivery date |
36-
| ----------- | ------------------------ | --------------------------------------------------------------------- |
37-
| `"<N>M"` | Before N-th month | At 8:00 on the _first_ workday<sup>1</sup> of this year's N-th month |
38-
| `"<N>M"` | After or in N-th month | At 8:00 on the _first_ workday<sup>1</sup> of next year's N-th month |
39-
| `"Q<N>"` | Before N-th quarter | At 8:00 on the _last_ workday<sup>1</sup> of this year's N-th quarter |
40-
| `"Q<N>"` | After or in N-th quarter | At 8:00 on the _last_ workday<sup>1</sup> of next year's N-th quarter |
35+
| Description | Meeting start | Delivery date |
36+
| ----------- | ------------------------- | --------------------------------------------------------------------- |
37+
| `"<N>M"` | Before N-th month | At 8:00 on the _first_ workday<sup>1</sup> of this year's N-th month |
38+
| `"<N>M"` | After or in N-th month | At 8:00 on the _first_ workday<sup>1</sup> of next year's N-th month |
39+
| `"Q<N>"` | Before or in N-th quarter | At 8:00 on the _last_ workday<sup>1</sup> of this year's N-th quarter |
40+
| `"Q<N>"` | After N-th quarter | At 8:00 on the _last_ workday<sup>1</sup> of next year's N-th quarter |
4141

4242
<sup>1</sup> A workday is a Monday, Tuesday, Wednesday, Thursday, or Friday.

0 commit comments

Comments
 (0)