@@ 138-152 (lines=15) @@ | ||
135 | self::assertContains($instruction, $this->testApp->getDisplay()); |
|
136 | } |
|
137 | ||
138 | public function testTurningLeft() |
|
139 | { |
|
140 | $instruction = '3,2,W'; |
|
141 | ||
142 | $this->testApp->run(['command' => 'place', 'X,Y,F' => $instruction]); |
|
143 | ||
144 | self::assertSame(0, $this->testApp->getStatusCode(), $this->testApp->getDisplay()); |
|
145 | ||
146 | $this->testApp->run(['left']); |
|
147 | ||
148 | self::assertSame(0, $this->testApp->getStatusCode(), $this->testApp->getDisplay()); |
|
149 | ||
150 | // Now face south |
|
151 | self::assertContains('3,2,S', $this->testApp->getDisplay()); |
|
152 | } |
|
153 | ||
154 | public function testTurningRight() |
|
155 | { |
|
@@ 154-168 (lines=15) @@ | ||
151 | self::assertContains('3,2,S', $this->testApp->getDisplay()); |
|
152 | } |
|
153 | ||
154 | public function testTurningRight() |
|
155 | { |
|
156 | $instruction = '1,2,E'; |
|
157 | ||
158 | $this->testApp->run(['command' => 'place', 'X,Y,F' => $instruction]); |
|
159 | ||
160 | self::assertSame(0, $this->testApp->getStatusCode(), $this->testApp->getDisplay()); |
|
161 | ||
162 | $this->testApp->run(['right']); |
|
163 | ||
164 | self::assertSame(0, $this->testApp->getStatusCode(), $this->testApp->getDisplay()); |
|
165 | ||
166 | // Now face south |
|
167 | self::assertContains('1,2,S', $this->testApp->getDisplay()); |
|
168 | } |
|
169 | ||
170 | public function testMovingForward() |
|
171 | { |
|
@@ 170-184 (lines=15) @@ | ||
167 | self::assertContains('1,2,S', $this->testApp->getDisplay()); |
|
168 | } |
|
169 | ||
170 | public function testMovingForward() |
|
171 | { |
|
172 | $instruction = '3,3,W'; |
|
173 | ||
174 | $this->testApp->run(['command' => 'place', 'X,Y,F' => $instruction]); |
|
175 | ||
176 | self::assertSame(0, $this->testApp->getStatusCode(), $this->testApp->getDisplay()); |
|
177 | ||
178 | $this->testApp->run(['move']); |
|
179 | ||
180 | self::assertSame(0, $this->testApp->getStatusCode(), $this->testApp->getDisplay()); |
|
181 | ||
182 | // Now x has decreased |
|
183 | self::assertContains('2,3,W', $this->testApp->getDisplay()); |
|
184 | } |
|
185 | } |
|
186 |