From 562750f31c6433e9cd793bbda2d6b808688e7a97 Mon Sep 17 00:00:00 2001 From: Ryan Potts Date: Mon, 29 Jan 2018 18:50:58 -0500 Subject: [PATCH 1/2] robot-simulator: apply "input" policy --- exercises/robot-simulator/canonical-data.json | 282 ++++++++++-------- 1 file changed, 161 insertions(+), 121 deletions(-) diff --git a/exercises/robot-simulator/canonical-data.json b/exercises/robot-simulator/canonical-data.json index 2be5197ed3..7569e98db1 100644 --- a/exercises/robot-simulator/canonical-data.json +++ b/exercises/robot-simulator/canonical-data.json @@ -1,6 +1,6 @@ { "exercise": "robot-simulator", - "version": "2.0.0", + "version": "2.1.0", "comments": [ "Some tests have two expectations: one for the position, one for the direction", "Optionally, you can also test", @@ -15,12 +15,14 @@ { "description": "Robots are created with a position and direction", "property": "create", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "north" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "north" + } }, "expected": { "position": { @@ -33,12 +35,14 @@ { "description": "Negative positions are allowed", "property": "create", - "robot": { - "position": { - "x": -1, - "y": -1 - }, - "direction": "south" + "input": { + "robot": { + "position": { + "x": -1, + "y": -1 + }, + "direction": "south" + } }, "expected": { "position": { @@ -56,12 +60,14 @@ { "description": "does not change the position", "property": "turnRight", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "north" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "north" + } }, "expected": { "position": { @@ -73,12 +79,14 @@ { "description": "changes the direction from north to east", "property": "turnRight", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "north" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "north" + } }, "expected": { "direction": "east" @@ -87,12 +95,14 @@ { "description": "changes the direction from east to south", "property": "turnRight", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "east" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "east" + } }, "expected": { "direction": "south" @@ -101,12 +111,14 @@ { "description": "changes the direction from south to west", "property": "turnRight", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "south" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "south" + } }, "expected": { "direction": "west" @@ -115,12 +127,14 @@ { "description": "changes the direction from west to north", "property": "turnRight", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "west" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "west" + } }, "expected": { "direction": "north" @@ -134,12 +148,14 @@ { "description": "does not change the position", "property": "turnLeft", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "north" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "north" + } }, "expected": { "position": { @@ -151,12 +167,14 @@ { "description": "changes the direction from north to west", "property": "turnLeft", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "north" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "north" + } }, "expected": { "direction": "west" @@ -165,12 +183,14 @@ { "description": "changes the direction from west to south", "property": "turnLeft", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "west" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "west" + } }, "expected": { "direction": "south" @@ -179,12 +199,14 @@ { "description": "changes the direction from south to east", "property": "turnLeft", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "south" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "south" + } }, "expected": { "direction": "east" @@ -193,12 +215,14 @@ { "description": "changes the direction from east to north", "property": "turnLeft", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "east" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "east" + } }, "expected": { "direction": "north" @@ -212,12 +236,14 @@ { "description": "does not change the direction", "property": "advance", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "north" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "north" + } }, "expected": { "direction": "north" @@ -226,12 +252,14 @@ { "description": "increases the y coordinate one when facing north", "property": "advance", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "north" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "north" + } }, "expected": { "position": { @@ -243,12 +271,14 @@ { "description": "decreases the y coordinate by one when facing south", "property": "advance", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "south" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "south" + } }, "expected": { "position": { @@ -260,12 +290,14 @@ { "description": "increases the x coordinate by one when facing east", "property": "advance", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "east" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "east" + } }, "expected": { "position": { @@ -277,12 +309,14 @@ { "description": "decreases the x coordinate by one when facing west", "property": "advance", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "west" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "west" + } }, "expected": { "position": { @@ -299,12 +333,14 @@ { "description": "instructions to move west and north", "property": "instructions", - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "north" + "input": { + "robot": { + "position": { + "x": 0, + "y": 0 + }, + "direction": "north" + } }, "instructions": "LAAARALA", "expected": { @@ -318,12 +354,14 @@ { "description": "instructions to move west and south", "property": "instructions", - "robot": { - "position": { - "x": 2, - "y": -7 - }, - "direction": "east" + "input": { + "robot": { + "position": { + "x": 2, + "y": -7 + }, + "direction": "east" + } }, "instructions": "RRAAAAALA", "expected": { @@ -337,12 +375,14 @@ { "description": "instructions to move east and north", "property": "instructions", - "robot": { - "position": { - "x": 8, - "y": 4 - }, - "direction": "south" + "input": { + "robot": { + "position": { + "x": 8, + "y": 4 + }, + "direction": "south" + } }, "instructions": "LAAARRRALLLL", "expected": { From 3763965e336daa570ac04dec12b0b3760949a22f Mon Sep 17 00:00:00 2001 From: Ryan Potts Date: Tue, 30 Jan 2018 08:54:48 -0500 Subject: [PATCH 2/2] robot-simulator: remove "robot" "robot" deemed unnecessary, replaced by "input". --- exercises/robot-simulator/canonical-data.json | 240 ++++++++---------- 1 file changed, 100 insertions(+), 140 deletions(-) diff --git a/exercises/robot-simulator/canonical-data.json b/exercises/robot-simulator/canonical-data.json index 7569e98db1..834965c8a3 100644 --- a/exercises/robot-simulator/canonical-data.json +++ b/exercises/robot-simulator/canonical-data.json @@ -16,13 +16,11 @@ "description": "Robots are created with a position and direction", "property": "create", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "north" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "north" }, "expected": { "position": { @@ -36,13 +34,11 @@ "description": "Negative positions are allowed", "property": "create", "input": { - "robot": { - "position": { - "x": -1, - "y": -1 - }, - "direction": "south" - } + "position": { + "x": -1, + "y": -1 + }, + "direction": "south" }, "expected": { "position": { @@ -61,13 +57,11 @@ "description": "does not change the position", "property": "turnRight", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "north" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "north" }, "expected": { "position": { @@ -80,13 +74,11 @@ "description": "changes the direction from north to east", "property": "turnRight", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "north" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "north" }, "expected": { "direction": "east" @@ -96,13 +88,11 @@ "description": "changes the direction from east to south", "property": "turnRight", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "east" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "east" }, "expected": { "direction": "south" @@ -112,13 +102,11 @@ "description": "changes the direction from south to west", "property": "turnRight", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "south" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "south" }, "expected": { "direction": "west" @@ -128,13 +116,11 @@ "description": "changes the direction from west to north", "property": "turnRight", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "west" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "west" }, "expected": { "direction": "north" @@ -149,13 +135,11 @@ "description": "does not change the position", "property": "turnLeft", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "north" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "north" }, "expected": { "position": { @@ -168,13 +152,11 @@ "description": "changes the direction from north to west", "property": "turnLeft", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "north" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "north" }, "expected": { "direction": "west" @@ -184,13 +166,11 @@ "description": "changes the direction from west to south", "property": "turnLeft", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "west" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "west" }, "expected": { "direction": "south" @@ -200,13 +180,11 @@ "description": "changes the direction from south to east", "property": "turnLeft", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "south" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "south" }, "expected": { "direction": "east" @@ -216,13 +194,11 @@ "description": "changes the direction from east to north", "property": "turnLeft", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "east" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "east" }, "expected": { "direction": "north" @@ -237,13 +213,11 @@ "description": "does not change the direction", "property": "advance", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "north" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "north" }, "expected": { "direction": "north" @@ -253,13 +227,11 @@ "description": "increases the y coordinate one when facing north", "property": "advance", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "north" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "north" }, "expected": { "position": { @@ -272,13 +244,11 @@ "description": "decreases the y coordinate by one when facing south", "property": "advance", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "south" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "south" }, "expected": { "position": { @@ -291,13 +261,11 @@ "description": "increases the x coordinate by one when facing east", "property": "advance", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "east" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "east" }, "expected": { "position": { @@ -310,13 +278,11 @@ "description": "decreases the x coordinate by one when facing west", "property": "advance", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "west" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "west" }, "expected": { "position": { @@ -334,13 +300,11 @@ "description": "instructions to move west and north", "property": "instructions", "input": { - "robot": { - "position": { - "x": 0, - "y": 0 - }, - "direction": "north" - } + "position": { + "x": 0, + "y": 0 + }, + "direction": "north" }, "instructions": "LAAARALA", "expected": { @@ -355,13 +319,11 @@ "description": "instructions to move west and south", "property": "instructions", "input": { - "robot": { - "position": { - "x": 2, - "y": -7 - }, - "direction": "east" - } + "position": { + "x": 2, + "y": -7 + }, + "direction": "east" }, "instructions": "RRAAAAALA", "expected": { @@ -376,13 +338,11 @@ "description": "instructions to move east and north", "property": "instructions", "input": { - "robot": { - "position": { - "x": 8, - "y": 4 - }, - "direction": "south" - } + "position": { + "x": 8, + "y": 4 + }, + "direction": "south" }, "instructions": "LAAARRRALLLL", "expected": {