From 2d45a33d5550811df7ea48a5fd9bae43f44b839c Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 13:14:30 +0100 Subject: [PATCH 01/58] affine-cipher: format --- exercises/affine-cipher/canonical-data.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/affine-cipher/canonical-data.json b/exercises/affine-cipher/canonical-data.json index 1f8b0ec17a..23d63b2db4 100644 --- a/exercises/affine-cipher/canonical-data.json +++ b/exercises/affine-cipher/canonical-data.json @@ -8,7 +8,7 @@ "cases": [ { "description": "encode", - "comments": [ "Test encoding from English to ciphertext with keys" ], + "comments": ["Test encoding from English to ciphertext with keys"], "cases": [ { "uuid": "2ee1d9af-1c43-416c-b41b-cefd7d4d2b2a", @@ -124,14 +124,14 @@ "a": 6, "b": 17 } - }, + }, "expected": { "error": "a and m must be coprime." } } ] }, { "description": "decode", - "comments": [ "Test decoding from ciphertext to English with keys" ], + "comments": ["Test decoding from ciphertext to English with keys"], "cases": [ { "uuid": "3f0ac7e2-ec0e-4a79-949e-95e414953438", From 50ec8c729d25409f3daa862b1bebbf846710ccec Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 13:15:53 +0100 Subject: [PATCH 02/58] all-your-base: format --- exercises/all-your-base/canonical-data.json | 36 +++++++++++++++------ 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/exercises/all-your-base/canonical-data.json b/exercises/all-your-base/canonical-data.json index 86ea0015b8..9a05309bde 100644 --- a/exercises/all-your-base/canonical-data.json +++ b/exercises/all-your-base/canonical-data.json @@ -153,7 +153,9 @@ "digits": [0], "outputBase": 10 }, - "expected": {"error": "input base must be >= 2"} + "expected": { + "error": "input base must be >= 2" + } }, { "uuid": "e21a693a-7a69-450b-b393-27415c26a016", @@ -164,7 +166,9 @@ "digits": [], "outputBase": 10 }, - "expected": {"error": "input base must be >= 2"} + "expected": { + "error": "input base must be >= 2" + } }, { "uuid": "54a23be5-d99e-41cc-88e0-a650ffe5fcc2", @@ -175,7 +179,9 @@ "digits": [1], "outputBase": 10 }, - "expected": {"error": "input base must be >= 2"} + "expected": { + "error": "input base must be >= 2" + } }, { "uuid": "9eccf60c-dcc9-407b-95d8-c37b8be56bb6", @@ -186,7 +192,9 @@ "digits": [1, -1, 1, 0, 1, 0], "outputBase": 10 }, - "expected": {"error": "all digits must satisfy 0 <= d < input base"} + "expected": { + "error": "all digits must satisfy 0 <= d < input base" + } }, { "uuid": "232fa4a5-e761-4939-ba0c-ed046cd0676a", @@ -197,7 +205,9 @@ "digits": [1, 2, 1, 0, 1, 0], "outputBase": 10 }, - "expected": {"error": "all digits must satisfy 0 <= d < input base"} + "expected": { + "error": "all digits must satisfy 0 <= d < input base" + } }, { "uuid": "14238f95-45da-41dc-95ce-18f860b30ad3", @@ -208,7 +218,9 @@ "digits": [1, 0, 1, 0, 1, 0], "outputBase": 1 }, - "expected": {"error": "output base must be >= 2"} + "expected": { + "error": "output base must be >= 2" + } }, { "uuid": "73dac367-da5c-4a37-95fe-c87fad0a4047", @@ -219,7 +231,9 @@ "digits": [7], "outputBase": 0 }, - "expected": {"error": "output base must be >= 2"} + "expected": { + "error": "output base must be >= 2" + } }, { "uuid": "13f81f42-ff53-4e24-89d9-37603a48ebd9", @@ -230,7 +244,9 @@ "digits": [1], "outputBase": -7 }, - "expected": {"error": "output base must be >= 2"} + "expected": { + "error": "output base must be >= 2" + } }, { "uuid": "0e6c895d-8a5d-4868-a345-309d094cfe8d", @@ -241,7 +257,9 @@ "digits": [1], "outputBase": -7 }, - "expected": {"error": "input base must be >= 2"} + "expected": { + "error": "input base must be >= 2" + } } ] } From cd678218351bb7ddfc08d6a60522920c0dc1b3e1 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 13:16:46 +0100 Subject: [PATCH 03/58] alphametics: format --- exercises/alphametics/canonical-data.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/exercises/alphametics/canonical-data.json b/exercises/alphametics/canonical-data.json index 1447d4781f..49e661e0a9 100644 --- a/exercises/alphametics/canonical-data.json +++ b/exercises/alphametics/canonical-data.json @@ -138,16 +138,16 @@ "puzzle": "THIS + A + FIRE + THEREFORE + FOR + ALL + HISTORIES + I + TELL + A + TALE + THAT + FALSIFIES + ITS + TITLE + TIS + A + LIE + THE + TALE + OF + THE + LAST + FIRE + HORSES + LATE + AFTER + THE + FIRST + FATHERS + FORESEE + THE + HORRORS + THE + LAST + FREE + TROLL + TERRIFIES + THE + HORSES + OF + FIRE + THE + TROLL + RESTS + AT + THE + HOLE + OF + LOSSES + IT + IS + THERE + THAT + SHE + STORES + ROLES + OF + LEATHERS + AFTER + SHE + SATISFIES + HER + HATE + OFF + THOSE + FEARS + A + TASTE + RISES + AS + SHE + HEARS + THE + LEAST + FAR + HORSE + THOSE + FAST + HORSES + THAT + FIRST + HEAR + THE + TROLL + FLEE + OFF + TO + THE + FOREST + THE + HORSES + THAT + ALERTS + RAISE + THE + STARES + OF + THE + OTHERS + AS + THE + TROLL + ASSAILS + AT + THE + TOTAL + SHIFT + HER + TEETH + TEAR + HOOF + OFF + TORSO + AS + THE + LAST + HORSE + FORFEITS + ITS + LIFE + THE + FIRST + FATHERS + HEAR + OF + THE + HORRORS + THEIR + FEARS + THAT + THE + FIRES + FOR + THEIR + FEASTS + ARREST + AS + THE + FIRST + FATHERS + RESETTLE + THE + LAST + OF + THE + FIRE + HORSES + THE + LAST + TROLL + HARASSES + THE + FOREST + HEART + FREE + AT + LAST + OF + THE + LAST + TROLL + ALL + OFFER + THEIR + FIRE + HEAT + TO + THE + ASSISTERS + FAR + OFF + THE + TROLL + FASTS + ITS + LIFE + SHORTER + AS + STARS + RISE + THE + HORSES + REST + SAFE + AFTER + ALL + SHARE + HOT + FISH + AS + THEIR + AFFILIATES + TAILOR + A + ROOFS + FOR + THEIR + SAFE == FORTRESSES" }, "expected": { - "A": 1, - "E": 0, - "F": 5, - "H": 8, - "I": 7, - "L": 2, - "O": 6, - "R": 3, - "S": 4, - "T": 9 + "A": 1, + "E": 0, + "F": 5, + "H": 8, + "I": 7, + "L": 2, + "O": 6, + "R": 3, + "S": 4, + "T": 9 } } ] From 2c7fe524cfcc68a4f9305418b08b4953f19f577f Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 13:16:57 +0100 Subject: [PATCH 04/58] atbash-cipher: format --- exercises/atbash-cipher/canonical-data.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/atbash-cipher/canonical-data.json b/exercises/atbash-cipher/canonical-data.json index 1663fbc2af..aa4687ba40 100644 --- a/exercises/atbash-cipher/canonical-data.json +++ b/exercises/atbash-cipher/canonical-data.json @@ -8,7 +8,7 @@ "cases": [ { "description": "encode", - "comments": [ "Test encoding from English to atbash" ], + "comments": ["Test encoding from English to atbash"], "cases": [ { "uuid": "2f47ebe1-eab9-4d6b-b3c6-627562a31c77", @@ -86,7 +86,7 @@ }, { "description": "decode", - "comments": [ "Test decoding from atbash to English" ], + "comments": ["Test decoding from atbash to English"], "cases": [ { "uuid": "bb50e087-7fdf-48e7-9223-284fe7e69851", From d2da698af4d49d1bc44f58db6b5c20620be1f385 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 13:17:43 +0100 Subject: [PATCH 05/58] binary-search: format --- exercises/binary-search/canonical-data.json | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/exercises/binary-search/canonical-data.json b/exercises/binary-search/canonical-data.json index cc7321f872..92027d4181 100644 --- a/exercises/binary-search/canonical-data.json +++ b/exercises/binary-search/canonical-data.json @@ -83,7 +83,9 @@ "array": [1, 3, 4, 6, 8, 9, 11], "value": 7 }, - "expected": {"error": "value not in array"} + "expected": { + "error": "value not in array" + } }, { "uuid": "95d869ff-3daf-4c79-b622-6e805c675f97", @@ -93,7 +95,9 @@ "array": [1, 3, 4, 6, 8, 9, 11], "value": 0 }, - "expected": {"error": "value not in array"} + "expected": { + "error": "value not in array" + } }, { "uuid": "8b24ef45-6e51-4a94-9eac-c2bf38fdb0ba", @@ -103,7 +107,9 @@ "array": [1, 3, 4, 6, 8, 9, 11], "value": 13 }, - "expected": {"error": "value not in array"} + "expected": { + "error": "value not in array" + } }, { "uuid": "f439a0fa-cf42-4262-8ad1-64bf41ce566a", @@ -113,7 +119,9 @@ "array": [], "value": 1 }, - "expected": {"error": "value not in array"} + "expected": { + "error": "value not in array" + } }, { "uuid": "2c353967-b56d-40b8-acff-ce43115eed64", @@ -123,7 +131,9 @@ "array": [1, 2], "value": 0 }, - "expected": {"error": "value not in array"} + "expected": { + "error": "value not in array" + } } ] } From c46ce2904db13fe727ca90d973d48eca5e22d88b Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 13:17:56 +0100 Subject: [PATCH 06/58] binary-search-tree: format --- .../binary-search-tree/canonical-data.json | 353 +++++++++--------- 1 file changed, 178 insertions(+), 175 deletions(-) diff --git a/exercises/binary-search-tree/canonical-data.json b/exercises/binary-search-tree/canonical-data.json index e7bfb279fd..688b27b53a 100644 --- a/exercises/binary-search-tree/canonical-data.json +++ b/exercises/binary-search-tree/canonical-data.json @@ -1,186 +1,189 @@ { - "exercise": "binary-search-tree", - "comments": [ - "Each test case assumes an empty/new tree.", - "As per exercism/problem-specifications#996 key 'treeData' counts as an input", - "to test generators.", - "The key 'treeData' represents an array of numbers for which the data should be ", - "inserted/added to the tree as it appears in the array from left to right.", - "e.g. treeData: ['2', '1', '3', '6', '7', '5']", - "Insert 2. Insert 1. Insert 3. Insert 6, so on...", - "This canonical-data does not restrict the data type of array elements to either", - "strings or integers.", - "The key 'expected' represents tree state as JSON object of schema :", - "{", - " 'title':'nodeObject',", - " 'type':'object',", - " 'properties':{", - " 'data':{", - " 'type':'string'", - " },", - " 'left':{", - " 'type':'nodeObject'", - " },", - " 'right':{", - " 'type':'nodeObject'", - " }", - " },", - " 'required':['data', 'left', 'right']", - "}" - ], - "cases": [{ - "uuid": "e9c93a78-c536-4750-a336-94583d23fafa", - "description": "data is retained", - "property": "data", - "input": { - "treeData": ["4"] + "exercise": "binary-search-tree", + "comments": [ + "Each test case assumes an empty/new tree.", + "As per exercism/problem-specifications#996 key 'treeData' counts as an input", + "to test generators.", + "The key 'treeData' represents an array of numbers for which the data should be ", + "inserted/added to the tree as it appears in the array from left to right.", + "e.g. treeData: ['2', '1', '3', '6', '7', '5']", + "Insert 2. Insert 1. Insert 3. Insert 6, so on...", + "This canonical-data does not restrict the data type of array elements to either", + "strings or integers.", + "The key 'expected' represents tree state as JSON object of schema :", + "{", + " 'title':'nodeObject',", + " 'type':'object',", + " 'properties':{", + " 'data':{", + " 'type':'string'", + " },", + " 'left':{", + " 'type':'nodeObject'", + " },", + " 'right':{", + " 'type':'nodeObject'", + " }", + " },", + " 'required':['data', 'left', 'right']", + "}" + ], + "cases": [ + { + "uuid": "e9c93a78-c536-4750-a336-94583d23fafa", + "description": "data is retained", + "property": "data", + "input": { + "treeData": ["4"] + }, + "expected": { + "data": "4", + "left": null, + "right": null + } + }, + { + "description": "insert data at proper node", + "cases": [ + { + "uuid": "7a95c9e8-69f6-476a-b0c4-4170cb3f7c91", + "description": "smaller number at left node", + "property": "data", + "input": { + "treeData": ["4", "2"] + }, + "expected": { + "data": "4", + "left": { + "data": "2", + "left": null, + "right": null }, - "expected": { - "data": "4", - "left": null, - "right": null - } + "right": null + } }, { - "description": "insert data at proper node", - "cases": [{ - "uuid": "7a95c9e8-69f6-476a-b0c4-4170cb3f7c91", - "description": "smaller number at left node", - "property": "data", - "input": { - "treeData": ["4", "2"] - }, - "expected": { - "data": "4", - "left": { - "data": "2", - "left": null, - "right": null - }, - "right": null - } - }, - { - "uuid": "22b89499-9805-4703-a159-1a6e434c1585", - "description": "same number at left node", - "property": "data", - "input": { - "treeData": ["4", "4"] - }, - "expected": { - "data": "4", - "left": { - "data": "4", - "left": null, - "right": null - }, - "right": null - } - }, - { - "uuid": "2e85fdde-77b1-41ed-b6ac-26ce6b663e34", - "description": "greater number at right node", - "property": "data", - "input": { - "treeData": ["4", "5"] - }, - "expected": { - "data": "4", - "left": null, - "right": { - "data": "5", - "left": null, - "right": null - } - } - } - ] + "uuid": "22b89499-9805-4703-a159-1a6e434c1585", + "description": "same number at left node", + "property": "data", + "input": { + "treeData": ["4", "4"] + }, + "expected": { + "data": "4", + "left": { + "data": "4", + "left": null, + "right": null + }, + "right": null + } }, { - "uuid": "dd898658-40ab-41d0-965e-7f145bf66e0b", - "description": "can create complex tree", - "property": "data", - "input": { - "treeData": ["4", "2", "6", "1", "3", "5", "7"] - }, - "expected": { - "data": "4", - "left": { - "data": "2", - "left": { - "data": "1", - "left": null, - "right": null - }, - "right": { - "data": "3", - "left": null, - "right": null - } - }, - "right": { - "data": "6", - "left": { - "data": "5", - "left": null, - "right": null - }, - "right": { - "data": "7", - "left": null, - "right": null - } - } + "uuid": "2e85fdde-77b1-41ed-b6ac-26ce6b663e34", + "description": "greater number at right node", + "property": "data", + "input": { + "treeData": ["4", "5"] + }, + "expected": { + "data": "4", + "left": null, + "right": { + "data": "5", + "left": null, + "right": null } + } + } + ] + }, + { + "uuid": "dd898658-40ab-41d0-965e-7f145bf66e0b", + "description": "can create complex tree", + "property": "data", + "input": { + "treeData": ["4", "2", "6", "1", "3", "5", "7"] + }, + "expected": { + "data": "4", + "left": { + "data": "2", + "left": { + "data": "1", + "left": null, + "right": null + }, + "right": { + "data": "3", + "left": null, + "right": null + } + }, + "right": { + "data": "6", + "left": { + "data": "5", + "left": null, + "right": null + }, + "right": { + "data": "7", + "left": null, + "right": null + } + } + } + }, + { + "description": "can sort data", + "cases": [ + { + "uuid": "9e0c06ef-aeca-4202-b8e4-97f1ed057d56", + "description": "can sort single number", + "property": "sortedData", + "input": { + "treeData": ["2"] + }, + "expected": ["2"] + }, + { + "uuid": "425e6d07-fceb-4681-a4f4-e46920e380bb", + "description": "can sort if second number is smaller than first", + "property": "sortedData", + "input": { + "treeData": ["2", "1"] + }, + "expected": ["1", "2"] + }, + { + "uuid": "bd7532cc-6988-4259-bac8-1d50140079ab", + "description": "can sort if second number is same as first", + "property": "sortedData", + "input": { + "treeData": ["2", "2"] + }, + "expected": ["2", "2"] + }, + { + "uuid": "b6d1b3a5-9d79-44fd-9013-c83ca92ddd36", + "description": "can sort if second number is greater than first", + "property": "sortedData", + "input": { + "treeData": ["2", "3"] + }, + "expected": ["2", "3"] }, { - "description": "can sort data", - "cases": [{ - "uuid": "9e0c06ef-aeca-4202-b8e4-97f1ed057d56", - "description": "can sort single number", - "property": "sortedData", - "input": { - "treeData": ["2"] - }, - "expected": ["2"] - }, - { - "uuid": "425e6d07-fceb-4681-a4f4-e46920e380bb", - "description": "can sort if second number is smaller than first", - "property": "sortedData", - "input": { - "treeData": ["2", "1"] - }, - "expected": ["1", "2"] - }, - { - "uuid": "bd7532cc-6988-4259-bac8-1d50140079ab", - "description": "can sort if second number is same as first", - "property": "sortedData", - "input": { - "treeData": ["2", "2"] - }, - "expected": ["2", "2"] - }, - { - "uuid": "b6d1b3a5-9d79-44fd-9013-c83ca92ddd36", - "description": "can sort if second number is greater than first", - "property": "sortedData", - "input": { - "treeData": ["2", "3"] - }, - "expected": ["2", "3"] - }, - { - "uuid": "d00ec9bd-1288-4171-b968-d44d0808c1c8", - "description": "can sort complex tree", - "property": "sortedData", - "input": { - "treeData": ["2", "1", "3", "6", "7", "5"] - }, - "expected": ["1", "2", "3", "5", "6", "7"] - } - ] + "uuid": "d00ec9bd-1288-4171-b968-d44d0808c1c8", + "description": "can sort complex tree", + "property": "sortedData", + "input": { + "treeData": ["2", "1", "3", "6", "7", "5"] + }, + "expected": ["1", "2", "3", "5", "6", "7"] } - ] + ] + } + ] } From 9a8fb2327d768576f67f01f426270c02c644182f Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 13:18:19 +0100 Subject: [PATCH 07/58] book-store: format --- exercises/book-store/canonical-data.json | 50 ++++++++++++++---------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/exercises/book-store/canonical-data.json b/exercises/book-store/canonical-data.json index c63eacb52d..21f2069258 100644 --- a/exercises/book-store/canonical-data.json +++ b/exercises/book-store/canonical-data.json @@ -25,7 +25,7 @@ "description": "Two of the same book", "comments": ["Suggested grouping, [[2],[2]]."], "input": { - "basket": [2,2] + "basket": [2, 2] }, "expected": 1600 }, @@ -45,7 +45,7 @@ "description": "Two different books", "comments": ["Suggested grouping, [[1,2]]."], "input": { - "basket": [1,2] + "basket": [1, 2] }, "expected": 1520 }, @@ -55,7 +55,7 @@ "description": "Three different books", "comments": ["Suggested grouping, [[1,2,3]]."], "input": { - "basket": [1,2,3] + "basket": [1, 2, 3] }, "expected": 2160 }, @@ -65,7 +65,7 @@ "description": "Four different books", "comments": ["Suggested grouping, [[1,2,3,4]]."], "input": { - "basket": [1,2,3,4] + "basket": [1, 2, 3, 4] }, "expected": 2560 }, @@ -75,7 +75,7 @@ "description": "Five different books", "comments": ["Suggested grouping, [[1,2,3,4,5]]."], "input": { - "basket": [1,2,3,4,5] + "basket": [1, 2, 3, 4, 5] }, "expected": 3000 }, @@ -85,7 +85,7 @@ "description": "Two groups of four is cheaper than group of five plus group of three", "comments": ["Suggested grouping, [[1,2,3,4],[1,2,3,5]]."], "input": { - "basket": [1,1,2,2,3,3,4,5] + "basket": [1, 1, 2, 2, 3, 3, 4, 5] }, "expected": 5120 }, @@ -93,9 +93,11 @@ "uuid": "f808b5a4-e01f-4c0d-881f-f7b90d9739da", "property": "total", "description": "Two groups of four is cheaper than groups of five and three", - "comments": ["Suggested grouping, [[1,2,4,5],[1,3,4,5]]. This differs from the other 'two groups of four' test in that it will fail for solutions that add books to groups in the order in which they appear in the list."], + "comments": [ + "Suggested grouping, [[1,2,4,5],[1,3,4,5]]. This differs from the other 'two groups of four' test in that it will fail for solutions that add books to groups in the order in which they appear in the list." + ], "input": { - "basket": [1,1,2,3,4,4,5,5] + "basket": [1, 1, 2, 3, 4, 4, 5, 5] }, "expected": 5120 }, @@ -105,7 +107,7 @@ "description": "Group of four plus group of two is cheaper than two groups of three", "comments": ["Suggested grouping, [[1,2,3,4],[1,2]]."], "input": { - "basket": [1,1,2,2,3,4] + "basket": [1, 1, 2, 2, 3, 4] }, "expected": 4080 }, @@ -115,7 +117,7 @@ "description": "Two each of first 4 books and 1 copy each of rest", "comments": ["Suggested grouping, [[1,2,3,4,5],[1,2,3,4]]."], "input": { - "basket": [1,1,2,2,3,3,4,4,5] + "basket": [1, 1, 2, 2, 3, 3, 4, 4, 5] }, "expected": 5560 }, @@ -125,7 +127,7 @@ "description": "Two copies of each book", "comments": ["Suggested grouping, [[1,2,3,4,5],[1,2,3,4,5]]."], "input": { - "basket": [1,1,2,2,3,3,4,4,5,5] + "basket": [1, 1, 2, 2, 3, 3, 4, 4, 5, 5] }, "expected": 6000 }, @@ -135,7 +137,7 @@ "description": "Three copies of first book and 2 each of remaining", "comments": ["Suggested grouping, [[1,2,3,4,5],[1,2,3,4,5],[1]]."], "input": { - "basket": [1,1,2,2,3,3,4,4,5,5,1] + "basket": [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1] }, "expected": 6800 }, @@ -145,7 +147,7 @@ "description": "Three each of first 2 books and 2 each of remaining books", "comments": ["Suggested grouping, [[1,2,3,4,5],[1,2,3,4,5],[1,2]]."], "input": { - "basket": [1,1,2,2,3,3,4,4,5,5,1,2] + "basket": [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2] }, "expected": 7520 }, @@ -153,9 +155,11 @@ "uuid": "bb376344-4fb2-49ab-ab85-e38d8354a58d", "property": "total", "description": "Four groups of four are cheaper than two groups each of five and three", - "comments": ["Suggested grouping, [[1,2,3,4],[1,2,3,5],[1,2,3,4],[1,2,3,5]]."], + "comments": [ + "Suggested grouping, [[1,2,3,4],[1,2,3,5],[1,2,3,4],[1,2,3,5]]." + ], "input": { - "basket": [1,1,2,2,3,3,4,5,1,1,2,2,3,3,4,5] + "basket": [1, 1, 2, 2, 3, 3, 4, 5, 1, 1, 2, 2, 3, 3, 4, 5] }, "expected": 10240 }, @@ -163,9 +167,13 @@ "uuid": "5260ddde-2703-4915-b45a-e54dbbac4303", "property": "total", "description": "Check that groups of four are created properly even when there are more groups of three than groups of five", - "comments": ["Suggested grouping, [[1,2,3,4],[1,2,3,5],[1,2,3,4],[1,2,3,5],[1,2,3],[1,2,3]]."], + "comments": [ + "Suggested grouping, [[1,2,3,4],[1,2,3,5],[1,2,3,4],[1,2,3,5],[1,2,3],[1,2,3]]." + ], "input": { - "basket": [1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,5,5] + "basket": [ + 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5 + ] }, "expected": 14560 }, @@ -175,7 +183,7 @@ "description": "One group of one and four is cheaper than one group of two and three", "comments": ["Suggested grouping, [[1],[1,2,3,4]]."], "input": { - "basket": [1,1,2,3,4] + "basket": [1, 1, 2, 3, 4] }, "expected": 3360 }, @@ -183,9 +191,11 @@ "uuid": "cf868453-6484-4ae1-9dfc-f8ee85bbde01", "property": "total", "description": "One group of one and two plus three groups of four is cheaper than one group of each size", - "comments": ["Suggested grouping, [[5],[5,4],[5,4,3,2],[5,4,3,2],[5,4,3,1]]."], + "comments": [ + "Suggested grouping, [[5],[5,4],[5,4,3,2],[5,4,3,2],[5,4,3,1]]." + ], "input": { - "basket": [1,2,2,3,3,3,4,4,4,4,5,5,5,5,5] + "basket": [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5] }, "expected": 10000 } From b1e82d49b63fee33eeccf11d34c3f152155a3765 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 13:19:40 +0100 Subject: [PATCH 08/58] bowling: format --- exercises/bowling/canonical-data.json | 568 +++++++++++++++----------- 1 file changed, 339 insertions(+), 229 deletions(-) diff --git a/exercises/bowling/canonical-data.json b/exercises/bowling/canonical-data.json index 2e37838444..b2ff54dd18 100644 --- a/exercises/bowling/canonical-data.json +++ b/exercises/bowling/canonical-data.json @@ -19,263 +19,373 @@ "In all error cases you should expect an error as is idiomatic for your language", "whether that be via exceptions, optional values, or otherwise." ], - "cases": [{ - "uuid": "656ae006-25c2-438c-a549-f338e7ec7441", - "description": "should be able to score a game with all zeros", - "property": "score", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + "cases": [ + { + "uuid": "656ae006-25c2-438c-a549-f338e7ec7441", + "description": "should be able to score a game with all zeros", + "property": "score", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ] + }, + "expected": 0 }, - "expected": 0 - }, { - "uuid": "f85dcc56-cd6b-4875-81b3-e50921e3597b", - "description": "should be able to score a game with no strikes or spares", - "property": "score", - "input": { - "previousRolls": [3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6] + { + "uuid": "f85dcc56-cd6b-4875-81b3-e50921e3597b", + "description": "should be able to score a game with no strikes or spares", + "property": "score", + "input": { + "previousRolls": [ + 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6 + ] + }, + "expected": 90 }, - "expected": 90 - }, { - "uuid": "d1f56305-3ac2-4fe0-8645-0b37e3073e20", - "description": "a spare followed by zeros is worth ten points", - "property": "score", - "input": { - "previousRolls": [6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + { + "uuid": "d1f56305-3ac2-4fe0-8645-0b37e3073e20", + "description": "a spare followed by zeros is worth ten points", + "property": "score", + "input": { + "previousRolls": [ + 6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ] + }, + "expected": 10 }, - "expected": 10 - }, { - "uuid": "0b8c8bb7-764a-4287-801a-f9e9012f8be4", - "description": "points scored in the roll after a spare are counted twice", - "property": "score", - "input": { - "previousRolls": [6, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + { + "uuid": "0b8c8bb7-764a-4287-801a-f9e9012f8be4", + "description": "points scored in the roll after a spare are counted twice", + "property": "score", + "input": { + "previousRolls": [ + 6, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ] + }, + "expected": 16 }, - "expected": 16 - }, { - "uuid": "4d54d502-1565-4691-84cd-f29a09c65bea", - "description": "consecutive spares each get a one roll bonus", - "property": "score", - "input": { - "previousRolls": [5, 5, 3, 7, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + { + "uuid": "4d54d502-1565-4691-84cd-f29a09c65bea", + "description": "consecutive spares each get a one roll bonus", + "property": "score", + "input": { + "previousRolls": [ + 5, 5, 3, 7, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ] + }, + "expected": 31 }, - "expected": 31 - }, { - "uuid": "e5c9cf3d-abbe-4b74-ad48-34051b2b08c0", - "description": "a spare in the last frame gets a one roll bonus that is counted once", - "property": "score", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 7] + { + "uuid": "e5c9cf3d-abbe-4b74-ad48-34051b2b08c0", + "description": "a spare in the last frame gets a one roll bonus that is counted once", + "property": "score", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 7 + ] + }, + "expected": 17 }, - "expected": 17 - }, { - "uuid": "75269642-2b34-4b72-95a4-9be28ab16902", - "description": "a strike earns ten points in a frame with a single roll", - "property": "score", - "input": { - "previousRolls": [10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + { + "uuid": "75269642-2b34-4b72-95a4-9be28ab16902", + "description": "a strike earns ten points in a frame with a single roll", + "property": "score", + "input": { + "previousRolls": [ + 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ] + }, + "expected": 10 }, - "expected": 10 - }, { - "uuid": "037f978c-5d01-4e49-bdeb-9e20a2e6f9a6", - "description": "points scored in the two rolls after a strike are counted twice as a bonus", - "property": "score", - "input": { - "previousRolls": [10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + { + "uuid": "037f978c-5d01-4e49-bdeb-9e20a2e6f9a6", + "description": "points scored in the two rolls after a strike are counted twice as a bonus", + "property": "score", + "input": { + "previousRolls": [ + 10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ] + }, + "expected": 26 }, - "expected": 26 - }, { - "uuid": "1635e82b-14ec-4cd1-bce4-4ea14bd13a49", - "description": "consecutive strikes each get the two roll bonus", - "property": "score", - "input": { - "previousRolls": [10, 10, 10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + { + "uuid": "1635e82b-14ec-4cd1-bce4-4ea14bd13a49", + "description": "consecutive strikes each get the two roll bonus", + "property": "score", + "input": { + "previousRolls": [10, 10, 10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + }, + "expected": 81 }, - "expected": 81 - }, { - "uuid": "e483e8b6-cb4b-4959-b310-e3982030d766", - "description": "a strike in the last frame gets a two roll bonus that is counted once", - "property": "score", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 1] + { + "uuid": "e483e8b6-cb4b-4959-b310-e3982030d766", + "description": "a strike in the last frame gets a two roll bonus that is counted once", + "property": "score", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 1 + ] + }, + "expected": 18 }, - "expected": 18 - }, { - "uuid": "9d5c87db-84bc-4e01-8e95-53350c8af1f8", - "description": "rolling a spare with the two roll bonus does not get a bonus roll", - "property": "score", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 3] + { + "uuid": "9d5c87db-84bc-4e01-8e95-53350c8af1f8", + "description": "rolling a spare with the two roll bonus does not get a bonus roll", + "property": "score", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 3 + ] + }, + "expected": 20 }, - "expected": 20 - }, { - "uuid": "576faac1-7cff-4029-ad72-c16bcada79b5", - "description": "strikes with the two roll bonus do not get bonus rolls", - "property": "score", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10] + { + "uuid": "576faac1-7cff-4029-ad72-c16bcada79b5", + "description": "strikes with the two roll bonus do not get bonus rolls", + "property": "score", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10 + ] + }, + "expected": 30 }, - "expected": 30 - }, { - "uuid": "efb426ec-7e15-42e6-9b96-b4fca3ec2359", - "description": "last two strikes followed by only last bonus with non strike points", - "property": "score", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 1] + { + "uuid": "efb426ec-7e15-42e6-9b96-b4fca3ec2359", + "description": "last two strikes followed by only last bonus with non strike points", + "property": "score", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 0, 1 + ] + }, + "expected": 31 }, - "expected": 31 - }, { - "uuid": "72e24404-b6c6-46af-b188-875514c0377b", - "description": "a strike with the one roll bonus after a spare in the last frame does not get a bonus", - "property": "score", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 10] + { + "uuid": "72e24404-b6c6-46af-b188-875514c0377b", + "description": "a strike with the one roll bonus after a spare in the last frame does not get a bonus", + "property": "score", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 10 + ] + }, + "expected": 20 }, - "expected": 20 - }, { - "uuid": "62ee4c72-8ee8-4250-b794-234f1fec17b1", - "description": "all strikes is a perfect game", - "property": "score", - "input": { - "previousRolls": [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10] + { + "uuid": "62ee4c72-8ee8-4250-b794-234f1fec17b1", + "description": "all strikes is a perfect game", + "property": "score", + "input": { + "previousRolls": [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10] + }, + "expected": 300 }, - "expected": 300 - }, { - "uuid": "1245216b-19c6-422c-b34b-6e4012d7459f", - "description": "rolls cannot score negative points", - "property": "roll", - "input": { - "previousRolls": [], - "roll": -1 + { + "uuid": "1245216b-19c6-422c-b34b-6e4012d7459f", + "description": "rolls cannot score negative points", + "property": "roll", + "input": { + "previousRolls": [], + "roll": -1 + }, + "expected": { + "error": "Negative roll is invalid" + } }, - "expected": {"error": "Negative roll is invalid"} - }, { - "uuid": "5fcbd206-782c-4faa-8f3a-be5c538ba841", - "description": "a roll cannot score more than 10 points", - "property": "roll", - "input": { - "previousRolls": [], - "roll": 11 + { + "uuid": "5fcbd206-782c-4faa-8f3a-be5c538ba841", + "description": "a roll cannot score more than 10 points", + "property": "roll", + "input": { + "previousRolls": [], + "roll": 11 + }, + "expected": { + "error": "Pin count exceeds pins on the lane" + } }, - "expected": {"error": "Pin count exceeds pins on the lane"} - }, { - "uuid": "fb023c31-d842-422d-ad7e-79ce1db23c21", - "description": "two rolls in a frame cannot score more than 10 points", - "property": "roll", - "input": { - "previousRolls": [5], - "roll": 6 + { + "uuid": "fb023c31-d842-422d-ad7e-79ce1db23c21", + "description": "two rolls in a frame cannot score more than 10 points", + "property": "roll", + "input": { + "previousRolls": [5], + "roll": 6 + }, + "expected": { + "error": "Pin count exceeds pins on the lane" + } }, - "expected": {"error": "Pin count exceeds pins on the lane"} - }, { - "uuid": "6082d689-d677-4214-80d7-99940189381b", - "description": "bonus roll after a strike in the last frame cannot score more than 10 points", - "property": "roll", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10], - "roll": 11 + { + "uuid": "6082d689-d677-4214-80d7-99940189381b", + "description": "bonus roll after a strike in the last frame cannot score more than 10 points", + "property": "roll", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10 + ], + "roll": 11 + }, + "expected": { + "error": "Pin count exceeds pins on the lane" + } }, - "expected": {"error": "Pin count exceeds pins on the lane"} - }, { - "uuid": "e9565fe6-510a-4675-ba6b-733a56767a45", - "description": "two bonus rolls after a strike in the last frame cannot score more than 10 points", - "property": "roll", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5], - "roll": 6 + { + "uuid": "e9565fe6-510a-4675-ba6b-733a56767a45", + "description": "two bonus rolls after a strike in the last frame cannot score more than 10 points", + "property": "roll", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5 + ], + "roll": 6 + }, + "expected": { + "error": "Pin count exceeds pins on the lane" + } }, - "expected": {"error": "Pin count exceeds pins on the lane"} - }, { - "uuid": "2f6acf99-448e-4282-8103-0b9c7df99c3d", - "description": "two bonus rolls after a strike in the last frame can score more than 10 points if one is a strike", - "property": "score", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 6] + { + "uuid": "2f6acf99-448e-4282-8103-0b9c7df99c3d", + "description": "two bonus rolls after a strike in the last frame can score more than 10 points if one is a strike", + "property": "score", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 6 + ] + }, + "expected": 26 }, - "expected": 26 - }, { - "uuid": "6380495a-8bc4-4cdb-a59f-5f0212dbed01", - "description": "the second bonus rolls after a strike in the last frame cannot be a strike if the first one is not a strike", - "property": "roll", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6], - "roll": 10 + { + "uuid": "6380495a-8bc4-4cdb-a59f-5f0212dbed01", + "description": "the second bonus rolls after a strike in the last frame cannot be a strike if the first one is not a strike", + "property": "roll", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6 + ], + "roll": 10 + }, + "expected": { + "error": "Pin count exceeds pins on the lane" + } }, - "expected": {"error": "Pin count exceeds pins on the lane"} - }, { - "uuid": "2b2976ea-446c-47a3-9817-42777f09fe7e", - "description": "second bonus roll after a strike in the last frame cannot score more than 10 points", - "property": "roll", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10], - "roll": 11 + { + "uuid": "2b2976ea-446c-47a3-9817-42777f09fe7e", + "description": "second bonus roll after a strike in the last frame cannot score more than 10 points", + "property": "roll", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10 + ], + "roll": 11 + }, + "expected": { + "error": "Pin count exceeds pins on the lane" + } }, - "expected": {"error": "Pin count exceeds pins on the lane"} - }, { - "uuid": "29220245-ac8d-463d-bc19-98a94cfada8a", - "description": "an unstarted game cannot be scored", - "property": "score", - "input": { - "previousRolls": [] + { + "uuid": "29220245-ac8d-463d-bc19-98a94cfada8a", + "description": "an unstarted game cannot be scored", + "property": "score", + "input": { + "previousRolls": [] + }, + "expected": { + "error": "Score cannot be taken until the end of the game" + } }, - "expected": {"error": "Score cannot be taken until the end of the game"} - }, { - "uuid": "4473dc5d-1f86-486f-bf79-426a52ddc955", - "description": "an incomplete game cannot be scored", - "property": "score", - "input": { - "previousRolls": [0, 0] + { + "uuid": "4473dc5d-1f86-486f-bf79-426a52ddc955", + "description": "an incomplete game cannot be scored", + "property": "score", + "input": { + "previousRolls": [0, 0] + }, + "expected": { + "error": "Score cannot be taken until the end of the game" + } }, - "expected": {"error": "Score cannot be taken until the end of the game"} - }, { - "uuid": "2ccb8980-1b37-4988-b7d1-e5701c317df3", - "description": "cannot roll if game already has ten frames", - "property": "roll", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - "roll": 0 + { + "uuid": "2ccb8980-1b37-4988-b7d1-e5701c317df3", + "description": "cannot roll if game already has ten frames", + "property": "roll", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ], + "roll": 0 + }, + "expected": { + "error": "Cannot roll after game is over" + } }, - "expected": {"error": "Cannot roll after game is over"} - }, { - "uuid": "4864f09b-9df3-4b65-9924-c595ed236f1b", - "description": "bonus rolls for a strike in the last frame must be rolled before score can be calculated", - "property": "score", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10] + { + "uuid": "4864f09b-9df3-4b65-9924-c595ed236f1b", + "description": "bonus rolls for a strike in the last frame must be rolled before score can be calculated", + "property": "score", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10 + ] + }, + "expected": { + "error": "Score cannot be taken until the end of the game" + } }, - "expected": {"error": "Score cannot be taken until the end of the game"} - }, { - "uuid": "537f4e37-4b51-4d1c-97e2-986eb37b2ac1", - "description": "both bonus rolls for a strike in the last frame must be rolled before score can be calculated", - "property": "score", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10] + { + "uuid": "537f4e37-4b51-4d1c-97e2-986eb37b2ac1", + "description": "both bonus rolls for a strike in the last frame must be rolled before score can be calculated", + "property": "score", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10 + ] + }, + "expected": { + "error": "Score cannot be taken until the end of the game" + } }, - "expected": {"error": "Score cannot be taken until the end of the game"} - }, { - "uuid": "8134e8c1-4201-4197-bf9f-1431afcde4b9", - "description": "bonus roll for a spare in the last frame must be rolled before score can be calculated", - "property": "score", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3] + { + "uuid": "8134e8c1-4201-4197-bf9f-1431afcde4b9", + "description": "bonus roll for a spare in the last frame must be rolled before score can be calculated", + "property": "score", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3 + ] + }, + "expected": { + "error": "Score cannot be taken until the end of the game" + } }, - "expected": {"error": "Score cannot be taken until the end of the game"} - }, { - "uuid": "9d4a9a55-134a-4bad-bae8-3babf84bd570", - "description": "cannot roll after bonus roll for spare", - "property": "roll", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 2], - "roll": 2 + { + "uuid": "9d4a9a55-134a-4bad-bae8-3babf84bd570", + "description": "cannot roll after bonus roll for spare", + "property": "roll", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 2 + ], + "roll": 2 + }, + "expected": { + "error": "Cannot roll after game is over" + } }, - "expected": {"error": "Cannot roll after game is over"} - }, { - "uuid": "d3e02652-a799-4ae3-b53b-68582cc604be", - "description": "cannot roll after bonus rolls for strike", - "property": "roll", - "input": { - "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 3, 2], - "roll": 2 - }, - "expected": {"error": "Cannot roll after game is over"} - }] + { + "uuid": "d3e02652-a799-4ae3-b53b-68582cc604be", + "description": "cannot roll after bonus rolls for strike", + "property": "roll", + "input": { + "previousRolls": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 3, 2 + ], + "roll": 2 + }, + "expected": { + "error": "Cannot roll after game is over" + } + } + ] } From 22441301c2a7f9bfe440826d3043a081b59559be Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 13:19:59 +0100 Subject: [PATCH 09/58] change: format --- exercises/change/canonical-data.json | 144 ++++----------------------- 1 file changed, 20 insertions(+), 124 deletions(-) diff --git a/exercises/change/canonical-data.json b/exercises/change/canonical-data.json index bea6b1041b..b5f2db3eae 100644 --- a/exercises/change/canonical-data.json +++ b/exercises/change/canonical-data.json @@ -11,127 +11,61 @@ "description": "change for 1 cent", "property": "findFewestCoins", "input": { - "coins": [ - 1, - 5, - 10, - 25 - ], + "coins": [1, 5, 10, 25], "target": 1 }, - "expected": [ - 1 - ] + "expected": [1] }, { "uuid": "36887bea-7f92-4a9c-b0cc-c0e886b3ecc8", "description": "single coin change", "property": "findFewestCoins", "input": { - "coins": [ - 1, - 5, - 10, - 25, - 100 - ], + "coins": [1, 5, 10, 25, 100], "target": 25 }, - "expected": [ - 25 - ] + "expected": [25] }, { "uuid": "cef21ccc-0811-4e6e-af44-f011e7eab6c6", "description": "multiple coin change", "property": "findFewestCoins", "input": { - "coins": [ - 1, - 5, - 10, - 25, - 100 - ], + "coins": [1, 5, 10, 25, 100], "target": 15 }, - "expected": [ - 5, - 10 - ] + "expected": [5, 10] }, { "uuid": "d60952bc-0c1a-4571-bf0c-41be72690cb3", "description": "change with Lilliputian Coins", "property": "findFewestCoins", "input": { - "coins": [ - 1, - 4, - 15, - 20, - 50 - ], + "coins": [1, 4, 15, 20, 50], "target": 23 }, - "expected": [ - 4, - 4, - 15 - ] + "expected": [4, 4, 15] }, { "uuid": "408390b9-fafa-4bb9-b608-ffe6036edb6c", "description": "change with Lower Elbonia Coins", "property": "findFewestCoins", "input": { - "coins": [ - 1, - 5, - 10, - 21, - 25 - ], + "coins": [1, 5, 10, 21, 25], "target": 63 }, - "expected": [ - 21, - 21, - 21 - ] + "expected": [21, 21, 21] }, { "uuid": "7421a4cb-1c48-4bf9-99c7-7f049689132f", "description": "large target values", "property": "findFewestCoins", "input": { - "coins": [ - 1, - 2, - 5, - 10, - 20, - 50, - 100 - ], + "coins": [1, 2, 5, 10, 20, 50, 100], "target": 999 }, "expected": [ - 2, - 2, - 5, - 20, - 20, - 50, - 100, - 100, - 100, - 100, - 100, - 100, - 100, - 100, - 100 + 2, 2, 5, 20, 20, 50, 100, 100, 100, 100, 100, 100, 100, 100, 100 ] }, { @@ -139,55 +73,27 @@ "description": "possible change without unit coins available", "property": "findFewestCoins", "input": { - "coins": [ - 2, - 5, - 10, - 20, - 50 - ], + "coins": [2, 5, 10, 20, 50], "target": 21 }, - "expected": [ - 2, - 2, - 2, - 5, - 10 - ] + "expected": [2, 2, 2, 5, 10] }, { "uuid": "9a166411-d35d-4f7f-a007-6724ac266178", "description": "another possible change without unit coins available", "property": "findFewestCoins", "input": { - "coins": [ - 4, - 5 - ], + "coins": [4, 5], "target": 27 }, - "expected": [ - 4, - 4, - 4, - 5, - 5, - 5 - ] + "expected": [4, 4, 4, 5, 5, 5] }, { "uuid": "bbbcc154-e9e9-4209-a4db-dd6d81ec26bb", "description": "no coins make 0 change", "property": "findFewestCoins", "input": { - "coins": [ - 1, - 5, - 10, - 21, - 25 - ], + "coins": [1, 5, 10, 21, 25], "target": 0 }, "expected": [] @@ -197,10 +103,7 @@ "description": "error testing for change smaller than the smallest of coins", "property": "findFewestCoins", "input": { - "coins": [ - 5, - 10 - ], + "coins": [5, 10], "target": 3 }, "expected": { @@ -212,10 +115,7 @@ "description": "error if no combination can add up to target", "property": "findFewestCoins", "input": { - "coins": [ - 5, - 10 - ], + "coins": [5, 10], "target": 94 }, "expected": { @@ -227,11 +127,7 @@ "description": "cannot find negative change values", "property": "findFewestCoins", "input": { - "coins": [ - 1, - 2, - 5 - ], + "coins": [1, 2, 5], "target": -5 }, "expected": { From 171fd22758211bb40ba506cc77aa1015ab8b3c8c Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 13:20:10 +0100 Subject: [PATCH 10/58] complex-numbers: format --- exercises/complex-numbers/canonical-data.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/complex-numbers/canonical-data.json b/exercises/complex-numbers/canonical-data.json index aca403f48c..ca6472c774 100644 --- a/exercises/complex-numbers/canonical-data.json +++ b/exercises/complex-numbers/canonical-data.json @@ -68,7 +68,7 @@ "uuid": "0f998f19-69ee-4c64-80ef-01b086feab80", "description": "Imaginary part of a number with real and imaginary part", "property": "imaginary", - "input": { + "input": { "z": [1, 2] }, "expected": 2 @@ -330,7 +330,7 @@ "uuid": "6d96d4c6-2edb-445b-94a2-7de6d4caaf60", "description": "Euler's identity/formula", "property": "exp", - "input": { + "input": { "z": [0, "pi"] }, "expected": [-1, 0] From 81f4367bdec35382ef03b0401d27eb810bdf4c91 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 13:21:00 +0100 Subject: [PATCH 11/58] diamond: format --- exercises/diamond/canonical-data.json | 274 +++++++++++++------------- 1 file changed, 137 insertions(+), 137 deletions(-) diff --git a/exercises/diamond/canonical-data.json b/exercises/diamond/canonical-data.json index e642569259..290336a78a 100644 --- a/exercises/diamond/canonical-data.json +++ b/exercises/diamond/canonical-data.json @@ -1,139 +1,139 @@ { - "exercise": "diamond", - "comments": [ - " The tests contained within this canonical data file are suitable ", - " for value-based testing, in which each test case checks that the ", - " value returned by the function under test is in every way ", - " identical to a given expected value. ", - " ", - " This exercise is also amenable to property-based testing, in which ", - " each test case verifies that the value returned by the function ", - " under test exhibits a specific desired property. ", - " ", - " Several tracks (notably, C# and Go) forgo the value-based tests ", - " below in favor of property-based tests. If you are feeling ", - " adventurous and would like to use this exercise to introduce the ", - " concept of property-based testing to participants in your track, ", - " please ignore the value-based tests below and instead reference ", - " the test suites in the aforementioned tracks. " - ], - "cases": [ - { - "uuid": "202fb4cc-6a38-4883-9193-a29d5cb92076", - "description": "Degenerate case with a single 'A' row", - "property": "rows", - "input": { - "letter": "A" - }, - "expected": [ - "A" - ] - }, - { - "uuid": "bd6a6d78-9302-42e9-8f60-ac1461e9abae", - "description": "Degenerate case with no row containing 3 distinct groups of spaces", - "property": "rows", - "input": { - "letter": "B" - }, - "expected": [ - " A ", - "B B", - " A " - ] - }, - { - "uuid": "af8efb49-14ed-447f-8944-4cc59ce3fd76", - "description": "Smallest non-degenerate case with odd diamond side length", - "property": "rows", - "input": { - "letter": "C" - }, - "expected": [ - " A ", - " B B ", - "C C", - " B B ", - " A " - ] - }, - { - "uuid": "e0c19a95-9888-4d05-86a0-fa81b9e70d1d", - "description": "Smallest non-degenerate case with even diamond side length", - "property": "rows", - "input": { - "letter": "D" - }, - "expected": [ - " A ", - " B B ", - " C C ", - "D D", - " C C ", - " B B ", - " A " - ] - }, - { - "uuid": "82ea9aa9-4c0e-442a-b07e-40204e925944", - "description": "Largest possible diamond", - "property": "rows", - "input": { - "letter": "Z" - }, - "expected": [ - " A ", - " B B ", - " C C ", - " D D ", - " E E ", - " F F ", - " G G ", - " H H ", - " I I ", - " J J ", - " K K ", - " L L ", - " M M ", - " N N ", - " O O ", - " P P ", - " Q Q ", - " R R ", - " S S ", - " T T ", - " U U ", - " V V ", - " W W ", - " X X ", - " Y Y ", - "Z Z", - " Y Y ", - " X X ", - " W W ", - " V V ", - " U U ", - " T T ", - " S S ", - " R R ", - " Q Q ", - " P P ", - " O O ", - " N N ", - " M M ", - " L L ", - " K K ", - " J J ", - " I I ", - " H H ", - " G G ", - " F F ", - " E E ", - " D D ", - " C C ", - " B B ", - " A " - ] - } - ] + "exercise": "diamond", + "comments": [ + " The tests contained within this canonical data file are suitable ", + " for value-based testing, in which each test case checks that the ", + " value returned by the function under test is in every way ", + " identical to a given expected value. ", + " ", + " This exercise is also amenable to property-based testing, in which ", + " each test case verifies that the value returned by the function ", + " under test exhibits a specific desired property. ", + " ", + " Several tracks (notably, C# and Go) forgo the value-based tests ", + " below in favor of property-based tests. If you are feeling ", + " adventurous and would like to use this exercise to introduce the ", + " concept of property-based testing to participants in your track, ", + " please ignore the value-based tests below and instead reference ", + " the test suites in the aforementioned tracks. " + ], + "cases": [ + { + "uuid": "202fb4cc-6a38-4883-9193-a29d5cb92076", + "description": "Degenerate case with a single 'A' row", + "property": "rows", + "input": { + "letter": "A" + }, + "expected": [ + "A" + ] + }, + { + "uuid": "bd6a6d78-9302-42e9-8f60-ac1461e9abae", + "description": "Degenerate case with no row containing 3 distinct groups of spaces", + "property": "rows", + "input": { + "letter": "B" + }, + "expected": [ + " A ", + "B B", + " A " + ] + }, + { + "uuid": "af8efb49-14ed-447f-8944-4cc59ce3fd76", + "description": "Smallest non-degenerate case with odd diamond side length", + "property": "rows", + "input": { + "letter": "C" + }, + "expected": [ + " A ", + " B B ", + "C C", + " B B ", + " A " + ] + }, + { + "uuid": "e0c19a95-9888-4d05-86a0-fa81b9e70d1d", + "description": "Smallest non-degenerate case with even diamond side length", + "property": "rows", + "input": { + "letter": "D" + }, + "expected": [ + " A ", + " B B ", + " C C ", + "D D", + " C C ", + " B B ", + " A " + ] + }, + { + "uuid": "82ea9aa9-4c0e-442a-b07e-40204e925944", + "description": "Largest possible diamond", + "property": "rows", + "input": { + "letter": "Z" + }, + "expected": [ + " A ", + " B B ", + " C C ", + " D D ", + " E E ", + " F F ", + " G G ", + " H H ", + " I I ", + " J J ", + " K K ", + " L L ", + " M M ", + " N N ", + " O O ", + " P P ", + " Q Q ", + " R R ", + " S S ", + " T T ", + " U U ", + " V V ", + " W W ", + " X X ", + " Y Y ", + "Z Z", + " Y Y ", + " X X ", + " W W ", + " V V ", + " U U ", + " T T ", + " S S ", + " R R ", + " Q Q ", + " P P ", + " O O ", + " N N ", + " M M ", + " L L ", + " K K ", + " J J ", + " I I ", + " H H ", + " G G ", + " F F ", + " E E ", + " D D ", + " C C ", + " B B ", + " A " + ] + } + ] } From 7e2bc926bff9772dc52548965dad3818eddb2baf Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 13:21:25 +0100 Subject: [PATCH 12/58] diffie-hellman: format --- exercises/diffie-hellman/canonical-data.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/exercises/diffie-hellman/canonical-data.json b/exercises/diffie-hellman/canonical-data.json index b111b84d38..31e4e851c4 100644 --- a/exercises/diffie-hellman/canonical-data.json +++ b/exercises/diffie-hellman/canonical-data.json @@ -63,9 +63,7 @@ "privateKey": 15 }, "expected": 19, - "scenarios": [ - "immutable" - ] + "scenarios": ["immutable"] }, { "uuid": "cd02ad45-3f52-4510-99cc-5161dad948a8", From fdb8ee3f1194a5c1b44d73248cb1a822ef7e89cb Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 13:22:20 +0100 Subject: [PATCH 13/58] etl: format --- exercises/etl/canonical-data.json | 42 +++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/exercises/etl/canonical-data.json b/exercises/etl/canonical-data.json index 33844f6820..0dcde3aab2 100644 --- a/exercises/etl/canonical-data.json +++ b/exercises/etl/canonical-data.json @@ -63,21 +63,41 @@ "property": "transform", "input": { "legacy": { - "1": ["A", "E", "I", "O", "U", "L", "N", "R", "S", "T"], - "2": ["D", "G"], - "3": ["B", "C", "M", "P"], - "4": ["F", "H", "V", "W", "Y"], - "5": ["K"], - "8": ["J", "X"], + "1": ["A", "E", "I", "O", "U", "L", "N", "R", "S", "T"], + "2": ["D", "G"], + "3": ["B", "C", "M", "P"], + "4": ["F", "H", "V", "W", "Y"], + "5": ["K"], + "8": ["J", "X"], "10": ["Q", "Z"] } }, "expected": { - "a": 1, "b": 3, "c": 3, "d": 2, "e": 1, - "f": 4, "g": 2, "h": 4, "i": 1, "j": 8, - "k": 5, "l": 1, "m": 3, "n": 1, "o": 1, - "p": 3, "q": 10, "r": 1, "s": 1, "t": 1, - "u": 1, "v": 4, "w": 4, "x": 8, "y": 4, + "a": 1, + "b": 3, + "c": 3, + "d": 2, + "e": 1, + "f": 4, + "g": 2, + "h": 4, + "i": 1, + "j": 8, + "k": 5, + "l": 1, + "m": 3, + "n": 1, + "o": 1, + "p": 3, + "q": 10, + "r": 1, + "s": 1, + "t": 1, + "u": 1, + "v": 4, + "w": 4, + "x": 8, + "y": 4, "z": 10 } } From 3dce8e32463405d0dfc75c18c7e6f2f50050511b Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 13:56:45 +0100 Subject: [PATCH 14/58] grade-school: format --- exercises/grade-school/canonical-data.json | 129 +++++++++++++++++---- 1 file changed, 104 insertions(+), 25 deletions(-) diff --git a/exercises/grade-school/canonical-data.json b/exercises/grade-school/canonical-data.json index 4bffb47840..1890a85566 100644 --- a/exercises/grade-school/canonical-data.json +++ b/exercises/grade-school/canonical-data.json @@ -37,7 +37,11 @@ "description": "Adding multiple students in the same grade in the roster", "property": "add", "input": { - "students": [["Blair", 2], ["James", 2], ["Paul", 2]] + "students": [ + ["Blair", 2], + ["James", 2], + ["Paul", 2] + ] }, "expected": [true, true, true] }, @@ -46,7 +50,11 @@ "description": "Multiple students in the same grade are added to the roster", "property": "roster", "input": { - "students": [["Blair", 2], ["James", 2], ["Paul", 2]] + "students": [ + ["Blair", 2], + ["James", 2], + ["Paul", 2] + ] }, "expected": ["Blair", "James", "Paul"] }, @@ -55,7 +63,12 @@ "description": "Cannot add student to same grade in the roster more than once", "property": "add", "input": { - "students": [["Blair", 2], ["James", 2], ["James", 2], ["Paul", 2]] + "students": [ + ["Blair", 2], + ["James", 2], + ["James", 2], + ["Paul", 2] + ] }, "expected": [true, true, false, true] }, @@ -64,7 +77,10 @@ "description": "A student can't be in two different grades", "property": "roster", "input": { - "students": [["Aimee", 2], ["Aimee", 1]], + "students": [ + ["Aimee", 2], + ["Aimee", 1] + ], "desiredGrade": 2 }, "expected": [] @@ -72,13 +88,14 @@ { "uuid": "a0c7b9b8-0e89-47f8-8b4a-c50f885e79d1", "reimplements": "c125dab7-2a53-492f-a99a-56ad511940d8", - "comments": [ - "Reimplemented to be logically consistent" - ], + "comments": ["Reimplemented to be logically consistent"], "description": "A student can only be added to the same grade in the roster once", "property": "roster", "input": { - "students": [["Aimee", 2], ["Aimee", 2]] + "students": [ + ["Aimee", 2], + ["Aimee", 2] + ] }, "expected": ["Aimee"] }, @@ -92,7 +109,12 @@ ], "property": "roster", "input": { - "students": [["Blair", 2], ["James", 2], ["James", 2], ["Paul", 2]] + "students": [ + ["Blair", 2], + ["James", 2], + ["James", 2], + ["Paul", 2] + ] }, "expected": ["Blair", "James", "Paul"] }, @@ -101,7 +123,10 @@ "description": "Adding students in multiple grades", "property": "add", "input": { - "students": [["Chelsea", 3], ["Logan", 7]] + "students": [ + ["Chelsea", 3], + ["Logan", 7] + ] }, "expected": [true, true] }, @@ -110,7 +135,10 @@ "description": "Students in multiple grades are added to the roster", "property": "roster", "input": { - "students": [["Chelsea", 3], ["Logan", 7]] + "students": [ + ["Chelsea", 3], + ["Logan", 7] + ] }, "expected": ["Chelsea", "Logan"] }, @@ -119,20 +147,26 @@ "description": "Cannot add same student to multiple grades in the roster", "property": "add", "input": { - "students": [["Blair", 2], ["James", 2], ["James", 3], ["Paul", 3]] + "students": [ + ["Blair", 2], + ["James", 2], + ["James", 3], + ["Paul", 3] + ] }, "expected": [true, true, false, true] }, { "uuid": "6a03b61e-1211-4783-a3cc-fc7f773fba3f", "reimplements": "c125dab7-2a53-492f-a99a-56ad511940d8", - "comments": [ - "Reimplemented to be logically consistent" - ], + "comments": ["Reimplemented to be logically consistent"], "description": "A student cannot be added to more than one grade in the sorted roster", "property": "roster", "input": { - "students": [["Aimee", 2], ["Aimee", 1]] + "students": [ + ["Aimee", 2], + ["Aimee", 1] + ] }, "expected": ["Aimee"] }, @@ -146,7 +180,12 @@ "description": "Student not added to multiple grades in the roster", "property": "roster", "input": { - "students": [["Blair", 2], ["James", 2], ["James", 3], ["Paul", 3]] + "students": [ + ["Blair", 2], + ["James", 2], + ["James", 3], + ["Paul", 3] + ] }, "expected": ["Blair", "James", "Paul"] }, @@ -155,7 +194,11 @@ "description": "Students are sorted by grades in the roster", "property": "roster", "input": { - "students": [["Jim", 3], ["Peter", 2], ["Anna", 1]] + "students": [ + ["Jim", 3], + ["Peter", 2], + ["Anna", 1] + ] }, "expected": ["Anna", "Peter", "Jim"] }, @@ -164,7 +207,11 @@ "description": "Students are sorted by name in the roster", "property": "roster", "input": { - "students": [["Peter", 2], ["Zoe", 2], ["Alex", 2]] + "students": [ + ["Peter", 2], + ["Zoe", 2], + ["Alex", 2] + ] }, "expected": ["Alex", "Peter", "Zoe"] }, @@ -173,7 +220,15 @@ "description": "Students are sorted by grades and then by name in the roster", "property": "roster", "input": { - "students": [["Peter", 2], ["Anna", 1], ["Barb", 1], ["Zoe", 2], ["Alex", 2], ["Jim", 3], ["Charlie", 1]] + "students": [ + ["Peter", 2], + ["Anna", 1], + ["Barb", 1], + ["Zoe", 2], + ["Alex", 2], + ["Jim", 3], + ["Charlie", 1] + ] }, "expected": ["Anna", "Barb", "Charlie", "Alex", "Peter", "Zoe", "Jim"] }, @@ -192,7 +247,12 @@ "description": "Grade is empty if no students in that grade", "property": "grade", "input": { - "students": [["Peter", 2], ["Zoe", 2], ["Alex", 2], ["Jim", 3]], + "students": [ + ["Peter", 2], + ["Zoe", 2], + ["Alex", 2], + ["Jim", 3] + ], "desiredGrade": 1 }, "expected": [] @@ -202,7 +262,12 @@ "description": "Student not added to same grade more than once", "property": "grade", "input": { - "students": [["Blair", 2], ["James", 2], ["James", 2], ["Paul", 2]], + "students": [ + ["Blair", 2], + ["James", 2], + ["James", 2], + ["Paul", 2] + ], "desiredGrade": 2 }, "expected": ["Blair", "James", "Paul"] @@ -212,7 +277,12 @@ "description": "Student not added to multiple grades", "property": "grade", "input": { - "students": [["Blair", 2], ["James", 2], ["James", 3], ["Paul", 3]], + "students": [ + ["Blair", 2], + ["James", 2], + ["James", 3], + ["Paul", 3] + ], "desiredGrade": 2 }, "expected": ["Blair", "James"] @@ -222,7 +292,12 @@ "description": "Student not added to other grade for multiple grades", "property": "grade", "input": { - "students": [["Blair", 2], ["James", 2], ["James", 3], ["Paul", 3]], + "students": [ + ["Blair", 2], + ["James", 2], + ["James", 3], + ["Paul", 3] + ], "desiredGrade": 3 }, "expected": ["Paul"] @@ -232,7 +307,11 @@ "description": "Students are sorted by name in a grade", "property": "grade", "input": { - "students": [["Franklin", 5], ["Bradley", 5], ["Jeff", 1]], + "students": [ + ["Franklin", 5], + ["Bradley", 5], + ["Jeff", 1] + ], "desiredGrade": 5 }, "expected": ["Bradley", "Franklin"] From 4c1dfb3c9ef83a6cbd65a92e1c908daabbc6f6ba Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 13:57:53 +0100 Subject: [PATCH 15/58] grains: format --- exercises/grains/canonical-data.json | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/exercises/grains/canonical-data.json b/exercises/grains/canonical-data.json index 3ed6de75a2..3eea863bd3 100644 --- a/exercises/grains/canonical-data.json +++ b/exercises/grains/canonical-data.json @@ -78,7 +78,9 @@ "input": { "square": 0 }, - "expected": {"error": "square must be between 1 and 64"} + "expected": { + "error": "square must be between 1 and 64" + } }, { "uuid": "61974483-eeb2-465e-be54-ca5dde366453", @@ -87,7 +89,9 @@ "input": { "square": -1 }, - "expected": {"error": "square must be between 1 and 64"} + "expected": { + "error": "square must be between 1 and 64" + } }, { "uuid": "a95e4374-f32c-45a7-a10d-ffec475c012f", @@ -96,7 +100,9 @@ "input": { "square": 65 }, - "expected": {"error": "square must be between 1 and 64"} + "expected": { + "error": "square must be between 1 and 64" + } } ] }, From 7a63292e944e90d9b5c09f0ba130fbc64f22783f Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:15:41 +0100 Subject: [PATCH 16/58] hamming: format --- exercises/hamming/canonical-data.json | 42 ++++++++++++++++++++------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/exercises/hamming/canonical-data.json b/exercises/hamming/canonical-data.json index c2093528ef..b0bd1ae167 100644 --- a/exercises/hamming/canonical-data.json +++ b/exercises/hamming/canonical-data.json @@ -1,5 +1,5 @@ { -"exercise": "hamming", + "exercise": "hamming", "comments": [ "Language implementations vary on the issue of unequal length strands.", "A language may elect to simplify this task by only presenting equal", @@ -68,7 +68,9 @@ "strand1": "AATG", "strand2": "AAA" }, - "expected": {"error": "left and right strands must be of equal length"} + "expected": { + "error": "left and right strands must be of equal length" + } }, { "uuid": "b9228bb1-465f-4141-b40f-1f99812de5a8", @@ -80,7 +82,9 @@ "strand1": "AATG", "strand2": "AAA" }, - "expected": {"error": "strands must be of equal length"} + "expected": { + "error": "strands must be of equal length" + } }, { "uuid": "8a2d4ed0-ead5-4fdd-924d-27c4cf56e60e", @@ -90,7 +94,9 @@ "strand1": "ATA", "strand2": "AGTG" }, - "expected": {"error": "left and right strands must be of equal length"} + "expected": { + "error": "left and right strands must be of equal length" + } }, { "uuid": "dab38838-26bb-4fff-acbe-3b0a9bfeba2d", @@ -102,7 +108,9 @@ "strand1": "ATA", "strand2": "AGTG" }, - "expected": {"error": "strands must be of equal length"} + "expected": { + "error": "strands must be of equal length" + } }, { "uuid": "5dce058b-28d4-4ca7-aa64-adfe4e17784c", @@ -112,7 +120,9 @@ "strand1": "", "strand2": "G" }, - "expected": {"error": "left strand must not be empty"} + "expected": { + "error": "left strand must not be empty" + } }, { "uuid": "db92e77e-7c72-499d-8fe6-9354d2bfd504", @@ -124,7 +134,9 @@ "strand1": "", "strand2": "G" }, - "expected": {"error": "left and right strands must be of equal length"} + "expected": { + "error": "left and right strands must be of equal length" + } }, { "uuid": "b764d47c-83ff-4de2-ab10-6cfe4b15c0f3", @@ -136,7 +148,9 @@ "strand1": "", "strand2": "G" }, - "expected": {"error": "strands must be of equal length"} + "expected": { + "error": "strands must be of equal length" + } }, { "uuid": "38826d4b-16fb-4639-ac3e-ba027dec8b5f", @@ -146,7 +160,9 @@ "strand1": "G", "strand2": "" }, - "expected": {"error": "right strand must not be empty"} + "expected": { + "error": "right strand must not be empty" + } }, { "uuid": "920cd6e3-18f4-4143-b6b8-74270bb8f8a3", @@ -158,7 +174,9 @@ "strand1": "G", "strand2": "" }, - "expected": {"error": "left and right strands must be of equal length"} + "expected": { + "error": "left and right strands must be of equal length" + } }, { "uuid": "9ab9262f-3521-4191-81f5-0ed184a5aa89", @@ -170,7 +188,9 @@ "strand1": "G", "strand2": "" }, - "expected": {"error": "strands must be of equal length"} + "expected": { + "error": "strands must be of equal length" + } } ] } From b2431e6ddfd32159c49c7c967d4931e27fdcea30 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:15:54 +0100 Subject: [PATCH 17/58] high-scores: format --- exercises/high-scores/canonical-data.json | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/exercises/high-scores/canonical-data.json b/exercises/high-scores/canonical-data.json index 6be6033ebd..3a72593e66 100644 --- a/exercises/high-scores/canonical-data.json +++ b/exercises/high-scores/canonical-data.json @@ -92,9 +92,7 @@ "scores": [70, 50, 20, 30] }, "expected": 30, - "scenarios": [ - "immutable" - ] + "scenarios": ["immutable"] }, { "uuid": "809c4058-7eb1-4206-b01e-79238b9b71bc", @@ -104,9 +102,7 @@ "scores": [30, 50, 20, 70] }, "expected": [30, 50, 20, 70], - "scenarios": [ - "immutable" - ] + "scenarios": ["immutable"] } ] } From 37ddc8c5f61f7b2fc255440e9f3534d2a527b4e6 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:16:11 +0100 Subject: [PATCH 18/58] isbn-verifier: format --- exercises/isbn-verifier/canonical-data.json | 340 ++++++++++---------- 1 file changed, 170 insertions(+), 170 deletions(-) diff --git a/exercises/isbn-verifier/canonical-data.json b/exercises/isbn-verifier/canonical-data.json index 80982344ad..af8929eb48 100644 --- a/exercises/isbn-verifier/canonical-data.json +++ b/exercises/isbn-verifier/canonical-data.json @@ -1,172 +1,172 @@ { - "exercise": "isbn-verifier", - "comments": [ - "An expected value of true indicates a valid ISBN-10, ", - "whereas false means the ISBN-10 is invalid." - ], - "cases": [ - { - "uuid": "0caa3eac-d2e3-4c29-8df8-b188bc8c9292", - "description": "valid isbn", - "property": "isValid", - "input": { - "isbn": "3-598-21508-8" - }, - "expected": true - }, - { - "uuid": "19f76b53-7c24-45f8-87b8-4604d0ccd248", - "description": "invalid isbn check digit", - "property": "isValid", - "input": { - "isbn": "3-598-21508-9" - }, - "expected": false - }, - { - "uuid": "4164bfee-fb0a-4a1c-9f70-64c6a1903dcd", - "description": "valid isbn with a check digit of 10", - "property": "isValid", - "input": { - "isbn": "3-598-21507-X" - }, - "expected": true - }, - { - "uuid": "3ed50db1-8982-4423-a993-93174a20825c", - "description": "check digit is a character other than X", - "property": "isValid", - "input": { - "isbn": "3-598-21507-A" - }, - "expected": false - }, - { - "uuid": "c19ba0c4-014f-4dc3-a63f-ff9aefc9b5ec", - "description": "invalid character in isbn is not treated as zero", - "property": "isValid", - "input": { - "isbn": "3-598-P1581-X" - }, - "expected": false - }, - { - "uuid": "28025280-2c39-4092-9719-f3234b89c627", - "description": "X is only valid as a check digit", - "property": "isValid", - "input": { - "isbn": "3-598-2X507-9" - }, - "expected": false - }, - { - "uuid": "f6294e61-7e79-46b3-977b-f48789a4945b", - "description": "valid isbn without separating dashes", - "property": "isValid", - "input": { - "isbn": "3598215088" - }, - "expected": true - }, - { - "uuid": "185ab99b-3a1b-45f3-aeec-b80d80b07f0b", - "description": "isbn without separating dashes and X as check digit", - "property": "isValid", - "input": { - "isbn": "359821507X" - }, - "expected": true - }, - { - "uuid": "7725a837-ec8e-4528-a92a-d981dd8cf3e2", - "description": "isbn without check digit and dashes", - "property": "isValid", - "input": { - "isbn": "359821507" - }, - "expected": false - }, - { - "uuid": "47e4dfba-9c20-46ed-9958-4d3190630bdf", - "description": "too long isbn and no dashes", - "property": "isValid", - "input": { - "isbn": "3598215078X" - }, - "expected": false - }, - { - "uuid": "737f4e91-cbba-4175-95bf-ae630b41fb60", - "description": "too short isbn", - "property": "isValid", - "input": { - "isbn": "00" - }, - "expected": false - }, - { - "uuid": "5458a128-a9b6-4ff8-8afb-674e74567cef", - "description": "isbn without check digit", - "property": "isValid", - "input": { - "isbn": "3-598-21507" - }, - "expected": false - }, - { - "uuid": "70b6ad83-d0a2-4ca7-a4d5-a9ab731800f7", - "description": "check digit of X should not be used for 0", - "property": "isValid", - "input": { - "isbn": "3-598-21515-X" - }, - "expected": false - }, - { - "uuid": "94610459-55ab-4c35-9b93-ff6ea1a8e562", - "description": "empty isbn", - "property": "isValid", - "input": { - "isbn": "" - }, - "expected": false - }, - { - "uuid": "7bff28d4-d770-48cc-80d6-b20b3a0fb46c", - "description": "input is 9 characters", - "property": "isValid", - "input": { - "isbn": "134456729" - }, - "expected": false - }, - { - "uuid": "ed6e8d1b-382c-4081-8326-8b772c581fec", - "description": "invalid characters are not ignored after checking length", - "property": "isValid", - "input": { - "isbn": "3132P34035" - }, - "expected": false - }, - { - "uuid": "daad3e58-ce00-4395-8a8e-e3eded1cdc86", - "description": "invalid characters are not ignored before checking length", - "comments": ["Catch invalid characters in an otherwise valid isbn"], - "property": "isValid", - "input": { - "isbn": "3598P215088" - }, - "expected": false - }, - { - "uuid": "fb5e48d8-7c03-4bfb-a088-b101df16fdc3", - "description": "input is too long but contains a valid isbn", - "property": "isValid", - "input": { - "isbn": "98245726788" - }, - "expected": false - } - ] + "exercise": "isbn-verifier", + "comments": [ + "An expected value of true indicates a valid ISBN-10, ", + "whereas false means the ISBN-10 is invalid." + ], + "cases": [ + { + "uuid": "0caa3eac-d2e3-4c29-8df8-b188bc8c9292", + "description": "valid isbn", + "property": "isValid", + "input": { + "isbn": "3-598-21508-8" + }, + "expected": true + }, + { + "uuid": "19f76b53-7c24-45f8-87b8-4604d0ccd248", + "description": "invalid isbn check digit", + "property": "isValid", + "input": { + "isbn": "3-598-21508-9" + }, + "expected": false + }, + { + "uuid": "4164bfee-fb0a-4a1c-9f70-64c6a1903dcd", + "description": "valid isbn with a check digit of 10", + "property": "isValid", + "input": { + "isbn": "3-598-21507-X" + }, + "expected": true + }, + { + "uuid": "3ed50db1-8982-4423-a993-93174a20825c", + "description": "check digit is a character other than X", + "property": "isValid", + "input": { + "isbn": "3-598-21507-A" + }, + "expected": false + }, + { + "uuid": "c19ba0c4-014f-4dc3-a63f-ff9aefc9b5ec", + "description": "invalid character in isbn is not treated as zero", + "property": "isValid", + "input": { + "isbn": "3-598-P1581-X" + }, + "expected": false + }, + { + "uuid": "28025280-2c39-4092-9719-f3234b89c627", + "description": "X is only valid as a check digit", + "property": "isValid", + "input": { + "isbn": "3-598-2X507-9" + }, + "expected": false + }, + { + "uuid": "f6294e61-7e79-46b3-977b-f48789a4945b", + "description": "valid isbn without separating dashes", + "property": "isValid", + "input": { + "isbn": "3598215088" + }, + "expected": true + }, + { + "uuid": "185ab99b-3a1b-45f3-aeec-b80d80b07f0b", + "description": "isbn without separating dashes and X as check digit", + "property": "isValid", + "input": { + "isbn": "359821507X" + }, + "expected": true + }, + { + "uuid": "7725a837-ec8e-4528-a92a-d981dd8cf3e2", + "description": "isbn without check digit and dashes", + "property": "isValid", + "input": { + "isbn": "359821507" + }, + "expected": false + }, + { + "uuid": "47e4dfba-9c20-46ed-9958-4d3190630bdf", + "description": "too long isbn and no dashes", + "property": "isValid", + "input": { + "isbn": "3598215078X" + }, + "expected": false + }, + { + "uuid": "737f4e91-cbba-4175-95bf-ae630b41fb60", + "description": "too short isbn", + "property": "isValid", + "input": { + "isbn": "00" + }, + "expected": false + }, + { + "uuid": "5458a128-a9b6-4ff8-8afb-674e74567cef", + "description": "isbn without check digit", + "property": "isValid", + "input": { + "isbn": "3-598-21507" + }, + "expected": false + }, + { + "uuid": "70b6ad83-d0a2-4ca7-a4d5-a9ab731800f7", + "description": "check digit of X should not be used for 0", + "property": "isValid", + "input": { + "isbn": "3-598-21515-X" + }, + "expected": false + }, + { + "uuid": "94610459-55ab-4c35-9b93-ff6ea1a8e562", + "description": "empty isbn", + "property": "isValid", + "input": { + "isbn": "" + }, + "expected": false + }, + { + "uuid": "7bff28d4-d770-48cc-80d6-b20b3a0fb46c", + "description": "input is 9 characters", + "property": "isValid", + "input": { + "isbn": "134456729" + }, + "expected": false + }, + { + "uuid": "ed6e8d1b-382c-4081-8326-8b772c581fec", + "description": "invalid characters are not ignored after checking length", + "property": "isValid", + "input": { + "isbn": "3132P34035" + }, + "expected": false + }, + { + "uuid": "daad3e58-ce00-4395-8a8e-e3eded1cdc86", + "description": "invalid characters are not ignored before checking length", + "comments": ["Catch invalid characters in an otherwise valid isbn"], + "property": "isValid", + "input": { + "isbn": "3598P215088" + }, + "expected": false + }, + { + "uuid": "fb5e48d8-7c03-4bfb-a088-b101df16fdc3", + "description": "input is too long but contains a valid isbn", + "property": "isValid", + "input": { + "isbn": "98245726788" + }, + "expected": false + } + ] } From 4e20fd5cb0d342d8a1b9873230e2971b175cbb95 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:16:37 +0100 Subject: [PATCH 19/58] isogram: format --- exercises/isogram/canonical-data.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exercises/isogram/canonical-data.json b/exercises/isogram/canonical-data.json index ff2d7dd60a..de5d4913c6 100644 --- a/exercises/isogram/canonical-data.json +++ b/exercises/isogram/canonical-data.json @@ -124,7 +124,9 @@ { "uuid": "0d0b8644-0a1e-4a31-a432-2b3ee270d847", "description": "word with duplicated character and with two hyphens", - "comments": ["This test aims to catch buggy implementations that check for duplicate spaces or hyphens."], + "comments": [ + "This test aims to catch buggy implementations that check for duplicate spaces or hyphens." + ], "property": "isIsogram", "input": { "phrase": "up-to-date" From cca24e4506870b87a39fd196fda85f5dfaa4e16d Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:17:31 +0100 Subject: [PATCH 20/58] largest-series-product: format --- .../canonical-data.json | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/exercises/largest-series-product/canonical-data.json b/exercises/largest-series-product/canonical-data.json index b00b59fb54..66fa73895f 100644 --- a/exercises/largest-series-product/canonical-data.json +++ b/exercises/largest-series-product/canonical-data.json @@ -109,7 +109,9 @@ "digits": "123", "span": 4 }, - "expected": {"error": "span must be smaller than string length"} + "expected": { + "error": "span must be smaller than string length" + } }, { "comments": [ @@ -157,7 +159,9 @@ "digits": "", "span": 1 }, - "expected": {"error": "span must be smaller than string length"} + "expected": { + "error": "span must be smaller than string length" + } }, { "uuid": "7a38f2d6-3c35-45f6-8d6f-12e6e32d4d74", @@ -167,7 +171,9 @@ "digits": "1234a5", "span": 2 }, - "expected": {"error": "digits input must only contain digits"} + "expected": { + "error": "digits input must only contain digits" + } }, { "uuid": "5fe3c0e5-a945-49f2-b584-f0814b4dd1ef", @@ -177,7 +183,9 @@ "digits": "12345", "span": -1 }, - "expected": {"error": "span must be greater than zero"} + "expected": { + "error": "span must be greater than zero" + } }, { "uuid": "c859f34a-9bfe-4897-9c2f-6d7f8598e7f0", @@ -189,7 +197,9 @@ "digits": "12345", "span": -1 }, - "expected": {"error": "span must not be negative"} + "expected": { + "error": "span must not be negative" + } } ] } From 8c3ab85a5e88c236550ce5736be550e086d1ef06 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:17:49 +0100 Subject: [PATCH 21/58] luhn: format --- exercises/luhn/canonical-data.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/luhn/canonical-data.json b/exercises/luhn/canonical-data.json index aa440986dd..06d869c1fc 100644 --- a/exercises/luhn/canonical-data.json +++ b/exercises/luhn/canonical-data.json @@ -150,7 +150,7 @@ "description": "very long input is valid", "comments": [ "Designed to prevent converting input to a single number as this approach can risk an overflow" - ], + ], "property": "valid", "input": { "value": "9999999999 9999999999 9999999999 9999999999" From ed4fdd28b8532e3950f4238a435cd971c8cc9c7f Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:18:11 +0100 Subject: [PATCH 22/58] markdown: format --- exercises/markdown/canonical-data.json | 106 ++++++++++++------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/exercises/markdown/canonical-data.json b/exercises/markdown/canonical-data.json index 1af3fdc0fb..3143d00d0a 100644 --- a/exercises/markdown/canonical-data.json +++ b/exercises/markdown/canonical-data.json @@ -59,59 +59,59 @@ "expected": "

This will be an h2

" }, { - "uuid": "9df3f500-0622-4696-81a7-d5babd9b5f49", - "description": "with h3 header level", - "property": "parse", - "input": { - "markdown": "### This will be an h3" - }, - "expected": "

This will be an h3

" - }, - { - "uuid": "50862777-a5e8-42e9-a3b8-4ba6fcd0ed03", - "description": "with h4 header level", - "property": "parse", - "input": { - "markdown": "#### This will be an h4" - }, - "expected": "

This will be an h4

" - }, - { - "uuid": "ee1c23ac-4c86-4f2a-8b9c-403548d4ab82", - "description": "with h5 header level", - "property": "parse", - "input": { - "markdown": "##### This will be an h5" - }, - "expected": "
This will be an h5
" - }, - { - "uuid": "13b5f410-33f5-44f0-a6a7-cfd4ab74b5d5", - "description": "with h6 header level", - "property": "parse", - "input": { - "markdown": "###### This will be an h6" - }, - "expected": "
This will be an h6
" - }, - { - "uuid": "6dca5d10-5c22-4e2a-ac2b-bd6f21e61939", - "description": "with h7 header level", - "property": "parse", - "input": { - "markdown": "####### This will not be an h7" - }, - "expected": "####### This will not be an h7" - }, - { - "uuid": "81c0c4db-435e-4d77-860d-45afacdad810", - "reimplements": "6dca5d10-5c22-4e2a-ac2b-bd6f21e61939", - "description": "h7 header level is a paragraph", - "property": "parse", - "input": { - "markdown": "####### This will not be an h7" - }, - "expected": "

####### This will not be an h7

" + "uuid": "9df3f500-0622-4696-81a7-d5babd9b5f49", + "description": "with h3 header level", + "property": "parse", + "input": { + "markdown": "### This will be an h3" + }, + "expected": "

This will be an h3

" + }, + { + "uuid": "50862777-a5e8-42e9-a3b8-4ba6fcd0ed03", + "description": "with h4 header level", + "property": "parse", + "input": { + "markdown": "#### This will be an h4" + }, + "expected": "

This will be an h4

" + }, + { + "uuid": "ee1c23ac-4c86-4f2a-8b9c-403548d4ab82", + "description": "with h5 header level", + "property": "parse", + "input": { + "markdown": "##### This will be an h5" + }, + "expected": "
This will be an h5
" + }, + { + "uuid": "13b5f410-33f5-44f0-a6a7-cfd4ab74b5d5", + "description": "with h6 header level", + "property": "parse", + "input": { + "markdown": "###### This will be an h6" + }, + "expected": "
This will be an h6
" + }, + { + "uuid": "6dca5d10-5c22-4e2a-ac2b-bd6f21e61939", + "description": "with h7 header level", + "property": "parse", + "input": { + "markdown": "####### This will not be an h7" + }, + "expected": "####### This will not be an h7" + }, + { + "uuid": "81c0c4db-435e-4d77-860d-45afacdad810", + "reimplements": "6dca5d10-5c22-4e2a-ac2b-bd6f21e61939", + "description": "h7 header level is a paragraph", + "property": "parse", + "input": { + "markdown": "####### This will not be an h7" + }, + "expected": "

####### This will not be an h7

" }, { "uuid": "25288a2b-8edc-45db-84cf-0b6c6ee034d6", From 5f9392552b4c857544dc2b8c0520eda85c3c778f Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:18:48 +0100 Subject: [PATCH 23/58] palindrome-products: format --- .../palindrome-products/canonical-data.json | 333 +++++++++--------- 1 file changed, 160 insertions(+), 173 deletions(-) diff --git a/exercises/palindrome-products/canonical-data.json b/exercises/palindrome-products/canonical-data.json index 054624728d..1ca82c513c 100644 --- a/exercises/palindrome-products/canonical-data.json +++ b/exercises/palindrome-products/canonical-data.json @@ -1,175 +1,162 @@ { - "exercise": "palindrome-products", - "cases": [{ - "uuid": "5cff78fe-cf02-459d-85c2-ce584679f887", - "description": "finds the smallest palindrome from single digit factors", - "property": "smallest", - "input": { - "min": 1, - "max": 9 - }, - "expected": { - "value": 1, - "factors": [ - [1, 1] - ] - } - }, - { - "uuid": "0853f82c-5fc4-44ae-be38-fadb2cced92d", - "description": "finds the largest palindrome from single digit factors", - "property": "largest", - "input": { - "min": 1, - "max": 9 - }, - "expected": { - "value": 9, - "factors": [ - [1, 9], - [3, 3] - ] - } - }, - { - "uuid": "66c3b496-bdec-4103-9129-3fcb5a9063e1", - "description": "find the smallest palindrome from double digit factors", - "property": "smallest", - "input": { - "min": 10, - "max": 99 - }, - "expected": { - "value": 121, - "factors": [ - [11, 11] - ] - } - }, - { - "uuid": "a10682ae-530a-4e56-b89d-69664feafe53", - "description": "find the largest palindrome from double digit factors", - "property": "largest", - "input": { - "min": 10, - "max": 99 - }, - "expected": { - "value": 9009, - "factors": [ - [91, 99] - ] - } - }, - { - "uuid": "cecb5a35-46d1-4666-9719-fa2c3af7499d", - "description": "find smallest palindrome from triple digit factors", - "property": "smallest", - "input": { - "min": 100, - "max": 999 - }, - "expected": { - "value": 10201, - "factors": [ - [101, 101] - ] - } - }, - { - "uuid": "edab43e1-c35f-4ea3-8c55-2f31dddd92e5", - "description": "find the largest palindrome from triple digit factors", - "property": "largest", - "input": { - "min": 100, - "max": 999 - }, - "expected": { - "value": 906609, - "factors": [ - [913, 993] - ] - } - }, - { - "uuid": "4f802b5a-9d74-4026-a70f-b53ff9234e4e", - "description": "find smallest palindrome from four digit factors", - "property": "smallest", - "input": { - "min": 1000, - "max": 9999 - }, - "expected": { - "value": 1002001, - "factors": [ - [1001, 1001] - ] - } - }, - { - "uuid": "787525e0-a5f9-40f3-8cb2-23b52cf5d0be", - "description": "find the largest palindrome from four digit factors", - "property": "largest", - "input": { - "min": 1000, - "max": 9999 - }, - "expected": { - "value": 99000099, - "factors": [ - [9901, 9999] - ] - } - }, - { - "uuid": "58fb1d63-fddb-4409-ab84-a7a8e58d9ea0", - "description": "empty result for smallest if no palindrome in the range", - "property": "smallest", - "input": { - "min": 1002, - "max": 1003 - }, - "expected": { - "value": null, - "factors": [] - } - }, - { - "uuid": "9de9e9da-f1d9-49a5-8bfc-3d322efbdd02", - "description": "empty result for largest if no palindrome in the range", - "property": "largest", - "input": { - "min": 15, - "max": 15 - }, - "expected": { - "value": null, - "factors": [] - } - }, - { - "uuid": "12e73aac-d7ee-4877-b8aa-2aa3dcdb9f8a", - "description": "error result for smallest if min is more than max", - "property": "smallest", - "input": { - "min": 10000, - "max": 1 - }, - "expected": { - "error": "min must be <= max" - } - }, - { - "uuid": "eeeb5bff-3f47-4b1e-892f-05829277bd74", - "description": "error result for largest if min is more than max", - "property": "largest", - "input": { - "min": 2, - "max": 1 - }, - "expected": { - "error": "min must be <= max" - } - } - ] + "exercise": "palindrome-products", + "cases": [ + { + "uuid": "5cff78fe-cf02-459d-85c2-ce584679f887", + "description": "finds the smallest palindrome from single digit factors", + "property": "smallest", + "input": { + "min": 1, + "max": 9 + }, + "expected": { + "value": 1, + "factors": [[1, 1]] + } + }, + { + "uuid": "0853f82c-5fc4-44ae-be38-fadb2cced92d", + "description": "finds the largest palindrome from single digit factors", + "property": "largest", + "input": { + "min": 1, + "max": 9 + }, + "expected": { + "value": 9, + "factors": [ + [1, 9], + [3, 3] + ] + } + }, + { + "uuid": "66c3b496-bdec-4103-9129-3fcb5a9063e1", + "description": "find the smallest palindrome from double digit factors", + "property": "smallest", + "input": { + "min": 10, + "max": 99 + }, + "expected": { + "value": 121, + "factors": [[11, 11]] + } + }, + { + "uuid": "a10682ae-530a-4e56-b89d-69664feafe53", + "description": "find the largest palindrome from double digit factors", + "property": "largest", + "input": { + "min": 10, + "max": 99 + }, + "expected": { + "value": 9009, + "factors": [[91, 99]] + } + }, + { + "uuid": "cecb5a35-46d1-4666-9719-fa2c3af7499d", + "description": "find smallest palindrome from triple digit factors", + "property": "smallest", + "input": { + "min": 100, + "max": 999 + }, + "expected": { + "value": 10201, + "factors": [[101, 101]] + } + }, + { + "uuid": "edab43e1-c35f-4ea3-8c55-2f31dddd92e5", + "description": "find the largest palindrome from triple digit factors", + "property": "largest", + "input": { + "min": 100, + "max": 999 + }, + "expected": { + "value": 906609, + "factors": [[913, 993]] + } + }, + { + "uuid": "4f802b5a-9d74-4026-a70f-b53ff9234e4e", + "description": "find smallest palindrome from four digit factors", + "property": "smallest", + "input": { + "min": 1000, + "max": 9999 + }, + "expected": { + "value": 1002001, + "factors": [[1001, 1001]] + } + }, + { + "uuid": "787525e0-a5f9-40f3-8cb2-23b52cf5d0be", + "description": "find the largest palindrome from four digit factors", + "property": "largest", + "input": { + "min": 1000, + "max": 9999 + }, + "expected": { + "value": 99000099, + "factors": [[9901, 9999]] + } + }, + { + "uuid": "58fb1d63-fddb-4409-ab84-a7a8e58d9ea0", + "description": "empty result for smallest if no palindrome in the range", + "property": "smallest", + "input": { + "min": 1002, + "max": 1003 + }, + "expected": { + "value": null, + "factors": [] + } + }, + { + "uuid": "9de9e9da-f1d9-49a5-8bfc-3d322efbdd02", + "description": "empty result for largest if no palindrome in the range", + "property": "largest", + "input": { + "min": 15, + "max": 15 + }, + "expected": { + "value": null, + "factors": [] + } + }, + { + "uuid": "12e73aac-d7ee-4877-b8aa-2aa3dcdb9f8a", + "description": "error result for smallest if min is more than max", + "property": "smallest", + "input": { + "min": 10000, + "max": 1 + }, + "expected": { + "error": "min must be <= max" + } + }, + { + "uuid": "eeeb5bff-3f47-4b1e-892f-05829277bd74", + "description": "error result for largest if min is more than max", + "property": "largest", + "input": { + "min": 2, + "max": 1 + }, + "expected": { + "error": "min must be <= max" + } + } + ] } From 53597c5acce4130fa80732e81bce47dd93dff385 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:19:19 +0100 Subject: [PATCH 24/58] perfect-numbers: format --- exercises/perfect-numbers/canonical-data.json | 272 +++++++++--------- 1 file changed, 136 insertions(+), 136 deletions(-) diff --git a/exercises/perfect-numbers/canonical-data.json b/exercises/perfect-numbers/canonical-data.json index 1c462006aa..92dbc0aaee 100644 --- a/exercises/perfect-numbers/canonical-data.json +++ b/exercises/perfect-numbers/canonical-data.json @@ -1,146 +1,146 @@ { - "exercise": "perfect-numbers", - "cases": [ + "exercise": "perfect-numbers", + "cases": [ + { + "description": "Perfect numbers", + "cases": [ { - "description": "Perfect numbers", - "cases": [ - { - "uuid": "163e8e86-7bfd-4ee2-bd68-d083dc3381a3", - "description": "Smallest perfect number is classified correctly", - "property": "classify", - "input": { - "number": 6 - }, - "expected": "perfect" - }, - { - "uuid": "169a7854-0431-4ae0-9815-c3b6d967436d", - "description": "Medium perfect number is classified correctly", - "property": "classify", - "input": { - "number": 28 - }, - "expected": "perfect" - }, - { - "uuid": "ee3627c4-7b36-4245-ba7c-8727d585f402", - "description": "Large perfect number is classified correctly", - "property": "classify", - "input": { - "number": 33550336 - }, - "expected": "perfect" - } - ] + "uuid": "163e8e86-7bfd-4ee2-bd68-d083dc3381a3", + "description": "Smallest perfect number is classified correctly", + "property": "classify", + "input": { + "number": 6 + }, + "expected": "perfect" }, { - "description": "Abundant numbers", - "cases": [ - { - "uuid": "80ef7cf8-9ea8-49b9-8b2d-d9cb3db3ed7e", - "description": "Smallest abundant number is classified correctly", - "property": "classify", - "input": { - "number": 12 - }, - "expected": "abundant" - }, - { - "uuid": "3e300e0d-1a12-4f11-8c48-d1027165ab60", - "description": "Medium abundant number is classified correctly", - "property": "classify", - "input": { - "number": 30 - }, - "expected": "abundant" - }, - { - "uuid": "ec7792e6-8786-449c-b005-ce6dd89a772b", - "description": "Large abundant number is classified correctly", - "property": "classify", - "input": { - "number": 33550335 - }, - "expected": "abundant" - } - ] + "uuid": "169a7854-0431-4ae0-9815-c3b6d967436d", + "description": "Medium perfect number is classified correctly", + "property": "classify", + "input": { + "number": 28 + }, + "expected": "perfect" }, { - "description": "Deficient numbers", - "cases": [ - { - "uuid": "e610fdc7-2b6e-43c3-a51c-b70fb37413ba", - "description": "Smallest prime deficient number is classified correctly", - "property": "classify", - "input": { - "number": 2 - }, - "expected": "deficient" - }, - { - "uuid": "0beb7f66-753a-443f-8075-ad7fbd9018f3", - "description": "Smallest non-prime deficient number is classified correctly", - "property": "classify", - "input": { - "number": 4 - }, - "expected": "deficient" - }, - { - "uuid": "1c802e45-b4c6-4962-93d7-1cad245821ef", - "description": "Medium deficient number is classified correctly", - "property": "classify", - "input": { - "number": 32 - }, - "expected": "deficient" - }, - { - "uuid": "47dd569f-9e5a-4a11-9a47-a4e91c8c28aa", - "description": "Large deficient number is classified correctly", - "property": "classify", - "input": { - "number": 33550337 - }, - "expected": "deficient" - }, - { - "uuid": "a696dec8-6147-4d68-afad-d38de5476a56", - "description": "Edge case (no factors other than itself) is classified correctly", - "property": "classify", - "input": { - "number": 1 - }, - "expected": "deficient" - } - ] + "uuid": "ee3627c4-7b36-4245-ba7c-8727d585f402", + "description": "Large perfect number is classified correctly", + "property": "classify", + "input": { + "number": 33550336 + }, + "expected": "perfect" + } + ] + }, + { + "description": "Abundant numbers", + "cases": [ + { + "uuid": "80ef7cf8-9ea8-49b9-8b2d-d9cb3db3ed7e", + "description": "Smallest abundant number is classified correctly", + "property": "classify", + "input": { + "number": 12 + }, + "expected": "abundant" + }, + { + "uuid": "3e300e0d-1a12-4f11-8c48-d1027165ab60", + "description": "Medium abundant number is classified correctly", + "property": "classify", + "input": { + "number": 30 + }, + "expected": "abundant" + }, + { + "uuid": "ec7792e6-8786-449c-b005-ce6dd89a772b", + "description": "Large abundant number is classified correctly", + "property": "classify", + "input": { + "number": 33550335 + }, + "expected": "abundant" + } + ] + }, + { + "description": "Deficient numbers", + "cases": [ + { + "uuid": "e610fdc7-2b6e-43c3-a51c-b70fb37413ba", + "description": "Smallest prime deficient number is classified correctly", + "property": "classify", + "input": { + "number": 2 + }, + "expected": "deficient" + }, + { + "uuid": "0beb7f66-753a-443f-8075-ad7fbd9018f3", + "description": "Smallest non-prime deficient number is classified correctly", + "property": "classify", + "input": { + "number": 4 + }, + "expected": "deficient" + }, + { + "uuid": "1c802e45-b4c6-4962-93d7-1cad245821ef", + "description": "Medium deficient number is classified correctly", + "property": "classify", + "input": { + "number": 32 + }, + "expected": "deficient" + }, + { + "uuid": "47dd569f-9e5a-4a11-9a47-a4e91c8c28aa", + "description": "Large deficient number is classified correctly", + "property": "classify", + "input": { + "number": 33550337 + }, + "expected": "deficient" + }, + { + "uuid": "a696dec8-6147-4d68-afad-d38de5476a56", + "description": "Edge case (no factors other than itself) is classified correctly", + "property": "classify", + "input": { + "number": 1 + }, + "expected": "deficient" + } + ] + }, + { + "description": "Invalid inputs", + "cases": [ + { + "uuid": "72445cee-660c-4d75-8506-6c40089dc302", + "description": "Zero is rejected (as it is not a positive integer)", + "property": "classify", + "input": { + "number": 0 + }, + "expected": { + "error": "Classification is only possible for positive integers." + } }, { - "description": "Invalid inputs", - "cases": [ - { - "uuid": "72445cee-660c-4d75-8506-6c40089dc302", - "description": "Zero is rejected (as it is not a positive integer)", - "property": "classify", - "input": { - "number": 0 - }, - "expected": { - "error": "Classification is only possible for positive integers." - } - }, - { - "uuid": "2d72ce2c-6802-49ac-8ece-c790ba3dae13", - "description": "Negative integer is rejected (as it is not a positive integer)", - "property": "classify", - "input": { - "number": -1 - }, - "expected": { - "error": "Classification is only possible for positive integers." - } - } - ] + "uuid": "2d72ce2c-6802-49ac-8ece-c790ba3dae13", + "description": "Negative integer is rejected (as it is not a positive integer)", + "property": "classify", + "input": { + "number": -1 + }, + "expected": { + "error": "Classification is only possible for positive integers." + } } - ] + ] + } + ] } From 38bf8f4dbe952848d673bf2be142401d9052d138 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:19:47 +0100 Subject: [PATCH 25/58] phone-number: format --- exercises/phone-number/canonical-data.json | 58 ++++++++++++++++------ 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/exercises/phone-number/canonical-data.json b/exercises/phone-number/canonical-data.json index 3d0a967dde..cae77a12ab 100644 --- a/exercises/phone-number/canonical-data.json +++ b/exercises/phone-number/canonical-data.json @@ -1,9 +1,9 @@ { "exercise": "phone-number", "comments": [ - " Returns the cleaned phone number if given number is valid, " - , " else returns error object. Note that number is not formatted," - , " just a 10-digit number is returned. " + " Returns the cleaned phone number if given number is valid, ", + " else returns error object. Note that number is not formatted,", + " just a 10-digit number is returned. " ], "cases": [ { @@ -40,7 +40,9 @@ "input": { "phrase": "123456789" }, - "expected": {"error": "incorrect number of digits"} + "expected": { + "error": "incorrect number of digits" + } }, { "uuid": "57061c72-07b5-431f-9766-d97da7c4399d", @@ -49,7 +51,9 @@ "input": { "phrase": "22234567890" }, - "expected": {"error": "11 digits must start with 1"} + "expected": { + "error": "11 digits must start with 1" + } }, { "uuid": "9962cbf3-97bb-4118-ba9b-38ff49c64430", @@ -76,7 +80,9 @@ "input": { "phrase": "321234567890" }, - "expected": {"error": "more than 11 digits"} + "expected": { + "error": "more than 11 digits" + } }, { "uuid": "63f38f37-53f6-4a5f-bd86-e9b404f10a60", @@ -85,7 +91,9 @@ "input": { "phrase": "123-abc-7890" }, - "expected": {"error": "letters not permitted"} + "expected": { + "error": "letters not permitted" + } }, { "uuid": "4bd97d90-52fd-45d3-b0db-06ab95b1244e", @@ -94,7 +102,9 @@ "input": { "phrase": "123-@:!-7890" }, - "expected": {"error": "punctuations not permitted"} + "expected": { + "error": "punctuations not permitted" + } }, { "uuid": "d77d07f8-873c-4b17-8978-5f66139bf7d7", @@ -103,7 +113,9 @@ "input": { "phrase": "(023) 456-7890" }, - "expected": {"error": "area code cannot start with zero"} + "expected": { + "error": "area code cannot start with zero" + } }, { "uuid": "c7485cfb-1e7b-4081-8e96-8cdb3b77f15e", @@ -112,7 +124,9 @@ "input": { "phrase": "(123) 456-7890" }, - "expected": {"error": "area code cannot start with one"} + "expected": { + "error": "area code cannot start with one" + } }, { "uuid": "4d622293-6976-413d-b8bf-dd8a94d4e2ac", @@ -121,7 +135,9 @@ "input": { "phrase": "(223) 056-7890" }, - "expected": {"error": "exchange code cannot start with zero"} + "expected": { + "error": "exchange code cannot start with zero" + } }, { "uuid": "4cef57b4-7d8e-43aa-8328-1e1b89001262", @@ -130,7 +146,9 @@ "input": { "phrase": "(223) 156-7890" }, - "expected": {"error": "exchange code cannot start with one"} + "expected": { + "error": "exchange code cannot start with one" + } }, { "uuid": "9925b09c-1a0d-4960-a197-5d163cbe308c", @@ -139,7 +157,9 @@ "input": { "phrase": "1 (023) 456-7890" }, - "expected": {"error": "area code cannot start with zero"} + "expected": { + "error": "area code cannot start with zero" + } }, { "uuid": "3f809d37-40f3-44b5-ad90-535838b1a816", @@ -148,7 +168,9 @@ "input": { "phrase": "1 (123) 456-7890" }, - "expected": {"error": "area code cannot start with one"} + "expected": { + "error": "area code cannot start with one" + } }, { "uuid": "e08e5532-d621-40d4-b0cc-96c159276b65", @@ -157,7 +179,9 @@ "input": { "phrase": "1 (223) 056-7890" }, - "expected": {"error": "exchange code cannot start with zero"} + "expected": { + "error": "exchange code cannot start with zero" + } }, { "uuid": "57b32f3d-696a-455c-8bf1-137b6d171cdf", @@ -166,7 +190,9 @@ "input": { "phrase": "1 (223) 156-7890" }, - "expected": {"error": "exchange code cannot start with one"} + "expected": { + "error": "exchange code cannot start with one" + } } ] } From 4090026590dd036debada7351bef0920fa97bab7 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:20:26 +0100 Subject: [PATCH 26/58] prime-factors: format --- exercises/prime-factors/canonical-data.json | 61 ++++----------------- 1 file changed, 11 insertions(+), 50 deletions(-) diff --git a/exercises/prime-factors/canonical-data.json b/exercises/prime-factors/canonical-data.json index ae6465d0b3..5c5329b5d0 100644 --- a/exercises/prime-factors/canonical-data.json +++ b/exercises/prime-factors/canonical-data.json @@ -17,9 +17,7 @@ "input": { "value": 2 }, - "expected": [ - 2 - ] + "expected": [2] }, { "uuid": "238d57c8-4c12-42ef-af34-ae4929f94789", @@ -28,9 +26,7 @@ "input": { "value": 3 }, - "expected": [ - 3 - ] + "expected": [3] }, { "uuid": "f59b8350-a180-495a-8fb1-1712fbee1158", @@ -39,10 +35,7 @@ "input": { "value": 9 }, - "expected": [ - 3, - 3 - ] + "expected": [3, 3] }, { "uuid": "756949d3-3158-4e3d-91f2-c4f9f043ee70", @@ -51,10 +44,7 @@ "input": { "value": 4 }, - "expected": [ - 2, - 2 - ] + "expected": [2, 2] }, { "uuid": "bc8c113f-9580-4516-8669-c5fc29512ceb", @@ -63,11 +53,7 @@ "input": { "value": 8 }, - "expected": [ - 2, - 2, - 2 - ] + "expected": [2, 2, 2] }, { "uuid": "7d6a3300-a4cb-4065-bd33-0ced1de6cb44", @@ -76,11 +62,7 @@ "input": { "value": 27 }, - "expected": [ - 3, - 3, - 3 - ] + "expected": [3, 3, 3] }, { "uuid": "073ac0b2-c915-4362-929d-fc45f7b9a9e4", @@ -89,12 +71,7 @@ "input": { "value": 625 }, - "expected": [ - 5, - 5, - 5, - 5 - ] + "expected": [5, 5, 5, 5] }, { "uuid": "6e0e4912-7fb6-47f3-a9ad-dbcd79340c75", @@ -103,10 +80,7 @@ "input": { "value": 6 }, - "expected": [ - 2, - 3 - ] + "expected": [2, 3] }, { "uuid": "00485cd3-a3fe-4fbe-a64a-a4308fc1f870", @@ -115,11 +89,7 @@ "input": { "value": 12 }, - "expected": [ - 2, - 2, - 3 - ] + "expected": [2, 2, 3] }, { "uuid": "02251d54-3ca1-4a9b-85e1-b38f4b0ccb91", @@ -128,12 +98,7 @@ "input": { "value": 901255 }, - "expected": [ - 5, - 17, - 23, - 461 - ] + "expected": [5, 17, 23, 461] }, { "uuid": "070cf8dc-e202-4285-aa37-8d775c9cd473", @@ -142,11 +107,7 @@ "input": { "value": 93819012551 }, - "expected": [ - 11, - 9539, - 894119 - ] + "expected": [11, 9539, 894119] } ] } From 716802d2d0d623931f9f2ab64c586124362ad88a Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:20:36 +0100 Subject: [PATCH 27/58] protein-translation: format --- exercises/protein-translation/canonical-data.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/exercises/protein-translation/canonical-data.json b/exercises/protein-translation/canonical-data.json index a4c552ae5b..6f048c259b 100644 --- a/exercises/protein-translation/canonical-data.json +++ b/exercises/protein-translation/canonical-data.json @@ -174,7 +174,7 @@ "input": { "strand": "UUUUUU" }, - "expected": ["Phenylalanine","Phenylalanine"] + "expected": ["Phenylalanine", "Phenylalanine"] }, { "uuid": "dd22eef3-b4f1-4ad6-bb0b-27093c090a9d", @@ -186,7 +186,7 @@ "input": { "strand": "UUAUUG" }, - "expected": ["Leucine","Leucine"] + "expected": ["Leucine", "Leucine"] }, { "uuid": "d0f295df-fb70-425c-946c-ec2ec185388e", @@ -195,7 +195,7 @@ "input": { "strand": "AUGUUUUGG" }, - "expected": ["Methionine","Phenylalanine","Tryptophan"] + "expected": ["Methionine", "Phenylalanine", "Tryptophan"] }, { "uuid": "e30e8505-97ec-4e5f-a73e-5726a1faa1f4", @@ -222,7 +222,7 @@ "input": { "strand": "AUGUUUUAA" }, - "expected": ["Methionine","Phenylalanine"] + "expected": ["Methionine", "Phenylalanine"] }, { "uuid": "4089bb5a-d5b4-4e71-b79e-b8d1f14a2911", @@ -240,7 +240,7 @@ "input": { "strand": "UGGUGUUAUUAAUGGUUU" }, - "expected": ["Tryptophan","Cysteine","Tyrosine"] + "expected": ["Tryptophan", "Cysteine", "Tyrosine"] }, { "uuid": "1e75ea2a-f907-4994-ae5c-118632a1cb0f", @@ -308,7 +308,7 @@ "input": { "strand": "UUCUUCUAAUGGU" }, - "expected": ["Phenylalanine","Phenylalanine"] + "expected": ["Phenylalanine", "Phenylalanine"] } ] } From 911042067120f6e300bd473100ea0a9a61007b7f Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:20:44 +0100 Subject: [PATCH 28/58] proverb: format --- exercises/proverb/canonical-data.json | 196 ++++++++++++-------------- 1 file changed, 90 insertions(+), 106 deletions(-) diff --git a/exercises/proverb/canonical-data.json b/exercises/proverb/canonical-data.json index 2cabf7192a..6784c9ac25 100644 --- a/exercises/proverb/canonical-data.json +++ b/exercises/proverb/canonical-data.json @@ -1,108 +1,92 @@ { - "exercise": "proverb", - "comments": [ - "JSON doesn't allow for multi-line strings, so all expected outputs are presented ", - "here as arrays of strings. It's up to the test generator to join the ", - "lines together with line breaks. " - ], - "cases": [ - { - "uuid": "e974b73e-7851-484f-8d6d-92e07fe742fc", - "description": "zero pieces", - "property": "recite", - "input": { - "strings": [] - }, - "expected": [] - }, - { - "uuid": "2fcd5f5e-8b82-4e74-b51d-df28a5e0faa4", - "description": "one piece", - "property": "recite", - "input": { - "strings": [ - "nail" - ] - }, - "expected": [ - "And all for the want of a nail." - ] - }, - { - "uuid": "d9d0a8a1-d933-46e2-aa94-eecf679f4b0e", - "description": "two pieces", - "property": "recite", - "input": { - "strings": [ - "nail", - "shoe" - ] - }, - "expected": [ - "For want of a nail the shoe was lost.", - "And all for the want of a nail." - ] - }, - { - "uuid": "c95ef757-5e94-4f0d-a6cb-d2083f5e5a83", - "description": "three pieces", - "property": "recite", - "input": { - "strings": [ - "nail", - "shoe", - "horse" - ] - }, - "expected": [ - "For want of a nail the shoe was lost.", - "For want of a shoe the horse was lost.", - "And all for the want of a nail." - ] - }, - { - "uuid": "433fb91c-35a2-4d41-aeab-4de1e82b2126", - "description": "full proverb", - "property": "recite", - "input": { - "strings": [ - "nail", - "shoe", - "horse", - "rider", - "message", - "battle", - "kingdom" - ] - }, - "expected": [ - "For want of a nail the shoe was lost.", - "For want of a shoe the horse was lost.", - "For want of a horse the rider was lost.", - "For want of a rider the message was lost.", - "For want of a message the battle was lost.", - "For want of a battle the kingdom was lost.", - "And all for the want of a nail." - ] - }, - { - "uuid": "c1eefa5a-e8d9-41c7-91d4-99fab6d6b9f7", - "description": "four pieces modernized", - "property": "recite", - "input": { - "strings": [ - "pin", - "gun", - "soldier", - "battle" - ] - }, - "expected": [ - "For want of a pin the gun was lost.", - "For want of a gun the soldier was lost.", - "For want of a soldier the battle was lost.", - "And all for the want of a pin." - ] - } - ] + "exercise": "proverb", + "comments": [ + "JSON doesn't allow for multi-line strings, so all expected outputs are presented ", + "here as arrays of strings. It's up to the test generator to join the ", + "lines together with line breaks. " + ], + "cases": [ + { + "uuid": "e974b73e-7851-484f-8d6d-92e07fe742fc", + "description": "zero pieces", + "property": "recite", + "input": { + "strings": [] + }, + "expected": [] + }, + { + "uuid": "2fcd5f5e-8b82-4e74-b51d-df28a5e0faa4", + "description": "one piece", + "property": "recite", + "input": { + "strings": ["nail"] + }, + "expected": ["And all for the want of a nail."] + }, + { + "uuid": "d9d0a8a1-d933-46e2-aa94-eecf679f4b0e", + "description": "two pieces", + "property": "recite", + "input": { + "strings": ["nail", "shoe"] + }, + "expected": [ + "For want of a nail the shoe was lost.", + "And all for the want of a nail." + ] + }, + { + "uuid": "c95ef757-5e94-4f0d-a6cb-d2083f5e5a83", + "description": "three pieces", + "property": "recite", + "input": { + "strings": ["nail", "shoe", "horse"] + }, + "expected": [ + "For want of a nail the shoe was lost.", + "For want of a shoe the horse was lost.", + "And all for the want of a nail." + ] + }, + { + "uuid": "433fb91c-35a2-4d41-aeab-4de1e82b2126", + "description": "full proverb", + "property": "recite", + "input": { + "strings": [ + "nail", + "shoe", + "horse", + "rider", + "message", + "battle", + "kingdom" + ] + }, + "expected": [ + "For want of a nail the shoe was lost.", + "For want of a shoe the horse was lost.", + "For want of a horse the rider was lost.", + "For want of a rider the message was lost.", + "For want of a message the battle was lost.", + "For want of a battle the kingdom was lost.", + "And all for the want of a nail." + ] + }, + { + "uuid": "c1eefa5a-e8d9-41c7-91d4-99fab6d6b9f7", + "description": "four pieces modernized", + "property": "recite", + "input": { + "strings": ["pin", "gun", "soldier", "battle"] + }, + "expected": [ + "For want of a pin the gun was lost.", + "For want of a gun the soldier was lost.", + "For want of a soldier the battle was lost.", + "And all for the want of a pin." + ] + } + ] } From c7b2a09979b9ac03c9db45de1dba168657869b12 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:21:17 +0100 Subject: [PATCH 29/58] pythagorean-triplets: format --- .../pythagorean-triplet/canonical-data.json | 180 +++++++++--------- 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/exercises/pythagorean-triplet/canonical-data.json b/exercises/pythagorean-triplet/canonical-data.json index 2a6e7251c9..ae7ce4d313 100644 --- a/exercises/pythagorean-triplet/canonical-data.json +++ b/exercises/pythagorean-triplet/canonical-data.json @@ -1,92 +1,92 @@ { - "exercise": "pythagorean-triplet", - "cases": [ - { - "uuid": "a19de65d-35b8-4480-b1af-371d9541e706", - "description": "triplets whose sum is 12", - "property": "tripletsWithSum", - "input": { - "n": 12 - }, - "expected": [ - [3, 4, 5] - ] - }, - { - "uuid": "48b21332-0a3d-43b2-9a52-90b2a6e5c9f5", - "description": "triplets whose sum is 108", - "property": "tripletsWithSum", - "input": { - "n": 108 - }, - "expected": [ - [27, 36, 45] - ] - }, - { - "uuid": "dffc1266-418e-4daa-81af-54c3e95c3bb5", - "description": "triplets whose sum is 1000", - "property": "tripletsWithSum", - "input": { - "n": 1000 - }, - "expected": [ - [200, 375, 425] - ] - }, - { - "uuid": "5f86a2d4-6383-4cce-93a5-e4489e79b186", - "description": "no matching triplets for 1001", - "property": "tripletsWithSum", - "input": { - "n": 1001 - }, - "expected": [] - }, - { - "uuid": "bf17ba80-1596-409a-bb13-343bdb3b2904", - "description": "returns all matching triplets", - "property": "tripletsWithSum", - "input": { - "n": 90 - }, - "expected": [ - [9, 40, 41], - [15, 36, 39] - ] - }, - { - "uuid": "9d8fb5d5-6c6f-42df-9f95-d3165963ac57", - "description": "several matching triplets", - "property": "tripletsWithSum", - "input": { - "n": 840 - }, - "expected": [ - [40, 399, 401], - [56, 390, 394], - [105, 360, 375], - [120, 350, 370], - [140, 336, 364], - [168, 315, 357], - [210, 280, 350], - [240, 252, 348] - ] - }, - { - "uuid": "f5be5734-8aa0-4bd1-99a2-02adcc4402b4", - "description": "triplets for large number", - "property": "tripletsWithSum", - "input": { - "n": 30000 - }, - "expected": [ - [1200, 14375, 14425], - [1875, 14000, 14125], - [5000, 12000, 13000], - [6000, 11250, 12750], - [7500, 10000, 12500] - ] - } - ] + "exercise": "pythagorean-triplet", + "cases": [ + { + "uuid": "a19de65d-35b8-4480-b1af-371d9541e706", + "description": "triplets whose sum is 12", + "property": "tripletsWithSum", + "input": { + "n": 12 + }, + "expected": [ + [3, 4, 5] + ] + }, + { + "uuid": "48b21332-0a3d-43b2-9a52-90b2a6e5c9f5", + "description": "triplets whose sum is 108", + "property": "tripletsWithSum", + "input": { + "n": 108 + }, + "expected": [ + [27, 36, 45] + ] + }, + { + "uuid": "dffc1266-418e-4daa-81af-54c3e95c3bb5", + "description": "triplets whose sum is 1000", + "property": "tripletsWithSum", + "input": { + "n": 1000 + }, + "expected": [ + [200, 375, 425] + ] + }, + { + "uuid": "5f86a2d4-6383-4cce-93a5-e4489e79b186", + "description": "no matching triplets for 1001", + "property": "tripletsWithSum", + "input": { + "n": 1001 + }, + "expected": [] + }, + { + "uuid": "bf17ba80-1596-409a-bb13-343bdb3b2904", + "description": "returns all matching triplets", + "property": "tripletsWithSum", + "input": { + "n": 90 + }, + "expected": [ + [9, 40, 41], + [15, 36, 39] + ] + }, + { + "uuid": "9d8fb5d5-6c6f-42df-9f95-d3165963ac57", + "description": "several matching triplets", + "property": "tripletsWithSum", + "input": { + "n": 840 + }, + "expected": [ + [40, 399, 401], + [56, 390, 394], + [105, 360, 375], + [120, 350, 370], + [140, 336, 364], + [168, 315, 357], + [210, 280, 350], + [240, 252, 348] + ] + }, + { + "uuid": "f5be5734-8aa0-4bd1-99a2-02adcc4402b4", + "description": "triplets for large number", + "property": "tripletsWithSum", + "input": { + "n": 30000 + }, + "expected": [ + [1200, 14375, 14425], + [1875, 14000, 14125], + [5000, 12000, 13000], + [6000, 11250, 12750], + [7500, 10000, 12500] + ] + } + ] } From d37916474ee650582b3af8998300c9f9282b61fa Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:21:29 +0100 Subject: [PATCH 30/58] yacht: format --- exercises/yacht/canonical-data.json | 588 ++++++++++++++-------------- 1 file changed, 294 insertions(+), 294 deletions(-) diff --git a/exercises/yacht/canonical-data.json b/exercises/yacht/canonical-data.json index 3faf79b6ac..5361ad8fdc 100644 --- a/exercises/yacht/canonical-data.json +++ b/exercises/yacht/canonical-data.json @@ -1,296 +1,296 @@ { - "exercise":"yacht", - "comments":[ - "The dice are represented always as a list of exactly five integers", - "with values between 1 and 6 inclusive. The category is an string.", - "the categories are 'ones' to 'sixes',", - "Then 'full house',", - " 'four of a kind'", - " 'little straight' 1-5", - " 'big straight' 2-6", - " 'choice', sometimes called Chance", - " 'yacht', or five of a kind" - ], - "cases":[ - { - "uuid": "3060e4a5-4063-4deb-a380-a630b43a84b6", - "description":"Yacht", - "property":"score", - "input":{ - "dice":[5, 5, 5, 5, 5], - "category":"yacht" - }, - "expected":50 - }, - { - "uuid": "15026df2-f567-482f-b4d5-5297d57769d9", - "description":"Not Yacht", - "property":"score", - "input":{ - "dice":[1, 3, 3, 2, 5], - "category":"yacht" - }, - "expected":0 - }, - { - "uuid": "36b6af0c-ca06-4666-97de-5d31213957a4", - "description":"Ones", - "property":"score", - "input":{ - "dice":[1, 1, 1, 3, 5], - "category":"ones" - }, - "expected":3 - }, - { - "uuid": "023a07c8-6c6e-44d0-bc17-efc5e1b8205a", - "description":"Ones, out of order", - "property":"score", - "input":{ - "dice":[3, 1, 1, 5, 1], - "category":"ones" - }, - "expected":3 - }, - { - "uuid": "7189afac-cccd-4a74-8182-1cb1f374e496", - "description":"No ones", - "property":"score", - "input":{ - "dice":[4, 3, 6, 5, 5], - "category":"ones" - }, - "expected":0 - }, - { - "uuid": "793c4292-dd14-49c4-9707-6d9c56cee725", - "description":"Twos", - "property":"score", - "input":{ - "dice":[2, 3, 4, 5, 6], - "category":"twos" - }, - "expected":2 - }, - { - "uuid": "dc41bceb-d0c5-4634-a734-c01b4233a0c6", - "description":"Fours", - "property":"score", - "input":{ - "dice":[1, 4, 1, 4, 1], - "category":"fours" - }, - "expected":8 - }, - { - "uuid": "f6125417-5c8a-4bca-bc5b-b4b76d0d28c8", - "description":"Yacht counted as threes", - "property":"score", - "input":{ - "dice":[3, 3, 3, 3, 3], - "category":"threes" - }, - "expected":15 - }, - { - "uuid": "464fc809-96ed-46e4-acb8-d44e302e9726", - "description":"Yacht of 3s counted as fives", - "property":"score", - "input":{ - "dice":[3, 3, 3, 3, 3], - "category":"fives" - }, - "expected":0 - }, - { - "uuid": "e8a036e0-9d21-443a-8b5f-e15a9e19a761", - "description":"Sixes", - "property":"score", - "input":{ - "dice":[2, 3, 4, 5 ,6], - "category":"sixes" - }, - "expected":6 - }, - { - "uuid": "51cb26db-6b24-49af-a9ff-12f53b252eea", - "description":"Full house two small, three big", - "property":"score", - "input":{ - "dice":[2, 2, 4, 4, 4], - "category":"full house" - }, - "expected":16 - }, - { - "uuid": "1822ca9d-f235-4447-b430-2e8cfc448f0c", - "description":"Full house three small, two big", - "property":"score", - "input":{ - "dice":[5, 3, 3, 5, 3], - "category":"full house" - }, - "expected":19 - }, - { - "uuid": "b208a3fc-db2e-4363-a936-9e9a71e69c07", - "description":"Two pair is not a full house", - "property":"score", - "input":{ - "dice":[2, 2, 4, 4, 5], - "category":"full house" - }, - "expected":0 - }, - { - "uuid": "b90209c3-5956-445b-8a0b-0ac8b906b1c2", - "description":"Four of a kind is not a full house", - "property":"score", - "input":{ - "dice":[1, 4, 4, 4, 4], - "category":"full house" - }, - "expected":0 - }, - { - "uuid": "32a3f4ee-9142-4edf-ba70-6c0f96eb4b0c", - "description":"Yacht is not a full house", - "property":"score", - "input":{ - "dice":[2, 2, 2, 2, 2], - "category":"full house" - }, - "expected":0 - }, - { - "uuid": "b286084d-0568-4460-844a-ba79d71d79c6", - "description":"Four of a Kind", - "property":"score", - "input":{ - "dice":[6, 6, 4, 6, 6], - "category":"four of a kind" - }, - "expected":24 - }, - { - "uuid": "f25c0c90-5397-4732-9779-b1e9b5f612ca", - "description":"Yacht can be scored as Four of a Kind", - "property":"score", - "input":{ - "dice":[3, 3, 3, 3, 3], - "category":"four of a kind" - }, - "expected":12 - }, - { - "uuid": "9f8ef4f0-72bb-401a-a871-cbad39c9cb08", - "description":"Full house is not Four of a Kind", - "property":"score", - "input":{ - "dice":[3, 3, 3, 5, 5], - "category":"four of a kind" - }, - "expected":0 - }, - { - "uuid": "b4743c82-1eb8-4a65-98f7-33ad126905cd", - "description":"Little Straight", - "property":"score", - "input":{ - "dice":[3, 5, 4, 1, 2], - "category":"little straight" - }, - "expected":30 - }, - { - "uuid": "7ac08422-41bf-459c-8187-a38a12d080bc", - "description":"Little Straight as Big Straight", - "property":"score", - "input":{ - "dice":[1, 2, 3, 4, 5], - "category":"big straight" - }, - "expected":0 - }, - { - "uuid": "97bde8f7-9058-43ea-9de7-0bc3ed6d3002", - "description":"Four in order but not a little straight", - "property":"score", - "input":{ - "dice":[1, 1, 2, 3, 4], - "category":"little straight" - }, - "expected":0 - }, - { - "uuid": "cef35ff9-9c5e-4fd2-ae95-6e4af5e95a99", - "description":"No pairs but not a little straight", - "property":"score", - "input":{ - "dice":[1, 2, 3, 4, 6], - "category":"little straight" - }, - "expected":0 - }, - { - "uuid": "fd785ad2-c060-4e45-81c6-ea2bbb781b9d", - "description":"Minimum is 1, maximum is 5, but not a little straight", - "property":"score", - "input":{ - "dice":[1, 1, 3, 4, 5], - "category":"little straight" - }, - "expected":0 - }, - { - "uuid": "35bd74a6-5cf6-431a-97a3-4f713663f467", - "description":"Big Straight", - "property":"score", - "input":{ - "dice":[4, 6, 2, 5, 3], - "category":"big straight" - }, - "expected":30 - }, - { - "uuid": "87c67e1e-3e87-4f3a-a9b1-62927822b250", - "description":"Big Straight as little straight", - "property":"score", - "input":{ - "dice":[6, 5, 4, 3, 2], - "category":"little straight" - }, - "expected":0 - }, - { - "uuid": "c1fa0a3a-40ba-4153-a42d-32bc34d2521e", - "description":"No pairs but not a big straight", - "property":"score", - "input":{ - "dice":[6, 5, 4, 3, 1], - "category":"big straight" - }, - "expected":0 - }, - { - "uuid": "207e7300-5d10-43e5-afdd-213e3ac8827d", - "description":"Choice", - "property":"score", - "input":{ - "dice":[3, 3, 5, 6, 6], - "category":"choice" - }, - "expected":23 - }, - { - "uuid": "b524c0cf-32d2-4b40-8fb3-be3500f3f135", - "description":"Yacht as choice", - "property":"score", - "input":{ - "dice":[2, 2, 2, 2, 2], - "category":"choice" - }, - "expected":10 - } - ] + "exercise": "yacht", + "comments": [ + "The dice are represented always as a list of exactly five integers", + "with values between 1 and 6 inclusive. The category is an string.", + "the categories are 'ones' to 'sixes',", + "Then 'full house',", + " 'four of a kind'", + " 'little straight' 1-5", + " 'big straight' 2-6", + " 'choice', sometimes called Chance", + " 'yacht', or five of a kind" + ], + "cases": [ + { + "uuid": "3060e4a5-4063-4deb-a380-a630b43a84b6", + "description": "Yacht", + "property": "score", + "input": { + "dice": [5, 5, 5, 5, 5], + "category": "yacht" + }, + "expected": 50 + }, + { + "uuid": "15026df2-f567-482f-b4d5-5297d57769d9", + "description": "Not Yacht", + "property": "score", + "input": { + "dice": [1, 3, 3, 2, 5], + "category": "yacht" + }, + "expected": 0 + }, + { + "uuid": "36b6af0c-ca06-4666-97de-5d31213957a4", + "description": "Ones", + "property": "score", + "input": { + "dice": [1, 1, 1, 3, 5], + "category": "ones" + }, + "expected": 3 + }, + { + "uuid": "023a07c8-6c6e-44d0-bc17-efc5e1b8205a", + "description": "Ones, out of order", + "property": "score", + "input": { + "dice": [3, 1, 1, 5, 1], + "category": "ones" + }, + "expected": 3 + }, + { + "uuid": "7189afac-cccd-4a74-8182-1cb1f374e496", + "description": "No ones", + "property": "score", + "input": { + "dice": [4, 3, 6, 5, 5], + "category": "ones" + }, + "expected": 0 + }, + { + "uuid": "793c4292-dd14-49c4-9707-6d9c56cee725", + "description": "Twos", + "property": "score", + "input": { + "dice": [2, 3, 4, 5, 6], + "category": "twos" + }, + "expected": 2 + }, + { + "uuid": "dc41bceb-d0c5-4634-a734-c01b4233a0c6", + "description": "Fours", + "property": "score", + "input": { + "dice": [1, 4, 1, 4, 1], + "category": "fours" + }, + "expected": 8 + }, + { + "uuid": "f6125417-5c8a-4bca-bc5b-b4b76d0d28c8", + "description": "Yacht counted as threes", + "property": "score", + "input": { + "dice": [3, 3, 3, 3, 3], + "category": "threes" + }, + "expected": 15 + }, + { + "uuid": "464fc809-96ed-46e4-acb8-d44e302e9726", + "description": "Yacht of 3s counted as fives", + "property": "score", + "input": { + "dice": [3, 3, 3, 3, 3], + "category": "fives" + }, + "expected": 0 + }, + { + "uuid": "e8a036e0-9d21-443a-8b5f-e15a9e19a761", + "description": "Sixes", + "property": "score", + "input": { + "dice": [2, 3, 4, 5, 6], + "category": "sixes" + }, + "expected": 6 + }, + { + "uuid": "51cb26db-6b24-49af-a9ff-12f53b252eea", + "description": "Full house two small, three big", + "property": "score", + "input": { + "dice": [2, 2, 4, 4, 4], + "category": "full house" + }, + "expected": 16 + }, + { + "uuid": "1822ca9d-f235-4447-b430-2e8cfc448f0c", + "description": "Full house three small, two big", + "property": "score", + "input": { + "dice": [5, 3, 3, 5, 3], + "category": "full house" + }, + "expected": 19 + }, + { + "uuid": "b208a3fc-db2e-4363-a936-9e9a71e69c07", + "description": "Two pair is not a full house", + "property": "score", + "input": { + "dice": [2, 2, 4, 4, 5], + "category": "full house" + }, + "expected": 0 + }, + { + "uuid": "b90209c3-5956-445b-8a0b-0ac8b906b1c2", + "description": "Four of a kind is not a full house", + "property": "score", + "input": { + "dice": [1, 4, 4, 4, 4], + "category": "full house" + }, + "expected": 0 + }, + { + "uuid": "32a3f4ee-9142-4edf-ba70-6c0f96eb4b0c", + "description": "Yacht is not a full house", + "property": "score", + "input": { + "dice": [2, 2, 2, 2, 2], + "category": "full house" + }, + "expected": 0 + }, + { + "uuid": "b286084d-0568-4460-844a-ba79d71d79c6", + "description": "Four of a Kind", + "property": "score", + "input": { + "dice": [6, 6, 4, 6, 6], + "category": "four of a kind" + }, + "expected": 24 + }, + { + "uuid": "f25c0c90-5397-4732-9779-b1e9b5f612ca", + "description": "Yacht can be scored as Four of a Kind", + "property": "score", + "input": { + "dice": [3, 3, 3, 3, 3], + "category": "four of a kind" + }, + "expected": 12 + }, + { + "uuid": "9f8ef4f0-72bb-401a-a871-cbad39c9cb08", + "description": "Full house is not Four of a Kind", + "property": "score", + "input": { + "dice": [3, 3, 3, 5, 5], + "category": "four of a kind" + }, + "expected": 0 + }, + { + "uuid": "b4743c82-1eb8-4a65-98f7-33ad126905cd", + "description": "Little Straight", + "property": "score", + "input": { + "dice": [3, 5, 4, 1, 2], + "category": "little straight" + }, + "expected": 30 + }, + { + "uuid": "7ac08422-41bf-459c-8187-a38a12d080bc", + "description": "Little Straight as Big Straight", + "property": "score", + "input": { + "dice": [1, 2, 3, 4, 5], + "category": "big straight" + }, + "expected": 0 + }, + { + "uuid": "97bde8f7-9058-43ea-9de7-0bc3ed6d3002", + "description": "Four in order but not a little straight", + "property": "score", + "input": { + "dice": [1, 1, 2, 3, 4], + "category": "little straight" + }, + "expected": 0 + }, + { + "uuid": "cef35ff9-9c5e-4fd2-ae95-6e4af5e95a99", + "description": "No pairs but not a little straight", + "property": "score", + "input": { + "dice": [1, 2, 3, 4, 6], + "category": "little straight" + }, + "expected": 0 + }, + { + "uuid": "fd785ad2-c060-4e45-81c6-ea2bbb781b9d", + "description": "Minimum is 1, maximum is 5, but not a little straight", + "property": "score", + "input": { + "dice": [1, 1, 3, 4, 5], + "category": "little straight" + }, + "expected": 0 + }, + { + "uuid": "35bd74a6-5cf6-431a-97a3-4f713663f467", + "description": "Big Straight", + "property": "score", + "input": { + "dice": [4, 6, 2, 5, 3], + "category": "big straight" + }, + "expected": 30 + }, + { + "uuid": "87c67e1e-3e87-4f3a-a9b1-62927822b250", + "description": "Big Straight as little straight", + "property": "score", + "input": { + "dice": [6, 5, 4, 3, 2], + "category": "little straight" + }, + "expected": 0 + }, + { + "uuid": "c1fa0a3a-40ba-4153-a42d-32bc34d2521e", + "description": "No pairs but not a big straight", + "property": "score", + "input": { + "dice": [6, 5, 4, 3, 1], + "category": "big straight" + }, + "expected": 0 + }, + { + "uuid": "207e7300-5d10-43e5-afdd-213e3ac8827d", + "description": "Choice", + "property": "score", + "input": { + "dice": [3, 3, 5, 6, 6], + "category": "choice" + }, + "expected": 23 + }, + { + "uuid": "b524c0cf-32d2-4b40-8fb3-be3500f3f135", + "description": "Yacht as choice", + "property": "score", + "input": { + "dice": [2, 2, 2, 2, 2], + "category": "choice" + }, + "expected": 10 + } + ] } From 9082e330f8c90589b7e7c5429a084f1a78fb0d50 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:21:42 +0100 Subject: [PATCH 31/58] say: format --- exercises/say/canonical-data.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/exercises/say/canonical-data.json b/exercises/say/canonical-data.json index 8df626d902..b2e8a8dcf6 100644 --- a/exercises/say/canonical-data.json +++ b/exercises/say/canonical-data.json @@ -129,7 +129,9 @@ "input": { "number": -1 }, - "expected": {"error": "input out of range"} + "expected": { + "error": "input out of range" + } }, { "uuid": "4d6492eb-5853-4d16-9d34-b0f61b261fd9", @@ -138,7 +140,9 @@ "input": { "number": 1000000000000 }, - "expected": {"error": "input out of range"} + "expected": { + "error": "input out of range" + } } ] } From 822c9c5ee5077311858781ea57ddb573a7b1b37d Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:22:01 +0100 Subject: [PATCH 32/58] satellite: format --- exercises/satellite/canonical-data.json | 40 +++++++++++++++---------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/exercises/satellite/canonical-data.json b/exercises/satellite/canonical-data.json index 2326463bf6..19656c0043 100644 --- a/exercises/satellite/canonical-data.json +++ b/exercises/satellite/canonical-data.json @@ -16,25 +16,27 @@ "description": "Tree with one item", "property": "treeFromTraversals", "input": { - "preorder": ["a"], - "inorder": ["a"] + "preorder": ["a"], + "inorder": ["a"] }, - "expected": {"v": "a", "l": {}, "r": {}} + "expected": { "v": "a", "l": {}, "r": {} } }, { "uuid": "a0121d5f-37b0-48dd-9c64-cba4c4464135", "description": "Tree with many items", "property": "treeFromTraversals", "input": { - "preorder": ["a", "i", "x", "f", "r"], - "inorder": ["i", "a", "f", "x", "r"] + "preorder": ["a", "i", "x", "f", "r"], + "inorder": ["i", "a", "f", "x", "r"] }, - "expected": {"v": "a", - "l": {"v": "i", "l": {}, "r": {}}, - "r": {"v": "x", - "l": {"v": "f", "l": {}, "r": {}}, - "r": {"v": "r", "l": {}, "r": {}} - } + "expected": { + "v": "a", + "l": { "v": "i", "l": {}, "r": {} }, + "r": { + "v": "x", + "l": { "v": "f", "l": {}, "r": {} }, + "r": { "v": "r", "l": {}, "r": {} } + } } }, { @@ -45,17 +47,21 @@ "preorder": ["a", "b"], "inorder": ["b", "a", "r"] }, - "expected": {"error": "traversals must have the same length"} + "expected": { + "error": "traversals must have the same length" + } }, { "uuid": "27916ce4-45f3-4d8b-8528-496fedc157ca", "description": "Reject inconsistent traversals of same length", "property": "treeFromTraversals", "input": { - "preorder": ["x", "y", "z"], - "inorder": ["a", "b", "c"] + "preorder": ["x", "y", "z"], + "inorder": ["a", "b", "c"] }, - "expected": {"error": "traversals must have the same elements"} + "expected": { + "error": "traversals must have the same elements" + } }, { "uuid": "d86a3d72-76a9-43b5-9d3a-e64cb1216035", @@ -65,7 +71,9 @@ "preorder": ["a", "b", "a"], "inorder": ["b", "a", "a"] }, - "expected": {"error": "traversals must contain unique items"} + "expected": { + "error": "traversals must contain unique items" + } } ] } From 3484902fd5c811d4b2033fd7b1212701cbfaf695 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:22:25 +0100 Subject: [PATCH 33/58] resistor-color: format --- exercises/resistor-color/canonical-data.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/exercises/resistor-color/canonical-data.json b/exercises/resistor-color/canonical-data.json index 37624546de..952e3c2605 100644 --- a/exercises/resistor-color/canonical-data.json +++ b/exercises/resistor-color/canonical-data.json @@ -38,7 +38,18 @@ "description": "Colors", "property": "colors", "input": {}, - "expected": ["black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "grey", "white"] + "expected": [ + "black", + "brown", + "red", + "orange", + "yellow", + "green", + "blue", + "violet", + "grey", + "white" + ] } ] } From e30af2647fbdc4ca62283ba78d463d510991a4d8 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:22:34 +0100 Subject: [PATCH 34/58] rest-api: format --- exercises/rest-api/canonical-data.json | 789 ++++++++++++------------- 1 file changed, 394 insertions(+), 395 deletions(-) diff --git a/exercises/rest-api/canonical-data.json b/exercises/rest-api/canonical-data.json index 29e86388b5..4ba237fd00 100644 --- a/exercises/rest-api/canonical-data.json +++ b/exercises/rest-api/canonical-data.json @@ -1,421 +1,420 @@ { - "exercise": "rest-api", - "comments": [ - "The state of the API database before the request is represented", - "by the input->database object. Your track may determine how this", - "initial state is set.", - "The input->payload and expected objects should be marshalled as", - "strings in track implementation, as parsing and validating text", - "payloads is an integral part of implementing a REST API.", - "All arrays are ordered." - ], - "cases": [ + "exercise": "rest-api", + "comments": [ + "The state of the API database before the request is represented", + "by the input->database object. Your track may determine how this", + "initial state is set.", + "The input->payload and expected objects should be marshalled as", + "strings in track implementation, as parsing and validating text", + "payloads is an integral part of implementing a REST API.", + "All arrays are ordered." + ], + "cases": [ + { + "description": "user management", + "cases": [ { - "description": "user management", - "cases": [ + "uuid": "5be01ffb-a814-47a8-a19f-490a5622ba07", + "description": "no users", + "property": "get", + "input": { + "database": { + "users": [] + }, + "url": "/users" + }, + "expected": { + "users": [] + } + }, + { + "uuid": "382b70cc-9f6c-486d-9bee-fda2df81c803", + "description": "add user", + "property": "post", + "input": { + "database": { + "users": [] + }, + "url": "/add", + "payload": { + "user": "Adam" + } + }, + "expected": { + "name": "Adam", + "owes": {}, + "owed_by": {}, + "balance": 0.0 + } + }, + { + "uuid": "d624e5e5-1abb-4f18-95b3-45d55c818dc3", + "description": "get single user", + "property": "get", + "input": { + "database": { + "users": [ + { + "name": "Adam", + "owes": {}, + "owed_by": {}, + "balance": 0.0 + }, + { + "name": "Bob", + "owes": {}, + "owed_by": {}, + "balance": 0.0 + } + ] + }, + "url": "/users", + "payload": { + "users": ["Bob"] + } + }, + "expected": { + "users": [ + { + "name": "Bob", + "owes": {}, + "owed_by": {}, + "balance": 0.0 + } + ] + } + } + ] + }, + { + "description": "iou", + "cases": [ + { + "uuid": "7a81b82c-7276-433e-8fce-29ce983a7c56", + "description": "both users have 0 balance", + "property": "post", + "input": { + "database": { + "users": [ + { + "name": "Adam", + "owes": {}, + "owed_by": {}, + "balance": 0.0 + }, + { + "name": "Bob", + "owes": {}, + "owed_by": {}, + "balance": 0.0 + } + ] + }, + "url": "/iou", + "payload": { + "lender": "Adam", + "borrower": "Bob", + "amount": 3.0 + } + }, + "expected": { + "users": [ + { + "name": "Adam", + "owes": {}, + "owed_by": { + "Bob": 3.0 + }, + "balance": 3.0 + }, + { + "name": "Bob", + "owes": { + "Adam": 3.0 + }, + "owed_by": {}, + "balance": -3.0 + } + ] + } + }, + { + "uuid": "1c61f957-cf8c-48ba-9e77-b221ab068803", + "description": "borrower has negative balance", + "property": "post", + "input": { + "database": { + "users": [ + { + "name": "Adam", + "owes": {}, + "owed_by": {}, + "balance": 0.0 + }, { - "uuid": "5be01ffb-a814-47a8-a19f-490a5622ba07", - "description": "no users", - "property": "get", - "input": { - "database": { - "users": [] - }, - "url": "/users" - }, - "expected": { - "users": [] - } + "name": "Bob", + "owes": { + "Chuck": 3.0 + }, + "owed_by": {}, + "balance": -3.0 }, { - "uuid": "382b70cc-9f6c-486d-9bee-fda2df81c803", - "description": "add user", - "property": "post", - "input": { - "database": { - "users": [] - }, - "url": "/add", - "payload": { - "user": "Adam" - } - }, - "expected": { - "name": "Adam", - "owes": {}, - "owed_by": {}, - "balance": 0.0 - } + "name": "Chuck", + "owes": {}, + "owed_by": { + "Bob": 3.0 + }, + "balance": 3.0 + } + ] + }, + "url": "/iou", + "payload": { + "lender": "Adam", + "borrower": "Bob", + "amount": 3.0 + } + }, + "expected": { + "users": [ + { + "name": "Adam", + "owes": {}, + "owed_by": { + "Bob": 3.0 + }, + "balance": 3.0 + }, + { + "name": "Bob", + "owes": { + "Adam": 3.0, + "Chuck": 3.0 }, + "owed_by": {}, + "balance": -6.0 + } + ] + } + }, + { + "uuid": "8a8567b3-c097-468a-9541-6bb17d5afc85", + "description": "lender has negative balance", + "property": "post", + "input": { + "database": { + "users": [ { - "uuid": "d624e5e5-1abb-4f18-95b3-45d55c818dc3", - "description": "get single user", - "property": "get", - "input": { - "database": { - "users": [ - { - "name": "Adam", - "owes": {}, - "owed_by": {}, - "balance": 0.0 - }, - { - "name": "Bob", - "owes": {}, - "owed_by": {}, - "balance": 0.0 - } - ] - }, - "url": "/users", - "payload": { - "users": ["Bob"] - } - }, - "expected": { - "users": [ - { - "name": "Bob", - "owes": {}, - "owed_by": {}, - "balance": 0.0 - } - ] - } + "name": "Adam", + "owes": {}, + "owed_by": {}, + "balance": 0.0 + }, + { + "name": "Bob", + "owes": { + "Chuck": 3.0 + }, + "owed_by": {}, + "balance": -3.0 + }, + { + "name": "Chuck", + "owes": {}, + "owed_by": { + "Bob": 3.0 + }, + "balance": 3.0 } - + ] + }, + "url": "/iou", + "payload": { + "lender": "Bob", + "borrower": "Adam", + "amount": 3.0 + } + }, + "expected": { + "users": [ + { + "name": "Adam", + "owes": { + "Bob": 3.0 + }, + "owed_by": {}, + "balance": -3.0 + }, + { + "name": "Bob", + "owes": { + "Chuck": 3.0 + }, + "owed_by": { + "Adam": 3.0 + }, + "balance": 0.0 + } ] + } }, { - "description": "iou", - "cases": [ + "uuid": "29fb7c12-7099-4a85-a7c4-9c290d2dc01a", + "description": "lender owes borrower", + "property": "post", + "input": { + "database": { + "users": [ { - "uuid": "7a81b82c-7276-433e-8fce-29ce983a7c56", - "description": "both users have 0 balance", - "property": "post", - "input": { - "database": { - "users": [ - { - "name": "Adam", - "owes": {}, - "owed_by": {}, - "balance": 0.0 - }, - { - "name": "Bob", - "owes": {}, - "owed_by": {}, - "balance": 0.0 - } - ] - }, - "url": "/iou", - "payload": { - "lender": "Adam", - "borrower": "Bob", - "amount": 3.0 - } - }, - "expected": { - "users": [ - { - "name": "Adam", - "owes": {}, - "owed_by": { - "Bob": 3.0 - }, - "balance": 3.0 - }, - { - "name": "Bob", - "owes": { - "Adam": 3.0 - }, - "owed_by": {}, - "balance": -3.0 - } - ] - } + "name": "Adam", + "owes": { + "Bob": 3.0 + }, + "owed_by": {}, + "balance": -3.0 }, { - "uuid": "1c61f957-cf8c-48ba-9e77-b221ab068803", - "description": "borrower has negative balance", - "property": "post", - "input": { - "database": { - "users": [ - { - "name": "Adam", - "owes": {}, - "owed_by": {}, - "balance": 0.0 - }, - { - "name": "Bob", - "owes": { - "Chuck": 3.0 - }, - "owed_by": {}, - "balance": -3.0 - }, - { - "name": "Chuck", - "owes": {}, - "owed_by": { - "Bob": 3.0 - }, - "balance": 3.0 - } - ] - }, - "url": "/iou", - "payload": { - "lender": "Adam", - "borrower": "Bob", - "amount": 3.0 - } - }, - "expected": { - "users": [ - { - "name": "Adam", - "owes": {}, - "owed_by": { - "Bob": 3.0 - }, - "balance": 3.0 - }, - { - "name": "Bob", - "owes": { - "Adam": 3.0, - "Chuck": 3.0 - }, - "owed_by": {}, - "balance": -6.0 - } - ] - } + "name": "Bob", + "owes": {}, + "owed_by": { + "Adam": 3.0 + }, + "balance": 3.0 + } + ] + }, + "url": "/iou", + "payload": { + "lender": "Adam", + "borrower": "Bob", + "amount": 2.0 + } + }, + "expected": { + "users": [ + { + "name": "Adam", + "owes": { + "Bob": 1.0 + }, + "owed_by": {}, + "balance": -1.0 + }, + { + "name": "Bob", + "owes": {}, + "owed_by": { + "Adam": 1.0 }, + "balance": 1.0 + } + ] + } + }, + { + "uuid": "ce969e70-163c-4135-a4a6-2c3a5da286f5", + "description": "lender owes borrower less than new loan", + "property": "post", + "input": { + "database": { + "users": [ { - "uuid": "8a8567b3-c097-468a-9541-6bb17d5afc85", - "description": "lender has negative balance", - "property": "post", - "input": { - "database": { - "users": [ - { - "name": "Adam", - "owes": {}, - "owed_by": {}, - "balance": 0.0 - }, - { - "name": "Bob", - "owes": { - "Chuck": 3.0 - }, - "owed_by": {}, - "balance": -3.0 - }, - { - "name": "Chuck", - "owes": {}, - "owed_by": { - "Bob": 3.0 - }, - "balance": 3.0 - } - ] - }, - "url": "/iou", - "payload": { - "lender": "Bob", - "borrower": "Adam", - "amount": 3.0 - } - }, - "expected": { - "users": [ - { - "name": "Adam", - "owes": { - "Bob": 3.0 - }, - "owed_by": {}, - "balance": -3.0 - }, - { - "name": "Bob", - "owes": { - "Chuck": 3.0 - }, - "owed_by": { - "Adam": 3.0 - }, - "balance": 0.0 - } - ] - } + "name": "Adam", + "owes": { + "Bob": 3.0 + }, + "owed_by": {}, + "balance": -3.0 }, { - "uuid": "29fb7c12-7099-4a85-a7c4-9c290d2dc01a", - "description": "lender owes borrower", - "property": "post", - "input": { - "database": { - "users": [ - { - "name": "Adam", - "owes": { - "Bob": 3.0 - }, - "owed_by": {}, - "balance": -3.0 - }, - { - "name": "Bob", - "owes": {}, - "owed_by": { - "Adam": 3.0 - }, - "balance": 3.0 - } - ] - }, - "url": "/iou", - "payload": { - "lender": "Adam", - "borrower": "Bob", - "amount": 2.0 - } - }, - "expected": { - "users": [ - { - "name": "Adam", - "owes": { - "Bob": 1.0 - }, - "owed_by": {}, - "balance": -1.0 - }, - { - "name": "Bob", - "owes": {}, - "owed_by": { - "Adam": 1.0 - }, - "balance": 1.0 - } - ] - } + "name": "Bob", + "owes": {}, + "owed_by": { + "Adam": 3.0 + }, + "balance": 3.0 + } + ] + }, + "url": "/iou", + "payload": { + "lender": "Adam", + "borrower": "Bob", + "amount": 4.0 + } + }, + "expected": { + "users": [ + { + "name": "Adam", + "owes": {}, + "owed_by": { + "Bob": 1.0 + }, + "balance": 1.0 + }, + { + "name": "Bob", + "owes": { + "Adam": 1.0 }, + "owed_by": {}, + "balance": -1.0 + } + ] + } + }, + { + "uuid": "7f4aafd9-ae9b-4e15-a406-87a87bdf47a4", + "description": "lender owes borrower same as new loan", + "property": "post", + "input": { + "database": { + "users": [ { - "uuid": "ce969e70-163c-4135-a4a6-2c3a5da286f5", - "description": "lender owes borrower less than new loan", - "property": "post", - "input": { - "database": { - "users": [ - { - "name": "Adam", - "owes": { - "Bob": 3.0 - }, - "owed_by": {}, - "balance": -3.0 - }, - { - "name": "Bob", - "owes": {}, - "owed_by": { - "Adam": 3.0 - }, - "balance": 3.0 - } - ] - }, - "url": "/iou", - "payload": { - "lender": "Adam", - "borrower": "Bob", - "amount": 4.0 - } - }, - "expected": { - "users": [ - { - "name": "Adam", - "owes": {}, - "owed_by": { - "Bob": 1.0 - }, - "balance": 1.0 - }, - { - "name": "Bob", - "owes": { - "Adam": 1.0 - }, - "owed_by": {}, - "balance": -1.0 - } - ] - } + "name": "Adam", + "owes": { + "Bob": 3.0 + }, + "owed_by": {}, + "balance": -3.0 }, { - "uuid": "7f4aafd9-ae9b-4e15-a406-87a87bdf47a4", - "description": "lender owes borrower same as new loan", - "property": "post", - "input": { - "database": { - "users": [ - { - "name": "Adam", - "owes": { - "Bob": 3.0 - }, - "owed_by": {}, - "balance": -3.0 - }, - { - "name": "Bob", - "owes": {}, - "owed_by": { - "Adam": 3.0 - }, - "balance": 3.0 - } - ] - }, - "url": "/iou", - "payload": { - "lender": "Adam", - "borrower": "Bob", - "amount": 3.0 - } - }, - "expected": { - "users": [ - { - "name": "Adam", - "owes": {}, - "owed_by": {}, - "balance": 0.0 - }, - { - "name": "Bob", - "owes": {}, - "owed_by": {}, - "balance": 0.0 - } - ] - } + "name": "Bob", + "owes": {}, + "owed_by": { + "Adam": 3.0 + }, + "balance": 3.0 } + ] + }, + "url": "/iou", + "payload": { + "lender": "Adam", + "borrower": "Bob", + "amount": 3.0 + } + }, + "expected": { + "users": [ + { + "name": "Adam", + "owes": {}, + "owed_by": {}, + "balance": 0.0 + }, + { + "name": "Bob", + "owes": {}, + "owed_by": {}, + "balance": 0.0 + } ] + } } - ] + ] + } + ] } From 27e861fcd3f669f4bb3ac9cc1eca61ef19949af5 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:22:45 +0100 Subject: [PATCH 35/58] reverse-string: format --- exercises/reverse-string/canonical-data.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/reverse-string/canonical-data.json b/exercises/reverse-string/canonical-data.json index 1127970dea..3608727afb 100644 --- a/exercises/reverse-string/canonical-data.json +++ b/exercises/reverse-string/canonical-data.json @@ -1,8 +1,8 @@ { "exercise": "reverse-string", "comments": [ - "If property based testing tools are available, a good property to test is reversing a string twice: reverse(reverse(string)) == string" - ], + "If property based testing tools are available, a good property to test is reversing a string twice: reverse(reverse(string)) == string" + ], "cases": [ { "uuid": "c3b7d806-dced-49ee-8543-933fd1719b1c", From 26566b2c4368ddb21a60b24b9a8b7e28a6e0967a Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:22:54 +0100 Subject: [PATCH 36/58] robot-simulator: format --- exercises/robot-simulator/canonical-data.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exercises/robot-simulator/canonical-data.json b/exercises/robot-simulator/canonical-data.json index fd013e300f..be375a92a6 100644 --- a/exercises/robot-simulator/canonical-data.json +++ b/exercises/robot-simulator/canonical-data.json @@ -308,8 +308,9 @@ }, { "description": "Follow series of instructions", - "comments": [ "The robot can follow a series of instructions and end up with the correct position and direction.", - "Where R = Turn Right, L = Turn Left and A = Advance" + "comments": [ + "The robot can follow a series of instructions and end up with the correct position and direction.", + "Where R = Turn Right, L = Turn Left and A = Advance" ], "cases": [ { From 1e82c20182601d11d826b42b45625a123b90b917 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:23:22 +0100 Subject: [PATCH 37/58] roman-numerals: format --- exercises/roman-numerals/canonical-data.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/roman-numerals/canonical-data.json b/exercises/roman-numerals/canonical-data.json index 8e1926c990..5bbf351167 100644 --- a/exercises/roman-numerals/canonical-data.json +++ b/exercises/roman-numerals/canonical-data.json @@ -156,7 +156,7 @@ { "uuid": "432de891-7fd6-4748-a7f6-156082eeca2f", "description": "911 is CMXI", - "comments":["Because 900 is 1000 - 100"], + "comments": ["Because 900 is 1000 - 100"], "property": "roman", "input": { "number": 911 From 13108aa301cf327c4c78088f735bffa6cf61a191 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:24:21 +0100 Subject: [PATCH 38/58] scale-generator: format --- exercises/scale-generator/canonical-data.json | 85 ++++++++++--------- 1 file changed, 47 insertions(+), 38 deletions(-) diff --git a/exercises/scale-generator/canonical-data.json b/exercises/scale-generator/canonical-data.json index fcafd95a2e..3508d7f797 100644 --- a/exercises/scale-generator/canonical-data.json +++ b/exercises/scale-generator/canonical-data.json @@ -15,7 +15,20 @@ "input": { "tonic": "C" }, - "expected": [ "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" ] + "expected": [ + "C", + "C#", + "D", + "D#", + "E", + "F", + "F#", + "G", + "G#", + "A", + "A#", + "B" + ] }, { "uuid": "af8381de-9a72-4efd-823a-48374dbfe76f", @@ -24,7 +37,7 @@ "input": { "tonic": "F" }, - "expected": [ "F", "Gb", "G", "Ab", "A", "Bb", "B", "C", "Db", "D", "Eb", "E" ] + "expected": ["F", "Gb", "G", "Ab", "A", "Bb", "B", "C", "Db", "D", "Eb", "E"] } ] }, @@ -39,15 +52,13 @@ "uuid": "7195998a-7be7-40c9-8877-a1d7949e061b", "reimplements": "6f5b1410-1dd7-4c6c-b410-6b7e986f6f1e", "description": "Simple major scale", - "comments": [ - "The simplest major scale, with no sharps or flats." - ], + "comments": ["The simplest major scale, with no sharps or flats."], "property": "interval", "input": { "tonic": "C", "intervals": "MMmMMMm" }, - "expected": [ "C", "D", "E", "F", "G", "A", "B", "C" ] + "expected": ["C", "D", "E", "F", "G", "A", "B", "C"] }, { "uuid": "fe853b97-1878-4090-b218-4029246abb91", @@ -58,7 +69,7 @@ "tonic": "G", "intervals": "MMmMMMm" }, - "expected": [ "G", "A", "B", "C", "D", "E", "F#", "G" ] + "expected": ["G", "A", "B", "C", "D", "E", "F#", "G"] }, { "uuid": "d60cb414-cc02-4fcb-ad7a-fc7ef0a9eead", @@ -69,7 +80,7 @@ "tonic": "F", "intervals": "MMmMMMm" }, - "expected": [ "F", "G", "A", "Bb", "C", "D", "E", "F" ] + "expected": ["F", "G", "A", "Bb", "C", "D", "E", "F"] }, { "uuid": "77dab9b3-1bbc-4f9a-afd8-06da693bcc67", @@ -80,7 +91,7 @@ "tonic": "f#", "intervals": "MmMMmMM" }, - "expected": [ "F#", "G#", "A", "B", "C#", "D", "E", "F#" ] + "expected": ["F#", "G#", "A", "B", "C#", "D", "E", "F#"] }, { "uuid": "5fa1728f-5b66-4b43-9b7c-84359b7069d4", @@ -91,7 +102,7 @@ "tonic": "bb", "intervals": "MmMMmMM" }, - "expected": [ "Bb", "C", "Db", "Eb", "F", "Gb", "Ab", "Bb" ] + "expected": ["Bb", "C", "Db", "Eb", "F", "Gb", "Ab", "Bb"] }, { "uuid": "f3f1c353-8f7b-4a85-a5b5-ae06c2645823", @@ -102,7 +113,7 @@ "tonic": "d", "intervals": "MmMMMmM" }, - "expected": [ "D", "E", "F", "G", "A", "B", "C", "D" ] + "expected": ["D", "E", "F", "G", "A", "B", "C", "D"] }, { "uuid": "5fe14e5a-3ddc-4202-a158-2c1158beb5d0", @@ -113,7 +124,7 @@ "tonic": "Eb", "intervals": "MMmMMmM" }, - "expected": [ "Eb", "F", "G", "Ab", "Bb", "C", "Db", "Eb" ] + "expected": ["Eb", "F", "G", "Ab", "Bb", "C", "Db", "Eb"] }, { "uuid": "e6307799-b7f6-43fc-a6d8-a4834d6e2bdb", @@ -124,7 +135,7 @@ "tonic": "a", "intervals": "MMMmMMm" }, - "expected": [ "A", "B", "C#", "D#", "E", "F#", "G#", "A" ] + "expected": ["A", "B", "C#", "D#", "E", "F#", "G#", "A"] }, { "uuid": "7c4a95cd-ecf4-448d-99bc-dbbca51856e0", @@ -135,7 +146,7 @@ "tonic": "e", "intervals": "mMMMmMM" }, - "expected": [ "E", "F", "G", "A", "B", "C", "D", "E" ] + "expected": ["E", "F", "G", "A", "B", "C", "D", "E"] }, { "uuid": "f476f9c9-5a13-473d-bb6c-f884cf8fd9f2", @@ -146,7 +157,7 @@ "tonic": "g", "intervals": "mMMmMMM" }, - "expected": [ "G", "Ab", "Bb", "C", "Db", "Eb", "F", "G" ] + "expected": ["G", "Ab", "Bb", "C", "Db", "Eb", "F", "G"] }, { "comments": [ @@ -160,7 +171,7 @@ "tonic": "d", "intervals": "MmMMmAm" }, - "expected": [ "D", "E", "F", "G", "A", "Bb", "Db", "D" ] + "expected": ["D", "E", "F", "G", "A", "Bb", "Db", "D"] }, { "uuid": "b28ecc18-88db-4fd5-a973-cfe6361e2b24", @@ -171,7 +182,7 @@ "tonic": "C", "intervals": "MmMmMmMm" }, - "expected": [ "C", "D", "D#", "F", "F#", "G#", "A", "B", "C" ] + "expected": ["C", "D", "D#", "F", "F#", "G#", "A", "B", "C"] }, { "uuid": "a1c7d333-6fb3-4f3b-9178-8a0cbe043134", @@ -182,7 +193,7 @@ "tonic": "Db", "intervals": "MMMMMM" }, - "expected": [ "Db", "Eb", "F", "G", "A", "B", "Db" ] + "expected": ["Db", "Eb", "F", "G", "A", "B", "Db"] }, { "uuid": "9acfd139-0781-4926-8273-66a478c3b287", @@ -193,7 +204,7 @@ "tonic": "A", "intervals": "MMAMA" }, - "expected": [ "A", "B", "C#", "E", "F#", "A" ] + "expected": ["A", "B", "C#", "E", "F#", "A"] }, { "uuid": "31c933ca-2251-4a5b-92dd-9d5831bc84ad", @@ -204,20 +215,18 @@ "tonic": "G", "intervals": "mAMMMmm" }, - "expected": [ "G", "G#", "B", "C#", "D#", "F", "F#", "G" ] + "expected": ["G", "G#", "B", "C#", "D#", "F", "F#", "G"] }, { "uuid": "6f5b1410-1dd7-4c6c-b410-6b7e986f6f1e", "description": "Simple major scale", - "comments": [ - "The simplest major scale, with no sharps or flats." - ], + "comments": ["The simplest major scale, with no sharps or flats."], "property": "interval", "input": { "tonic": "C", "intervals": "MMmMMMm" }, - "expected": [ "C", "D", "E", "F", "G", "A", "B" ] + "expected": ["C", "D", "E", "F", "G", "A", "B"] }, { "uuid": "13a92f89-a83e-40b5-b9d4-01136931ba02", @@ -227,7 +236,7 @@ "tonic": "G", "intervals": "MMmMMMm" }, - "expected": [ "G", "A", "B", "C", "D", "E", "F#" ] + "expected": ["G", "A", "B", "C", "D", "E", "F#"] }, { "uuid": "aa3320f6-a761-49a1-bcf6-978e0c81080a", @@ -237,7 +246,7 @@ "tonic": "F", "intervals": "MMmMMMm" }, - "expected": [ "F", "G", "A", "Bb", "C", "D", "E" ] + "expected": ["F", "G", "A", "Bb", "C", "D", "E"] }, { "uuid": "63daeb2f-c3f9-4c45-92be-5bf97f61ff94", @@ -247,7 +256,7 @@ "tonic": "f#", "intervals": "MmMMmMM" }, - "expected": [ "F#", "G#", "A", "B", "C#", "D", "E" ] + "expected": ["F#", "G#", "A", "B", "C#", "D", "E"] }, { "uuid": "616594d0-9c48-4301-949e-af1d4fad16fd", @@ -257,7 +266,7 @@ "tonic": "bb", "intervals": "MmMMmMM" }, - "expected": [ "Bb", "C", "Db", "Eb", "F", "Gb", "Ab" ] + "expected": ["Bb", "C", "Db", "Eb", "F", "Gb", "Ab"] }, { "uuid": "390bd12c-5ac7-4ec7-bdde-4e58d5c78b0a", @@ -267,7 +276,7 @@ "tonic": "d", "intervals": "MmMMMmM" }, - "expected": [ "D", "E", "F", "G", "A", "B", "C" ] + "expected": ["D", "E", "F", "G", "A", "B", "C"] }, { "uuid": "846d0862-0f3e-4f3b-8a2d-9cc74f017848", @@ -277,7 +286,7 @@ "tonic": "Eb", "intervals": "MMmMMmM" }, - "expected": [ "Eb", "F", "G", "Ab", "Bb", "C", "Db" ] + "expected": ["Eb", "F", "G", "Ab", "Bb", "C", "Db"] }, { "uuid": "7d49a8bb-b5f7-46ad-a207-83bd5032291a", @@ -287,7 +296,7 @@ "tonic": "a", "intervals": "MMMmMMm" }, - "expected": [ "A", "B", "C#", "D#", "E", "F#", "G#" ] + "expected": ["A", "B", "C#", "D#", "E", "F#", "G#"] }, { "uuid": "a4e4dac5-1891-4160-a19f-bb06d653d4d0", @@ -297,7 +306,7 @@ "tonic": "e", "intervals": "mMMMmMM" }, - "expected": [ "E", "F", "G", "A", "B", "C", "D" ] + "expected": ["E", "F", "G", "A", "B", "C", "D"] }, { "uuid": "ef3650af-90f8-4ad9-9ef6-fdbeae07dcaa", @@ -307,7 +316,7 @@ "tonic": "g", "intervals": "mMMmMMM" }, - "expected": [ "G", "Ab", "Bb", "C", "Db", "Eb", "F" ] + "expected": ["G", "Ab", "Bb", "C", "Db", "Eb", "F"] }, { "comments": [ @@ -320,7 +329,7 @@ "tonic": "d", "intervals": "MmMMmAm" }, - "expected": [ "D", "E", "F", "G", "A", "Bb", "Db" ] + "expected": ["D", "E", "F", "G", "A", "Bb", "Db"] }, { "uuid": "37114c0b-c54d-45da-9f4b-3848201470b0", @@ -330,7 +339,7 @@ "tonic": "C", "intervals": "MmMmMmMm" }, - "expected": [ "C", "D", "D#", "F", "F#", "G#", "A", "B" ] + "expected": ["C", "D", "D#", "F", "F#", "G#", "A", "B"] }, { "uuid": "496466e7-aa45-4bbd-a64d-f41030feed9c", @@ -340,7 +349,7 @@ "tonic": "Db", "intervals": "MMMMMM" }, - "expected": [ "Db", "Eb", "F", "G", "A", "B" ] + "expected": ["Db", "Eb", "F", "G", "A", "B"] }, { "uuid": "bee5d9ec-e226-47b6-b62b-847a9241f3cc", @@ -350,7 +359,7 @@ "tonic": "A", "intervals": "MMAMA" }, - "expected": [ "A", "B", "C#", "E", "F#" ] + "expected": ["A", "B", "C#", "E", "F#"] }, { "uuid": "dbee06a6-7535-4ab7-98e8-d8a36c8402d1", @@ -360,7 +369,7 @@ "tonic": "G", "intervals": "mAMMMmm" }, - "expected": [ "G", "G#", "B", "C#", "D#", "F", "F#" ] + "expected": ["G", "G#", "B", "C#", "D#", "F", "F#"] } ] } From afa5cecb498a6197cda6788a7bdff16981022bb5 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:24:35 +0100 Subject: [PATCH 39/58] series: format --- exercises/series/canonical-data.json | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/exercises/series/canonical-data.json b/exercises/series/canonical-data.json index fcf8632080..e58cace732 100644 --- a/exercises/series/canonical-data.json +++ b/exercises/series/canonical-data.json @@ -59,8 +59,16 @@ "series": "918493904243", "sliceLength": 5 }, - "expected": ["91849", "18493", "84939", "49390", - "93904", "39042", "90424", "04243"] + "expected": [ + "91849", + "18493", + "84939", + "49390", + "93904", + "39042", + "90424", + "04243" + ] }, { "uuid": "6d235d85-46cf-4fae-9955-14b6efef27cd", From 9083cd1b47bbc778e90b8ef7af831db6a8461623 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:25:17 +0100 Subject: [PATCH 40/58] sgf-parsing: format --- exercises/sgf-parsing/canonical-data.json | 354 +++++++++++----------- 1 file changed, 177 insertions(+), 177 deletions(-) diff --git a/exercises/sgf-parsing/canonical-data.json b/exercises/sgf-parsing/canonical-data.json index b12ea74782..cf9dccb548 100644 --- a/exercises/sgf-parsing/canonical-data.json +++ b/exercises/sgf-parsing/canonical-data.json @@ -1,188 +1,188 @@ { - "exercise": "sgf-parsing", - "cases": [ - { - "uuid": "2668d5dc-109f-4f71-b9d5-8d06b1d6f1cd", - "description": "empty input", - "property": "parse", - "input": { - "encoded": "" - }, - "expected": { - "error": "tree missing" - } - }, - { - "uuid": "84ded10a-94df-4a30-9457-b50ccbdca813", - "description": "tree with no nodes", - "property": "parse", - "input": { - "encoded": "()" - }, - "expected": { - "error": "tree with no nodes" - } - }, - { - "uuid": "0a6311b2-c615-4fa7-800e-1b1cbb68833d", - "description": "node without tree", - "property": "parse", - "input": { - "encoded": ";" - }, - "expected": { - "error": "tree missing" - } - }, - { - "uuid": "8c419ed8-28c4-49f6-8f2d-433e706110ef", - "description": "node without properties", - "property": "parse", - "input": { - "encoded": "(;)" - }, - "expected": { - "properties": {}, - "children": [] - } - }, - { - "uuid": "8209645f-32da-48fe-8e8f-b9b562c26b49", - "description": "single node tree", - "property": "parse", - "input": { - "encoded": "(;A[B])" - }, - "expected": { - "properties": { - "A": ["B"] - }, - "children": [] - } - }, - { - "uuid": "6c995856-b919-4c75-8fd6-c2c3c31b37dc", - "description": "multiple properties", - "property": "parse", - "input": { - "encoded": "(;A[b]C[d])" - }, - "expected": { - "properties": { - "A": ["b"], - "C": ["d"] - }, - "children": [] - } + "exercise": "sgf-parsing", + "cases": [ + { + "uuid": "2668d5dc-109f-4f71-b9d5-8d06b1d6f1cd", + "description": "empty input", + "property": "parse", + "input": { + "encoded": "" + }, + "expected": { + "error": "tree missing" + } + }, + { + "uuid": "84ded10a-94df-4a30-9457-b50ccbdca813", + "description": "tree with no nodes", + "property": "parse", + "input": { + "encoded": "()" + }, + "expected": { + "error": "tree with no nodes" + } + }, + { + "uuid": "0a6311b2-c615-4fa7-800e-1b1cbb68833d", + "description": "node without tree", + "property": "parse", + "input": { + "encoded": ";" + }, + "expected": { + "error": "tree missing" + } + }, + { + "uuid": "8c419ed8-28c4-49f6-8f2d-433e706110ef", + "description": "node without properties", + "property": "parse", + "input": { + "encoded": "(;)" + }, + "expected": { + "properties": {}, + "children": [] + } + }, + { + "uuid": "8209645f-32da-48fe-8e8f-b9b562c26b49", + "description": "single node tree", + "property": "parse", + "input": { + "encoded": "(;A[B])" + }, + "expected": { + "properties": { + "A": ["B"] }, - { - "uuid": "a771f518-ec96-48ca-83c7-f8d39975645f", - "description": "properties without delimiter", - "property": "parse", - "input": { - "encoded": "(;A)" - }, - "expected": { - "error": "properties without delimiter" - } + "children": [] + } + }, + { + "uuid": "6c995856-b919-4c75-8fd6-c2c3c31b37dc", + "description": "multiple properties", + "property": "parse", + "input": { + "encoded": "(;A[b]C[d])" + }, + "expected": { + "properties": { + "A": ["b"], + "C": ["d"] }, - { - "uuid": "6c02a24e-6323-4ed5-9962-187d19e36bc8", - "description": "all lowercase property", - "property": "parse", - "input": { - "encoded": "(;a[b])" - }, - "expected": { - "error": "property must be in uppercase" - } + "children": [] + } + }, + { + "uuid": "a771f518-ec96-48ca-83c7-f8d39975645f", + "description": "properties without delimiter", + "property": "parse", + "input": { + "encoded": "(;A)" + }, + "expected": { + "error": "properties without delimiter" + } + }, + { + "uuid": "6c02a24e-6323-4ed5-9962-187d19e36bc8", + "description": "all lowercase property", + "property": "parse", + "input": { + "encoded": "(;a[b])" + }, + "expected": { + "error": "property must be in uppercase" + } + }, + { + "uuid": "8772d2b1-3c57-405a-93ac-0703b671adc1", + "description": "upper and lowercase property", + "property": "parse", + "input": { + "encoded": "(;Aa[b])" + }, + "expected": { + "error": "property must be in uppercase" + } + }, + { + "uuid": "a759b652-240e-42ec-a6d2-3a08d834b9e2", + "description": "two nodes", + "property": "parse", + "input": { + "encoded": "(;A[B];B[C])" + }, + "expected": { + "properties": { + "A": ["B"] }, - { - "uuid": "8772d2b1-3c57-405a-93ac-0703b671adc1", - "description": "upper and lowercase property", - "property": "parse", - "input": { - "encoded": "(;Aa[b])" + "children": [ + { + "properties": { + "B": ["C"] }, - "expected": { - "error": "property must be in uppercase" - } + "children": [] + } + ] + } + }, + { + "uuid": "cc7c02bc-6097-42c4-ab88-a07cb1533d00", + "description": "two child trees", + "property": "parse", + "input": { + "encoded": "(;A[B](;B[C])(;C[D]))" + }, + "expected": { + "properties": { + "A": ["B"] }, - { - "uuid": "a759b652-240e-42ec-a6d2-3a08d834b9e2", - "description": "two nodes", - "property": "parse", - "input": { - "encoded": "(;A[B];B[C])" + "children": [ + { + "properties": { + "B": ["C"] }, - "expected": { - "properties": { - "A": ["B"] - }, - "children": [ - { - "properties": { - "B": ["C"] - }, - "children": [] - } - ] - } - }, - { - "uuid": "cc7c02bc-6097-42c4-ab88-a07cb1533d00", - "description": "two child trees", - "property": "parse", - "input": { - "encoded": "(;A[B](;B[C])(;C[D]))" + "children": [] + }, + { + "properties": { + "C": ["D"] }, - "expected": { - "properties": { - "A": ["B"] - }, - "children": [ - { - "properties": { - "B": ["C"] - }, - "children": [] - }, - { - "properties": { - "C": ["D"] - }, - "children": [] - } - ] - } + "children": [] + } + ] + } + }, + { + "uuid": "724eeda6-00db-41b1-8aa9-4d5238ca0130", + "description": "multiple property values", + "property": "parse", + "input": { + "encoded": "(;A[b][c][d])" + }, + "expected": { + "properties": { + "A": ["b", "c", "d"] }, - { - "uuid": "724eeda6-00db-41b1-8aa9-4d5238ca0130", - "description": "multiple property values", - "property": "parse", - "input": { - "encoded": "(;A[b][c][d])" - }, - "expected": { - "properties": { - "A": ["b", "c", "d"] - }, - "children": [] - } + "children": [] + } + }, + { + "uuid": "11c36323-93fc-495d-bb23-c88ee5844b8c", + "description": "escaped property", + "property": "parse", + "input": { + "encoded": "(;A[\\]b\\nc\\nd\\t\\te \\n\\]])" + }, + "expected": { + "properties": { + "A": ["]b\\nc\\nd e \\n]"] }, - { - "uuid": "11c36323-93fc-495d-bb23-c88ee5844b8c", - "description": "escaped property", - "property": "parse", - "input": { - "encoded": "(;A[\\]b\\nc\\nd\\t\\te \\n\\]])" - }, - "expected": { - "properties": { - "A": ["]b\\nc\\nd e \\n]"] - }, - "children": [] - } - } - ] + "children": [] + } + } + ] } From 4edc136575d00eb9c9c5962c607211c90e44f99d Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:25:31 +0100 Subject: [PATCH 41/58] simple-cipher: format --- exercises/simple-cipher/canonical-data.json | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/exercises/simple-cipher/canonical-data.json b/exercises/simple-cipher/canonical-data.json index 569cc3565f..93a2db9b05 100644 --- a/exercises/simple-cipher/canonical-data.json +++ b/exercises/simple-cipher/canonical-data.json @@ -1,11 +1,12 @@ { "exercise": "simple-cipher", - "comments": - ["Some of the strings used in this file are symbolic and do not represent their literal value. They are:", - "cipher.key - Represents the Cipher key", - "cipher.encode - Represents the output of the Cipher encode method", - "new - Represents the Cipher initialization", - "string.substring(start, length) - Represents a substring of 'string' that begins at index 'start' and is 'length' characters long"], + "comments": [ + "Some of the strings used in this file are symbolic and do not represent their literal value. They are:", + "cipher.key - Represents the Cipher key", + "cipher.encode - Represents the output of the Cipher encode method", + "new - Represents the Cipher initialization", + "string.substring(start, length) - Represents a substring of 'string' that begins at index 'start' and is 'length' characters long" + ], "cases": [ { "description": "Random key cipher", From d9856f8eaefdbfe36c155c5363dc68f112ec5a78 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:25:44 +0100 Subject: [PATCH 42/58] space-age: format --- exercises/space-age/canonical-data.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exercises/space-age/canonical-data.json b/exercises/space-age/canonical-data.json index d41fbf997e..81f5be711f 100644 --- a/exercises/space-age/canonical-data.json +++ b/exercises/space-age/canonical-data.json @@ -89,7 +89,9 @@ "planet": "Sun", "seconds": 680804807 }, - "expected": {"error": "not a planet"} + "expected": { + "error": "not a planet" + } } ] } From 0d72ce45a1d578c5aa0bb16d6f352ea96d374640 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:26:26 +0100 Subject: [PATCH 43/58] spiral-matirx: format --- exercises/spiral-matrix/canonical-data.json | 38 +++++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/exercises/spiral-matrix/canonical-data.json b/exercises/spiral-matrix/canonical-data.json index 2da984622e..aa44f92355 100644 --- a/exercises/spiral-matrix/canonical-data.json +++ b/exercises/spiral-matrix/canonical-data.json @@ -17,7 +17,7 @@ "input": { "size": 1 }, - "expected": [ [1] ] + "expected": [[1]] }, { "uuid": "cf05e42d-eb78-4098-a36e-cdaf0991bc48", @@ -26,8 +26,10 @@ "input": { "size": 2 }, - "expected": [ [1, 2] - , [4, 3] ] + "expected": [ + [1, 2], + [4, 3] + ] }, { "uuid": "1c475667-c896-4c23-82e2-e033929de939", @@ -36,9 +38,11 @@ "input": { "size": 3 }, - "expected": [ [1, 2, 3] - , [8, 9, 4] - , [7, 6, 5] ] + "expected": [ + [1, 2, 3], + [8, 9, 4], + [7, 6, 5] + ] }, { "uuid": "05ccbc48-d891-44f5-9137-f4ce462a759d", @@ -47,10 +51,12 @@ "input": { "size": 4 }, - "expected": [ [ 1, 2, 3, 4] - , [12, 13, 14, 5] - , [11, 16, 15, 6] - , [10, 9, 8, 7] ] + "expected": [ + [ 1, 2, 3, 4], + [12, 13, 14, 5], + [11, 16, 15, 6], + [10, 9, 8, 7] + ] }, { "uuid": "f4d2165b-1738-4e0c-bed0-c459045ae50d", @@ -59,11 +65,13 @@ "input": { "size": 5 }, - "expected": [ [ 1, 2, 3, 4, 5] - , [16, 17, 18, 19, 6] - , [15, 24, 25, 20, 7] - , [14, 23, 22, 21, 8] - , [13, 12, 11, 10, 9] ] + "expected": [ + [ 1, 2, 3, 4, 5], + [16, 17, 18, 19, 6], + [15, 24, 25, 20, 7], + [14, 23, 22, 21, 8], + [13, 12, 11, 10, 9] + ] } ] } From 5f7616efb05aec995fffb46295e8e7b27f60eaa8 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:27:04 +0100 Subject: [PATCH 44/58] tournament: format --- exercises/tournament/canonical-data.json | 32 +++++++++++++----------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/exercises/tournament/canonical-data.json b/exercises/tournament/canonical-data.json index 58a15b2ff0..a6238747d4 100644 --- a/exercises/tournament/canonical-data.json +++ b/exercises/tournament/canonical-data.json @@ -16,7 +16,9 @@ "input": { "rows": [] }, - "expected": [ "Team | MP | W | D | L | P" ] + "expected": [ + "Team | MP | W | D | L | P" + ] }, { "uuid": "1b4a8aef-0734-4007-80a2-0626178c88f4", @@ -31,8 +33,8 @@ "Team | MP | W | D | L | P", "Allegoric Alaskans | 1 | 1 | 0 | 0 | 3", "Blithering Badgers | 1 | 0 | 0 | 1 | 0" - ] - }, + ] + }, { "uuid": "5f45ac09-4efe-46e7-8ddb-75ad85f86e05", "description": "a win can also be expressed as a loss", @@ -46,8 +48,8 @@ "Team | MP | W | D | L | P", "Allegoric Alaskans | 1 | 1 | 0 | 0 | 3", "Blithering Badgers | 1 | 0 | 0 | 1 | 0" - ] - }, + ] + }, { "uuid": "fd297368-efa0-442d-9f37-dd3f9a437239", "description": "a different team can win", @@ -61,8 +63,8 @@ "Team | MP | W | D | L | P", "Blithering Badgers | 1 | 1 | 0 | 0 | 3", "Allegoric Alaskans | 1 | 0 | 0 | 1 | 0" - ] - }, + ] + }, { "uuid": "26c016f9-e753-4a93-94e9-842f7b4d70fc", "description": "a draw is one point each", @@ -76,8 +78,8 @@ "Team | MP | W | D | L | P", "Allegoric Alaskans | 1 | 0 | 1 | 0 | 1", "Blithering Badgers | 1 | 0 | 1 | 0 | 1" - ] - }, + ] + }, { "uuid": "731204f6-4f34-4928-97eb-1c307ba83e62", "description": "There can be more than one match", @@ -92,8 +94,8 @@ "Team | MP | W | D | L | P", "Allegoric Alaskans | 2 | 2 | 0 | 0 | 6", "Blithering Badgers | 2 | 0 | 0 | 2 | 0" - ] - }, + ] + }, { "uuid": "49dc2463-42af-4ea6-95dc-f06cc5776adf", "description": "There can be more than one winner", @@ -108,8 +110,8 @@ "Team | MP | W | D | L | P", "Allegoric Alaskans | 2 | 1 | 0 | 1 | 3", "Blithering Badgers | 2 | 1 | 0 | 1 | 3" - ] - }, + ] + }, { "uuid": "6d930f33-435c-4e6f-9e2d-63fa85ce7dc7", "description": "There can be more than two teams", @@ -126,8 +128,8 @@ "Allegoric Alaskans | 2 | 2 | 0 | 0 | 6", "Blithering Badgers | 2 | 1 | 0 | 1 | 3", "Courageous Californians | 2 | 0 | 0 | 2 | 0" - ] - }, + ] + }, { "uuid": "97022974-0c8a-4a50-8fe7-e36bdd8a5945", "description": "typical input", From 3e4e9c9975ea96a1d8e98876b8b9b06cb80a9bad Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:27:41 +0100 Subject: [PATCH 45/58] variable-length-quantity: format --- .../canonical-data.json | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/exercises/variable-length-quantity/canonical-data.json b/exercises/variable-length-quantity/canonical-data.json index 2cde144ead..a78d42e2ff 100644 --- a/exercises/variable-length-quantity/canonical-data.json +++ b/exercises/variable-length-quantity/canonical-data.json @@ -44,7 +44,7 @@ "input": { "integers": [128] }, - "expected": [129,0] + "expected": [129, 0] }, { "uuid": "63955a49-2690-4e22-a556-0040648d6b2d", @@ -170,7 +170,9 @@ "input": { "integers": [8192, 1193046, 268435455, 0, 16383, 16384] }, - "expected": [192, 0, 200, 232, 86, 255, 255, 255, 127, 0, 255, 127, 129, 128, 0] + "expected": [ + 192, 0, 200, 232, 86, 255, 255, 255, 127, 0, 255, 127, 129, 128, 0 + ] } ] }, @@ -229,7 +231,9 @@ "input": { "integers": [255] }, - "expected": {"error": "incomplete sequence"} + "expected": { + "error": "incomplete sequence" + } }, { "uuid": "aa378291-9043-4724-bc53-aca1b4a3fcb6", @@ -238,14 +242,18 @@ "input": { "integers": [128] }, - "expected": {"error": "incomplete sequence"} + "expected": { + "error": "incomplete sequence" + } }, { "uuid": "a91e6f5a-c64a-48e3-8a75-ce1a81e0ebee", "description": "multiple values", "property": "decode", "input": { - "integers": [192, 0, 200, 232, 86, 255, 255, 255, 127, 0, 255, 127, 129, 128, 0] + "integers": [ + 192, 0, 200, 232, 86, 255, 255, 255, 127, 0, 255, 127, 129, 128, 0 + ] }, "expected": [8192, 1193046, 268435455, 0, 16383, 16384] } From 131d57316403f27f4a7a8990b244b1463527bafd Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:28:12 +0100 Subject: [PATCH 46/58] word-search: format --- exercises/word-search/canonical-data.json | 114 +++++----------------- 1 file changed, 25 insertions(+), 89 deletions(-) diff --git a/exercises/word-search/canonical-data.json b/exercises/word-search/canonical-data.json index 641bc2c8f7..f80a28052e 100644 --- a/exercises/word-search/canonical-data.json +++ b/exercises/word-search/canonical-data.json @@ -1,20 +1,14 @@ { "exercise": "word-search", - "comments": [ - "Grid rows and columns are 1-indexed." - ], + "comments": ["Grid rows and columns are 1-indexed."], "cases": [ { "uuid": "b4057815-0d01-41f0-9119-6a91f54b2a0a", "description": "Should accept an initial game grid and a target search word", "property": "search", "input": { - "grid": [ - "jefblpepre" - ], - "wordsToSearchFor": [ - "clojure" - ] + "grid": ["jefblpepre"], + "wordsToSearchFor": ["clojure"] }, "expected": { "clojure": null @@ -25,12 +19,8 @@ "description": "Should locate one word written left to right", "property": "search", "input": { - "grid": [ - "clojurermt" - ], - "wordsToSearchFor": [ - "clojure" - ] + "grid": ["clojurermt"], + "wordsToSearchFor": ["clojure"] }, "expected": { "clojure": { @@ -50,12 +40,8 @@ "description": "Should locate the same word written left to right in a different position", "property": "search", "input": { - "grid": [ - "mtclojurer" - ], - "wordsToSearchFor": [ - "clojure" - ] + "grid": ["mtclojurer"], + "wordsToSearchFor": ["clojure"] }, "expected": { "clojure": { @@ -75,12 +61,8 @@ "description": "Should locate a different left to right word", "property": "search", "input": { - "grid": [ - "coffeelplx" - ], - "wordsToSearchFor": [ - "coffee" - ] + "grid": ["coffeelplx"], + "wordsToSearchFor": ["coffee"] }, "expected": { "coffee": { @@ -100,12 +82,8 @@ "description": "Should locate that different left to right word in a different position", "property": "search", "input": { - "grid": [ - "xcoffeezlp" - ], - "wordsToSearchFor": [ - "coffee" - ] + "grid": ["xcoffeezlp"], + "wordsToSearchFor": ["coffee"] }, "expected": { "coffee": { @@ -125,13 +103,8 @@ "description": "Should locate a left to right word in two line grid", "property": "search", "input": { - "grid": [ - "jefblpepre", - "tclojurerm" - ], - "wordsToSearchFor": [ - "clojure" - ] + "grid": ["jefblpepre", "tclojurerm"], + "wordsToSearchFor": ["clojure"] }, "expected": { "clojure": { @@ -151,14 +124,8 @@ "description": "Should locate a left to right word in three line grid", "property": "search", "input": { - "grid": [ - "camdcimgtc", - "jefblpepre", - "clojurermt" - ], - "wordsToSearchFor": [ - "clojure" - ] + "grid": ["camdcimgtc", "jefblpepre", "clojurermt"], + "wordsToSearchFor": ["clojure"] }, "expected": { "clojure": { @@ -190,9 +157,7 @@ "jalaycalmp", "clojurermt" ], - "wordsToSearchFor": [ - "clojure" - ] + "wordsToSearchFor": ["clojure"] }, "expected": { "clojure": { @@ -224,9 +189,7 @@ "clojurermt", "jalaycalmp" ], - "wordsToSearchFor": [ - "clojure" - ] + "wordsToSearchFor": ["clojure"] }, "expected": { "clojure": { @@ -258,9 +221,7 @@ "clojurermt", "jalaycalmp" ], - "wordsToSearchFor": [ - "fortran" - ] + "wordsToSearchFor": ["fortran"] }, "expected": { "fortran": { @@ -292,10 +253,7 @@ "jalaycalmp", "clojurermt" ], - "wordsToSearchFor": [ - "fortran", - "clojure" - ] + "wordsToSearchFor": ["fortran", "clojure"] }, "expected": { "clojure": { @@ -325,12 +283,8 @@ "description": "Should locate a single word written right to left", "property": "search", "input": { - "grid": [ - "rixilelhrs" - ], - "wordsToSearchFor": [ - "elixir" - ] + "grid": ["rixilelhrs"], + "wordsToSearchFor": ["elixir"] }, "expected": { "elixir": { @@ -362,10 +316,7 @@ "jalaycalmp", "clojurermt" ], - "wordsToSearchFor": [ - "elixir", - "clojure" - ] + "wordsToSearchFor": ["elixir", "clojure"] }, "expected": { "clojure": { @@ -407,11 +358,7 @@ "jalaycalmp", "clojurermt" ], - "wordsToSearchFor": [ - "clojure", - "elixir", - "ecmascript" - ] + "wordsToSearchFor": ["clojure", "elixir", "ecmascript"] }, "expected": { "clojure": { @@ -463,12 +410,7 @@ "jalaycalmp", "clojurermt" ], - "wordsToSearchFor": [ - "clojure", - "elixir", - "ecmascript", - "rust" - ] + "wordsToSearchFor": ["clojure", "elixir", "ecmascript", "rust"] }, "expected": { "clojure": { @@ -530,13 +472,7 @@ "jalaycalmp", "clojurermt" ], - "wordsToSearchFor": [ - "clojure", - "elixir", - "ecmascript", - "rust", - "java" - ] + "wordsToSearchFor": ["clojure", "elixir", "ecmascript", "rust", "java"] }, "expected": { "clojure": { From 510e72e576f14e59f965ee8c9e89051fc5213d0e Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 13 Jan 2022 14:28:24 +0100 Subject: [PATCH 47/58] wordy: format --- exercises/wordy/canonical-data.json | 32 +++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/exercises/wordy/canonical-data.json b/exercises/wordy/canonical-data.json index 83bc1efca9..06f296acc1 100644 --- a/exercises/wordy/canonical-data.json +++ b/exercises/wordy/canonical-data.json @@ -148,7 +148,9 @@ "input": { "question": "What is 52 cubed?" }, - "expected": {"error": "unknown operation"} + "expected": { + "error": "unknown operation" + } }, { "uuid": "8a7e85a8-9e7b-4d46-868f-6d759f4648f8", @@ -157,7 +159,9 @@ "input": { "question": "Who is the President of the United States?" }, - "expected": {"error": "unknown operation"} + "expected": { + "error": "unknown operation" + } }, { "uuid": "42d78b5f-dbd7-4cdb-8b30-00f794bb24cf", @@ -166,7 +170,9 @@ "input": { "question": "What is 1 plus?" }, - "expected": {"error": "syntax error"} + "expected": { + "error": "syntax error" + } }, { "uuid": "c2c3cbfc-1a72-42f2-b597-246e617e66f5", @@ -175,7 +181,9 @@ "input": { "question": "What is?" }, - "expected": {"error": "syntax error"} + "expected": { + "error": "syntax error" + } }, { "uuid": "4b3df66d-6ed5-4c95-a0a1-d38891fbdab6", @@ -184,7 +192,9 @@ "input": { "question": "What is 1 plus plus 2?" }, - "expected": {"error": "syntax error"} + "expected": { + "error": "syntax error" + } }, { "uuid": "6abd7a50-75b4-4665-aa33-2030fd08bab1", @@ -193,7 +203,9 @@ "input": { "question": "What is 1 plus 2 1?" }, - "expected": {"error": "syntax error"} + "expected": { + "error": "syntax error" + } }, { "uuid": "10a56c22-e0aa-405f-b1d2-c642d9c4c9de", @@ -202,7 +214,9 @@ "input": { "question": "What is 1 2 plus?" }, - "expected": {"error": "syntax error"} + "expected": { + "error": "syntax error" + } }, { "uuid": "0035bc63-ac43-4bb5-ad6d-e8651b7d954e", @@ -211,7 +225,9 @@ "input": { "question": "What is plus 1 2?" }, - "expected": {"error": "syntax error"} + "expected": { + "error": "syntax error" + } } ] } From 387594c0e9bb569cdfa1aaa01d614bf57ea6efe2 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Fri, 14 Jan 2022 10:21:32 +0100 Subject: [PATCH 48/58] Apply review comments --- exercises/book-store/canonical-data.json | 4 +--- exercises/change/canonical-data.json | 4 +--- exercises/isogram/canonical-data.json | 4 +--- exercises/reverse-string/canonical-data.json | 4 +--- exercises/variable-length-quantity/canonical-data.json | 8 ++------ 5 files changed, 6 insertions(+), 18 deletions(-) diff --git a/exercises/book-store/canonical-data.json b/exercises/book-store/canonical-data.json index 21f2069258..0197002f36 100644 --- a/exercises/book-store/canonical-data.json +++ b/exercises/book-store/canonical-data.json @@ -171,9 +171,7 @@ "Suggested grouping, [[1,2,3,4],[1,2,3,5],[1,2,3,4],[1,2,3,5],[1,2,3],[1,2,3]]." ], "input": { - "basket": [ - 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5 - ] + "basket": [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5] }, "expected": 14560 }, diff --git a/exercises/change/canonical-data.json b/exercises/change/canonical-data.json index b5f2db3eae..291d82ce93 100644 --- a/exercises/change/canonical-data.json +++ b/exercises/change/canonical-data.json @@ -64,9 +64,7 @@ "coins": [1, 2, 5, 10, 20, 50, 100], "target": 999 }, - "expected": [ - 2, 2, 5, 20, 20, 50, 100, 100, 100, 100, 100, 100, 100, 100, 100 - ] + "expected": [2, 2, 5, 20, 20, 50, 100, 100, 100, 100, 100, 100, 100, 100, 100] }, { "uuid": "f79d2e9b-0ae3-4d6a-bb58-dc978b0dba28", diff --git a/exercises/isogram/canonical-data.json b/exercises/isogram/canonical-data.json index de5d4913c6..60ed3d8506 100644 --- a/exercises/isogram/canonical-data.json +++ b/exercises/isogram/canonical-data.json @@ -1,8 +1,6 @@ { "exercise": "isogram", - "comments": [ - "An isogram is a word or phrase without a repeating letter." - ], + "comments": ["An isogram is a word or phrase without a repeating letter."], "cases": [ { "uuid": "a0e97d2d-669e-47c7-8134-518a1e2c4555", diff --git a/exercises/reverse-string/canonical-data.json b/exercises/reverse-string/canonical-data.json index 3608727afb..cc23c6a47e 100644 --- a/exercises/reverse-string/canonical-data.json +++ b/exercises/reverse-string/canonical-data.json @@ -1,8 +1,6 @@ { "exercise": "reverse-string", - "comments": [ - "If property based testing tools are available, a good property to test is reversing a string twice: reverse(reverse(string)) == string" - ], + "comments": ["If property based testing tools are available, a good property to test is reversing a string twice: reverse(reverse(string)) == string"], "cases": [ { "uuid": "c3b7d806-dced-49ee-8543-933fd1719b1c", diff --git a/exercises/variable-length-quantity/canonical-data.json b/exercises/variable-length-quantity/canonical-data.json index a78d42e2ff..1fcae474b8 100644 --- a/exercises/variable-length-quantity/canonical-data.json +++ b/exercises/variable-length-quantity/canonical-data.json @@ -170,9 +170,7 @@ "input": { "integers": [8192, 1193046, 268435455, 0, 16383, 16384] }, - "expected": [ - 192, 0, 200, 232, 86, 255, 255, 255, 127, 0, 255, 127, 129, 128, 0 - ] + "expected": [192, 0, 200, 232, 86, 255, 255, 255, 127, 0, 255, 127, 129, 128, 0] } ] }, @@ -251,9 +249,7 @@ "description": "multiple values", "property": "decode", "input": { - "integers": [ - 192, 0, 200, 232, 86, 255, 255, 255, 127, 0, 255, 127, 129, 128, 0 - ] + "integers": [192, 0, 200, 232, 86, 255, 255, 255, 127, 0, 255, 127, 129, 128, 0] }, "expected": [8192, 1193046, 268435455, 0, 16383, 16384] } From 7c78d2c2be4f501c9b0e3737c65205c872e57077 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Fri, 14 Jan 2022 10:23:09 +0100 Subject: [PATCH 49/58] Fix error expected value indentation --- README.md | 4 +++- exercises/affine-cipher/canonical-data.json | 8 ++++++-- exercises/collatz-conjecture/canonical-data.json | 16 ++++++++++++---- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7531b87450..a9f7b63930 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,9 @@ The file format is described in [canonical-data.schema.json](./canonical-data.sc "firstName": "HAL", "lastName": "9000" }, - "expected": { "error": "You should never bar a number" } + "expected": { + "error": "You should never bar a number" + } } ] } diff --git a/exercises/affine-cipher/canonical-data.json b/exercises/affine-cipher/canonical-data.json index 23d63b2db4..21216d560c 100644 --- a/exercises/affine-cipher/canonical-data.json +++ b/exercises/affine-cipher/canonical-data.json @@ -125,7 +125,9 @@ "b": 17 } }, - "expected": { "error": "a and m must be coprime." } + "expected": { + "error": "a and m must be coprime." + } } ] }, @@ -222,7 +224,9 @@ "b": 5 } }, - "expected": { "error": "a and m must be coprime." } + "expected": { + "error": "a and m must be coprime." + } } ] } diff --git a/exercises/collatz-conjecture/canonical-data.json b/exercises/collatz-conjecture/canonical-data.json index a0cd5652ee..1572f98ea9 100644 --- a/exercises/collatz-conjecture/canonical-data.json +++ b/exercises/collatz-conjecture/canonical-data.json @@ -44,7 +44,9 @@ "input": { "number": 0 }, - "expected": { "error": "Only positive numbers are allowed" } + "expected": { + "error": "Only positive numbers are allowed" + } }, { "uuid": "2187673d-77d6-4543-975e-66df6c50e2da", @@ -55,7 +57,9 @@ "input": { "number": 0 }, - "expected": { "error": "Only positive integers are allowed" } + "expected": { + "error": "Only positive integers are allowed" + } }, { "uuid": "c6c795bf-a288-45e9-86a1-841359ad426d", @@ -64,7 +68,9 @@ "input": { "number": -15 }, - "expected": { "error": "Only positive numbers are allowed" } + "expected": { + "error": "Only positive numbers are allowed" + } }, { "uuid": "ec11f479-56bc-47fd-a434-bcd7a31a7a2e", @@ -75,7 +81,9 @@ "input": { "number": -15 }, - "expected": { "error": "Only positive integers are allowed" } + "expected": { + "error": "Only positive integers are allowed" + } } ] } From 83c1467c90c100b2718962d59107c0bbb7cd52cb Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Wed, 19 Jan 2022 10:16:10 +0100 Subject: [PATCH 50/58] bowling: use consistent array formatting --- exercises/bowling/canonical-data.json | 92 +++++++-------------------- 1 file changed, 23 insertions(+), 69 deletions(-) diff --git a/exercises/bowling/canonical-data.json b/exercises/bowling/canonical-data.json index b2ff54dd18..c8e8d13150 100644 --- a/exercises/bowling/canonical-data.json +++ b/exercises/bowling/canonical-data.json @@ -25,9 +25,7 @@ "description": "should be able to score a game with all zeros", "property": "score", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - ] + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }, "expected": 0 }, @@ -36,9 +34,7 @@ "description": "should be able to score a game with no strikes or spares", "property": "score", "input": { - "previousRolls": [ - 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6 - ] + "previousRolls": [3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6] }, "expected": 90 }, @@ -47,9 +43,7 @@ "description": "a spare followed by zeros is worth ten points", "property": "score", "input": { - "previousRolls": [ - 6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - ] + "previousRolls": [6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }, "expected": 10 }, @@ -58,9 +52,7 @@ "description": "points scored in the roll after a spare are counted twice", "property": "score", "input": { - "previousRolls": [ - 6, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - ] + "previousRolls": [6, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }, "expected": 16 }, @@ -69,9 +61,7 @@ "description": "consecutive spares each get a one roll bonus", "property": "score", "input": { - "previousRolls": [ - 5, 5, 3, 7, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - ] + "previousRolls": [5, 5, 3, 7, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }, "expected": 31 }, @@ -80,9 +70,7 @@ "description": "a spare in the last frame gets a one roll bonus that is counted once", "property": "score", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 7 - ] + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 7] }, "expected": 17 }, @@ -91,9 +79,7 @@ "description": "a strike earns ten points in a frame with a single roll", "property": "score", "input": { - "previousRolls": [ - 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - ] + "previousRolls": [10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }, "expected": 10 }, @@ -102,9 +88,7 @@ "description": "points scored in the two rolls after a strike are counted twice as a bonus", "property": "score", "input": { - "previousRolls": [ - 10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - ] + "previousRolls": [10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }, "expected": 26 }, @@ -122,9 +106,7 @@ "description": "a strike in the last frame gets a two roll bonus that is counted once", "property": "score", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 1 - ] + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 1] }, "expected": 18 }, @@ -133,9 +115,7 @@ "description": "rolling a spare with the two roll bonus does not get a bonus roll", "property": "score", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 3 - ] + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 7, 3] }, "expected": 20 }, @@ -144,9 +124,7 @@ "description": "strikes with the two roll bonus do not get bonus rolls", "property": "score", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10 - ] + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10] }, "expected": 30 }, @@ -166,9 +144,7 @@ "description": "a strike with the one roll bonus after a spare in the last frame does not get a bonus", "property": "score", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 10 - ] + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 10] }, "expected": 20 }, @@ -222,9 +198,7 @@ "description": "bonus roll after a strike in the last frame cannot score more than 10 points", "property": "roll", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10 - ], + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10], "roll": 11 }, "expected": { @@ -236,9 +210,7 @@ "description": "two bonus rolls after a strike in the last frame cannot score more than 10 points", "property": "roll", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5 - ], + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5], "roll": 6 }, "expected": { @@ -250,9 +222,7 @@ "description": "two bonus rolls after a strike in the last frame can score more than 10 points if one is a strike", "property": "score", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 6 - ] + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 6] }, "expected": 26 }, @@ -261,9 +231,7 @@ "description": "the second bonus rolls after a strike in the last frame cannot be a strike if the first one is not a strike", "property": "roll", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6 - ], + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6], "roll": 10 }, "expected": { @@ -275,9 +243,7 @@ "description": "second bonus roll after a strike in the last frame cannot score more than 10 points", "property": "roll", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10 - ], + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10], "roll": 11 }, "expected": { @@ -311,9 +277,7 @@ "description": "cannot roll if game already has ten frames", "property": "roll", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - ], + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "roll": 0 }, "expected": { @@ -325,9 +289,7 @@ "description": "bonus rolls for a strike in the last frame must be rolled before score can be calculated", "property": "score", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10 - ] + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10] }, "expected": { "error": "Score cannot be taken until the end of the game" @@ -338,9 +300,7 @@ "description": "both bonus rolls for a strike in the last frame must be rolled before score can be calculated", "property": "score", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10 - ] + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10] }, "expected": { "error": "Score cannot be taken until the end of the game" @@ -351,9 +311,7 @@ "description": "bonus roll for a spare in the last frame must be rolled before score can be calculated", "property": "score", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3 - ] + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3] }, "expected": { "error": "Score cannot be taken until the end of the game" @@ -364,9 +322,7 @@ "description": "cannot roll after bonus roll for spare", "property": "roll", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 2 - ], + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 3, 2], "roll": 2 }, "expected": { @@ -378,9 +334,7 @@ "description": "cannot roll after bonus rolls for strike", "property": "roll", "input": { - "previousRolls": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 3, 2 - ], + "previousRolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 3, 2], "roll": 2 }, "expected": { From 9725d3f8b25dc1d2bf0a12ee6f254310b84db21f Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Wed, 19 Jan 2022 10:17:07 +0100 Subject: [PATCH 51/58] scale-generator: use consistent array formatting --- exercises/scale-generator/canonical-data.json | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/exercises/scale-generator/canonical-data.json b/exercises/scale-generator/canonical-data.json index 3508d7f797..0e8061fd91 100644 --- a/exercises/scale-generator/canonical-data.json +++ b/exercises/scale-generator/canonical-data.json @@ -15,20 +15,7 @@ "input": { "tonic": "C" }, - "expected": [ - "C", - "C#", - "D", - "D#", - "E", - "F", - "F#", - "G", - "G#", - "A", - "A#", - "B" - ] + "expected": ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"] }, { "uuid": "af8381de-9a72-4efd-823a-48374dbfe76f", From 2b786c0934d7a44701d7887bf0dedf8a6924fcf7 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Wed, 19 Jan 2022 10:19:49 +0100 Subject: [PATCH 52/58] word-search: use consistent array formatting --- exercises/word-search/canonical-data.json | 110 +++++++++++++++++----- 1 file changed, 86 insertions(+), 24 deletions(-) diff --git a/exercises/word-search/canonical-data.json b/exercises/word-search/canonical-data.json index f80a28052e..a70a8bef2d 100644 --- a/exercises/word-search/canonical-data.json +++ b/exercises/word-search/canonical-data.json @@ -7,8 +7,12 @@ "description": "Should accept an initial game grid and a target search word", "property": "search", "input": { - "grid": ["jefblpepre"], - "wordsToSearchFor": ["clojure"] + "grid": [ + "jefblpepre" + ], + "wordsToSearchFor": [ + "clojure" + ] }, "expected": { "clojure": null @@ -19,8 +23,12 @@ "description": "Should locate one word written left to right", "property": "search", "input": { - "grid": ["clojurermt"], - "wordsToSearchFor": ["clojure"] + "grid": [ + "clojurermt" + ], + "wordsToSearchFor": [ + "clojure" + ] }, "expected": { "clojure": { @@ -40,8 +48,12 @@ "description": "Should locate the same word written left to right in a different position", "property": "search", "input": { - "grid": ["mtclojurer"], - "wordsToSearchFor": ["clojure"] + "grid": [ + "mtclojurer" + ], + "wordsToSearchFor": [ + "clojure" + ] }, "expected": { "clojure": { @@ -61,8 +73,12 @@ "description": "Should locate a different left to right word", "property": "search", "input": { - "grid": ["coffeelplx"], - "wordsToSearchFor": ["coffee"] + "grid": [ + "coffeelplx" + ], + "wordsToSearchFor": [ + "coffee" + ] }, "expected": { "coffee": { @@ -82,8 +98,12 @@ "description": "Should locate that different left to right word in a different position", "property": "search", "input": { - "grid": ["xcoffeezlp"], - "wordsToSearchFor": ["coffee"] + "grid": [ + "xcoffeezlp" + ], + "wordsToSearchFor": [ + "coffee" + ] }, "expected": { "coffee": { @@ -103,8 +123,13 @@ "description": "Should locate a left to right word in two line grid", "property": "search", "input": { - "grid": ["jefblpepre", "tclojurerm"], - "wordsToSearchFor": ["clojure"] + "grid": [ + "jefblpepre", + "tclojurerm" + ], + "wordsToSearchFor": [ + "clojure" + ] }, "expected": { "clojure": { @@ -124,8 +149,14 @@ "description": "Should locate a left to right word in three line grid", "property": "search", "input": { - "grid": ["camdcimgtc", "jefblpepre", "clojurermt"], - "wordsToSearchFor": ["clojure"] + "grid": [ + "camdcimgtc", + "jefblpepre", + "clojurermt" + ], + "wordsToSearchFor": [ + "clojure" + ] }, "expected": { "clojure": { @@ -157,7 +188,9 @@ "jalaycalmp", "clojurermt" ], - "wordsToSearchFor": ["clojure"] + "wordsToSearchFor": [ + "clojure" + ] }, "expected": { "clojure": { @@ -189,7 +222,9 @@ "clojurermt", "jalaycalmp" ], - "wordsToSearchFor": ["clojure"] + "wordsToSearchFor": [ + "clojure" + ] }, "expected": { "clojure": { @@ -221,7 +256,9 @@ "clojurermt", "jalaycalmp" ], - "wordsToSearchFor": ["fortran"] + "wordsToSearchFor": [ + "fortran" + ] }, "expected": { "fortran": { @@ -253,7 +290,10 @@ "jalaycalmp", "clojurermt" ], - "wordsToSearchFor": ["fortran", "clojure"] + "wordsToSearchFor": [ + "fortran", + "clojure" + ] }, "expected": { "clojure": { @@ -283,8 +323,12 @@ "description": "Should locate a single word written right to left", "property": "search", "input": { - "grid": ["rixilelhrs"], - "wordsToSearchFor": ["elixir"] + "grid": [ + "rixilelhrs" + ], + "wordsToSearchFor": [ + "elixir" + ] }, "expected": { "elixir": { @@ -316,7 +360,10 @@ "jalaycalmp", "clojurermt" ], - "wordsToSearchFor": ["elixir", "clojure"] + "wordsToSearchFor": [ + "elixir", + "clojure" + ] }, "expected": { "clojure": { @@ -358,7 +405,11 @@ "jalaycalmp", "clojurermt" ], - "wordsToSearchFor": ["clojure", "elixir", "ecmascript"] + "wordsToSearchFor": [ + "clojure", + "elixir", + "ecmascript" + ] }, "expected": { "clojure": { @@ -410,7 +461,12 @@ "jalaycalmp", "clojurermt" ], - "wordsToSearchFor": ["clojure", "elixir", "ecmascript", "rust"] + "wordsToSearchFor": [ + "clojure", + "elixir", + "ecmascript", + "rust" + ] }, "expected": { "clojure": { @@ -472,7 +528,13 @@ "jalaycalmp", "clojurermt" ], - "wordsToSearchFor": ["clojure", "elixir", "ecmascript", "rust", "java"] + "wordsToSearchFor": [ + "clojure", + "elixir", + "ecmascript", + "rust", + "java" + ] }, "expected": { "clojure": { From dd229f569da7c0845c92731d52030cd3349e6db7 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Tue, 25 Jan 2022 11:52:08 +0100 Subject: [PATCH 53/58] Ignore manually formatted files --- .prettierignore | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..b99e33a1c9 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,33 @@ +exercises/allergies/canonical-data.json +exercises/book-store/canonical-data.json +exercises/bowling/canonical-data.json +exercises/change/canonical-data.json +exercises/connect/canonical-data.json +exercises/diamond/canonical-data.json +exercises/dominoes/canonical-data.json +exercises/flatten-array/canonical-data.json +exercises/forth/canonical-data.json +exercises/go-counting/canonical-data.json +exercises/grep/canonical-data.json +exercises/house/canonical-data.json +exercises/kindergarten-garden/canonical-data.json +exercises/knapsack/canonical-data.json +exercises/markdown/canonical-data.json +exercises/minesweeper/canonical-data.json +exercises/ocr-numbers/canonical-data.json +exercises/pascals-triangle/canonical-data.json +exercises/poker/canonical-data.json +exercises/pov/canonical-data.json +exercises/pythagorean-triplet/canonical-data.json +exercises/rectangles/canonical-data.json +exercises/reverse-string/canonical-data.json +exercises/roman-numerals/canonical-data.json +exercises/rotational-cipher/canonical-data.json +exercises/saddle-points/canonical-data.json +exercises/scale-generator/canonical-data.json +exercises/sieve/canonical-data.json +exercises/spiral-matrix/canonical-data.json +exercises/tournament/canonical-data.json +exercises/transpose/canonical-data.json +exercises/variable-length-quantity/canonical-data.json +exercises/word-search/canonical-data.json From 6ee1de225f1a306f0b8bde904d425db55484e045 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Tue, 25 Jan 2022 11:53:20 +0100 Subject: [PATCH 54/58] Format non-exercise JSON files --- ...anonical-data-changed-scenarios-after.json | 4 +- ...nonical-data-changed-scenarios-before.json | 4 +- .../canonical-data-deleted-case.json | 4 +- .../canonical-data-mutated-and-deleted.json | 4 +- .../canonical-data-mutated.json | 4 +- .../canonical-data-new-test.json | 4 +- .../immutability-check/canonical-data.json | 4 +- canonical-data.schema.json | 319 +++++++++--------- 8 files changed, 170 insertions(+), 177 deletions(-) diff --git a/.github/workflow-tests/immutability-check/canonical-data-changed-scenarios-after.json b/.github/workflow-tests/immutability-check/canonical-data-changed-scenarios-after.json index c13fdabbba..bcb930bf77 100644 --- a/.github/workflow-tests/immutability-check/canonical-data-changed-scenarios-after.json +++ b/.github/workflow-tests/immutability-check/canonical-data-changed-scenarios-after.json @@ -69,7 +69,7 @@ "uuid": "0f998f19-69ee-4c64-80ef-01b086feab80", "description": "Imaginary part of a number with real and imaginary part", "property": "imaginary", - "input": { + "input": { "z": [1, 2] }, "expected": 2 @@ -331,7 +331,7 @@ "uuid": "6d96d4c6-2edb-445b-94a2-7de6d4caaf60", "description": "Euler's identity/formula", "property": "exp", - "input": { + "input": { "z": [0, "pi"] }, "expected": [-1, 0] diff --git a/.github/workflow-tests/immutability-check/canonical-data-changed-scenarios-before.json b/.github/workflow-tests/immutability-check/canonical-data-changed-scenarios-before.json index 9b4f65bfba..5009510f0c 100644 --- a/.github/workflow-tests/immutability-check/canonical-data-changed-scenarios-before.json +++ b/.github/workflow-tests/immutability-check/canonical-data-changed-scenarios-before.json @@ -69,7 +69,7 @@ "uuid": "0f998f19-69ee-4c64-80ef-01b086feab80", "description": "Imaginary part of a number with real and imaginary part", "property": "imaginary", - "input": { + "input": { "z": [1, 2] }, "expected": 2 @@ -331,7 +331,7 @@ "uuid": "6d96d4c6-2edb-445b-94a2-7de6d4caaf60", "description": "Euler's identity/formula", "property": "exp", - "input": { + "input": { "z": [0, "pi"] }, "expected": [-1, 0] diff --git a/.github/workflow-tests/immutability-check/canonical-data-deleted-case.json b/.github/workflow-tests/immutability-check/canonical-data-deleted-case.json index 83cd8e1861..30a91be09d 100644 --- a/.github/workflow-tests/immutability-check/canonical-data-deleted-case.json +++ b/.github/workflow-tests/immutability-check/canonical-data-deleted-case.json @@ -59,7 +59,7 @@ "uuid": "0f998f19-69ee-4c64-80ef-01b086feab80", "description": "Imaginary part of a number with real and imaginary part", "property": "imaginary", - "input": { + "input": { "z": [1, 2] }, "expected": 2 @@ -321,7 +321,7 @@ "uuid": "6d96d4c6-2edb-445b-94a2-7de6d4caaf60", "description": "Euler's identity/formula", "property": "exp", - "input": { + "input": { "z": [0, "pi"] }, "expected": [-1, 0] diff --git a/.github/workflow-tests/immutability-check/canonical-data-mutated-and-deleted.json b/.github/workflow-tests/immutability-check/canonical-data-mutated-and-deleted.json index f93719ffb3..b21d197635 100644 --- a/.github/workflow-tests/immutability-check/canonical-data-mutated-and-deleted.json +++ b/.github/workflow-tests/immutability-check/canonical-data-mutated-and-deleted.json @@ -68,7 +68,7 @@ "uuid": "0f998f19-69ee-4c64-80ef-01b086feab80", "description": "Imaginary part of a number with real and imaginary part", "property": "imaginary", - "input": { + "input": { "z": [1, 2] }, "expected": 2 @@ -320,7 +320,7 @@ "uuid": "6d96d4c6-2edb-445b-94a2-7de6d4caaf60", "description": "Euler's identity/formula", "property": "exp", - "input": { + "input": { "z": [0, "pi"] }, "expected": [-1, 0] diff --git a/.github/workflow-tests/immutability-check/canonical-data-mutated.json b/.github/workflow-tests/immutability-check/canonical-data-mutated.json index f6d695512d..9fbaa16f41 100644 --- a/.github/workflow-tests/immutability-check/canonical-data-mutated.json +++ b/.github/workflow-tests/immutability-check/canonical-data-mutated.json @@ -68,7 +68,7 @@ "uuid": "0f998f19-69ee-4c64-80ef-01b086feab80", "description": "Imaginary part of a number with real and imaginary part", "property": "imaginary", - "input": { + "input": { "z": [1, 2] }, "expected": 2 @@ -330,7 +330,7 @@ "uuid": "6d96d4c6-2edb-445b-94a2-7de6d4caaf60", "description": "Euler's identity/formula", "property": "exp", - "input": { + "input": { "z": [0, "pi"] }, "expected": [-1, 0] diff --git a/.github/workflow-tests/immutability-check/canonical-data-new-test.json b/.github/workflow-tests/immutability-check/canonical-data-new-test.json index 96f8cfc6a6..c48e6f2646 100644 --- a/.github/workflow-tests/immutability-check/canonical-data-new-test.json +++ b/.github/workflow-tests/immutability-check/canonical-data-new-test.json @@ -77,7 +77,7 @@ "uuid": "0f998f19-69ee-4c64-80ef-01b086feab80", "description": "Imaginary part of a number with real and imaginary part", "property": "imaginary", - "input": { + "input": { "z": [1, 2] }, "expected": 2 @@ -339,7 +339,7 @@ "uuid": "6d96d4c6-2edb-445b-94a2-7de6d4caaf60", "description": "Euler's identity/formula", "property": "exp", - "input": { + "input": { "z": [0, "pi"] }, "expected": [-1, 0] diff --git a/.github/workflow-tests/immutability-check/canonical-data.json b/.github/workflow-tests/immutability-check/canonical-data.json index 8233b1d2e7..2be34cbfe6 100644 --- a/.github/workflow-tests/immutability-check/canonical-data.json +++ b/.github/workflow-tests/immutability-check/canonical-data.json @@ -68,7 +68,7 @@ "uuid": "0f998f19-69ee-4c64-80ef-01b086feab80", "description": "Imaginary part of a number with real and imaginary part", "property": "imaginary", - "input": { + "input": { "z": [1, 2] }, "expected": 2 @@ -330,7 +330,7 @@ "uuid": "6d96d4c6-2edb-445b-94a2-7de6d4caaf60", "description": "Euler's identity/formula", "property": "exp", - "input": { + "input": { "z": [0, "pi"] }, "expected": [-1, 0] diff --git a/canonical-data.schema.json b/canonical-data.schema.json index f665ac0de5..84a02f90e1 100644 --- a/canonical-data.schema.json +++ b/canonical-data.schema.json @@ -1,166 +1,159 @@ { - "comments": - [ " This is a JSON Schema for 'canonical-data.json' files. " - , " " - , " It enforces just a general structure for all exercises, " - , " optimising for the ability to represent example-based tests" - , " of the form 'function (input) == output'. Future expansions" - , " may allow for other types of tests such as property-based. " - , " " - , " The only thing enforced regarding how test data should be " - , " structured is the error encoding, because it was agreed " - , " and it doesn't restrict flexibility in a significant way. " - , " " - , " Standardized property names may help when automatically " - , " deriving JSON parsers in some languages, so we followed " - , " a few conventions from the 'Google JSON Style Guide'. " - , " " - , " Additionally, this schema strictly enforces letters, in " - , " lowerCamelCase, for naming the 'property' being tested. We " - , " expect this regularity will allow an easier automatic " - , " generation of function's names in test generators, " - , " slightly reducing the amount of manually generated code. " - ], - - "$schema": "http://json-schema.org/draft-04/schema#", - - "self": { "vendor" : "io.exercism" - , "name" : "canonical-data" - , "format" : "jsonschema" - , "version": "1-1-0" - }, - - "$ref": "#/definitions/canonicalData", - - "definitions":{ - - "canonicalData": - { "description": "This is the top-level file structure" - , "type" : "object" - , "required" : ["exercise", "cases"] - , "properties" : - { "exercise" : { "$ref": "#/definitions/exercise" } - , "comments" : { "$ref": "#/definitions/comments" } - , "cases" : { "$ref": "#/definitions/testGroup" } - } - , "additionalProperties": false - }, - - "exercise": - { "description": "Exercise's slug (kebab-case)" - , "type" : "string" - , "pattern" : "^[a-z]+(-[a-z]+)*$" - }, - - "comments": - { "description": "An array of strings to fake multi-line comments" - , "type" : "array" - , "items" : { "type": "string" } - , "minItems" : 1 - }, - - "testGroup": - { "description": "An array of labeled test items" - , "type" : "array" - , "items" : { "$ref": "#/definitions/labeledTestItem" } - , "minItems" : 1 - }, - - "labeledTestItem": - { "description": "A single test or group of tests with a description" - , "oneOf": [ { "$ref": "#/definitions/labeledTest" } - , { "$ref": "#/definitions/labeledTestGroup" } - ] - }, - - "labeledTest": - { "description": "A single test with a description" - , "type" : "object" - , "required" : ["uuid", "description", "property", "input", "expected"] - , "properties" : - { "uuid" : { "$ref": "#/definitions/uuid" } - , "reimplements": { "$ref": "#/definitions/uuid" } - , "description" : { "$ref": "#/definitions/description" } - , "scenarios" : { "$ref": "#/definitions/scenarios" } - , "comments" : { "$ref": "#/definitions/comments" } - , "property" : { "$ref": "#/definitions/property" } - , "input" : { "$ref": "#/definitions/input" } - , "expected" : { "$ref": "#/definitions/expected" } - } - , "additionalProperties": false - }, - - "labeledTestGroup": - { "description": "A group of tests with a description" - , "type" : "object" - , "required" : ["description", "cases"] - , "properties" : - { "description": { "$ref": "#/definitions/description" } - , "scenarios" : { "$ref": "#/definitions/scenarios" } - , "comments" : { "$ref": "#/definitions/comments" } - , "cases" : { "$ref": "#/definitions/testGroup" } - } - , "additionalProperties": false - }, - - "description": - { "description": "A short, clear, one-line description" - , "type" : "string" - }, - - "uuid": - { "description": "A version 4 UUID (compliant with RFC 4122) in the canonical textual representation" - , "type" : "string" - , "pattern" : "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" - }, - - "scenario": - { "description": "An identifier for a specific scenario (kebab-case)" - , "type": "string" - , "enum": - [ "big-integer" - , "floating-point" - , "immutable" - , "library-test" - , "local-scope" - , "unicode" - , "input-validation" - , "runtime-validation" - ] - }, - - "scenarios": - { "description": "An array of scenarios that can be used to include/exclude test cases" - , "type" : "array" - , "items" : { "$ref": "#/definitions/scenario" } - , "minItems" : 0 - }, - - "property": - { "description": "A letters-only, lowerCamelCase property name" - , "type" : "string" - , "pattern" : "^[a-z]+([A-Z][a-z]+)*[A-Z]?$" - }, - - "input": - { "description": "The inputs to a test case" - , "type" : "object" - }, - - "expected": - { "description": "The expected return value of a test case" - , "properties": - { "error": { "$ref": "#/definitions/error" } - } - , "dependencies": - { "error": { "maxProperties": 1 } - } - }, - - "error": - { "description": "A message describing an error condition" - , "type" : "string" - } - + "comments": [ + " This is a JSON Schema for 'canonical-data.json' files. ", + " ", + " It enforces just a general structure for all exercises, ", + " optimising for the ability to represent example-based tests", + " of the form 'function (input) == output'. Future expansions", + " may allow for other types of tests such as property-based. ", + " ", + " The only thing enforced regarding how test data should be ", + " structured is the error encoding, because it was agreed ", + " and it doesn't restrict flexibility in a significant way. ", + " ", + " Standardized property names may help when automatically ", + " deriving JSON parsers in some languages, so we followed ", + " a few conventions from the 'Google JSON Style Guide'. ", + " ", + " Additionally, this schema strictly enforces letters, in ", + " lowerCamelCase, for naming the 'property' being tested. We ", + " expect this regularity will allow an easier automatic ", + " generation of function's names in test generators, ", + " slightly reducing the amount of manually generated code. " + ], + + "$schema": "http://json-schema.org/draft-04/schema#", + + "self": { + "vendor": "io.exercism", + "name": "canonical-data", + "format": "jsonschema", + "version": "1-1-0" + }, + + "$ref": "#/definitions/canonicalData", + + "definitions": { + "canonicalData": { + "description": "This is the top-level file structure", + "type": "object", + "required": ["exercise", "cases"], + "properties": { + "exercise": { "$ref": "#/definitions/exercise" }, + "comments": { "$ref": "#/definitions/comments" }, + "cases": { "$ref": "#/definitions/testGroup" } + }, + "additionalProperties": false + }, + + "exercise": { + "description": "Exercise's slug (kebab-case)", + "type": "string", + "pattern": "^[a-z]+(-[a-z]+)*$" + }, + + "comments": { + "description": "An array of strings to fake multi-line comments", + "type": "array", + "items": { "type": "string" }, + "minItems": 1 + }, + + "testGroup": { + "description": "An array of labeled test items", + "type": "array", + "items": { "$ref": "#/definitions/labeledTestItem" }, + "minItems": 1 + }, + + "labeledTestItem": { + "description": "A single test or group of tests with a description", + "oneOf": [ + { "$ref": "#/definitions/labeledTest" }, + { "$ref": "#/definitions/labeledTestGroup" } + ] + }, + + "labeledTest": { + "description": "A single test with a description", + "type": "object", + "required": ["uuid", "description", "property", "input", "expected"], + "properties": { + "uuid": { "$ref": "#/definitions/uuid" }, + "reimplements": { "$ref": "#/definitions/uuid" }, + "description": { "$ref": "#/definitions/description" }, + "scenarios": { "$ref": "#/definitions/scenarios" }, + "comments": { "$ref": "#/definitions/comments" }, + "property": { "$ref": "#/definitions/property" }, + "input": { "$ref": "#/definitions/input" }, + "expected": { "$ref": "#/definitions/expected" } + }, + "additionalProperties": false + }, + + "labeledTestGroup": { + "description": "A group of tests with a description", + "type": "object", + "required": ["description", "cases"], + "properties": { + "description": { "$ref": "#/definitions/description" }, + "scenarios": { "$ref": "#/definitions/scenarios" }, + "comments": { "$ref": "#/definitions/comments" }, + "cases": { "$ref": "#/definitions/testGroup" } + }, + "additionalProperties": false + }, + + "description": { + "description": "A short, clear, one-line description", + "type": "string" + }, + + "uuid": { + "description": "A version 4 UUID (compliant with RFC 4122) in the canonical textual representation", + "type": "string", + "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" + }, + + "scenario": { + "description": "An identifier for a specific scenario (kebab-case)", + "type": "string", + "enum": [ + "big-integer", + "floating-point", + "immutable", + "library-test", + "local-scope", + "unicode", + "input-validation", + "runtime-validation" + ] + }, + + "scenarios": { + "description": "An array of scenarios that can be used to include/exclude test cases", + "type": "array", + "items": { "$ref": "#/definitions/scenario" }, + "minItems": 0 + }, + + "property": { + "description": "A letters-only, lowerCamelCase property name", + "type": "string", + "pattern": "^[a-z]+([A-Z][a-z]+)*[A-Z]?$" + }, + + "input": { "description": "The inputs to a test case", "type": "object" }, + + "expected": { + "description": "The expected return value of a test case", + "properties": { "error": { "$ref": "#/definitions/error" } }, + "dependencies": { "error": { "maxProperties": 1 } } + }, + + "error": { + "description": "A message describing an error condition", + "type": "string" } } +} From 467b34b30b98a663b0c126595a4d6212d0591ced Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Tue, 25 Jan 2022 12:01:32 +0100 Subject: [PATCH 55/58] Allow testing of formatting --- package.json | 7 ++- yarn.lock | 128 +++++++++++++++++++++++++++++++++------------------ 2 files changed, 87 insertions(+), 48 deletions(-) diff --git a/package.json b/package.json index e88f674204..a71747582d 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,14 @@ "author": "Tejas Bubane ", "license": "MIT", "dependencies": { - "ajv-cli": "^3.3.0" + "ajv-cli": "^3.3.0", + "prettier": "^2.5.1" }, "scripts": { "test": "ajv -s canonical-data.schema.json -d \"exercises/*/canonical-data.json\"", - "test-one": "ajv -s canonical-data.schema.json -d" + "test-one": "ajv -s canonical-data.schema.json -d", + "test-format": "prettier --check **/*.json", + "format": "prettier --write **/*.json" }, "resolutions": { "minimist": "^1.2.3" diff --git a/yarn.lock b/yarn.lock index 1c812daea6..40a76524cb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4,11 +4,12 @@ abbrev@1: version "1.1.1" - resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + resolved "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz" + integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== ajv-cli@^3.3.0: version "3.3.0" - resolved "https://registry.yarnpkg.com/ajv-cli/-/ajv-cli-3.3.0.tgz#dd72207f5395051db7d620ab7d4da1cec3d50f06" + resolved "https://registry.npmjs.org/ajv-cli/-/ajv-cli-3.3.0.tgz" integrity sha512-4eiNNjDlainn5Rm+rU3egxLUUxzevcB+gviBLs9sm6etHNrE7l2JSQ3yoz5hE+eqrth3pTygELOafhSIO8Hiig== dependencies: ajv "^6.7.0" @@ -22,14 +23,16 @@ ajv-cli@^3.3.0: ajv-pack@^0.3.0: version "0.3.1" - resolved "https://registry.yarnpkg.com/ajv-pack/-/ajv-pack-0.3.1.tgz#b72c4d4219e3928e62842d742ded93bf50796560" + resolved "https://registry.npmjs.org/ajv-pack/-/ajv-pack-0.3.1.tgz" + integrity sha1-tyxNQhnjko5ihC10Le2Tv1B5ZWA= dependencies: js-beautify "^1.6.4" require-from-string "^1.2.0" ajv@^5.0.0: version "5.5.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" + resolved "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz" + integrity sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU= dependencies: co "^4.6.0" fast-deep-equal "^1.0.0" @@ -38,7 +41,7 @@ ajv@^5.0.0: ajv@^6.7.0: version "6.12.6" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== dependencies: fast-deep-equal "^3.1.1" @@ -48,48 +51,56 @@ ajv@^6.7.0: argparse@^1.0.7: version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + resolved "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz" integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== dependencies: sprintf-js "~1.0.2" balanced-match@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= bluebird@^3.0.5: version "3.5.1" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9" + resolved "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz" + integrity sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA== brace-expansion@^1.1.7: version "1.1.8" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz" + integrity sha1-wHshHHyVLsH479Uad+8NHTmQopI= dependencies: balanced-match "^1.0.0" concat-map "0.0.1" co@^4.6.0: version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + resolved "https://registry.npmjs.org/co/-/co-4.6.0.tgz" + integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= commander@^2.9.0: version "2.12.2" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.12.2.tgz#0f5946c427ed9ec0d91a46bb9def53e54650e555" + resolved "https://registry.npmjs.org/commander/-/commander-2.12.2.tgz" + integrity sha512-BFnaq5ZOGcDN7FlrtBT4xxkgIToalIIxwjxLWVJ8bGTpe1LroqMiqQXdA7ygc7CRvaYS+9zfPGFnJqFSayx+AA== concat-map@0.0.1: version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= config-chain@~1.1.5: version "1.1.11" - resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.11.tgz#aba09747dfbe4c3e70e766a6e41586e1859fc6f2" + resolved "https://registry.npmjs.org/config-chain/-/config-chain-1.1.11.tgz" + integrity sha1-q6CXR9++TD5w52am5BWG4YWfxvI= dependencies: ini "^1.3.4" proto-list "~1.2.1" editorconfig@^0.13.2: version "0.13.3" - resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-0.13.3.tgz#e5219e587951d60958fd94ea9a9a008cdeff1b34" + resolved "https://registry.npmjs.org/editorconfig/-/editorconfig-0.13.3.tgz" + integrity sha512-WkjsUNVCu+ITKDj73QDvi0trvpdDWdkDyHybDGSXPfekLCqwmpD7CP7iPbvBgosNuLcI96XTDwNa75JyFl7tEQ== dependencies: bluebird "^3.0.5" commander "^2.9.0" @@ -99,41 +110,44 @@ editorconfig@^0.13.2: esprima@^4.0.0: version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== fast-deep-equal@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" + resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz" + integrity sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8= fast-deep-equal@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" + resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz" integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= fast-deep-equal@^3.1.1: version "3.1.3" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== fast-json-patch@^2.0.0: version "2.2.1" - resolved "https://registry.yarnpkg.com/fast-json-patch/-/fast-json-patch-2.2.1.tgz#18150d36c9ab65c7209e7d4eb113f4f8eaabe6d9" + resolved "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-2.2.1.tgz" integrity sha512-4j5uBaTnsYAV5ebkidvxiLUYOwjQ+JSFljeqfTxCrH9bDmlCQaOJFS84oDJ2rAXZq2yskmk3ORfoP9DCwqFNig== dependencies: fast-deep-equal "^2.0.1" fast-json-stable-stringify@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + resolved "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz" + integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= fs.realpath@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= glob@^7.1.0: version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + resolved "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== dependencies: fs.realpath "^1.0.0" @@ -145,23 +159,26 @@ glob@^7.1.0: inflight@^1.0.4: version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= dependencies: once "^1.3.0" wrappy "1" inherits@2: version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" + integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= ini@^1.3.4: version "1.3.7" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.7.tgz#a09363e1911972ea16d7a8851005d84cf09a9a84" + resolved "https://registry.npmjs.org/ini/-/ini-1.3.7.tgz" integrity sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ== js-beautify@^1.6.4: version "1.7.5" - resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.7.5.tgz#69d9651ef60dbb649f65527b53674950138a7919" + resolved "https://registry.npmjs.org/js-beautify/-/js-beautify-1.7.5.tgz" + integrity sha512-9OhfAqGOrD7hoQBLJMTA+BKuKmoEtTJXzZ7WDF/9gvjtey1koVLuZqIY6c51aPDjbNdNtIXAkiWKVhziawE9Og== dependencies: config-chain "~1.1.5" editorconfig "^0.13.2" @@ -170,7 +187,7 @@ js-beautify@^1.6.4: js-yaml@^3.13.1: version "3.14.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz" integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== dependencies: argparse "^1.0.7" @@ -178,35 +195,39 @@ js-yaml@^3.13.1: json-schema-migrate@^0.2.0: version "0.2.0" - resolved "https://registry.yarnpkg.com/json-schema-migrate/-/json-schema-migrate-0.2.0.tgz#ba47a5b0072fc72396460e1bd60b44d52178bbc6" + resolved "https://registry.npmjs.org/json-schema-migrate/-/json-schema-migrate-0.2.0.tgz" + integrity sha1-ukelsAcvxyOWRg4b1gtE1SF4u8Y= dependencies: ajv "^5.0.0" json-schema-traverse@^0.3.0: version "0.3.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" + resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz" + integrity sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A= json-schema-traverse@^0.4.1: version "0.4.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== json5@^2.1.3: version "2.1.3" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.3.tgz#c9b0f7fa9233bfe5807fe66fcf3a5617ed597d43" + resolved "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz" integrity sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA== dependencies: minimist "^1.2.5" lru-cache@^3.2.0: version "3.2.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-3.2.0.tgz#71789b3b7f5399bec8565dda38aa30d2a097efee" + resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-3.2.0.tgz" + integrity sha1-cXibO39Tmb7IVl3aOKow0qCX7+4= dependencies: pseudomap "^1.0.1" minimatch@^3.0.4: version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== dependencies: brace-expansion "^1.1.7" @@ -217,63 +238,78 @@ minimist@0.0.8, minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5: mkdirp@~0.5.0: version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= dependencies: minimist "0.0.8" nopt@~3.0.1: version "3.0.6" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" + resolved "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz" + integrity sha1-xkZdvwirzU2zWTF/eaxopkayj/k= dependencies: abbrev "1" once@^1.3.0: version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" path-is-absolute@^1.0.0: version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +prettier@^2.5.1: + version "2.5.1" + resolved "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz" + integrity sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg== proto-list@~1.2.1: version "1.2.4" - resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" + resolved "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz" + integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk= pseudomap@^1.0.1: version "1.0.2" - resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + resolved "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz" + integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= punycode@^2.1.0: version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== require-from-string@^1.2.0: version "1.2.1" - resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-1.2.1.tgz#529c9ccef27380adfec9a2f965b649bbee636418" + resolved "https://registry.npmjs.org/require-from-string/-/require-from-string-1.2.1.tgz" + integrity sha1-UpyczvJzgK3+yaL5ZbZJu+5jZBg= semver@^5.1.0: version "5.4.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" + resolved "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz" + integrity sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg== sigmund@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590" + resolved "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz" + integrity sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA= sprintf-js@~1.0.2: version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= uri-js@^4.2.2: version "4.4.0" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.0.tgz#aa714261de793e8a82347a7bcc9ce74e86f28602" + resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz" integrity sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g== dependencies: punycode "^2.1.0" wrappy@1: version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= From 2be235c866c9e614002084a633b6469eca7b7421 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Tue, 25 Jan 2022 12:03:09 +0100 Subject: [PATCH 56/58] Add CI to formatting --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ package.json | 3 +-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2dd50bd89a..112aa4283b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,3 +126,28 @@ jobs: with: globs: | **/*.md + + json-lint: + name: Lint json files + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Cache yarn + uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install dependencies + run: yarn install + + - name: Verify that json files are formatted correctly + run: yarn test-json-formatting diff --git a/package.json b/package.json index a71747582d..48ebcd93eb 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,7 @@ "scripts": { "test": "ajv -s canonical-data.schema.json -d \"exercises/*/canonical-data.json\"", "test-one": "ajv -s canonical-data.schema.json -d", - "test-format": "prettier --check **/*.json", - "format": "prettier --write **/*.json" + "test-json-formatting": "prettier --check **/*.json" }, "resolutions": { "minimist": "^1.2.3" From ddfc0f9f23b6d9fcbab06be98dae878388d898b0 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Tue, 1 Feb 2022 12:42:39 +0100 Subject: [PATCH 57/58] Add command to format JSON --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 48ebcd93eb..ed217f9067 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "scripts": { "test": "ajv -s canonical-data.schema.json -d \"exercises/*/canonical-data.json\"", "test-one": "ajv -s canonical-data.schema.json -d", - "test-json-formatting": "prettier --check **/*.json" + "test-json-formatting": "prettier --check **/*.json", + "format-json": "prettier --write **/*.json" }, "resolutions": { "minimist": "^1.2.3" From fbd495f606e14ee8261c319cc0da5611d42a1a06 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Tue, 1 Feb 2022 12:42:46 +0100 Subject: [PATCH 58/58] Add documentation on how to format JSON --- CONTRIBUTING.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c2802c3e95..300a498cd3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,13 +22,14 @@ This guide covers several common scenarios pertaining to **improving the languag * [Track Anatomy](#track-anatomy) * [Starting a New Track](#starting-a-new-track) * [Beta-Testing a Language Track](#beta-testing-a-language-track) -* [Useful Tidbits](#useful-tidbits) +* [Useful Tidbits](#useful-tidbits) * [Pull Request Guidelines](#pull-request-guidelines) * [Anatomy of an Exercise](#anatomy-of-an-exercise) * [Track configuration file (config.json)](#track-configuration-file) * [Track-Level Linting With Configlet](#track-level-linting-with-configlet) * [Git Basics](#git-basics) * [Improving Consistency By Extracting Shared Test Data](#improving-consistency-by-extracting-shared-test-data) + * [Formatting](#formatting) ## We Will Gladly Help You Help Us @@ -301,6 +302,18 @@ TODO: add more sections: We are maintaining this section, since many open issues link to it. +## Formatting + +This repository uses [prettier][prettier] to automatically format its JSON files. +If you've added or modified a JSON file, you can format it using: + +```shell +yarn install +yarn format-json +``` + +Note: if you use VS Code as your editor, you can install the [prettier plugin][prettier-vs-code] to automatically handle formatting for you. + [contributing]: https://exercism.org/contributing [support-chat]: https://gitter.im/exercism/support [exercism-issues]: https://github.com/exercism/exercism/issues @@ -322,3 +335,5 @@ We are maintaining this section, since many open issues link to it. [git-basics]: https://github.com/exercism/legacy-docs/blob/main/contributing/git-basics.md [improve-exercise-metadata]: https://github.com/exercism/legacy-docs/blob/main/you-can-help/improve-exercise-metadata.md [legacy-docs]: https://github.com/exercism/legacy-docs +[prettier]: https://prettier.io/ +[prettier-vs-code]: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode