# Testing Reldbase uses two testing frameworks: - **boost::ut** — unit tests, which construct objects in memory and verify SQL output without connecting to a database - **Catch2** — integration tests, which connect to a real PostgreSQL database and verify end-to-end behavior ## Running the tests ```bash cmake --build build ctest --test-dir build ``` `ctest` runs the unit tests first and then the integration suite. The integration suite requires PostgreSQL running locally and a single test database: ```bash createdb reldbase_test ``` The tests look up the database name in the `RELDBASE_TEST_DB` environment variable, defaulting to `reldbase_test` when it is unset. ## Unit tests The unit tests live in `src/` and use boost::ut. They are registered with CTest as `test_attribute`, `test_reltuple`, and `test_reldb`. ```bash # Run a single unit test ctest --test-dir build -R test_attribute # Or run a unit test binary directly ./build/src/reltypes/attribute_test ``` ## Integration tests The integration tests live in `tests/` and use Catch2. They connect to the test database through `Rel_db` and exercise the relational database layer end-to-end. ```bash # Ensure the test database exists createdb reldbase_test # Run the integration suite ctest --test-dir build -R test_reldb_integration ``` ## Test organization | File | Framework | Coverage | |------|-----------|----------| | `src/reltypes/attribute_test.cpp` | boost::ut | Attribute types, type registry | | `src/reltypes/reltuple_test.cpp` | boost::ut | Rel_tuple construction and values | | `src/reldb/reldb_test.cpp` | boost::ut | Rel_db helpers (no connection) | | `tests/test_reldb.cpp` | Catch2 | Rel_db queries and transactions (DB) |