Working with 1000+ tests on a stable C++ library

submited by
Style Pass
2023-03-19 18:30:06

Working on a project that handles every edge case of a URL specification and has over 1000 unit tests can be quite challenging. Recently, I had the opportunity to work on a refactor and a new API for the Ada URL parser library with Daniel Lemire. This project presented interesting challenges that tested the limits of our motivation, determination, and productivity. In this blog post, I will share my experience working on a stable and well-tested C++ project and discuss some of the issues we faced along the way.

Our overall test suite for Ada, consists of 5+ files, running using CTest. For reasons which are unrelevant of this article, we've implemented our own macros for assertion, succeeding and failing the test suites. Here's an exaple of a C++ macro for our assertion function.

As we progressed through the development process, we found that we were spending a lot of time on debugging, so we made the decision to implement our own logging system to capture valuable information. With this approach, whenever we encountered a bug, we could easily run the test suite and debug values through the terminal output. Daniel played a crucial role in this effort and was able to add a simple yet effective logger to the project in no time at all!

Leave a Comment