From f87663ae14bb1344d30a80e7d90e7154593b1a27 Mon Sep 17 00:00:00 2001 From: rbasso Date: Tue, 7 Mar 2017 04:15:03 +0900 Subject: [PATCH 1/2] change: Make canonical-data.json compliant --- exercises/change/canonical-data.json | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/exercises/change/canonical-data.json b/exercises/change/canonical-data.json index 349760e010..9f0ebe24eb 100644 --- a/exercises/change/canonical-data.json +++ b/exercises/change/canonical-data.json @@ -1,6 +1,7 @@ { - "find_fewest_coins": { - "description": [ + "exercise": "change", + "version": "1.0.0", + "comments": [ "Given an infinite supply of coins with different values, ", "find the smallest number of coins needed to make a desired ", "amount of change." @@ -8,64 +9,73 @@ "cases": [ { "description": "single coin change", + "property": "findFewestCoins", "coins": [1, 5, 10, 25, 100], "target": 25, "expected": [25] }, { "description": "multiple coin change", + "property": "findFewestCoins", "coins": [1, 5, 10, 25, 100], "target": 15, "expected": [5, 10] }, { "description": "change with Lilliputian Coins", + "property": "findFewestCoins", "coins": [1, 4, 15, 20, 50], "target": 23, "expected": [4, 4, 15] }, { "description": "change with Lower Elbonia Coins", + "property": "findFewestCoins", "coins": [1, 5, 10, 21, 25], "target": 63, "expected": [21, 21, 21] }, { "description": "large target values", + "property": "findFewestCoins", "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] }, { "description": "possible change without unit coins available", + "property": "findFewestCoins", "coins": [2, 5, 10, 20, 50], "target": 21, "expected": [2, 2, 2, 5, 10] }, { "description": "no coins make 0 change", + "property": "findFewestCoins", "coins": [1, 5, 10, 21, 25], "target": 0, "expected": [] }, { "description": "error testing for change smaller than the smallest of coins", + "property": "findFewestCoins", "coins": [5, 10], "target": 3, "expected": -1 }, { "description": "error if no combination can add up to target", + "property": "findFewestCoins", "coins": [5, 10], "target": 94, "expected": -1 }, { "description": "cannot find negative change values", + "property": "findFewestCoins", "coins": [1, 2, 5], "target": -5, "expected": -1 } ] - } } From 3d8b5b3d21b381eaa27bbb489fb24badd6514ecc Mon Sep 17 00:00:00 2001 From: rbasso Date: Tue, 7 Mar 2017 04:21:49 +0900 Subject: [PATCH 2/2] change: Fix canonical-data.json formatting --- exercises/change/canonical-data.json | 156 ++++++++++++++------------- 1 file changed, 79 insertions(+), 77 deletions(-) diff --git a/exercises/change/canonical-data.json b/exercises/change/canonical-data.json index 9f0ebe24eb..d1c95f928b 100644 --- a/exercises/change/canonical-data.json +++ b/exercises/change/canonical-data.json @@ -1,81 +1,83 @@ { "exercise": "change", "version": "1.0.0", - "comments": [ - "Given an infinite supply of coins with different values, ", - "find the smallest number of coins needed to make a desired ", - "amount of change." - ], - "cases": [ - { - "description": "single coin change", - "property": "findFewestCoins", - "coins": [1, 5, 10, 25, 100], - "target": 25, - "expected": [25] - }, - { - "description": "multiple coin change", - "property": "findFewestCoins", - "coins": [1, 5, 10, 25, 100], - "target": 15, - "expected": [5, 10] - }, - { - "description": "change with Lilliputian Coins", - "property": "findFewestCoins", - "coins": [1, 4, 15, 20, 50], - "target": 23, - "expected": [4, 4, 15] - }, - { - "description": "change with Lower Elbonia Coins", - "property": "findFewestCoins", - "coins": [1, 5, 10, 21, 25], - "target": 63, - "expected": [21, 21, 21] - }, - { - "description": "large target values", - "property": "findFewestCoins", - "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] - }, - { - "description": "possible change without unit coins available", - "property": "findFewestCoins", - "coins": [2, 5, 10, 20, 50], - "target": 21, - "expected": [2, 2, 2, 5, 10] - }, - { - "description": "no coins make 0 change", - "property": "findFewestCoins", - "coins": [1, 5, 10, 21, 25], - "target": 0, - "expected": [] - }, - { - "description": "error testing for change smaller than the smallest of coins", - "property": "findFewestCoins", - "coins": [5, 10], - "target": 3, - "expected": -1 - }, - { - "description": "error if no combination can add up to target", - "property": "findFewestCoins", - "coins": [5, 10], - "target": 94, - "expected": -1 - }, - { - "description": "cannot find negative change values", - "property": "findFewestCoins", - "coins": [1, 2, 5], - "target": -5, - "expected": -1 - } - ] + "comments": [ + "Given an infinite supply of coins with different values, ", + "find the smallest number of coins needed to make a desired ", + "amount of change." + ], + "cases": [ + { + "description": "single coin change", + "property": "findFewestCoins", + "coins": [1, 5, 10, 25, 100], + "target": 25, + "expected": [25] + }, + { + "description": "multiple coin change", + "property": "findFewestCoins", + "coins": [1, 5, 10, 25, 100], + "target": 15, + "expected": [5, 10] + }, + { + "description": "change with Lilliputian Coins", + "property": "findFewestCoins", + "coins": [1, 4, 15, 20, 50], + "target": 23, + "expected": [4, 4, 15] + }, + { + "description": "change with Lower Elbonia Coins", + "property": "findFewestCoins", + "coins": [1, 5, 10, 21, 25], + "target": 63, + "expected": [21, 21, 21] + }, + { + "description": "large target values", + "property": "findFewestCoins", + "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 ] + }, + { + "description": "possible change without unit coins available", + "property": "findFewestCoins", + "coins": [2, 5, 10, 20, 50], + "target": 21, + "expected": [2, 2, 2, 5, 10] + }, + { + "description": "no coins make 0 change", + "property": "findFewestCoins", + "coins": [1, 5, 10, 21, 25], + "target": 0, + "expected": [] + }, + { + "description": "error testing for change smaller than the smallest of coins", + "property": "findFewestCoins", + "coins": [5, 10], + "target": 3, + "expected": -1 + }, + { + "description": "error if no combination can add up to target", + "property": "findFewestCoins", + "coins": [5, 10], + "target": 94, + "expected": -1 + }, + { + "description": "cannot find negative change values", + "property": "findFewestCoins", + "coins": [1, 2, 5], + "target": -5, + "expected": -1 + } + ] }