diff --git a/exercises/robot-simulator/canonical-data.json b/exercises/robot-simulator/canonical-data.json index 12d652f91c..84323d3b48 100644 --- a/exercises/robot-simulator/canonical-data.json +++ b/exercises/robot-simulator/canonical-data.json @@ -1,242 +1,266 @@ { - "#": [ + "exercise": "robot-simulator", + "version": "1.0.0", + "comments": [ "Some tests have two expectations: one for the position, one for the direction", "Optionally, you can also test", " - An invalid direction throws an error", " - An invalid instruction throws an error", " - Default starting position and direction if none are provided" ], - "create": { - "description": "A robot is created with a position and a direction", - "cases" : [ - { - "description": "Robots are created with a position and direction", - "robot": { - "position": "(0,0)", - "direction": "north" + "cases": [ + { + "description": "A robot is created with a position and a direction", + "cases": [ + { + "description": "Robots are created with a position and direction", + "property": "create", + "robot": { + "position": "(0,0)", + "direction": "north" + }, + "expected": { + "position": "(0,0)", + "direction": "north" + } }, - "expected": { - "position": "(0,0)", - "direction": "north" + { + "description": "Negative positions are allowed", + "property": "create", + "robot": { + "position": "(-1,-1)", + "direction": "south" + }, + "expected": { + "position": "(-1,-1)", + "direction": "south" + } } - }, - { - "description": "Negative positions are allowed", - "robot": { - "position": "(-1,-1)", - "direction": "south" + ] + }, + { + "description": "rotates the robot's direction 90 degrees clockwise", + "cases": [ + { + "description": "does not change the position", + "property": "turnRight", + "robot": { + "position": "(0,0)", + "direction": "north" + }, + "expected": { + "position": "(0,0)" + } }, - "expected": { - "position": "(-1,-1)", - "direction": "south" - } - } - ] - }, - "turn_right": { - "description": "rotates the robot's direction 90 degrees clockwise", - "cases" : [ - { - "description": "does not change the position", - "robot": { - "position": "(0,0)", - "direction": "north" - }, - "expected": { - "position": "(0,0)" - } - }, - { - "description": "changes the direction from north to east", - "robot": { - "position": "(0,0)", - "direction": "north" - }, - "expected": { - "direction": "east" - } - }, - { - "description": "changes the direction from east to south", - "robot": { - "position": "(0,0)", - "direction": "east" - }, - "expected": { - "direction": "south" - } - }, - { - "description": "changes the direction from south to west", - "robot": { - "position": "(0,0)", - "direction": "south" - }, - "expected": { - "direction": "west" - } - }, - { - "description": "changes the direction from west to north", - "robot": { - "position": "(0,0)", - "direction": "west" - }, - "expected": { - "direction": "north" - } - } - ] - }, - "turn_left": { - "description": "rotates the robot's direction 90 degrees counter-clockwise", - "cases" : [ - { - "description": "does not change the position", - "robot": { - "position": "(0,0)", - "direction": "north" + { + "description": "changes the direction from north to east", + "property": "turnRight", + "robot": { + "position": "(0,0)", + "direction": "north" + }, + "expected": { + "direction": "east" + } }, - "expected": { - "position": "(0,0)" - } - }, - { - "description": "changes the direction from north to west", - "robot": { - "position": "(0,0)", - "direction": "north" + { + "description": "changes the direction from east to south", + "property": "turnRight", + "robot": { + "position": "(0,0)", + "direction": "east" + }, + "expected": { + "direction": "south" + } }, - "expected": { - "direction": "west" - } - }, - { - "description": "changes the direction from west to south", - "robot": { - "position": "(0,0)", - "direction": "west" + { + "description": "changes the direction from south to west", + "property": "turnRight", + "robot": { + "position": "(0,0)", + "direction": "south" + }, + "expected": { + "direction": "west" + } }, - "expected": { - "direction": "south" + { + "description": "changes the direction from west to north", + "property": "turnRight", + "robot": { + "position": "(0,0)", + "direction": "west" + }, + "expected": { + "direction": "north" + } } - }, - { - "description": "changes the direction from south to east", - "robot": { - "position": "(0,0)", - "direction": "south" + ] + }, + { + "description": "rotates the robot's direction 90 degrees counter-clockwise", + "cases": [ + { + "description": "does not change the position", + "property": "turnLeft", + "robot": { + "position": "(0,0)", + "direction": "north" + }, + "expected": { + "position": "(0,0)" + } }, - "expected": { - "direction": "east" - } - }, - { - "description": "changes the direction from east to north", - "robot": { - "position": "(0,0)", - "direction": "east" + { + "description": "changes the direction from north to west", + "property": "turnLeft", + "robot": { + "position": "(0,0)", + "direction": "north" + }, + "expected": { + "direction": "west" + } }, - "expected": { - "direction": "north" - } - } - ] - }, - "advance": { - "description": "moves the robot forward 1 space in the direction it is pointing", - "cases" : [ - { - "description": "does not change the direction", - "robot": { - "position": "(0,0)", - "direction": "north" + { + "description": "changes the direction from west to south", + "property": "turnLeft", + "robot": { + "position": "(0,0)", + "direction": "west" + }, + "expected": { + "direction": "south" + } }, - "expected": { - "direction": "north" - } - }, - { - "description": "increases the y coordinate one when facing north", - "robot": { - "position": "(0,0)", - "direction": "north" + { + "description": "changes the direction from south to east", + "property": "turnLeft", + "robot": { + "position": "(0,0)", + "direction": "south" + }, + "expected": { + "direction": "east" + } }, - "expected": { - "position": "(0,1)" + { + "description": "changes the direction from east to north", + "property": "turnLeft", + "robot": { + "position": "(0,0)", + "direction": "east" + }, + "expected": { + "direction": "north" + } } - }, - { - "description": "decreases the y coordinate by one when facing south", - "robot": { - "position": "(0,0)", - "direction": "south" + ] + }, + { + "description": "moves the robot forward 1 space in the direction it is pointing", + "cases": [ + { + "description": "does not change the direction", + "property": "advance", + "robot": { + "position": "(0,0)", + "direction": "north" + }, + "expected": { + "direction": "north" + } }, - "expected": { - "position": "(0,-1)" - } - }, - { - "description": "increases the x coordinate by one when facing east", - "robot": { - "position": "(0,0)", - "direction": "east" + { + "description": "increases the y coordinate one when facing north", + "property": "advance", + "robot": { + "position": "(0,0)", + "direction": "north" + }, + "expected": { + "position": "(0,1)" + } }, - "expected": { - "position": "(1,0)" - } - }, - { - "description": "decreases the x coordinate by one when facing west", - "robot": { - "position": "(0,0)", - "direction": "west" + { + "description": "decreases the y coordinate by one when facing south", + "property": "advance", + "robot": { + "position": "(0,0)", + "direction": "south" + }, + "expected": { + "position": "(0,-1)" + } }, - "expected": { - "position": "(-1,0)" - } - } - ] - }, - "instructions": { - "description": "Where R = Turn Right, L = Turn Left and A = Advance, the robot can follow a series of instructions and end up with the correct position and direction", - "cases" : [ - { - "description": "instructions to move west and north", - "robot": { - "position": "(0,0)", - "direction": "north" + { + "description": "increases the x coordinate by one when facing east", + "property": "advance", + "robot": { + "position": "(0,0)", + "direction": "east" + }, + "expected": { + "position": "(1,0)" + } }, - "instructions": "LAAARALA", - "expected": { - "position": "(-4,1)", - "direction": "west" + { + "description": "decreases the x coordinate by one when facing west", + "property": "advance", + "robot": { + "position": "(0,0)", + "direction": "west" + }, + "expected": { + "position": "(-1,0)" + } } - }, - { - "description": "instructions to move west and south", - "robot": { - "position": "(2,-7)", - "direction": "east" + ] + }, + { + "description": "Where R = Turn Right, L = Turn Left and A = Advance, the robot can follow a series of instructions and end up with the correct position and direction", + "cases": [ + { + "description": "instructions to move west and north", + "property": "instructions", + "robot": { + "position": "(0,0)", + "direction": "north" + }, + "instructions": "LAAARALA", + "expected": { + "position": "(-4,1)", + "direction": "west" + } }, - "instructions": "RRAAAAALA", - "expected": { - "position": "(-3,-8)", - "direction": "south" - } - }, - { - "description": "instructions to move east and north", - "robot": { - "position": "(8,4)", - "direction": "south" + { + "description": "instructions to move west and south", + "property": "instructions", + "robot": { + "position": "(2,-7)", + "direction": "east" + }, + "instructions": "RRAAAAALA", + "expected": { + "position": "(-3,-8)", + "direction": "south" + } }, - "instructions": "LAAARRRALLLL", - "expected": { - "position": "(11,5)", - "direction": "north" + { + "description": "instructions to move east and north", + "property": "instructions", + "robot": { + "position": "(8,4)", + "direction": "south" + }, + "instructions": "LAAARRRALLLL", + "expected": { + "position": "(11,5)", + "direction": "north" + } } - } - ] - } + ] + } + ] }