From 2fef02083cd8df78b7d289985f1a0d572e1d89af Mon Sep 17 00:00:00 2001 From: rbasso Date: Fri, 10 Mar 2017 22:59:11 +0900 Subject: [PATCH 1/2] list-ops: Make canonical-data.json compliant --- exercises/list-ops/canonical-data.json | 39 ++++++++++++++++++++------ 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/exercises/list-ops/canonical-data.json b/exercises/list-ops/canonical-data.json index 744386cdc0..985f6d350c 100644 --- a/exercises/list-ops/canonical-data.json +++ b/exercises/list-ops/canonical-data.json @@ -1,101 +1,116 @@ { - "#": [ + "exercise": "list-ops", + "version": "1.0.0", + "comments": [ "Though there are no specifications here for dealing with large lists,", "implementers may add tests for handling large lists to ensure that the", "solutions have thought about performance concerns." ], - "append": { + "cases": [ + { "description": "append entries to a list and return the new list", "cases": [ { "description": "empty lists", + "property": "append", "list1": [], "list2": [], "expected": [] }, { "description": "empty list to list", + "property": "append", "list1": [], "list2": [1,2,3,4], "expected": [1,2,3,4] }, { "description": "non-empty lists", + "property": "append", "list1": [1,2], "list2": [2,3,4,5], "expected": [1,2,2,3,4,5] } ] }, - "concat": { + { "description": "concat lists and lists of list into a new list", "cases": [ { "description": "empty list", + "property": "concat", "lists": [], "expected": [] }, { "description": "list of lists", + "property": "concat", "lists": [[1,2],[3],[],[4,5,6]], "expected": [1,2,3,4,5,6] } ] }, - "filter": { + { "description": "filter list returning only values that satisfy the filter function", "cases": [ { "description": "empty list", + "property": "filter", "list": [], "function": "value modulo 2 == 1", "expected": [] }, { "description": "non-empty list", + "property": "filter", "list": [1,2,3,5], "function": "value modulo 2 == 1", "expected": [1,3,5] } ] }, - "length": { + { "description": "returns the length of a list", "cases": [ { "description": "empty list", + "property": "length", "list": [], "expected": 0 }, { "description": "non-empty list", + "property": "length", "list": [1,2,3,4], "expected": 4 } ] }, - "map": { + { "description": "return a list of elements whos values equal the list value transformed by the mapping function", "cases": [ { "description": "empty list", + "property": "map", "list": [], "function": "value + 1", "expected": [] }, { "description": "non-empty list", + "property": "map", "list": [1,3,5,7], "function": "value + 1", "expected": [2,4,6,8] } ] }, - "foldl": { + { "description": "folds (reduces) the given list from the left with a function", "cases": [ { "description": "empty list", + "property": "foldl", "list": [], "initial": 2, "function": "value / accumulator", @@ -103,6 +118,7 @@ }, { "description": "division of integers", + "property": "foldl", "list": [1,2,3,4], "initial": 24, "function": "value / accumulator", @@ -110,11 +126,12 @@ } ] }, - "foldr": { + { "description": "folds (reduces) the given list from the right with a function", "cases": [ { "description": "empty list", + "property": "foldr", "list": [], "initial": 2, "function": "value / accumulator", @@ -122,6 +139,7 @@ }, { "description": "division of integers", + "property": "foldr", "list": [1,2,3,4], "initial": 24, "function": "value / accumulator", @@ -129,19 +147,22 @@ } ] }, - "reverse": { + { "description": "reverse the elements of the list", "cases": [ { "description": "empty list", + "property": "reverse", "list": [], "expected": [] }, { "description": "non-empty list", + "property": "reverse", "list": [1,3,5,7], "expected": [7,5,3,1] } ] } + ] } From da6b039ecf8dfc1a9bc8b29759c848cb0c94ab6e Mon Sep 17 00:00:00 2001 From: rbasso Date: Fri, 10 Mar 2017 23:06:56 +0900 Subject: [PATCH 2/2] list-ops: Fix canonical-data.json formatting --- exercises/list-ops/canonical-data.json | 314 ++++++++++++------------- 1 file changed, 157 insertions(+), 157 deletions(-) diff --git a/exercises/list-ops/canonical-data.json b/exercises/list-ops/canonical-data.json index 985f6d350c..533baf4142 100644 --- a/exercises/list-ops/canonical-data.json +++ b/exercises/list-ops/canonical-data.json @@ -7,162 +7,162 @@ "solutions have thought about performance concerns." ], "cases": [ - { - "description": "append entries to a list and return the new list", - "cases": [ - { - "description": "empty lists", - "property": "append", - "list1": [], - "list2": [], - "expected": [] - }, - { - "description": "empty list to list", - "property": "append", - "list1": [], - "list2": [1,2,3,4], - "expected": [1,2,3,4] - }, - { - "description": "non-empty lists", - "property": "append", - "list1": [1,2], - "list2": [2,3,4,5], - "expected": [1,2,2,3,4,5] - } - ] - }, - { - "description": "concat lists and lists of list into a new list", - "cases": [ - { - "description": "empty list", - "property": "concat", - "lists": [], - "expected": [] - }, - { - "description": "list of lists", - "property": "concat", - "lists": [[1,2],[3],[],[4,5,6]], - "expected": [1,2,3,4,5,6] - } - ] - }, - { - "description": "filter list returning only values that satisfy the filter function", - "cases": [ - { - "description": "empty list", - "property": "filter", - "list": [], - "function": "value modulo 2 == 1", - "expected": [] - }, - { - "description": "non-empty list", - "property": "filter", - "list": [1,2,3,5], - "function": "value modulo 2 == 1", - "expected": [1,3,5] - } - ] - }, - { - "description": "returns the length of a list", - "cases": [ - { - "description": "empty list", - "property": "length", - "list": [], - "expected": 0 - }, - { - "description": "non-empty list", - "property": "length", - "list": [1,2,3,4], - "expected": 4 - } - ] - }, - { - "description": "return a list of elements whos values equal the list value transformed by the mapping function", - "cases": [ - { - "description": "empty list", - "property": "map", - "list": [], - "function": "value + 1", - "expected": [] - }, - { - "description": "non-empty list", - "property": "map", - "list": [1,3,5,7], - "function": "value + 1", - "expected": [2,4,6,8] - } - ] - }, - { - "description": "folds (reduces) the given list from the left with a function", - "cases": [ - { - "description": "empty list", - "property": "foldl", - "list": [], - "initial": 2, - "function": "value / accumulator", - "expected": 2 - }, - { - "description": "division of integers", - "property": "foldl", - "list": [1,2,3,4], - "initial": 24, - "function": "value / accumulator", - "expected": 64 - } - ] - }, - { - "description": "folds (reduces) the given list from the right with a function", - "cases": [ - { - "description": "empty list", - "property": "foldr", - "list": [], - "initial": 2, - "function": "value / accumulator", - "expected": 2 - }, - { - "description": "division of integers", - "property": "foldr", - "list": [1,2,3,4], - "initial": 24, - "function": "value / accumulator", - "expected": 9 - } - ] - }, - { - "description": "reverse the elements of the list", - "cases": [ - { - "description": "empty list", - "property": "reverse", - "list": [], - "expected": [] - }, - { - "description": "non-empty list", - "property": "reverse", - "list": [1,3,5,7], - "expected": [7,5,3,1] - } - ] - } + { + "description": "append entries to a list and return the new list", + "cases": [ + { + "description": "empty lists", + "property": "append", + "list1": [], + "list2": [], + "expected": [] + }, + { + "description": "empty list to list", + "property": "append", + "list1": [], + "list2": [1, 2, 3, 4], + "expected": [1, 2, 3, 4] + }, + { + "description": "non-empty lists", + "property": "append", + "list1": [1, 2], + "list2": [2, 3, 4, 5], + "expected": [1, 2, 2, 3, 4, 5] + } + ] + }, + { + "description": "concat lists and lists of list into a new list", + "cases": [ + { + "description": "empty list", + "property": "concat", + "lists": [], + "expected": [] + }, + { + "description": "list of lists", + "property": "concat", + "lists": [[1, 2], [3], [], [4, 5, 6]], + "expected": [1, 2, 3, 4, 5, 6] + } + ] + }, + { + "description": "filter list returning only values that satisfy the filter function", + "cases": [ + { + "description": "empty list", + "property": "filter", + "list": [], + "function": "value modulo 2 == 1", + "expected": [] + }, + { + "description": "non-empty list", + "property": "filter", + "list": [1, 2, 3, 5], + "function": "value modulo 2 == 1", + "expected": [1, 3, 5] + } + ] + }, + { + "description": "returns the length of a list", + "cases": [ + { + "description": "empty list", + "property": "length", + "list": [], + "expected": 0 + }, + { + "description": "non-empty list", + "property": "length", + "list": [1, 2, 3, 4], + "expected": 4 + } + ] + }, + { + "description": "return a list of elements whos values equal the list value transformed by the mapping function", + "cases": [ + { + "description": "empty list", + "property": "map", + "list": [], + "function": "value + 1", + "expected": [] + }, + { + "description": "non-empty list", + "property": "map", + "list": [1, 3, 5, 7], + "function": "value + 1", + "expected": [2, 4, 6, 8] + } + ] + }, + { + "description": "folds (reduces) the given list from the left with a function", + "cases": [ + { + "description": "empty list", + "property": "foldl", + "list": [], + "initial": 2, + "function": "value / accumulator", + "expected": 2 + }, + { + "description": "division of integers", + "property": "foldl", + "list": [1, 2, 3, 4], + "initial": 24, + "function": "value / accumulator", + "expected": 64 + } + ] + }, + { + "description": "folds (reduces) the given list from the right with a function", + "cases": [ + { + "description": "empty list", + "property": "foldr", + "list": [], + "initial": 2, + "function": "value / accumulator", + "expected": 2 + }, + { + "description": "division of integers", + "property": "foldr", + "list": [1, 2, 3, 4], + "initial": 24, + "function": "value / accumulator", + "expected": 9 + } + ] + }, + { + "description": "reverse the elements of the list", + "cases": [ + { + "description": "empty list", + "property": "reverse", + "list": [], + "expected": [] + }, + { + "description": "non-empty list", + "property": "reverse", + "list": [1, 3, 5, 7], + "expected": [7, 5, 3, 1] + } + ] + } ] }