Simple interface for Mbed Cloud Client
Embed:
(wiki syntax)
Show/hide line numbers
unity_fixture.h
00001 //- Copyright (c) 2010 James Grenning and Contributed to Unity Project 00002 /* ========================================== 00003 Unity Project - A Test Framework for C 00004 Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 00005 [Released under MIT License. Please refer to license.txt for details] 00006 ========================================== */ 00007 00008 #ifndef UNITY_FIXTURE_H_ 00009 #define UNITY_FIXTURE_H_ 00010 00011 #include "unity.h" 00012 #include "unity_internals.h" 00013 #include "unity_fixture_malloc_overrides.h" 00014 #include "unity_fixture_internals.h" 00015 00016 int UnityMain(int argc, const char* argv[], void (*runAllTests)(void)); 00017 00018 00019 #define TEST_GROUP(group)\ 00020 static const char* TEST_GROUP_##group = #group 00021 00022 #define TEST_SETUP(group) void TEST_##group##_SETUP(void);\ 00023 void TEST_##group##_SETUP(void) 00024 00025 #define TEST_TEAR_DOWN(group) void TEST_##group##_TEAR_DOWN(void);\ 00026 void TEST_##group##_TEAR_DOWN(void) 00027 00028 00029 #define TEST(group, name) \ 00030 void TEST_##group##_##name##_(void);\ 00031 void TEST_##group##_##name##_run(void);\ 00032 void TEST_##group##_##name##_run(void)\ 00033 {\ 00034 UnityTestRunner(TEST_##group##_SETUP,\ 00035 TEST_##group##_##name##_,\ 00036 TEST_##group##_TEAR_DOWN,\ 00037 "TEST(" #group ", " #name ")",\ 00038 TEST_GROUP_##group, #name,\ 00039 __FILE__, __LINE__);\ 00040 }\ 00041 void TEST_##group##_##name##_(void) 00042 00043 #define IGNORE_TEST(group, name) \ 00044 void TEST_##group##_##name##_(void);\ 00045 void TEST_##group##_##name##_run(void);\ 00046 void TEST_##group##_##name##_run(void)\ 00047 {\ 00048 UnityIgnoreTest("IGNORE_TEST(" #group ", " #name ")", TEST_GROUP_##group, #name);\ 00049 }\ 00050 void TEST_##group##_##name##_(void) 00051 00052 #define RUN_TEST_CASE(group, name) \ 00053 { void TEST_##group##_##name##_run(void);\ 00054 TEST_##group##_##name##_run(); } 00055 00056 //This goes at the bottom of each test file or in a separate c file 00057 #define TEST_GROUP_RUNNER(group)\ 00058 void TEST_##group##_GROUP_RUNNER(void);\ 00059 void TEST_##group##_GROUP_RUNNER(void) 00060 00061 //Call this from main 00062 #define RUN_TEST_GROUP(group)\ 00063 { void TEST_##group##_GROUP_RUNNER(void);\ 00064 TEST_##group##_GROUP_RUNNER(); } 00065 00066 //CppUTest Compatibility Macros 00067 #define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&(ptr), (void*)(newPointerValue), __LINE__) 00068 #define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR((expected), (actual)) 00069 #define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) 00070 #define FAIL(message) TEST_FAIL_MESSAGE((message)) 00071 #define CHECK(condition) TEST_ASSERT_TRUE((condition)) 00072 #define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) 00073 #define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) 00074 #define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) 00075 00076 void UnityMalloc_MakeMallocFailAfterCount(int count); 00077 00078 #endif /* UNITY_FIXTURE_H_ */
Generated on Tue Jul 12 2022 19:01:37 by 1.7.2