Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Ryooooooga/cute
Header only Unit Testing Framework for C99
https://github.com/Ryooooooga/cute
c header-only unittest unittesting
Last synced: 12 days ago
JSON representation
Header only Unit Testing Framework for C99
- Host: GitHub
- URL: https://github.com/Ryooooooga/cute
- Owner: Ryooooooga
- License: mit
- Created: 2022-09-18T07:47:28.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-18T12:33:12.000Z (11 months ago)
- Last Synced: 2024-10-12T02:16:14.399Z (about 1 month ago)
- Topics: c, header-only, unittest, unittesting
- Language: C
- Homepage:
- Size: 43.9 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# CUTE
❤️ Simple header only Unit Testing Framework for C99 ❤️
## Examples
```c
#define CUTE_MAIN
#include "cute.h"int factorial(int n) {
if (n > 0) {
return n * factorial(n - 1);
}
return 1;
}TEST(factorial) {
EXPECT(factorial(0), eq(1));
EXPECT(factorial(1), eq(1));
EXPECT(factorial(5), eq(120), "5! == %d (actual %d)", _1, _0);
}TEST(string) {
const char *s = "Hello, world!";ASSERT(s, is_not_null);
ASSERT(s, not(is_null));
EXPECT(s, eq_str("Hello, world!"));
EXPECT((s, 4), eq_str("Hell"));
EXPECT(s, contains("world"));
EXPECT(s, not(contains("nya")));
}int main(void) {
return RUN_ALL();
}
```See [example.c](example.c).
## Usage
### via CMake
```cmake
include(FetchContent)FetchContent_Declare(cute
GIT_REPOSITORY "https://github.com/Ryooooooga/cute.git"
GIT_TAG "main"
)FetchContent_MakeAvailable(cute)
add_executable(your_project your_src.c)
target_link_library(your_project cute)
```