Writing tests
Now we need to write some tests to make sure our patterns and FileReader interface perform as expected. For this, we create a new file called test_free_reader.cpp and add it to the test target. The setup is very similar to before, except we need to also include the regular expressions library (and link this on the CMake target) and re-declare the patterns. At the top of the file, we place these includes and the definition of the static patterns, as follows:
#include <gtest/gtest.h>
#include <ctre-unicode.hpp>
#include "free_reader.h"
using namespace duckies;
static constexpr ctll::fixed_string date { RE_DATE };
static constexpr ctll::fixed_string dd_coord { RE_DD };
static constexpr ctll::fixed_string dms_coord { RE_DMS };
Next, we can start to write some small tests for each of the patterns. For instance, we can write a test that checks that the full date pattern matches an ISO date string such as 2025-04-21. If the match is successful...