Lesson 6 · Testing Without a Robot — Knowledge ChecksAnswer key
What does 'separation of concerns' let you do here?
Because Manhattan only computes paths and Navigator only drives them, you can verify the algorithm on any computer before hardware is ever involved.
Where should the 'expected' path come from?
Testing needs an independent source of truth. You trace the path by hand first; the whole point is to catch the case where the code disagrees with the correct answer.
Your test shows actual = [(1,0),(2,0),(2,1)] but expected = [(1,0),(2,0),(2,1),(2,2),(2,3)]. What's the likely problem?
The row moves are all there but the column moves are cut short. That points straight at the east while loop — exactly the kind of pinpointing screen-testing gives you.
After using print statements to fix a bug, what should you do with them?
Debug prints are scaffolding. Once the bug is fixed, clear them so future test runs are easy to read.