Get Thinking

A detailed discussion of these questions can be found in the "Appendix A" section on page 494.

Mull It Over

  1. Write a test harness for the greatest_common_divisor code example earlier in this chapter. Make it as exhaustive as you can. How many individual test cases have you included?

    1. How many of these passed?

    2. How many failed?

    3. Using these tests, identify any faults and repair the code.

  2. How should the testing of a spreadsheet application and an automatic aircraft pilot differ?

  3. Should you test all of the test code that you write?

  4. How does a programmer’s testing differ from a QA department member’s testing?

  5. Is it necessary to write a test harness for every single function?

  6. Test-driven development encourages you to write tests first, before any code. ...

Get Code Craft now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.