https://github.com/kogosoftwarellc/test-c
A robust and minimal unit testing framework for C.
https://github.com/kogosoftwarellc/test-c
c framework unit-testing
Last synced: about 2 months ago
JSON representation
A robust and minimal unit testing framework for C.
- Host: GitHub
- URL: https://github.com/kogosoftwarellc/test-c
- Owner: kogosoftwarellc
- License: mit
- Created: 2017-05-26T22:08:37.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-21T19:54:30.000Z (over 7 years ago)
- Last Synced: 2025-08-13T22:30:50.807Z (2 months ago)
- Topics: c, framework, unit-testing
- Language: Shell
- Homepage:
- Size: 44.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# test-c
> A robust and minimal unit testing framework for C.Shut up and [test some C]
## Why?
* Because every other testing framework for C is a pain.
## Installing
```
curl -sk https://raw.githubusercontent.com/kogosoftwarellc/test-c/master/install.bash | bash
```Once that completes, you'll have `~/.test-c/test-c` available in your `PATH`.
## Goals
* Make C Unit Testing fast, easy, and fun.
* Reduce boilerplate.
* Keep tests focused on testing, not setup.
* Do the simplest thing possible.
* Avoid root priveleges.## Project Layout
test-c assumes a project layout similar to the following:
```
.
├── .testcrc
├── include
├── README.md
├── src
│ ├── add.c
│ └── add.h
└── tests
└── test_add.c
```Starting from scratch? Let `test-c --init-project` get you up and running quickly.
## Sample Test
Here's what `tests/test_add.c` looks like in our project layout:
```c
#include
#includeTEST_C_START(it_works)
int sum = add(5, 6);
TEST_C_ASSERT_INT_EQUAL(sum, 11);
TEST_C_END
```Now when we run `test-c` at the root of our project, we see this:
![running test-c][terminal-run]
## Running
```
test-c [OPTIONS] [FILES]
```See `test-c --help` for the full list of options.
### .testcrc
You can add a `.testcrc` file to the root of your project. This file will be
sourced by `test-c`. You can export environment variables as follows:* `export TESTC_LD_OPTIONS="-lssl"`
## LICENSE
[MIT](./LICENSE)
[terminal-run]: ./test-c.jpg