Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pdsouza/ctest

Simple testing library for C.
https://github.com/pdsouza/ctest

Last synced: 7 days ago
JSON representation

Simple testing library for C.

Awesome Lists containing this project

README

        

# ctest
[![Build Status](https://travis-ci.org/pdsouza/ctest.svg?branch=master)](https://travis-ci.org/pdsouza/ctest)

Simple testing library for C.

## Examples

simple.c:

```C
#include "ctest.h"

static int test_success() {
ASSERT_EQ(0, 0);
}

static int test_failure() {
ASSERT_EQ(0, 1);
}

int main () {
struct TestRunner r = { 0 };
TestRunner_init(&r);

r.add(&r, test_success);
r.add(&r, test_failure);

return r.run(&r);
}
```

Output:

```
$ ./simple
test_success [ PASS ]
test_failure [ FAIL ] (0 != 1)

1 of 2 test cases passed.
```

See [examples](examples) for more.