|
| 1 | +{ |
| 2 | + "exercise": "baffling-birthdays", |
| 3 | + "comments": [ |
| 4 | + "Dates are formatted as 'YYYY-MM-DD'.", |
| 5 | + "", |
| 6 | + "To increase the likelihood of consistent result, the tests should run the code returning random results many times.", |
| 7 | + "The expected probability values should be compared using some tolerance to allow for small deviations." |
| 8 | + ], |
| 9 | + "cases": [ |
| 10 | + { |
| 11 | + "uuid": "f7b3eb26-bcfc-4c1e-a2de-af07afc33f45", |
| 12 | + "description": "matching birthday for same date", |
| 13 | + "property": "matchingBirthday", |
| 14 | + "input": { |
| 15 | + "birthday1": "2000-01-01", |
| 16 | + "birthday2": "2000-01-01" |
| 17 | + }, |
| 18 | + "expected": true |
| 19 | + }, |
| 20 | + { |
| 21 | + "uuid": "7193409a-6e16-4bcb-b4cc-9ffe55f79b25", |
| 22 | + "description": "matching birthday for same year and month but different day", |
| 23 | + "property": "matchingBirthday", |
| 24 | + "input": { |
| 25 | + "birthday1": "2012-05-09", |
| 26 | + "birthday2": "2012-05-17" |
| 27 | + }, |
| 28 | + "expected": false |
| 29 | + }, |
| 30 | + { |
| 31 | + "uuid": "d04db648-121b-4b72-93e8-d7d2dced4495", |
| 32 | + "description": "matching birthday for same month and day but different year", |
| 33 | + "property": "matchingBirthday", |
| 34 | + "input": { |
| 35 | + "birthday1": "1999-10-23", |
| 36 | + "birthday2": "1988-10-23" |
| 37 | + }, |
| 38 | + "expected": true |
| 39 | + }, |
| 40 | + { |
| 41 | + "uuid": "3c8bd0f0-14c6-4d4c-975a-4c636bfdc233", |
| 42 | + "description": "matching birthday for same year but different month and day", |
| 43 | + "property": "matchingBirthday", |
| 44 | + "input": { |
| 45 | + "birthday1": "2007-12-19", |
| 46 | + "birthday2": "2007-04-27" |
| 47 | + }, |
| 48 | + "expected": false |
| 49 | + }, |
| 50 | + { |
| 51 | + "uuid": "df5daba6-0879-4480-883c-e855c99cdaa3", |
| 52 | + "description": "matching birthday for different year month and day", |
| 53 | + "property": "matchingBirthday", |
| 54 | + "input": { |
| 55 | + "birthday1": "1997-08-04", |
| 56 | + "birthday2": "1963-11-23" |
| 57 | + }, |
| 58 | + "expected": false |
| 59 | + }, |
| 60 | + { |
| 61 | + "uuid": "70b38cea-d234-4697-b146-7d130cd4ee12", |
| 62 | + "description": "random birthdays return specified number of birthdays", |
| 63 | + "scenarios": ["random"], |
| 64 | + "property": "randomBirthdays", |
| 65 | + "input": {}, |
| 66 | + "expected": "length == groupsize" |
| 67 | + }, |
| 68 | + { |
| 69 | + "uuid": "d9d5b7d3-5fea-4752-b9c1-3fcd176d1b03", |
| 70 | + "description": "random birthdays have fixed year per batch", |
| 71 | + "scenarios": ["random"], |
| 72 | + "property": "randomBirthdays", |
| 73 | + "input": {}, |
| 74 | + "expected": { |
| 75 | + "years": { |
| 76 | + "fixed": true |
| 77 | + } |
| 78 | + } |
| 79 | + }, |
| 80 | + { |
| 81 | + "uuid": "8da69a53-6900-4b63-897d-9f025f149fd2", |
| 82 | + "description": "random birthdays have random year between batches", |
| 83 | + "scenarios": ["random"], |
| 84 | + "property": "randomBirthdays", |
| 85 | + "input": {}, |
| 86 | + "expected": { |
| 87 | + "years": { |
| 88 | + "random": true |
| 89 | + } |
| 90 | + } |
| 91 | + }, |
| 92 | + { |
| 93 | + "uuid": "d1074327-f68c-4c8a-b0ff-e3730d0f0521", |
| 94 | + "description": "random birthdays have random months", |
| 95 | + "scenarios": ["random"], |
| 96 | + "property": "randomBirthdays", |
| 97 | + "input": {}, |
| 98 | + "expected": { |
| 99 | + "months": { |
| 100 | + "random": true |
| 101 | + } |
| 102 | + } |
| 103 | + }, |
| 104 | + { |
| 105 | + "uuid": "7df706b3-c3f5-471d-9563-23a4d0577940", |
| 106 | + "description": "random birthdays have random days", |
| 107 | + "scenarios": ["random"], |
| 108 | + "property": "randomBirthdays", |
| 109 | + "input": {}, |
| 110 | + "expected": { |
| 111 | + "days": { |
| 112 | + "random": true |
| 113 | + } |
| 114 | + } |
| 115 | + }, |
| 116 | + { |
| 117 | + "uuid": "ade37c87-f41d-4929-962a-286b4d1d048a", |
| 118 | + "description": "has matching birthdays with matching birthday pair", |
| 119 | + "property": "hasMatchingBirthdays", |
| 120 | + "input": { |
| 121 | + "birthdays": ["1970-01-19", "1975-06-03", "2003-01-19"] |
| 122 | + }, |
| 123 | + "expected": true |
| 124 | + }, |
| 125 | + { |
| 126 | + "uuid": "1d155b33-c6e1-46b9-81fa-09123ae378ea", |
| 127 | + "description": "has matching birthdays without matching birthday pair", |
| 128 | + "property": "hasMatchingBirthdays", |
| 129 | + "input": { |
| 130 | + "birthdays": ["1984-04-05", "2000-09-17", "1966-10-12"] |
| 131 | + }, |
| 132 | + "expected": false |
| 133 | + }, |
| 134 | + { |
| 135 | + "uuid": "89a462a4-4265-4912-9506-fb027913f221", |
| 136 | + "description": "probability for matching birthday for one person", |
| 137 | + "scenarios": ["random"], |
| 138 | + "property": "probabilityForMatchingBirthdays", |
| 139 | + "input": { |
| 140 | + "groupSize": 1 |
| 141 | + }, |
| 142 | + "expected": 0.0 |
| 143 | + }, |
| 144 | + { |
| 145 | + "uuid": "ec31c787-0ebb-4548-970c-5dcb4eadfb5f", |
| 146 | + "description": "probability for matching birthday for ten people", |
| 147 | + "scenarios": ["random"], |
| 148 | + "property": "probabilityForMatchingBirthdays", |
| 149 | + "input": { |
| 150 | + "groupSize": 10 |
| 151 | + }, |
| 152 | + "expected": 11.7 |
| 153 | + }, |
| 154 | + { |
| 155 | + "uuid": "b548afac-a451-46a3-9bb0-cb1f60c48e2f", |
| 156 | + "description": "probability for matching birthday for twenty-three people", |
| 157 | + "scenarios": ["random"], |
| 158 | + "property": "probabilityForMatchingBirthdays", |
| 159 | + "input": { |
| 160 | + "groupSize": 23 |
| 161 | + }, |
| 162 | + "expected": 50.7 |
| 163 | + }, |
| 164 | + { |
| 165 | + "uuid": "e43e6b9d-d77b-4f6c-a960-0fc0129a0bc5", |
| 166 | + "description": "probability for matching birthday for seventy people", |
| 167 | + "scenarios": ["random"], |
| 168 | + "property": "probabilityForMatchingBirthdays", |
| 169 | + "input": { |
| 170 | + "groupSize": 70 |
| 171 | + }, |
| 172 | + "expected": 99.9 |
| 173 | + } |
| 174 | + ] |
| 175 | +} |
0 commit comments