|
| 1 | +{ |
| 2 | + "exercise": "piecing-it-together", |
| 3 | + "comments": [ |
| 4 | + "For the aspect ratio, rational numbers can be used for languages without", |
| 5 | + "IEEE-754 support. Their representation depends on the track (e.g., a tuple like", |
| 6 | + "[numerator, denominator], a string like '3/4', or a custom rational type).", |
| 7 | + "The represented fractions should be reduced to lowest terms to avoid ambiguity." |
| 8 | + ], |
| 9 | + "cases": [ |
| 10 | + { |
| 11 | + "uuid": "ad626f23-09a2-4f5f-ba22-eec0671fa2a9", |
| 12 | + "description": "1000 pieces puzzle with 1.6 aspect ratio", |
| 13 | + "property": "jigsawData", |
| 14 | + "input": { |
| 15 | + "pieces": 1000, |
| 16 | + "aspectRatio": 1.6 |
| 17 | + }, |
| 18 | + "expected": { |
| 19 | + "pieces": 1000, |
| 20 | + "border": 126, |
| 21 | + "inside": 874, |
| 22 | + "rows": 25, |
| 23 | + "columns": 40, |
| 24 | + "aspectRatio": 1.6, |
| 25 | + "format": "landscape" |
| 26 | + } |
| 27 | + }, |
| 28 | + { |
| 29 | + "uuid": "3e0c5919-3561-42f5-b9ed-26d70c20214e", |
| 30 | + "description": "square puzzle with 32 rows", |
| 31 | + "property": "jigsawData", |
| 32 | + "input": { |
| 33 | + "rows": 32, |
| 34 | + "format": "square" |
| 35 | + }, |
| 36 | + "expected": { |
| 37 | + "pieces": 1024, |
| 38 | + "border": 124, |
| 39 | + "inside": 900, |
| 40 | + "rows": 32, |
| 41 | + "columns": 32, |
| 42 | + "aspectRatio": 1.0, |
| 43 | + "format": "square" |
| 44 | + } |
| 45 | + }, |
| 46 | + { |
| 47 | + "uuid": "1126f160-b094-4dc2-bf37-13e36e394867", |
| 48 | + "description": "400 pieces square puzzle with only inside pieces and aspect ratio", |
| 49 | + "property": "jigsawData", |
| 50 | + "input": { |
| 51 | + "inside": 324, |
| 52 | + "aspectRatio": 1.0 |
| 53 | + }, |
| 54 | + "expected": { |
| 55 | + "pieces": 400, |
| 56 | + "border": 76, |
| 57 | + "inside": 324, |
| 58 | + "rows": 20, |
| 59 | + "columns": 20, |
| 60 | + "aspectRatio": 1.0, |
| 61 | + "format": "square" |
| 62 | + } |
| 63 | + }, |
| 64 | + { |
| 65 | + "uuid": "a9743178-5642-4cc0-8fdb-00d6b031c3a0", |
| 66 | + "description": "1500 pieces landscape puzzle with 30 rows and 1.6 aspect ratio", |
| 67 | + "property": "jigsawData", |
| 68 | + "input": { |
| 69 | + "rows": 30, |
| 70 | + "aspectRatio": 1.6666666666666667 |
| 71 | + }, |
| 72 | + "expected": { |
| 73 | + "pieces": 1500, |
| 74 | + "border": 156, |
| 75 | + "inside": 1344, |
| 76 | + "rows": 30, |
| 77 | + "columns": 50, |
| 78 | + "aspectRatio": 1.6666666666666667, |
| 79 | + "format": "landscape" |
| 80 | + } |
| 81 | + }, |
| 82 | + { |
| 83 | + "uuid": "f6378369-989c-497f-a6e2-f30b1fa76cba", |
| 84 | + "description": "300 pieces portrait puzzle with 70 border pieces", |
| 85 | + "property": "jigsawData", |
| 86 | + "input": { |
| 87 | + "pieces": 300, |
| 88 | + "border": 70, |
| 89 | + "format": "portrait" |
| 90 | + }, |
| 91 | + "expected": { |
| 92 | + "pieces": 300, |
| 93 | + "border": 70, |
| 94 | + "inside": 230, |
| 95 | + "rows": 25, |
| 96 | + "columns": 12, |
| 97 | + "aspectRatio": 0.48, |
| 98 | + "format": "portrait" |
| 99 | + } |
| 100 | + }, |
| 101 | + { |
| 102 | + "uuid": "f53f82ba-5663-4c7e-9e86-57fdbb3e53d2", |
| 103 | + "description": "puzzle with insufficient data", |
| 104 | + "property": "jigsawData", |
| 105 | + "input": { |
| 106 | + "pieces": 1500, |
| 107 | + "format": "landscape" |
| 108 | + }, |
| 109 | + "expected": { |
| 110 | + "error": "Insufficient data" |
| 111 | + } |
| 112 | + }, |
| 113 | + { |
| 114 | + "uuid": "a3d5c31a-cc74-44bf-b4fc-9e4d65f1ac1a", |
| 115 | + "description": "puzzle with contradictory data", |
| 116 | + "property": "jigsawData", |
| 117 | + "input": { |
| 118 | + "rows": 100, |
| 119 | + "columns": 1000, |
| 120 | + "format": "square" |
| 121 | + }, |
| 122 | + "expected": { |
| 123 | + "error": "Contradictory data" |
| 124 | + } |
| 125 | + } |
| 126 | + ] |
| 127 | +} |
0 commit comments