test: add structure & framework for writing tests

This commit is contained in:
Jef Roosens 2023-01-18 13:08:09 +01:00
parent 3da95a63fb
commit c018d8d86c
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
4 changed files with 1953 additions and 5 deletions

View file

@ -13,6 +13,21 @@ Currently it contains the following:
## Development
### Compilation
Everything is handled by the provided Makefile. To compile the static library,
simply run `make`.
### Testing
This library uses [Acutest](https://github.com/mity/acutest) for its tests.
Tests should be placed in the `test` subdirectory, further divided into
directories that correspond those in `src`. Test files should begin with
`test_`, and their format should follow the expected format for Acutest.
To run the tests, simply run `make test`. If you wish to only run a specific
test binary, you can find them in `build/test`.
### `compile_commands.json`
Clangd requires a `compile_commands.json` to function properly. You can
@ -21,6 +36,7 @@ generate it using [bear](https://github.com/rizsotto/Bear):
```sh
make clean
bear -- make
bear --append -- make build-test
```
This will create a `compile_commands.json` file in the current directory.