-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: convert to test class to make the per method fixture easier…
… to use
- Loading branch information
fr2d9y2
authored and
fr2d9y2
committed
Apr 6, 2017
1 parent
1271062
commit 4712b10
Showing
1 changed file
with
19 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
from nose.tools import * | ||
import rover | ||
|
||
def setup(): | ||
global r | ||
r = rover.Rover(10, 21, 'N') | ||
class TestRover: | ||
|
||
def test_initial_x(): | ||
assert_equal(10, r.x) | ||
def setup(self): | ||
global r | ||
r = rover.Rover(10, 21, 'N') | ||
|
||
def test_initial_y(): | ||
assert_equal(21, r.y) | ||
def test_initial_x(self): | ||
assert_equal(10, r.x) | ||
|
||
def test_initial_orientation(): | ||
assert_equal('N', r.orientation) | ||
def test_initial_y(self): | ||
assert_equal(21, r.y) | ||
|
||
def test_move_f(): | ||
r.move(list("f")) | ||
assert_equal(22, r.y) | ||
assert_equal(10, r.x) | ||
def test_initial_orientation(self): | ||
assert_equal('N', r.orientation) | ||
|
||
@with_setup(setup) | ||
def test_move_b(): | ||
r.move(list("b")) | ||
assert_equal(10, r.x) | ||
assert_equal(20, r.y) | ||
def test_move_f(self): | ||
r.move(list("f")) | ||
assert_equal(22, r.y) | ||
assert_equal(10, r.x) | ||
|
||
def test_move_b(self): | ||
r.move(list("b")) | ||
assert_equal(10, r.x) | ||
assert_equal(20, r.y) |