From 77650ad0bc3a0ef95176aea2af145408024e3e8f Mon Sep 17 00:00:00 2001 From: rbasso Date: Mon, 6 Mar 2017 17:08:54 +0900 Subject: [PATCH 1/2] allergies: Make canonical-data.json compliant --- exercises/allergies/canonical-data.json | 26 +++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/exercises/allergies/canonical-data.json b/exercises/allergies/canonical-data.json index a517577331..f300928851 100644 --- a/exercises/allergies/canonical-data.json +++ b/exercises/allergies/canonical-data.json @@ -1,6 +1,10 @@ { - "allergic_to": { - "description": [ + "exercise": "allergies", + "version": "1.0.0", + "cases": [ + { + "description": "allergicTo", + "comments": [ "Given a number and a substance, indicate whether Tom is allergic ", "to that substance.", "Test cases for this method involve more than one assertion.", @@ -10,6 +14,7 @@ "cases": [ { "description": "no allergies means not allergic", + "property" : "allergicTo", "score": 0, "expected": [ { @@ -28,6 +33,7 @@ }, { "description": "is allergic to eggs", + "property" : "allergicTo", "score": 1, "expected": [ { @@ -38,6 +44,7 @@ }, { "description": "allergic to eggs in addition to other stuff", + "property" : "allergicTo", "score": 5, "expected": [ { @@ -56,54 +63,65 @@ } ] }, - "list": { - "description": ["Given a number, list all things Tom is allergic to"], + { + "description": "list", + "comments": ["Given a number, list all things Tom is allergic to"], "cases": [ { "description": "no allergies at all", + "property" : "list", "score": 0, "expected": [] }, { "description": "allergic to just eggs", + "property" : "list", "score": 1, "expected": ["eggs"] }, { "description": "allergic to just peanuts", + "property" : "list", "score": 2, "expected": ["peanuts"] }, { "description": "allergic to just strawberries", + "property" : "list", "score": 8, "expected": ["strawberries"] }, { "description": "allergic to eggs and peanuts", + "property" : "list", "score": 3, "expected": ["eggs", "peanuts"] }, { "description": "allergic to more than eggs but not peanuts", + "property" : "list", "score": 5, "expected": ["eggs", "shellfish"] }, { "description": "allergic to lots of stuff", + "property" : "list", "score": 248, "expected": ["strawberries", "tomatoes", "chocolate", "pollen", "cats"] }, { "description": "allergic to everything", + "property" : "list", "score": 255, "expected": ["eggs", "peanuts", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats"] }, { "description": "ignore non allergen score parts", + "property" : "list", "score": 509, "expected": ["eggs", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats"] } ] } + ] } From 879bc89b01281b81ad14dbc56e265eed6bfab65f Mon Sep 17 00:00:00 2001 From: rbasso Date: Mon, 6 Mar 2017 17:30:30 +0900 Subject: [PATCH 2/2] allergies: Fix canonical-data.json formatting --- exercises/allergies/canonical-data.json | 234 +++++++++++++----------- 1 file changed, 128 insertions(+), 106 deletions(-) diff --git a/exercises/allergies/canonical-data.json b/exercises/allergies/canonical-data.json index f300928851..0d8896fa0b 100644 --- a/exercises/allergies/canonical-data.json +++ b/exercises/allergies/canonical-data.json @@ -3,125 +3,147 @@ "version": "1.0.0", "cases": [ { - "description": "allergicTo", - "comments": [ - "Given a number and a substance, indicate whether Tom is allergic ", - "to that substance.", - "Test cases for this method involve more than one assertion.", - "Each case in 'expected' specifies what the method should return for", - "the given substance." - ], - "cases": [ + "description": "allergicTo", + "comments": [ + "Given a number and a substance, indicate whether Tom is allergic ", + "to that substance.", + "Test cases for this method involve more than one assertion.", + "Each case in 'expected' specifies what the method should return for", + "the given substance." + ], + "cases": [ + { + "description": "no allergies means not allergic", + "property": "allergicTo", + "score": 0, + "expected": [ { - "description": "no allergies means not allergic", - "property" : "allergicTo", - "score": 0, - "expected": [ - { - "substance": "peanuts", - "result": false - }, - { - "substance": "cats", - "result": false - }, - { - "substance": "strawberries", - "result": false - } - ] + "substance": "peanuts", + "result": false }, { - "description": "is allergic to eggs", - "property" : "allergicTo", - "score": 1, - "expected": [ - { - "substance": "eggs", - "result": true - } - ] + "substance": "cats", + "result": false }, { - "description": "allergic to eggs in addition to other stuff", - "property" : "allergicTo", - "score": 5, - "expected": [ - { - "substance": "eggs", - "result": true - }, - { - "substance": "shellfish", - "result": true - }, - { - "substance": "strawberries", - "result": false - } - ] + "substance": "strawberries", + "result": false } - ] - }, - { - "description": "list", - "comments": ["Given a number, list all things Tom is allergic to"], - "cases": [ - { - "description": "no allergies at all", - "property" : "list", - "score": 0, - "expected": [] - }, - { - "description": "allergic to just eggs", - "property" : "list", - "score": 1, - "expected": ["eggs"] - }, - { - "description": "allergic to just peanuts", - "property" : "list", - "score": 2, - "expected": ["peanuts"] - }, + ] + }, + { + "description": "is allergic to eggs", + "property": "allergicTo", + "score": 1, + "expected": [ { - "description": "allergic to just strawberries", - "property" : "list", - "score": 8, - "expected": ["strawberries"] - }, - { - "description": "allergic to eggs and peanuts", - "property" : "list", - "score": 3, - "expected": ["eggs", "peanuts"] - }, - { - "description": "allergic to more than eggs but not peanuts", - "property" : "list", - "score": 5, - "expected": ["eggs", "shellfish"] - }, + "substance": "eggs", + "result": true + } + ] + }, + { + "description": "allergic to eggs in addition to other stuff", + "property": "allergicTo", + "score": 5, + "expected": [ { - "description": "allergic to lots of stuff", - "property" : "list", - "score": 248, - "expected": ["strawberries", "tomatoes", "chocolate", "pollen", "cats"] + "substance": "eggs", + "result": true }, { - "description": "allergic to everything", - "property" : "list", - "score": 255, - "expected": ["eggs", "peanuts", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats"] + "substance": "shellfish", + "result": true }, { - "description": "ignore non allergen score parts", - "property" : "list", - "score": 509, - "expected": ["eggs", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats"] + "substance": "strawberries", + "result": false } - ] + ] + } + ] + }, + { + "description": "list", + "comments": [ + "Given a number, list all things Tom is allergic to" + ], + "cases": [ + { + "description": "no allergies at all", + "property": "list", + "score": 0, + "expected": [] + }, + { + "description": "allergic to just eggs", + "property": "list", + "score": 1, + "expected": ["eggs"] + }, + { + "description": "allergic to just peanuts", + "property": "list", + "score": 2, + "expected": ["peanuts"] + }, + { + "description": "allergic to just strawberries", + "property": "list", + "score": 8, + "expected": ["strawberries"] + }, + { + "description": "allergic to eggs and peanuts", + "property": "list", + "score": 3, + "expected": ["eggs", "peanuts"] + }, + { + "description": "allergic to more than eggs but not peanuts", + "property": "list", + "score": 5, + "expected": ["eggs", "shellfish"] + }, + { + "description": "allergic to lots of stuff", + "property": "list", + "score": 248, + "expected": [ "strawberries", + "tomatoes", + "chocolate", + "pollen", + "cats" + ] + }, + { + "description": "allergic to everything", + "property": "list", + "score": 255, + "expected": [ "eggs", + "peanuts", + "shellfish", + "strawberries", + "tomatoes", + "chocolate", + "pollen", + "cats" + ] + }, + { + "description": "ignore non allergen score parts", + "property": "list", + "score": 509, + "expected": [ "eggs", + "shellfish", + "strawberries", + "tomatoes", + "chocolate", + "pollen", + "cats" + ] + } + ] } ] }