Section 2

Unit Test For Grid Direction Hierarchy

We need a unit test for the grid direction vector code. Add the new class and method as shown. GridDirectionTestCase is a subclass of TestCase of course.

Run our tests again to ensure everything is good.

Oops. We have a coding error. We need parenthesis.

With the debugger open we should inspect the value returned by "direction vector" to see if we have a parenthesis problem in there too.

Looks the method result is fine. It's just our test method. We can fix this in the debugger. Close it and re-run after making the edit shown.

It failed again. This time in a new place.

We should just fix the method comparison code in the tests. Re-run after making the edits.

Finally, everything passes.

Index Page Next Page

Copyright © 2007, 2008, 2009, 2010 Stephan B Wessels    stevewessels@me.com