C library implementing various parts of Vieter.
 
 
 
Go to file
GreekStapler 660e711b17 refactor: Added SHA256 to package description file. 2023-03-09 22:35:03 +00:00
.woodpecker test: also test with -O3 which can produce extra errors 2023-01-26 12:24:34 +01:00
include refactor: Decided to not return char** in function that creates the package description after all, now returns char*. 2023-03-09 22:35:03 +00:00
src refactor: Added SHA256 to package description file. 2023-03-09 22:35:03 +00:00
test test(tree): add random insert test 2023-02-02 15:52:59 +01:00
.clangd chore: add some more config files 2023-01-18 16:58:33 +01:00
.gitignore test: started porting cron tests 2023-01-18 13:59:10 +01:00
LICENSE chore: add license 2023-01-28 12:02:52 +01:00
Makefile fix: also lint internal header files 2023-02-23 10:13:58 +01:00
README.md test: rename some stuff; separate cron part tests 2023-01-28 09:30:35 +01:00

README.md

libvieter

This library powers part of Vieter, most notably the sections that can easily be implemented in C (or just parts I want to implement in C because it's fun).

The goal of this library is to be as self-contained as possible; data structures should be implemented manually if possible.

See the source code for the list of modules.

Development

Compilation

Everything is handled by the provided Makefile. To compile the static library, simply run make.

Project structure

Each module has its own subdirectory inside src, e.g. src/cron. This directory contains the actual implementation of a module, along with any internally used header files. Each internal function should be defined in a header file, as to make testing these possible.

Each module should also have its own header file inside the include directory. This header file defines the public API that the library exposes for this specific module.

Any code in a module may only import internal headers from that module, along with any of the public API header files. Modules should not depend on each other's internal implementationns.

Each module should contain a README describing its contents.

All file names, function names... (even internals) should follow snake case convention and have a prefix unique to that module, starting with vieter_. For example, the cron modules uses the vieter_cron_ prefix for everything.

Header files should only import what they explicitely need. If some function is only used in a .c file, the import should be placed in the .c file instead.

Testing

This library uses Acutest for its tests. Tests should be placed in the test subdirectory, further divided into directories that correspond to those in src. Test files should begin with test_, and their format should follow the expected format for Acutest.

Each test_ is compiled separately into a binary, linked with libvieter. A test file can import any of the public API header files, along with any header files defined in its respective module. This allows testing internal functions.

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.

The name of tests in the TEST_LIST variable should be prefixed with the module they're testing. This makes it much easier to distinguish the output of tests in the CLI. For example:

TEST_LIST = {
    {"cron illegal parts", test_illegal_parts},
    {NULL, NULL}
};

compile_commands.json

Clangd requires a compile_commands.json to function properly. You can generate it using bear:

make clean
bear -- make
bear --append -- make build-test

This will create a compile_commands.json file in the current directory.