A simple header file to get test statistic in C
Go to file
2025-09-28 17:51:10 +05:30
examples Added a simple example file 2025-09-28 13:18:10 +05:30
.gitignore Added gitignore 2025-09-28 12:15:56 +05:30
README.md Added a README 2025-09-28 17:51:10 +05:30
test.h setup and teadown 2025-09-28 13:16:15 +05:30

test.h

A simple header file to get test statistics.

Currently under development things might change without notice

Usage

Here is a simple simple example for test.h

// sample_test.c

#include "test.h"

TEST(sample1, {
    ASSERT(1 == 1, "");
})

TEST_INIT({})

You can compile and rum this test file, and will get an output like this.

=========================================================================
TEST doc.c

test_sample1
	(1/1) passed (0) failed

PASSED - (1/1) passed (0) failed
=========================================================================

An example with two tests.

#include "test.h"

TEST(sample1, {
    ASSERT(1 == 1, "");
})

TEST(sample2, {
    ASSERT(1 == 1, "");
    ASSERT(1 == 0, "This assertion will fail");
})

TEST_INIT({})
=========================================================================
TEST doc.c

test_sample1
	(1/1) passed (0) failed

test_sample2
	assertion failed (l.no - 9) [1 == 0]  - This assertion will fail
	(1/2) passed (1) failed

FAILED - (1/2) passed (1) failed
=========================================================================

To know about all the macros that you can use, check the examples folder.


If you have any issues or want to discuss, Join my Discord

Bye....