Skip to content

PalmeseMattia/CUnit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CUnit

Simple and automatic single header C unit testing tool.

Take a look at the example.

Syntax:

#include "../cunit.h"

TEST(test_one) {
	ASSERT_EQUAL_STR("bello", "bello");
}

TEST(test_two) {
	ASSERT_EQUAL_INT(10, 10);
}

//SEG FAULT
TEST(test_three) {
	int *p = NULL;
	*p = 42;
	ASSERT_EQUAL_INT(42, *p);
}

//THIS TEST WILL FAIL
TEST(test_four) {
	ASSERT_EQUAL_STR("Hello", "Hell");
}

int main() {
	run_tests();
	return 0;
}

Basic Usage:

Alt text

Compatibility

This tool uses the __attribute__((constructor)) extension, so make sure that your compiler supports it.

About

Simple and Automatic C Unit Testing

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •