Skip to content

Commit 3a0a257

Browse files
Use nesting and improve naming
1 parent 3af6486 commit 3a0a257

File tree

1 file changed

+161
-141
lines changed

1 file changed

+161
-141
lines changed

exercises/baffling-birthdays/canonical-data.json

Lines changed: 161 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -9,156 +9,176 @@
99
],
1010
"cases": [
1111
{
12-
"uuid": "f7b3eb26-bcfc-4c1e-a2de-af07afc33f45",
13-
"description": "matching birthday for same date",
14-
"property": "matchingBirthday",
15-
"input": {
16-
"birthdate1": "2000-01-01",
17-
"birthdate2": "2000-01-01"
18-
},
19-
"expected": true
20-
},
21-
{
22-
"uuid": "7193409a-6e16-4bcb-b4cc-9ffe55f79b25",
23-
"description": "matching birthday for same year and month but different day",
24-
"property": "matchingBirthday",
25-
"input": {
26-
"birthdate1": "2012-05-09",
27-
"birthdate2": "2012-05-17"
28-
},
29-
"expected": false
30-
},
31-
{
32-
"uuid": "d04db648-121b-4b72-93e8-d7d2dced4495",
33-
"description": "matching birthday for same month and day but different year",
34-
"property": "matchingBirthday",
35-
"input": {
36-
"birthdate1": "1999-10-23",
37-
"birthdate2": "1988-10-23"
38-
},
39-
"expected": true
40-
},
41-
{
42-
"uuid": "3c8bd0f0-14c6-4d4c-975a-4c636bfdc233",
43-
"description": "matching birthday for same year but different month and day",
44-
"property": "matchingBirthday",
45-
"input": {
46-
"birthdate1": "2007-12-19",
47-
"birthdate2": "2007-04-27"
48-
},
49-
"expected": false
50-
},
51-
{
52-
"uuid": "df5daba6-0879-4480-883c-e855c99cdaa3",
53-
"description": "matching birthday for different year, month and day",
54-
"property": "matchingBirthday",
55-
"input": {
56-
"birthdate1": "1997-08-04",
57-
"birthdate2": "1963-11-23"
58-
},
59-
"expected": false
60-
},
61-
{
62-
"uuid": "70b38cea-d234-4697-b146-7d130cd4ee12",
63-
"description": "random birthdates generates requested number of birthdays",
64-
"scenarios": ["random"],
65-
"property": "randomBirthdates",
66-
"input": {},
67-
"expected": "length == groupsize"
68-
},
69-
{
70-
"uuid": "d9d5b7d3-5fea-4752-b9c1-3fcd176d1b03",
71-
"description": "random birthdates have non-leap year",
72-
"scenarios": ["random"],
73-
"property": "randomBirthdates",
74-
"input": {},
75-
"expected": {
76-
"years": {
77-
"leapYear": false
12+
"description": "matching birthday",
13+
"cases": [
14+
{
15+
"uuid": "f7b3eb26-bcfc-4c1e-a2de-af07afc33f45",
16+
"description": "same year, month, and day",
17+
"property": "matchingBirthday",
18+
"input": {
19+
"birthdate1": "2000-01-01",
20+
"birthdate2": "2000-01-01"
21+
},
22+
"expected": true
23+
},
24+
{
25+
"uuid": "7193409a-6e16-4bcb-b4cc-9ffe55f79b25",
26+
"description": "same year and month, but different day",
27+
"property": "matchingBirthday",
28+
"input": {
29+
"birthdate1": "2012-05-09",
30+
"birthdate2": "2012-05-17"
31+
},
32+
"expected": false
33+
},
34+
{
35+
"uuid": "d04db648-121b-4b72-93e8-d7d2dced4495",
36+
"description": "same month and day, but different year",
37+
"property": "matchingBirthday",
38+
"input": {
39+
"birthdate1": "1999-10-23",
40+
"birthdate2": "1988-10-23"
41+
},
42+
"expected": true
43+
},
44+
{
45+
"uuid": "3c8bd0f0-14c6-4d4c-975a-4c636bfdc233",
46+
"description": "same year, but different month and day",
47+
"property": "matchingBirthday",
48+
"input": {
49+
"birthdate1": "2007-12-19",
50+
"birthdate2": "2007-04-27"
51+
},
52+
"expected": false
53+
},
54+
{
55+
"uuid": "df5daba6-0879-4480-883c-e855c99cdaa3",
56+
"description": "different year, month, and day",
57+
"property": "matchingBirthday",
58+
"input": {
59+
"birthdate1": "1997-08-04",
60+
"birthdate2": "1963-11-23"
61+
},
62+
"expected": false
7863
}
79-
}
64+
]
8065
},
8166
{
82-
"uuid": "d1074327-f68c-4c8a-b0ff-e3730d0f0521",
83-
"description": "random birthdates have random month",
84-
"scenarios": ["random"],
85-
"property": "randomBirthdates",
86-
"input": {},
87-
"expected": {
88-
"months": {
89-
"random": true
67+
"description": "random birthdates",
68+
"cases": [
69+
{
70+
"uuid": "70b38cea-d234-4697-b146-7d130cd4ee12",
71+
"description": "generate requested number of birthdates",
72+
"scenarios": ["random"],
73+
"property": "randomBirthdates",
74+
"input": {},
75+
"expected": "length == groupsize"
76+
},
77+
{
78+
"uuid": "d9d5b7d3-5fea-4752-b9c1-3fcd176d1b03",
79+
"description": "years are not leap years",
80+
"scenarios": ["random"],
81+
"property": "randomBirthdates",
82+
"input": {},
83+
"expected": {
84+
"years": {
85+
"leapYear": false
86+
}
87+
}
88+
},
89+
{
90+
"uuid": "d1074327-f68c-4c8a-b0ff-e3730d0f0521",
91+
"description": "months are random",
92+
"scenarios": ["random"],
93+
"property": "randomBirthdates",
94+
"input": {},
95+
"expected": {
96+
"months": {
97+
"random": true
98+
}
99+
}
100+
},
101+
{
102+
"uuid": "7df706b3-c3f5-471d-9563-23a4d0577940",
103+
"description": "days are random",
104+
"scenarios": ["random"],
105+
"property": "randomBirthdates",
106+
"input": {},
107+
"expected": {
108+
"days": {
109+
"random": true
110+
}
111+
}
90112
}
91-
}
113+
]
92114
},
93115
{
94-
"uuid": "7df706b3-c3f5-471d-9563-23a4d0577940",
95-
"description": "random birthdates have random day",
96-
"scenarios": ["random"],
97-
"property": "randomBirthdates",
98-
"input": {},
99-
"expected": {
100-
"days": {
101-
"random": true
116+
"description": "has shared birthdays",
117+
"cases": [
118+
{
119+
"uuid": "ade37c87-f41d-4929-962a-286b4d1d048a",
120+
"description": "with match",
121+
"property": "hasSharedBirthday",
122+
"input": {
123+
"birthdates": ["1970-01-19", "1975-06-03", "2003-01-19"]
124+
},
125+
"expected": true
126+
},
127+
{
128+
"uuid": "1d155b33-c6e1-46b9-81fa-09123ae378ea",
129+
"description": "without match",
130+
"property": "hasSharedBirthday",
131+
"input": {
132+
"birthdates": ["1984-04-05", "2000-09-17", "1966-10-12"]
133+
},
134+
"expected": false
102135
}
103-
}
136+
]
104137
},
105138
{
106-
"uuid": "ade37c87-f41d-4929-962a-286b4d1d048a",
107-
"description": "has matching birthdays with matching birthday pair",
108-
"property": "hasMatchingBirthdays",
109-
"input": {
110-
"birthdates": ["1970-01-19", "1975-06-03", "2003-01-19"]
111-
},
112-
"expected": true
113-
},
114-
{
115-
"uuid": "1d155b33-c6e1-46b9-81fa-09123ae378ea",
116-
"description": "has matching birthdays without matching birthday pair",
117-
"property": "hasMatchingBirthdays",
118-
"input": {
119-
"birthdates": ["1984-04-05", "2000-09-17", "1966-10-12"]
120-
},
121-
"expected": false
122-
},
123-
{
124-
"uuid": "89a462a4-4265-4912-9506-fb027913f221",
125-
"description": "probability for matching birthday pair for one person",
126-
"scenarios": ["random"],
127-
"property": "probabilityForMatchingBirthdays",
128-
"input": {
129-
"groupSize": 1
130-
},
131-
"expected": 0.0
132-
},
133-
{
134-
"uuid": "ec31c787-0ebb-4548-970c-5dcb4eadfb5f",
135-
"description": "probability for matching birthday pair for ten people",
136-
"scenarios": ["random"],
137-
"property": "probabilityForMatchingBirthdays",
138-
"input": {
139-
"groupSize": 10
140-
},
141-
"expected": 11.694818
142-
},
143-
{
144-
"uuid": "b548afac-a451-46a3-9bb0-cb1f60c48e2f",
145-
"description": "probability for matching birthday pair for twenty-three people",
146-
"scenarios": ["random"],
147-
"property": "probabilityForMatchingBirthdays",
148-
"input": {
149-
"groupSize": 23
150-
},
151-
"expected": 50.729723
152-
},
153-
{
154-
"uuid": "e43e6b9d-d77b-4f6c-a960-0fc0129a0bc5",
155-
"description": "probability for matching birthday pair for seventy people",
156-
"scenarios": ["random"],
157-
"property": "probabilityForMatchingBirthdays",
158-
"input": {
159-
"groupSize": 70
160-
},
161-
"expected": 99.915958
139+
"description": "probability of at least one shared birthday",
140+
"cases": [
141+
{
142+
"uuid": "89a462a4-4265-4912-9506-fb027913f221",
143+
"description": "for one person",
144+
"scenarios": ["random"],
145+
"property": "probabilityForSharedBirthday",
146+
"input": {
147+
"groupSize": 1
148+
},
149+
"expected": 0.0
150+
},
151+
{
152+
"uuid": "ec31c787-0ebb-4548-970c-5dcb4eadfb5f",
153+
"description": "among ten people",
154+
"scenarios": ["random"],
155+
"property": "probabilityForSharedBirthday",
156+
"input": {
157+
"groupSize": 10
158+
},
159+
"expected": 11.694818
160+
},
161+
{
162+
"uuid": "b548afac-a451-46a3-9bb0-cb1f60c48e2f",
163+
"description": "among twenty-three people",
164+
"scenarios": ["random"],
165+
"property": "probabilityForSharedBirthday",
166+
"input": {
167+
"groupSize": 23
168+
},
169+
"expected": 50.729723
170+
},
171+
{
172+
"uuid": "e43e6b9d-d77b-4f6c-a960-0fc0129a0bc5",
173+
"description": "among seventy people",
174+
"scenarios": ["random"],
175+
"property": "probabilityForSharedBirthday",
176+
"input": {
177+
"groupSize": 70
178+
},
179+
"expected": 99.915958
180+
}
181+
]
162182
}
163183
]
164184
}

0 commit comments

Comments
 (0)