13 Testing and debugging

This chapter covers

  • Avoiding runtime errors by moving them to compile-time
  • Understanding the benefits of pure functions in unit testing
  • Automatically generating test cases for pure functions
  • Testing code by comparing against existing solutions
  • Testing monad-based concurrent systems

Computers are becoming omnipresent. We have smart watches, TVs, toasters, and more. Consequences of bugs in software today range from minor annoyances to serious problems, including identity theft and even danger to our lives.

Therefore, it’s more important than ever that the software we write is correct: that it does exactly what it should and doesn’t contain bugs. Although this sounds like a no-brainer—because who in their right mind ...

Get Functional Programming in C++ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.