Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/isayme/cut
a simple C Unit Test framework
https://github.com/isayme/cut
Last synced: 12 days ago
JSON representation
a simple C Unit Test framework
- Host: GitHub
- URL: https://github.com/isayme/cut
- Owner: isayme
- License: mit
- Created: 2014-10-23T05:11:08.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-23T12:41:14.000Z (about 10 years ago)
- Last Synced: 2024-04-16T14:21:44.400Z (8 months ago)
- Language: C
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## CUT ##
cut is a simple `C` `U`nit `T`est framework, a single header file `cut.h` contained.The cut is inspired by [MinUnit](http://www.eskimo.com/~scs/C-faq/q10.4.html).
## How to use ? ##
Just `#include "cut.h"` in you project, and then you can write you `TC`s(test case) and `TS`s(test suite).## Example ##
```
#include
#include
// include cut
#include "cut.h"// your function add to be tested
int add(int a, int b)
{
return a + b;
}// create a test case named `add_001`
CUT_CASE(add_001)
{
int rel = add(3, 4);
CUT_EXPECT_INT_EQ(7, rel);
}// create another test case named `add_002`
// a wrong test case on purpose
CUT_CASE(add_002)
{
int rel = add(4, 5);
CUT_EXPECT_INT_EQ(8, rel);
}// create a test suite named `suite_001`
CUT_SUITE(suite_001)
{
// add a test case
CUT_SUITE_ADD_TC(add_001);
CUT_SUITE_ADD_TC(add_002);
}int main()
{
// excute a test suite
CUT_RUN_SUITE(suite_001);
// show test report
CUT_REPORT();
return 0;
}```