Skip to content

massey101/janit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Janit

Janit is a tiny and simple unit test framework for C applications. The test framework is based on MinUnit.

Usage

The test suite usage is very simple. An example project is provided in the example directory. You can run the unit tests for the project with:

make test

One of the tests has been intentionally designed to fail. The basic usage is as follows. You must include "janit.h" in your test file along with tests and a main method to run the tests with. The file structure is shown below:

#include <janit.h>
#include "<name.h>"

// Unit test functions in the form:
static char * test_<test>() {
    ja_assert("<assert string>", <assert>);

    return 0;
}

int main() {
    ja_add_tests(
            // tests to add
            test_<test>,
            ...
    );

    return ja_run_tests("<name>");
}

Where is the file to test, and is the name of a test to perform. The is displayed when the test fails and describes the assert used. The is a boolean which will signify failure when returning false.

Installation

Install on a system using the following command:

make install

Licence

GPLv3

See LICENCE for more information

Authors

Jack Massey jacknmassey@gmail.com

About

Small C based unit test framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published