77 lines
1.3 KiB
Markdown
77 lines
1.3 KiB
Markdown
# 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`
|
|
|
|
```c
|
|
// 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.
|
|
|
|
```console
|
|
=========================================================================
|
|
TEST doc.c
|
|
|
|
test_sample1
|
|
(1/1) passed (0) failed
|
|
|
|
PASSED - (1/1) passed (0) failed
|
|
=========================================================================
|
|
```
|
|
|
|
An example with two tests.
|
|
|
|
```c
|
|
#include "test.h"
|
|
|
|
TEST(sample1, {
|
|
ASSERT(1 == 1, "");
|
|
})
|
|
|
|
TEST(sample2, {
|
|
ASSERT(1 == 1, "");
|
|
ASSERT(1 == 0, "This assertion will fail");
|
|
})
|
|
|
|
TEST_INIT({})
|
|
```
|
|
|
|
```console
|
|
=========================================================================
|
|
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](./examples/) folder.
|
|
|
|
---
|
|
|
|
If you have any issues or want to discuss, [Join my Discord](https://discord.gg/BxMbWzZe2Z)
|
|
|
|
## Bye....
|