From a60544f92936ccb03bce63dd95e387cc968bf440 Mon Sep 17 00:00:00 2001 From: rbasso Date: Wed, 8 Mar 2017 14:03:02 +0900 Subject: [PATCH 1/2] queen-attack: Make canonical-data.json compliant --- exercises/queen-attack/canonical-data.json | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/exercises/queen-attack/canonical-data.json b/exercises/queen-attack/canonical-data.json index be5a916b91..1d67672714 100644 --- a/exercises/queen-attack/canonical-data.json +++ b/exercises/queen-attack/canonical-data.json @@ -1,5 +1,7 @@ { - "#": [ + "exercise": "queen-attack", + "version": "1.0.0", + "comments": [ "Testing invalid positions will vary by language. The expected", "value of -1 is there to indicate some sort of failure should", "occur, while a 0 means no failure.", @@ -8,11 +10,13 @@ "the board graphically, or using standard chess notation. Those", "tests can be offered as extra credit" ], - "create": { + "cases": [ + { "description": "Test creation of Queens with valid and invalid positions", "cases" : [ { "description": "queen with a valid position", + "property": "create", "queen": { "position": "(2,2)" }, @@ -20,6 +24,7 @@ }, { "description": "queen must have positive rank", + "property": "create", "queen": { "position": "(-2,2)" }, @@ -27,6 +32,7 @@ }, { "description": "queen must have rank on board", + "property": "create", "queen": { "position": "(8,4)" }, @@ -34,6 +40,7 @@ }, { "description": "queen must have positive file", + "property": "create", "queen": { "position": "(2,-2)" }, @@ -41,6 +48,7 @@ }, { "description": "queen must have file on board", + "property": "create", "queen": { "position": "(4,8)" }, @@ -48,11 +56,12 @@ } ] }, - "can_attack": { + { "description": "Test the ability of one queen to attack another", "cases": [ { "description": "can not attack", + "property": "canAttack", "white_queen": { "position": "(2,4)" }, @@ -63,6 +72,7 @@ }, { "description": "can attack on same rank", + "property": "canAttack", "white_queen": { "position": "(2,4)" }, @@ -73,6 +83,7 @@ }, { "description": "can attack on same file", + "property": "canAttack", "white_queen": { "position": "(4,5)" }, @@ -83,6 +94,7 @@ }, { "description": "can attack on first diagonal", + "property": "canAttack", "white_queen": { "position": "(2,2)" }, @@ -93,6 +105,7 @@ }, { "description": "can attack on second diagonal", + "property": "canAttack", "white_queen": { "position": "(2,2)" }, @@ -103,6 +116,7 @@ }, { "description": "can attack on third diagonal", + "property": "canAttack", "white_queen": { "position": "(2,2)" }, @@ -113,6 +127,7 @@ }, { "description": "can attack on fourth diagonal", + "property": "canAttack", "white_queen": { "position": "(2,2)" }, @@ -123,4 +138,5 @@ } ] } + ] } From 8adde5f973d37a864cede8832e03783f8b0ec35c Mon Sep 17 00:00:00 2001 From: rbasso Date: Wed, 8 Mar 2017 14:05:14 +0900 Subject: [PATCH 2/2] queen-attack: Fix canonical-data.json formatting --- exercises/queen-attack/canonical-data.json | 240 ++++++++++----------- 1 file changed, 120 insertions(+), 120 deletions(-) diff --git a/exercises/queen-attack/canonical-data.json b/exercises/queen-attack/canonical-data.json index 1d67672714..7bfea89457 100644 --- a/exercises/queen-attack/canonical-data.json +++ b/exercises/queen-attack/canonical-data.json @@ -11,132 +11,132 @@ "tests can be offered as extra credit" ], "cases": [ - { - "description": "Test creation of Queens with valid and invalid positions", - "cases" : [ - { - "description": "queen with a valid position", - "property": "create", - "queen": { - "position": "(2,2)" + { + "description": "Test creation of Queens with valid and invalid positions", + "cases": [ + { + "description": "queen with a valid position", + "property": "create", + "queen": { + "position": "(2,2)" + }, + "expected": 0 }, - "expected": 0 - }, - { - "description": "queen must have positive rank", - "property": "create", - "queen": { - "position": "(-2,2)" + { + "description": "queen must have positive rank", + "property": "create", + "queen": { + "position": "(-2,2)" + }, + "expected": -1 }, - "expected": -1 - }, - { - "description": "queen must have rank on board", - "property": "create", - "queen": { - "position": "(8,4)" + { + "description": "queen must have rank on board", + "property": "create", + "queen": { + "position": "(8,4)" + }, + "expected": -1 }, - "expected": -1 - }, - { - "description": "queen must have positive file", - "property": "create", - "queen": { - "position": "(2,-2)" + { + "description": "queen must have positive file", + "property": "create", + "queen": { + "position": "(2,-2)" + }, + "expected": -1 }, - "expected": -1 - }, - { - "description": "queen must have file on board", - "property": "create", - "queen": { - "position": "(4,8)" + { + "description": "queen must have file on board", + "property": "create", + "queen": { + "position": "(4,8)" + }, + "expected": -1 + } + ] + }, + { + "description": "Test the ability of one queen to attack another", + "cases": [ + { + "description": "can not attack", + "property": "canAttack", + "white_queen": { + "position": "(2,4)" + }, + "black_queen": { + "position": "(6,6)" + }, + "expected": false }, - "expected": -1 - } - ] - }, - { - "description": "Test the ability of one queen to attack another", - "cases": [ - { - "description": "can not attack", - "property": "canAttack", - "white_queen": { - "position": "(2,4)" + { + "description": "can attack on same rank", + "property": "canAttack", + "white_queen": { + "position": "(2,4)" + }, + "black_queen": { + "position": "(2,6)" + }, + "expected": true }, - "black_queen": { - "position": "(6,6)" + { + "description": "can attack on same file", + "property": "canAttack", + "white_queen": { + "position": "(4,5)" + }, + "black_queen": { + "position": "(2,5)" + }, + "expected": true }, - "expected": false - }, - { - "description": "can attack on same rank", - "property": "canAttack", - "white_queen": { - "position": "(2,4)" - }, - "black_queen": { - "position": "(2,6)" - }, - "expected": true - }, - { - "description": "can attack on same file", - "property": "canAttack", - "white_queen": { - "position": "(4,5)" - }, - "black_queen": { - "position": "(2,5)" - }, - "expected": true - }, - { - "description": "can attack on first diagonal", - "property": "canAttack", - "white_queen": { - "position": "(2,2)" - }, - "black_queen": { - "position": "(0,4)" - }, - "expected": true - }, - { - "description": "can attack on second diagonal", - "property": "canAttack", - "white_queen": { - "position": "(2,2)" - }, - "black_queen": { - "position": "(3,1)" - }, - "expected": true - }, - { - "description": "can attack on third diagonal", - "property": "canAttack", - "white_queen": { - "position": "(2,2)" - }, - "black_queen": { - "position": "(1,1)" - }, - "expected": true - }, - { - "description": "can attack on fourth diagonal", - "property": "canAttack", - "white_queen": { - "position": "(2,2)" - }, - "black_queen": { - "position": "(5,5)" - }, - "expected": true - } - ] - } + { + "description": "can attack on first diagonal", + "property": "canAttack", + "white_queen": { + "position": "(2,2)" + }, + "black_queen": { + "position": "(0,4)" + }, + "expected": true + }, + { + "description": "can attack on second diagonal", + "property": "canAttack", + "white_queen": { + "position": "(2,2)" + }, + "black_queen": { + "position": "(3,1)" + }, + "expected": true + }, + { + "description": "can attack on third diagonal", + "property": "canAttack", + "white_queen": { + "position": "(2,2)" + }, + "black_queen": { + "position": "(1,1)" + }, + "expected": true + }, + { + "description": "can attack on fourth diagonal", + "property": "canAttack", + "white_queen": { + "position": "(2,2)" + }, + "black_queen": { + "position": "(5,5)" + }, + "expected": true + } + ] + } ] }