Test script to test our application works correctly and to catch bugs.

test_eq[source]

test_eq(a, b)

test a equals b

test_stdout[source]

test_stdout(f, args, exp)

test that f print out exp to stdout.

class DummyArgs:
    def __init__(self, path, verbose=False):
        self.cmd_file_path = path
        self.verbose = verbose

Now, we are good to create test cases.

args = DummyArgs('./examples/example1.txt')
test_stdout(run, args, '4,5,WEST')

args = DummyArgs('./examples/example2.txt')
test_stdout(run, args, '0,1,NORTH')

args = DummyArgs('./examples/example3.txt')
test_stdout(run, args, '0,0,WEST')

args = DummyArgs('./examples/example4.txt')
test_stdout(run, args, '3,3,NORTH')

args = DummyArgs('./examples/example5.txt')
test_stdout(run, args, '5,5,EAST')

args = DummyArgs('./examples/example6.txt')
test_stdout(run, args, '2,3,NORTH')

args = DummyArgs('./examples/example7.txt')
test_stdout(run, args, '5,5,NORTH')

args = DummyArgs('./examples/example8.txt')
test_stdout(run, args, '1,1,EAST')

args = DummyArgs('./examples/example9.txt')
test_stdout(run, args, '3,2,EAST')
from nbdev.export import * 
notebook2script()
Converted 01_direction.ipynb.
Converted 02_robot.ipynb.
Converted 03_main.ipynb.
Converted 04_tests.ipynb.
Converted index.ipynb.