This project contains a collection of useful data structures that are set up in an almost object-oriented manner.
I built this project to set up an environment for future C projects and provide a long-term project that I could work on indefinitely, as more can always be improved.
The layout of this project is simple: inside src/
, there are folders
for each data structure, which are laid out as follows:
<structure>/
public/
private/
test/
README.md
(optional)The only files that are allowed to break these rules are
src/main.c
and src/test.c
.
The public folder should only contain header files with functions, definitions, and structs that are strictly necessary for external usage of the data structure.
It is highly advised that the definition of a data structure's structs be inside a private header file so that it may not be edited externally.
The private folder should contain all the C files necessary for the data structure's methods and any internal header files needed for passing information between the private C files, such as struct definition.
The test folder should contain any C or header files necessary for testing the data structure.
Any function which is itself a test function should be marked with the
__attribute__((test))
attribute on the same line as the function name.
NOTE: all files in the test folder will only be excluded from the main build and will only be included for the test build.
The project must first be built with make
before it can be ran.
make # Build main and test executables
./bin/test # Run all the tests
./bin/main # Run the main program
make all
(default) targets build and testmake build
make the main executable in bin/main
make test
make the test executable in bin/test
and each test file's
executable inside bin/tests/
make clean
removes any files/folders produced from make targetsmake debug
make build and test executables with debug symbolsmake coverage
make html coverage report inside coverage/
make tar
create cbase.tar.gz
with any project filesAll executables will be located inside bin/
with the folder structure of:
bin/
tests/
All the test executables for each test filemain
The main program executabletest
The test program to run each test file executableFor information on the guidelines and rules for contributing to cbase, please
visit the CONTRIBUTION.md
This project is protected under the GNU General Public License.