diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/FAQ.html b/FAQ.html new file mode 100644 index 00000000..cf23c2d7 --- /dev/null +++ b/FAQ.html @@ -0,0 +1,114 @@ + + +
+ + + + +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
It is likely that you are using version 1.x.x and trying to use syntax like ASSERT_EQ_INT(a, b, fmt, ...)
to print something custom.
Due to a bug of MSVC (VA_ARGS incorrectly passed to nested macro as a single argument), we are not able to pass a const char*
string to parameter fmt.
To avoid this compiler error, use:
instead of:
+ cutest
+
+ UnitTest for C/C++.
+ |
+
Ccutest_hook_t | CUnitTest hook |
Ccutest_porting_timespec_t |
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
#include <stdio.h>
#include <stdarg.h>
Go to the source code of this file.
++Data Structures | |
struct | cutest_hook_t |
CUnitTest hook. More... | |
struct | cutest_porting_timespec_t |
+Macros | |
#define | CUTEST_VERSION_MAJOR 3 |
Major version. | |
#define | CUTEST_VERSION_MINOR 0 |
Minor version. | |
#define | CUTEST_VERSION_PATCH 1 |
Patch version. | |
#define | CUTEST_VERSION_PREREL 0 |
Development version. | |
#define | TEST_C_API |
Ensure the api is exposed as C function. | |
#define | TEST_FIXTURE_SETUP(fixture) TEST_C_API static void s_cutest_fixture_setup_##fixture(void) |
Setup test fixture. | |
#define | TEST_FIXTURE_TEARDOWN(fixture) TEST_C_API static void s_cutest_fixture_teardown_##fixture(void) |
TearDown test suit. | |
#define | TEST_GET_PARAM() (_test_parameterized_data[_test_parameterized_idx]) |
Get parameterized data. | |
#define | TEST_PARAMETERIZED_DEFINE(fixture, test, TYPE, ...) |
Define parameterized data for fixture. | |
#define | TEST_PARAMETERIZED_SUPPRESS_UNUSED (void)_test_parameterized_data; (void)_test_parameterized_idx |
Suppress unused parameter warning if TEST_GET_PARAM() is not used. | |
#define | TEST_P(fixture, test) |
Parameterized Test. | |
#define | TEST_F(fixture, test) |
Test Fixture. | |
#define | TEST(fixture, test) |
Simple Test. | |
#define | TEST_INITIALIZER(f) TEST_C_API void f(void) |
Function constructor. | |
#define | TEST_NEED_MANUAL_REGISTRATION 1 |
#define | TEST_MANUAL_DECLARE_TEST_INTERFACE(fixture, test) TEST_C_API void cutest_usertest_interface_##fixture##_##test(); |
Whether manual registration is needed. | |
#define | TEST_MANUAL_REGISTER_TEST_INTERFACE(fixture, test) cutest_usertest_interface_##fixture##_##test(); |
Call test interface. | |
#define | ASSERT_EQ_CHAR(a, b, ...) ASSERT_TEMPLATE(char, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_CHAR(a, b, ...) ASSERT_TEMPLATE(char, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_CHAR(a, b, ...) ASSERT_TEMPLATE(char, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_CHAR(a, b, ...) ASSERT_TEMPLATE(char, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_CHAR(a, b, ...) ASSERT_TEMPLATE(char, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_CHAR(a, b, ...) ASSERT_TEMPLATE(char, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_DCHAR(a, b, ...) ASSERT_TEMPLATE(signed char, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_DCHAR(a, b, ...) ASSERT_TEMPLATE(signed char, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_DCHAR(a, b, ...) ASSERT_TEMPLATE(signed char, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_DCHAR(a, b, ...) ASSERT_TEMPLATE(signed char, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_DCHAR(a, b, ...) ASSERT_TEMPLATE(signed char, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_DCHAR(a, b, ...) ASSERT_TEMPLATE(signed char, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_UCHAR(a, b, ...) ASSERT_TEMPLATE(unsigned char, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_UCHAR(a, b, ...) ASSERT_TEMPLATE(unsigned char, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_UCHAR(a, b, ...) ASSERT_TEMPLATE(unsigned char, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_UCHAR(a, b, ...) ASSERT_TEMPLATE(unsigned char, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_UCHAR(a, b, ...) ASSERT_TEMPLATE(unsigned char, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_UCHAR(a, b, ...) ASSERT_TEMPLATE(unsigned char, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_SHORT(a, b, ...) ASSERT_TEMPLATE(short, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_SHORT(a, b, ...) ASSERT_TEMPLATE(short, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_SHORT(a, b, ...) ASSERT_TEMPLATE(short, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_SHORT(a, b, ...) ASSERT_TEMPLATE(short, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_SHORT(a, b, ...) ASSERT_TEMPLATE(short, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_SHORT(a, b, ...) ASSERT_TEMPLATE(short, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_USHORT(a, b, ...) ASSERT_TEMPLATE(unsigned short, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_USHORT(a, b, ...) ASSERT_TEMPLATE(unsigned short, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_USHORT(a, b, ...) ASSERT_TEMPLATE(unsigned short, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_USHORT(a, b, ...) ASSERT_TEMPLATE(unsigned short, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_USHORT(a, b, ...) ASSERT_TEMPLATE(unsigned short, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_USHORT(a, b, ...) ASSERT_TEMPLATE(unsigned short, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_INT(a, b, ...) ASSERT_TEMPLATE(int, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_INT(a, b, ...) ASSERT_TEMPLATE(int, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_INT(a, b, ...) ASSERT_TEMPLATE(int, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_INT(a, b, ...) ASSERT_TEMPLATE(int, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_INT(a, b, ...) ASSERT_TEMPLATE(int, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_INT(a, b, ...) ASSERT_TEMPLATE(int, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_UINT(a, b, ...) ASSERT_TEMPLATE(unsigned int, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_UINT(a, b, ...) ASSERT_TEMPLATE(unsigned int, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_UINT(a, b, ...) ASSERT_TEMPLATE(unsigned int, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_UINT(a, b, ...) ASSERT_TEMPLATE(unsigned int, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_UINT(a, b, ...) ASSERT_TEMPLATE(unsigned int, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_UINT(a, b, ...) ASSERT_TEMPLATE(unsigned int, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_LONG(a, b, ...) ASSERT_TEMPLATE(long, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_LONG(a, b, ...) ASSERT_TEMPLATE(long, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_LONG(a, b, ...) ASSERT_TEMPLATE(long, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_LONG(a, b, ...) ASSERT_TEMPLATE(long, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_LONG(a, b, ...) ASSERT_TEMPLATE(long, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_LONG(a, b, ...) ASSERT_TEMPLATE(long, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_ULONG(a, b, ...) ASSERT_TEMPLATE(unsigned long, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_ULONG(a, b, ...) ASSERT_TEMPLATE(unsigned long, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_ULONG(a, b, ...) ASSERT_TEMPLATE(unsigned long, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_ULONG(a, b, ...) ASSERT_TEMPLATE(unsigned long, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_ULONG(a, b, ...) ASSERT_TEMPLATE(unsigned long, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_ULONG(a, b, ...) ASSERT_TEMPLATE(unsigned long, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_FLOAT(a, b, ...) ASSERT_TEMPLATE(float, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_FLOAT(a, b, ...) ASSERT_TEMPLATE(float, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_FLOAT(a, b, ...) ASSERT_TEMPLATE(float, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_FLOAT(a, b, ...) ASSERT_TEMPLATE(float, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_FLOAT(a, b, ...) ASSERT_TEMPLATE(float, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_FLOAT(a, b, ...) ASSERT_TEMPLATE(float, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_DOUBLE(a, b, ...) ASSERT_TEMPLATE(double, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_DOUBLE(a, b, ...) ASSERT_TEMPLATE(double, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_DOUBLE(a, b, ...) ASSERT_TEMPLATE(double, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_DOUBLE(a, b, ...) ASSERT_TEMPLATE(double, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_DOUBLE(a, b, ...) ASSERT_TEMPLATE(double, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_DOUBLE(a, b, ...) ASSERT_TEMPLATE(double, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_PTR(a, b, ...) ASSERT_TEMPLATE(const void*, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_PTR(a, b, ...) ASSERT_TEMPLATE(const void*, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_PTR(a, b, ...) ASSERT_TEMPLATE(const void*, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_PTR(a, b, ...) ASSERT_TEMPLATE(const void*, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_PTR(a, b, ...) ASSERT_TEMPLATE(const void*, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_PTR(a, b, ...) ASSERT_TEMPLATE(const void*, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_STR(a, b, ...) ASSERT_TEMPLATE(const char*, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_STR(a, b, ...) ASSERT_TEMPLATE(const char*, !=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_LONGLONG(a, b, ...) ASSERT_TEMPLATE(long long, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_LONGLONG(a, b, ...) ASSERT_TEMPLATE(long long, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_LONGLONG(a, b, ...) ASSERT_TEMPLATE(long long, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_LONGLONG(a, b, ...) ASSERT_TEMPLATE(long long, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_LONGLONG(a, b, ...) ASSERT_TEMPLATE(long long, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_LONGLONG(a, b, ...) ASSERT_TEMPLATE(long long, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_ULONGLONG(a, b, ...) ASSERT_TEMPLATE(unsigned long long, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_ULONGLONG(a, b, ...) ASSERT_TEMPLATE(unsigned long long, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_ULONGLONG(a, b, ...) ASSERT_TEMPLATE(unsigned long long, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_ULONGLONG(a, b, ...) ASSERT_TEMPLATE(unsigned long long, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_ULONGLONG(a, b, ...) ASSERT_TEMPLATE(unsigned long long, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_ULONGLONG(a, b, ...) ASSERT_TEMPLATE(unsigned long long, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_INT8(a, b, ...) ASSERT_TEMPLATE(int8_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_INT8(a, b, ...) ASSERT_TEMPLATE(int8_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_INT8(a, b, ...) ASSERT_TEMPLATE(int8_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_INT8(a, b, ...) ASSERT_TEMPLATE(int8_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_INT8(a, b, ...) ASSERT_TEMPLATE(int8_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_INT8(a, b, ...) ASSERT_TEMPLATE(int8_t, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_UINT8(a, b, ...) ASSERT_TEMPLATE(uint8_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_UINT8(a, b, ...) ASSERT_TEMPLATE(uint8_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_UINT8(a, b, ...) ASSERT_TEMPLATE(uint8_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_UINT8(a, b, ...) ASSERT_TEMPLATE(uint8_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_UINT8(a, b, ...) ASSERT_TEMPLATE(uint8_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_UINT8(a, b, ...) ASSERT_TEMPLATE(uint8_t, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_INT16(a, b, ...) ASSERT_TEMPLATE(int16_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_INT16(a, b, ...) ASSERT_TEMPLATE(int16_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_INT16(a, b, ...) ASSERT_TEMPLATE(int16_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_INT16(a, b, ...) ASSERT_TEMPLATE(int16_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_INT16(a, b, ...) ASSERT_TEMPLATE(int16_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_INT16(a, b, ...) ASSERT_TEMPLATE(int16_t, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_UINT16(a, b, ...) ASSERT_TEMPLATE(uint16_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_UINT16(a, b, ...) ASSERT_TEMPLATE(uint16_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_UINT16(a, b, ...) ASSERT_TEMPLATE(uint16_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_UINT16(a, b, ...) ASSERT_TEMPLATE(uint16_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_UINT16(a, b, ...) ASSERT_TEMPLATE(uint16_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_UINT16(a, b, ...) ASSERT_TEMPLATE(uint16_t, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_INT32(a, b, ...) ASSERT_TEMPLATE(int32_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_INT32(a, b, ...) ASSERT_TEMPLATE(int32_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_INT32(a, b, ...) ASSERT_TEMPLATE(int32_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_INT32(a, b, ...) ASSERT_TEMPLATE(int32_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_INT32(a, b, ...) ASSERT_TEMPLATE(int32_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_INT32(a, b, ...) ASSERT_TEMPLATE(int32_t, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_UINT32(a, b, ...) ASSERT_TEMPLATE(uint32_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_UINT32(a, b, ...) ASSERT_TEMPLATE(uint32_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_UINT32(a, b, ...) ASSERT_TEMPLATE(uint32_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_UINT32(a, b, ...) ASSERT_TEMPLATE(uint32_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_UINT32(a, b, ...) ASSERT_TEMPLATE(uint32_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_UINT32(a, b, ...) ASSERT_TEMPLATE(uint32_t, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_INT64(a, b, ...) ASSERT_TEMPLATE(int64_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_INT64(a, b, ...) ASSERT_TEMPLATE(int64_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_INT64(a, b, ...) ASSERT_TEMPLATE(int64_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_INT64(a, b, ...) ASSERT_TEMPLATE(int64_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_INT64(a, b, ...) ASSERT_TEMPLATE(int64_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_INT64(a, b, ...) ASSERT_TEMPLATE(int64_t, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_UINT64(a, b, ...) ASSERT_TEMPLATE(uint64_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_UINT64(a, b, ...) ASSERT_TEMPLATE(uint64_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_UINT64(a, b, ...) ASSERT_TEMPLATE(uint64_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_UINT64(a, b, ...) ASSERT_TEMPLATE(uint64_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_UINT64(a, b, ...) ASSERT_TEMPLATE(uint64_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_UINT64(a, b, ...) ASSERT_TEMPLATE(uint64_t, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_SIZE(a, b, ...) ASSERT_TEMPLATE(size_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_SIZE(a, b, ...) ASSERT_TEMPLATE(size_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_SIZE(a, b, ...) ASSERT_TEMPLATE(size_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_SIZE(a, b, ...) ASSERT_TEMPLATE(size_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_SIZE(a, b, ...) ASSERT_TEMPLATE(size_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_SIZE(a, b, ...) ASSERT_TEMPLATE(size_t, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_PTRDIFF(a, b, ...) ASSERT_TEMPLATE(ptrdiff_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_PTRDIFF(a, b, ...) ASSERT_TEMPLATE(ptrdiff_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_PTRDIFF(a, b, ...) ASSERT_TEMPLATE(ptrdiff_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_PTRDIFF(a, b, ...) ASSERT_TEMPLATE(ptrdiff_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_PTRDIFF(a, b, ...) ASSERT_TEMPLATE(ptrdiff_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_PTRDIFF(a, b, ...) ASSERT_TEMPLATE(ptrdiff_t, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_INTPTR(a, b, ...) ASSERT_TEMPLATE(intptr_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_INTPTR(a, b, ...) ASSERT_TEMPLATE(intptr_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_INTPTR(a, b, ...) ASSERT_TEMPLATE(intptr_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_INTPTR(a, b, ...) ASSERT_TEMPLATE(intptr_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_INTPTR(a, b, ...) ASSERT_TEMPLATE(intptr_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_INTPTR(a, b, ...) ASSERT_TEMPLATE(intptr_t, >=, a, b, __VA_ARGS__) |
#define | ASSERT_EQ_UINTPTR(a, b, ...) ASSERT_TEMPLATE(uintptr_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_UINTPTR(a, b, ...) ASSERT_TEMPLATE(uintptr_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_UINTPTR(a, b, ...) ASSERT_TEMPLATE(uintptr_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_UINTPTR(a, b, ...) ASSERT_TEMPLATE(uintptr_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_UINTPTR(a, b, ...) ASSERT_TEMPLATE(uintptr_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_UINTPTR(a, b, ...) ASSERT_TEMPLATE(uintptr_t, >=, a, b, __VA_ARGS__) |
#define | TEST_REGISTER_TYPE_ONCE(TYPE, fn_cmp, fn_dump) |
Declare and register custom type. | |
#define | ASSERT_TEMPLATE(TYPE, OP, a, b, fmt, ...) |
Compare template. | |
+Typedefs | |
typedef struct cutest_porting_jmpbuf | cutest_porting_jmpbuf_t |
typedef void(* | cutest_porting_longjmp_fn) (cutest_porting_jmpbuf_t *buf, int val) |
Function protocol for longjmp(). | |
typedef void(* | cutest_porting_setjmp_fn) (cutest_porting_jmpbuf_t *buf, cutest_porting_longjmp_fn fn_longjmp, int val, void *data) |
Execute function when call setjmp(). | |
+Enumerations | |
enum | cutest_porting_color_t { CUTEST_COLOR_DEFAULT +, CUTEST_COLOR_RED +, CUTEST_COLOR_GREEN +, CUTEST_COLOR_YELLOW + } |
+Functions | |
int | cutest_run_tests (int argc, char *argv[], FILE *out, const cutest_hook_t *hook) |
Run all test cases. | |
const char * | cutest_get_current_fixture (void) |
Get current running suit name. | |
const char * | cutest_get_current_test (void) |
Get current running case name. | |
void | cutest_skip_test (void) |
Skip current test case. | |
void | cutest_porting_abort (const char *fmt,...) |
void | cutest_porting_clock_gettime (cutest_porting_timespec_t *tp) |
int | cutest_porting_cvfprintf (FILE *stream, int color, const char *fmt, va_list ap) |
Colorful print. | |
void * | cutest_porting_gettid (void) |
Get current thread ID. | |
void | cutest_porting_setjmp (cutest_porting_setjmp_fn execute, void *data) |
Wrapper for setjmp() and longjmp(). | |
int | cutest_porting_compare_floating_number (int type, const void *v1, const void *v2) |
Floating number compare. | |
#define CUTEST_VERSION_MAJOR 3 | +
#define CUTEST_VERSION_MINOR 0 | +
#define CUTEST_VERSION_PATCH 1 | +
#define CUTEST_VERSION_PREREL 0 | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
This page explains how to interpret the graphs that are generated by doxygen.
+Consider the following example:
This will result in the following graph:
+The boxes in the above graph have the following meaning:
+The arrows have the following meaning:
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Modules | |
C89 Assertion | |
C99 Assertion | |
cutest support rich set of assertion. An assertion typically have following syntax:
+The OP
means which compare operation you want to use:
EQ
: a
is equal to b
.NE
: a
is not equal to b
.LT
: a
is less than b
.LE
: a
is equal to b
or less than b
.GT
: a
is greater than b
.GE
: a
is equal to b
or greater than b
.The TYPE
means the type of value a
and b
.
++To support more types, checkout TEST_REGISTER_TYPE_ONCE().
+
So, an assertion like ASSERT_EQ_INT() means except a
and b
have type of int
and they are the same value.
You may notice all assertions have syntax of ASSERT_OP_TYPE(a, b, fmt, ...)
, it means custom print is available if assertion fails. For example, the following code
Will print something like:
+You may also want to refer to the actual value of operator, you can use _L
to refer to left operator and _R
to refer to right operator:
The output will be something like:
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Modules | |
char | |
signed char | |
unsigned char | |
short | |
unsigned short | |
int | |
unsigned int | |
long | |
unsigned long | |
float | |
double | |
const void* | |
const char* | |
Assertion macros for C89 standard, provide native type support:
size_t
and ptrdiff_t
: Although they are included in C89 standard, the formal print conversion specifier %zu
and %td
are inclueded in C99 standard. Besides they need <stddef.h>
, and we want the dependency to be minimum.long double
: Although it exists in C89 standard, we do not offer support for type long double
, because actual properties unspecified. The implementation can be either x86 extended-precision floating-point format (80 bits, but typically 96 bits or 128 bits in memory with padding bytes), the non-IEEE "double-double" (128 bits), IEEE 754 quadruple-precision floating-point format (128 bits), or the same as double.
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_CHAR(a, b, ...) ASSERT_TEMPLATE(char, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_CHAR(a, b, ...) ASSERT_TEMPLATE(char, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_CHAR(a, b, ...) ASSERT_TEMPLATE(char, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_CHAR(a, b, ...) ASSERT_TEMPLATE(char, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_CHAR(a, b, ...) ASSERT_TEMPLATE(char, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_CHAR(a, b, ...) ASSERT_TEMPLATE(char, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_CHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(char, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_CHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(char, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_CHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(char, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_CHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(char, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_CHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(char, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_CHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(char, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_DCHAR(a, b, ...) ASSERT_TEMPLATE(signed char, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_DCHAR(a, b, ...) ASSERT_TEMPLATE(signed char, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_DCHAR(a, b, ...) ASSERT_TEMPLATE(signed char, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_DCHAR(a, b, ...) ASSERT_TEMPLATE(signed char, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_DCHAR(a, b, ...) ASSERT_TEMPLATE(signed char, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_DCHAR(a, b, ...) ASSERT_TEMPLATE(signed char, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_DCHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(signed char, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_DCHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(signed char, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_DCHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(signed char, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_DCHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(signed char, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_DCHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(signed char, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_DCHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(signed char, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_DOUBLE(a, b, ...) ASSERT_TEMPLATE(double, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_DOUBLE(a, b, ...) ASSERT_TEMPLATE(double, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_DOUBLE(a, b, ...) ASSERT_TEMPLATE(double, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_DOUBLE(a, b, ...) ASSERT_TEMPLATE(double, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_DOUBLE(a, b, ...) ASSERT_TEMPLATE(double, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_DOUBLE(a, b, ...) ASSERT_TEMPLATE(double, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_DOUBLE | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(double, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_DOUBLE | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(double, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_DOUBLE | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(double, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_DOUBLE | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(double, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_DOUBLE | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(double, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_DOUBLE | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(double, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_FLOAT(a, b, ...) ASSERT_TEMPLATE(float, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_FLOAT(a, b, ...) ASSERT_TEMPLATE(float, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_FLOAT(a, b, ...) ASSERT_TEMPLATE(float, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_FLOAT(a, b, ...) ASSERT_TEMPLATE(float, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_FLOAT(a, b, ...) ASSERT_TEMPLATE(float, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_FLOAT(a, b, ...) ASSERT_TEMPLATE(float, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_FLOAT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(float, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_FLOAT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(float, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_FLOAT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(float, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_FLOAT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(float, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_FLOAT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(float, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_FLOAT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(float, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_INT(a, b, ...) ASSERT_TEMPLATE(int, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_INT(a, b, ...) ASSERT_TEMPLATE(int, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_INT(a, b, ...) ASSERT_TEMPLATE(int, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_INT(a, b, ...) ASSERT_TEMPLATE(int, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_INT(a, b, ...) ASSERT_TEMPLATE(int, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_INT(a, b, ...) ASSERT_TEMPLATE(int, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_INT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_INT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_INT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_INT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_INT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_INT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_LONG(a, b, ...) ASSERT_TEMPLATE(long, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_LONG(a, b, ...) ASSERT_TEMPLATE(long, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_LONG(a, b, ...) ASSERT_TEMPLATE(long, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_LONG(a, b, ...) ASSERT_TEMPLATE(long, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_LONG(a, b, ...) ASSERT_TEMPLATE(long, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_LONG(a, b, ...) ASSERT_TEMPLATE(long, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_LONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(long, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_LONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(long, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_LONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(long, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_LONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(long, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_LONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(long, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_LONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(long, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_PTR(a, b, ...) ASSERT_TEMPLATE(const void*, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_PTR(a, b, ...) ASSERT_TEMPLATE(const void*, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_PTR(a, b, ...) ASSERT_TEMPLATE(const void*, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_PTR(a, b, ...) ASSERT_TEMPLATE(const void*, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_PTR(a, b, ...) ASSERT_TEMPLATE(const void*, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_PTR(a, b, ...) ASSERT_TEMPLATE(const void*, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_PTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(const void*, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_PTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(const void*, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_PTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(const void*, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_PTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(const void*, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_PTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(const void*, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_PTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(const void*, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_SHORT(a, b, ...) ASSERT_TEMPLATE(short, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_SHORT(a, b, ...) ASSERT_TEMPLATE(short, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_SHORT(a, b, ...) ASSERT_TEMPLATE(short, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_SHORT(a, b, ...) ASSERT_TEMPLATE(short, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_SHORT(a, b, ...) ASSERT_TEMPLATE(short, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_SHORT(a, b, ...) ASSERT_TEMPLATE(short, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_SHORT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(short, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_SHORT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(short, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_SHORT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(short, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_SHORT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(short, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_SHORT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(short, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_SHORT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(short, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_STR(a, b, ...) ASSERT_TEMPLATE(const char*, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_STR(a, b, ...) ASSERT_TEMPLATE(const char*, !=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_STR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(const char*, ==, a, b, __VA_ARGS__) | +
#define ASSERT_NE_STR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(const char*, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_UCHAR(a, b, ...) ASSERT_TEMPLATE(unsigned char, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_UCHAR(a, b, ...) ASSERT_TEMPLATE(unsigned char, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_UCHAR(a, b, ...) ASSERT_TEMPLATE(unsigned char, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_UCHAR(a, b, ...) ASSERT_TEMPLATE(unsigned char, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_UCHAR(a, b, ...) ASSERT_TEMPLATE(unsigned char, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_UCHAR(a, b, ...) ASSERT_TEMPLATE(unsigned char, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_UCHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned char, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_UCHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned char, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_UCHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned char, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_UCHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned char, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_UCHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned char, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_UCHAR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned char, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_UINT(a, b, ...) ASSERT_TEMPLATE(unsigned int, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_UINT(a, b, ...) ASSERT_TEMPLATE(unsigned int, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_UINT(a, b, ...) ASSERT_TEMPLATE(unsigned int, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_UINT(a, b, ...) ASSERT_TEMPLATE(unsigned int, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_UINT(a, b, ...) ASSERT_TEMPLATE(unsigned int, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_UINT(a, b, ...) ASSERT_TEMPLATE(unsigned int, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_UINT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned int, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_UINT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned int, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_UINT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned int, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_UINT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned int, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_UINT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned int, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_UINT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned int, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_ULONG(a, b, ...) ASSERT_TEMPLATE(unsigned long, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_ULONG(a, b, ...) ASSERT_TEMPLATE(unsigned long, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_ULONG(a, b, ...) ASSERT_TEMPLATE(unsigned long, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_ULONG(a, b, ...) ASSERT_TEMPLATE(unsigned long, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_ULONG(a, b, ...) ASSERT_TEMPLATE(unsigned long, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_ULONG(a, b, ...) ASSERT_TEMPLATE(unsigned long, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_ULONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned long, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_ULONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned long, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_ULONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned long, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_ULONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned long, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_ULONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned long, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_ULONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned long, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_USHORT(a, b, ...) ASSERT_TEMPLATE(unsigned short, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_USHORT(a, b, ...) ASSERT_TEMPLATE(unsigned short, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_USHORT(a, b, ...) ASSERT_TEMPLATE(unsigned short, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_USHORT(a, b, ...) ASSERT_TEMPLATE(unsigned short, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_USHORT(a, b, ...) ASSERT_TEMPLATE(unsigned short, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_USHORT(a, b, ...) ASSERT_TEMPLATE(unsigned short, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_USHORT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned short, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_USHORT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned short, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_USHORT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned short, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_USHORT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned short, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_USHORT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned short, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_USHORT | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned short, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Modules | |
long long | |
unsigned long long | |
int8_t | |
uint8_t | |
int16_t | |
uint16_t | |
int32_t | |
uint32_t | |
int64_t | |
uint64_t | |
size_t | |
ptrdiff_t | |
inttpr_t | |
uinttpr_t | |
Assertion macros for C99 standard, provide support:
<stdint.h>
and <inttypes.h>
header files which are not included.CUTEST_NO_C99_SUPPORT
(eg. -DCUTEST_NO_C99_SUPPORT
) during compile cutest.type | flag |
---|---|
long long | CUTEST_NO_LONGLONG_SUPPORT |
unsigned long long | CUTEST_NO_ULONGLONG_SUPPORT |
int8_t | CUTEST_NO_INT8_SUPPORT |
uint8_t | CUTEST_NO_UINT8_SUPPORT |
int16_t | CUTEST_NO_INT16_SUPPORT |
uint16_t | CUTEST_NO_UINT16_SUPPORT |
int32_t | CUTEST_NO_INT32_SUPPORT |
uint32_t | CUTEST_NO_UINT32_SUPPORT |
int64_t | CUTEST_NO_INT64_SUPPORT |
uint64_t | CUTEST_NO_UINT64_SUPPORT |
size_t | CUTEST_NO_SIZE_SUPPORT |
ptrdiff_t | CUTEST_NO_PTRDIFF_SUPPORT |
intptr_t | CUTEST_NO_INTPTR_SUPPORT |
uintptr_t | CUTEST_NO_UINTPTR_SUPPORT |
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_INT16(a, b, ...) ASSERT_TEMPLATE(int16_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_INT16(a, b, ...) ASSERT_TEMPLATE(int16_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_INT16(a, b, ...) ASSERT_TEMPLATE(int16_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_INT16(a, b, ...) ASSERT_TEMPLATE(int16_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_INT16(a, b, ...) ASSERT_TEMPLATE(int16_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_INT16(a, b, ...) ASSERT_TEMPLATE(int16_t, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_INT16 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int16_t, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_INT16 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int16_t, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_INT16 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int16_t, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_INT16 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int16_t, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_INT16 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int16_t, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_INT16 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int16_t, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_INT32(a, b, ...) ASSERT_TEMPLATE(int32_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_INT32(a, b, ...) ASSERT_TEMPLATE(int32_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_INT32(a, b, ...) ASSERT_TEMPLATE(int32_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_INT32(a, b, ...) ASSERT_TEMPLATE(int32_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_INT32(a, b, ...) ASSERT_TEMPLATE(int32_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_INT32(a, b, ...) ASSERT_TEMPLATE(int32_t, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_INT32 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int32_t, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_INT32 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int32_t, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_INT32 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int32_t, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_INT32 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int32_t, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_INT32 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int32_t, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_INT32 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int32_t, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_INT64(a, b, ...) ASSERT_TEMPLATE(int64_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_INT64(a, b, ...) ASSERT_TEMPLATE(int64_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_INT64(a, b, ...) ASSERT_TEMPLATE(int64_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_INT64(a, b, ...) ASSERT_TEMPLATE(int64_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_INT64(a, b, ...) ASSERT_TEMPLATE(int64_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_INT64(a, b, ...) ASSERT_TEMPLATE(int64_t, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_INT64 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int64_t, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_INT64 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int64_t, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_INT64 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int64_t, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_INT64 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int64_t, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_INT64 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int64_t, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_INT64 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int64_t, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_INT8(a, b, ...) ASSERT_TEMPLATE(int8_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_INT8(a, b, ...) ASSERT_TEMPLATE(int8_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_INT8(a, b, ...) ASSERT_TEMPLATE(int8_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_INT8(a, b, ...) ASSERT_TEMPLATE(int8_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_INT8(a, b, ...) ASSERT_TEMPLATE(int8_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_INT8(a, b, ...) ASSERT_TEMPLATE(int8_t, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_INT8 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int8_t, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_INT8 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int8_t, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_INT8 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int8_t, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_INT8 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int8_t, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_INT8 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int8_t, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_INT8 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(int8_t, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_INTPTR(a, b, ...) ASSERT_TEMPLATE(intptr_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_INTPTR(a, b, ...) ASSERT_TEMPLATE(intptr_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_INTPTR(a, b, ...) ASSERT_TEMPLATE(intptr_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_INTPTR(a, b, ...) ASSERT_TEMPLATE(intptr_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_INTPTR(a, b, ...) ASSERT_TEMPLATE(intptr_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_INTPTR(a, b, ...) ASSERT_TEMPLATE(intptr_t, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_INTPTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(intptr_t, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_INTPTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(intptr_t, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_INTPTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(intptr_t, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_INTPTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(intptr_t, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_INTPTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(intptr_t, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_INTPTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(intptr_t, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_LONGLONG(a, b, ...) ASSERT_TEMPLATE(long long, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_LONGLONG(a, b, ...) ASSERT_TEMPLATE(long long, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_LONGLONG(a, b, ...) ASSERT_TEMPLATE(long long, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_LONGLONG(a, b, ...) ASSERT_TEMPLATE(long long, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_LONGLONG(a, b, ...) ASSERT_TEMPLATE(long long, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_LONGLONG(a, b, ...) ASSERT_TEMPLATE(long long, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_LONGLONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(long long, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_LONGLONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(long long, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_LONGLONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(long long, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_LONGLONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(long long, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_LONGLONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(long long, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_LONGLONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(long long, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_PTRDIFF(a, b, ...) ASSERT_TEMPLATE(ptrdiff_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_PTRDIFF(a, b, ...) ASSERT_TEMPLATE(ptrdiff_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_PTRDIFF(a, b, ...) ASSERT_TEMPLATE(ptrdiff_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_PTRDIFF(a, b, ...) ASSERT_TEMPLATE(ptrdiff_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_PTRDIFF(a, b, ...) ASSERT_TEMPLATE(ptrdiff_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_PTRDIFF(a, b, ...) ASSERT_TEMPLATE(ptrdiff_t, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_PTRDIFF | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(ptrdiff_t, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_PTRDIFF | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(ptrdiff_t, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_PTRDIFF | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(ptrdiff_t, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_PTRDIFF | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(ptrdiff_t, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_PTRDIFF | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(ptrdiff_t, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_PTRDIFF | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(ptrdiff_t, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_SIZE(a, b, ...) ASSERT_TEMPLATE(size_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_SIZE(a, b, ...) ASSERT_TEMPLATE(size_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_SIZE(a, b, ...) ASSERT_TEMPLATE(size_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_SIZE(a, b, ...) ASSERT_TEMPLATE(size_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_SIZE(a, b, ...) ASSERT_TEMPLATE(size_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_SIZE(a, b, ...) ASSERT_TEMPLATE(size_t, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_SIZE | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(size_t, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_SIZE | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(size_t, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_SIZE | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(size_t, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_SIZE | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(size_t, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_SIZE | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(size_t, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_SIZE | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(size_t, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_UINT16(a, b, ...) ASSERT_TEMPLATE(uint16_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_UINT16(a, b, ...) ASSERT_TEMPLATE(uint16_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_UINT16(a, b, ...) ASSERT_TEMPLATE(uint16_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_UINT16(a, b, ...) ASSERT_TEMPLATE(uint16_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_UINT16(a, b, ...) ASSERT_TEMPLATE(uint16_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_UINT16(a, b, ...) ASSERT_TEMPLATE(uint16_t, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_UINT16 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint16_t, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_UINT16 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint16_t, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_UINT16 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint16_t, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_UINT16 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint16_t, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_UINT16 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint16_t, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_UINT16 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint16_t, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_UINT32(a, b, ...) ASSERT_TEMPLATE(uint32_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_UINT32(a, b, ...) ASSERT_TEMPLATE(uint32_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_UINT32(a, b, ...) ASSERT_TEMPLATE(uint32_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_UINT32(a, b, ...) ASSERT_TEMPLATE(uint32_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_UINT32(a, b, ...) ASSERT_TEMPLATE(uint32_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_UINT32(a, b, ...) ASSERT_TEMPLATE(uint32_t, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_UINT32 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint32_t, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_UINT32 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint32_t, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_UINT32 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint32_t, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_UINT32 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint32_t, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_UINT32 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint32_t, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_UINT32 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint32_t, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_UINT64(a, b, ...) ASSERT_TEMPLATE(uint64_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_UINT64(a, b, ...) ASSERT_TEMPLATE(uint64_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_UINT64(a, b, ...) ASSERT_TEMPLATE(uint64_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_UINT64(a, b, ...) ASSERT_TEMPLATE(uint64_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_UINT64(a, b, ...) ASSERT_TEMPLATE(uint64_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_UINT64(a, b, ...) ASSERT_TEMPLATE(uint64_t, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_UINT64 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint64_t, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_UINT64 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint64_t, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_UINT64 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint64_t, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_UINT64 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint64_t, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_UINT64 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint64_t, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_UINT64 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint64_t, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_UINT8(a, b, ...) ASSERT_TEMPLATE(uint8_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_UINT8(a, b, ...) ASSERT_TEMPLATE(uint8_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_UINT8(a, b, ...) ASSERT_TEMPLATE(uint8_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_UINT8(a, b, ...) ASSERT_TEMPLATE(uint8_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_UINT8(a, b, ...) ASSERT_TEMPLATE(uint8_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_UINT8(a, b, ...) ASSERT_TEMPLATE(uint8_t, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_UINT8 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint8_t, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_UINT8 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint8_t, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_UINT8 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint8_t, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_UINT8 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint8_t, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_UINT8 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint8_t, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_UINT8 | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uint8_t, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_UINTPTR(a, b, ...) ASSERT_TEMPLATE(uintptr_t, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_UINTPTR(a, b, ...) ASSERT_TEMPLATE(uintptr_t, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_UINTPTR(a, b, ...) ASSERT_TEMPLATE(uintptr_t, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_UINTPTR(a, b, ...) ASSERT_TEMPLATE(uintptr_t, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_UINTPTR(a, b, ...) ASSERT_TEMPLATE(uintptr_t, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_UINTPTR(a, b, ...) ASSERT_TEMPLATE(uintptr_t, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_UINTPTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uintptr_t, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_UINTPTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uintptr_t, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_UINTPTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uintptr_t, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_UINTPTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uintptr_t, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_UINTPTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uintptr_t, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_UINTPTR | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(uintptr_t, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | ASSERT_EQ_ULONGLONG(a, b, ...) ASSERT_TEMPLATE(unsigned long long, ==, a, b, __VA_ARGS__) |
#define | ASSERT_NE_ULONGLONG(a, b, ...) ASSERT_TEMPLATE(unsigned long long, !=, a, b, __VA_ARGS__) |
#define | ASSERT_LT_ULONGLONG(a, b, ...) ASSERT_TEMPLATE(unsigned long long, <, a, b, __VA_ARGS__) |
#define | ASSERT_LE_ULONGLONG(a, b, ...) ASSERT_TEMPLATE(unsigned long long, <=, a, b, __VA_ARGS__) |
#define | ASSERT_GT_ULONGLONG(a, b, ...) ASSERT_TEMPLATE(unsigned long long, >, a, b, __VA_ARGS__) |
#define | ASSERT_GE_ULONGLONG(a, b, ...) ASSERT_TEMPLATE(unsigned long long, >=, a, b, __VA_ARGS__) |
#define ASSERT_EQ_ULONGLONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned long long, ==, a, b, __VA_ARGS__) | +
#define ASSERT_GE_ULONGLONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned long long, >=, a, b, __VA_ARGS__) | +
#define ASSERT_GT_ULONGLONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned long long, >, a, b, __VA_ARGS__) | +
#define ASSERT_LE_ULONGLONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned long long, <=, a, b, __VA_ARGS__) | +
#define ASSERT_LT_ULONGLONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned long long, <, a, b, __VA_ARGS__) | +
#define ASSERT_NE_ULONGLONG | +( | ++ | a, | +
+ | + | + | b, | +
+ | + | + | ... | +
+ | ) | +ASSERT_TEMPLATE(unsigned long long, !=, a, b, __VA_ARGS__) | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | TEST_REGISTER_TYPE_ONCE(TYPE, fn_cmp, fn_dump) |
Declare and register custom type. | |
#define | ASSERT_TEMPLATE(TYPE, OP, a, b, fmt, ...) |
Compare template. | |
Even though cutest have rich set of assertion macros, there might be some cases that need to compare custom type.
+We have a custom type register system to support such scene.
+Suppose we have a custom type: typedef struct { int a; } foo_t
, to add type support:
Register type information by TEST_REGISTER_TYPE_ONCE()
+Define assertion macros
+Now you can use ASSERT_EQ_FOO()
/ ASSERT_NE_FOO()
/ etc to do assertion.
#define ASSERT_TEMPLATE | +( | ++ | TYPE, | +
+ | + | + | OP, | +
+ | + | + | a, | +
+ | + | + | b, | +
+ | + | + | fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
Compare template.
+[in] | TYPE | Type name. |
[in] | OP | Compare operation. |
[in] | a | Left operator. |
[in] | b | Right operator. |
[in] | fmt | Extra print format when assert failure. |
[in] | ... | Print arguments. |
#define TEST_REGISTER_TYPE_ONCE | +( | ++ | TYPE, | +
+ | + | + | fn_cmp, | +
+ | + | + | fn_dump | +
+ | ) | ++ |
Declare and register custom type.
+This function does following things:
cmp
and dump
. Note this depends on comiler so might not work.TYPE
.For example:
+TYPE
is unsigned
, the protocol of cmp
and dump
should be: TYPE
is const char*
, the protocol of cmp
and dump
should be: [in] | TYPE | Data type. |
[in] | fn_cmp | Compare function. It must have proto of int (*)(const TYPE*, const TYPE*) . |
[in] | fn_dump | Dump function. It must have proto of int (*)(FILE*, const TYPE*) . |
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | TEST_FIXTURE_SETUP(fixture) TEST_C_API static void s_cutest_fixture_setup_##fixture(void) |
Setup test fixture. | |
#define | TEST_FIXTURE_TEARDOWN(fixture) TEST_C_API static void s_cutest_fixture_teardown_##fixture(void) |
TearDown test suit. | |
#define | TEST_GET_PARAM() (_test_parameterized_data[_test_parameterized_idx]) |
Get parameterized data. | |
#define | TEST_PARAMETERIZED_DEFINE(fixture, test, TYPE, ...) |
Define parameterized data for fixture. | |
#define | TEST_PARAMETERIZED_SUPPRESS_UNUSED (void)_test_parameterized_data; (void)_test_parameterized_idx |
Suppress unused parameter warning if TEST_GET_PARAM() is not used. | |
#define | TEST_P(fixture, test) |
Parameterized Test. | |
#define | TEST_F(fixture, test) |
Test Fixture. | |
#define | TEST(fixture, test) |
Simple Test. | |
There are three ways to define a test:
+TEST() define a simple test unit, which should be self contained.
+Both TEST_F() and TEST_P() define a set of shared test unit, which share the same setup and teardown procedure defined by TEST_FIXTURE_SETUP() and TEST_FIXTURE_TEARDOWN().
+The TEST_P() define a parameterized test, which require TEST_PARAMETERIZED_DEFINE() define a set of parameterized data.
+#define TEST | +( | ++ | fixture, | +
+ | + | + | test | +
+ | ) | ++ |
Simple Test.
+Define a simple test that have no setup (AKA. TEST_FIXTURE_SETUP) and teardown (AKA. TEST_FIXTURE_TEARDOWN) stage, which should be a self contained test.
+[in] | fixture | suit name |
[in] | test | case name |
#define TEST_F | +( | ++ | fixture, | +
+ | + | + | test | +
+ | ) | ++ |
Test Fixture.
+[in] | fixture | The name of fixture |
[in] | test | The name of test case |
#define TEST_FIXTURE_SETUP | +( | ++ | fixture | ) | +TEST_C_API static void s_cutest_fixture_setup_##fixture(void) | +
#define TEST_FIXTURE_TEARDOWN | +( | ++ | fixture | ) | +TEST_C_API static void s_cutest_fixture_teardown_##fixture(void) | +
#define TEST_GET_PARAM | +( | +) | +(_test_parameterized_data[_test_parameterized_idx]) | +
Get parameterized data.
+#define TEST_P | +( | ++ | fixture, | +
+ | + | + | test | +
+ | ) | ++ |
Parameterized Test.
+A parameterized test will run many cycles, which was defined by TEST_PARAMETERIZED_DEFINE().
+You can get the parameter by TEST_GET_PARAM(). Each cycle the TEST_GET_PARAM() will return the matching data defined in TEST_PARAMETERIZED_DEFINE()
+unused parameter _test_parameterized_data
. To suppress this warning, just place TEST_PARAMETERIZED_SUPPRESS_UNUSED in the begin of your test body.[in] | fixture | The name of fixture |
[in] | test | The name of test case |
#define TEST_PARAMETERIZED_DEFINE | +( | ++ | fixture, | +
+ | + | + | test, | +
+ | + | + | TYPE, | +
+ | + | + | ... | +
+ | ) | ++ |
Define parameterized data for fixture.
+[in] | fixture | Which fixture you want to parameterized |
[in] | test | Which test you want to parameterized |
[in] | TYPE | Data type |
[in] | ... | Data values |
#define TEST_PARAMETERIZED_SUPPRESS_UNUSED (void)_test_parameterized_data; (void)_test_parameterized_idx | +
Suppress unused parameter warning if TEST_GET_PARAM() is not used.
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Functions | |
int | cutest_porting_compare_floating_number (int type, const void *v1, const void *v2) |
Floating number compare. | |
By default we use EPSILON
and ULP
to do floating number compre, which assume all floating numbers are matching IEEE 754 Standard (both float
and double
).
This works fine on most time, but there are indeed some hardware does not follow this standard, and this technology just broken.
+To use custom compare algorithm, define CUTEST_PORTING_COMPARE_FLOATING_NUMBER
(eg. -DCUTEST_PORTING_COMPARE_FLOATING_NUMBER
) when compile.
int cutest_porting_compare_floating_number | +( | +int | +type, | +
+ | + | const void * | +v1, | +
+ | + | const void * | +v2 | +
+ | ) | ++ |
Floating number compare.
+[in] | type | The type of v1 and v2 . 0 is float, 1 is double. |
[in] | v1 | The address to value1. |
[in] | v2 | The address to value2. |
v1
is less than, equal to, more than v2
.
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Macros | |
#define | TEST_INITIALIZER(f) TEST_C_API void f(void) |
Function constructor. | |
#define | TEST_NEED_MANUAL_REGISTRATION 1 |
#define | TEST_MANUAL_DECLARE_TEST_INTERFACE(fixture, test) TEST_C_API void cutest_usertest_interface_##fixture##_##test(); |
Whether manual registration is needed. | |
#define | TEST_MANUAL_REGISTER_TEST_INTERFACE(fixture, test) cutest_usertest_interface_##fixture##_##test(); |
Call test interface. | |
If your environment does not support automatically register test cases, you need to manually register your tests.
+There are at least two ways to manually register test cases:
+Assume you have following tests defined:
+To manually register your tests:
+First of all, you need a section name so all following magic can happen, let's say cutest
.
cutest.h
lds
. Please note the code ALIGN(0x4)
, it is the size of function pointer, which should be 0x4
on 32-bit platform and 0x8
on 64-bit platform. #define TEST_INITIALIZER | +( | ++ | f | ) | +TEST_C_API void f(void) | +
#define TEST_MANUAL_DECLARE_TEST_INTERFACE | +( | ++ | fixture, | +
+ | + | + | test | +
+ | ) | +TEST_C_API void cutest_usertest_interface_##fixture##_##test(); | +
#define TEST_MANUAL_REGISTER_TEST_INTERFACE | +( | ++ | fixture, | +
+ | + | + | test | +
+ | ) | +cutest_usertest_interface_##fixture##_##test(); | +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Modules | |
System API | |
Floating-Point Numbers | |
By default cutest support Windows/Linux, and if you need to porting it to some other OS, you need to implementation all the interfaces listed in this chapter.
+Do note that the following API is non-optional and operation system must provide it:
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Modules | |
abort() | |
clock_gettime() | |
fprintf() | |
gettid() | |
setjmp() | |
To porting all the interfaces, add CUTEST_PORTING
(eg. -DCUTEST_PORTING
) when compile cutest.
To porting specific interface, add one or more flags listed below:
Interface | Flag |
---|---|
cutest_porting_abort | CUTEST_PORTING_ABORT |
cutest_porting_clock_gettime | CUTEST_PORTING_CLOCK_GETTIME |
cutest_porting_cvfprintf | CUTEST_PORTING_CVFPRINTF |
cutest_porting_gettid | CUTEST_PORTING_GETTID |
cutest_porting_setjmp | CUTEST_PORTING_SETJMP |
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Functions | |
void | cutest_porting_abort (const char *fmt,...) |
void cutest_porting_abort | +( | +const char * | +fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
[in] | fmt | Last words. |
[in] | ... | Arguments to last words. |
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Data Structures | |
struct | cutest_porting_timespec_t |
+Functions | |
void | cutest_porting_clock_gettime (cutest_porting_timespec_t *tp) |
struct cutest_porting_timespec_t | +
void cutest_porting_clock_gettime | +( | +cutest_porting_timespec_t * | +tp | ) | ++ |
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Enumerations | |
enum | cutest_porting_color_t { CUTEST_COLOR_DEFAULT +, CUTEST_COLOR_RED +, CUTEST_COLOR_GREEN +, CUTEST_COLOR_YELLOW + } |
+Functions | |
int | cutest_porting_cvfprintf (FILE *stream, int color, const char *fmt, va_list ap) |
Colorful print. | |
enum cutest_porting_color_t | +
int cutest_porting_cvfprintf | +( | +FILE * | +stream, | +
+ | + | int | +color, | +
+ | + | const char * | +fmt, | +
+ | + | va_list | +ap | +
+ | ) | ++ |
Colorful print.
+Different system have different solutions to do colorful print, so we have a interface to do it.
+Below is a simple implementation that works just fine except drop colorful support:
+color
.stream
is a normal file and the color control charasters are printed into the file, this file is highly possible mess up.[in] | stream | The stream to print. |
[in] | color | Print color. Checkout cutest_porting_color_t. |
[in] | fmt | Print format. |
[in] | ap | Print arguments. |
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Functions | |
void * | cutest_porting_gettid (void) |
Get current thread ID. | |
void * cutest_porting_gettid | +( | +void | +) | ++ |
Get current thread ID.
+This function is used for check whether ASSERTION macros are called from main thread. If your system does not support multithread, just return NULL.
+ + +
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Typedefs | |
typedef struct cutest_porting_jmpbuf | cutest_porting_jmpbuf_t |
typedef void(* | cutest_porting_longjmp_fn) (cutest_porting_jmpbuf_t *buf, int val) |
Function protocol for longjmp(). | |
typedef void(* | cutest_porting_setjmp_fn) (cutest_porting_jmpbuf_t *buf, cutest_porting_longjmp_fn fn_longjmp, int val, void *data) |
Execute function when call setjmp(). | |
+Functions | |
void | cutest_porting_setjmp (cutest_porting_setjmp_fn execute, void *data) |
Wrapper for setjmp() and longjmp(). | |
typedef struct cutest_porting_jmpbuf cutest_porting_jmpbuf_t | +
typedef void(* cutest_porting_longjmp_fn) (cutest_porting_jmpbuf_t *buf, int val) | +
typedef void(* cutest_porting_setjmp_fn) (cutest_porting_jmpbuf_t *buf, cutest_porting_longjmp_fn fn_longjmp, int val, void *data) | +
Execute function when call setjmp().
+[in] | buf | Jump buffer. |
[in] | fn_longjmp | Function to do longjmp. |
[in] | val | 0 if first call, otherwise is the value passed to fn_longjmp . |
[in] | data | User defined data passed to cutest_porting_setjmp()/ |
void cutest_porting_setjmp | +( | +cutest_porting_setjmp_fn | +execute, | +
+ | + | void * | +data | +
+ | ) | ++ |
Wrapper for setjmp() and longjmp().
+A example implementation is:
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
+Data Structures | |
struct | cutest_hook_t |
CUnitTest hook. More... | |
+Functions | |
int | cutest_run_tests (int argc, char *argv[], FILE *out, const cutest_hook_t *hook) |
Run all test cases. | |
const char * | cutest_get_current_fixture (void) |
Get current running suit name. | |
const char * | cutest_get_current_test (void) |
Get current running case name. | |
void | cutest_skip_test (void) |
Skip current test case. | |
const char * cutest_get_current_fixture | +( | +void | +) | ++ |
Get current running suit name.
+const char * cutest_get_current_test | +( | +void | +) | ++ |
Get current running case name.
+int cutest_run_tests | +( | +int | +argc, | +
+ | + | char * | +argv[], | +
+ | + | FILE * | +out, | +
+ | + | const cutest_hook_t * | +hook | +
+ | ) | ++ |
Run all test cases.
+[in] | argc | The number of arguments. |
[in] | argv | The argument list. |
[in] | out | Output stream, cannot be NULL. |
[in] | hook | Test hook. |
void cutest_skip_test | +( | +void | +) | ++ |
Skip current test case.
+
+ cutest
+
+ UnitTest for C/C++.
+ |
+
UnitTest framework for C.
+You are done for everything! Compile your code and run, you will have following output:
+Add following code to your CMakeLists.txt:
+Remember to replace ${YOUR_TEST_EXECUTABLE}
with your actual executable name.
Just copy cutest.h
(in include/
directory) and cutest.c
(in src/
directory) to your build tree, and you are done.
Please do note that cutest.c
use #include "cutest.h"
syntax to find the header file, so be sure it can be found.
Checkout Online manual for API reference.
+