idenning2003 / cbase

Library of C data structures and tests
https://idenning2003.github.io/cbase/
GNU General Public License v3.0
2 stars 0 forks source link

cbase - Library of C Data Structures and Tests

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.

Table of Contents

  1. Overview
  2. Usage
  3. Contribution
  4. License
  5. Credits

Overview

The layout of this project is simple: inside src/, there are folders for each data structure, which are laid out as follows:

The only files that are allowed to break these rules are src/main.c and src/test.c.

Public

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.

Private

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.

Test

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.

Usage

The project must first be built with make before it can be ran.

Basic Usage

make        # Build main and test executables
./bin/test  # Run all the tests
./bin/main  # Run the main program

Make Targets

Executables

All executables will be located inside bin/ with the folder structure of:

Contribution

For information on the guidelines and rules for contributing to cbase, please visit the CONTRIBUTION.md

License

This project is protected under the GNU General Public License.

Credits