cmocka.h | cmocka.h | |||
---|---|---|---|---|
skipping to change at line 22 | skipping to change at line 22 | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | * See the License for the specific language governing permissions and | |||
* limitations under the License. | * limitations under the License. | |||
*/ | */ | |||
#ifndef CMOCKA_H_ | #ifndef CMOCKA_H_ | |||
#define CMOCKA_H_ | #define CMOCKA_H_ | |||
#ifdef _WIN32 | #ifdef _WIN32 | |||
# ifdef _MSC_VER | # ifdef _MSC_VER | |||
#define __func__ __FUNCTION__ | ||||
# ifndef inline | # ifndef inline | |||
#define inline __inline | #define inline __inline | |||
# endif /* inline */ | # endif /* inline */ | |||
# if _MSC_VER < 1500 | # if _MSC_VER < 1500 | |||
# ifdef __cplusplus | # ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
# endif /* __cplusplus */ | # endif /* __cplusplus */ | |||
int __stdcall IsDebuggerPresent(); | int __stdcall IsDebuggerPresent(); | |||
# ifdef __cplusplus | # ifdef __cplusplus | |||
skipping to change at line 55 | skipping to change at line 57 | |||
* #include <stddef.h> | * #include <stddef.h> | |||
* #include <setjmp.h> | * #include <setjmp.h> | |||
* @endcode | * @endcode | |||
* | * | |||
* This allows test applications to use custom definitions of C standard | * This allows test applications to use custom definitions of C standard | |||
* library functions and types. | * library functions and types. | |||
* | * | |||
* @{ | * @{ | |||
*/ | */ | |||
/* For those who are used to __func__ from gcc. */ | ||||
#ifndef __func__ | ||||
#define __func__ __FUNCTION__ | ||||
#endif | ||||
/* If __WORDSIZE is not set, try to figure it out and default to 32 bit. */ | /* If __WORDSIZE is not set, try to figure it out and default to 32 bit. */ | |||
#ifndef __WORDSIZE | #ifndef __WORDSIZE | |||
# if defined(__x86_64__) && !defined(__ILP32__) | # if defined(__x86_64__) && !defined(__ILP32__) | |||
# define __WORDSIZE 64 | # define __WORDSIZE 64 | |||
# else | # else | |||
# define __WORDSIZE 32 | # define __WORDSIZE 32 | |||
# endif | # endif | |||
#endif | #endif | |||
#ifdef DOXYGEN | #ifdef DOXYGEN | |||
skipping to change at line 1096 | skipping to change at line 1093 | |||
* @see assert_non_null() | * @see assert_non_null() | |||
*/ | */ | |||
void assert_null(void *pointer); | void assert_null(void *pointer); | |||
#else | #else | |||
#define assert_null(c) _assert_true(!(cast_ptr_to_largest_integral_type(c)) , #c, \ | #define assert_null(c) _assert_true(!(cast_ptr_to_largest_integral_type(c)) , #c, \ | |||
__FILE__, __LINE__) | __FILE__, __LINE__) | |||
#endif | #endif | |||
#ifdef DOXYGEN | #ifdef DOXYGEN | |||
/** | /** | |||
* @brief Assert that the two given pointers are equal. | ||||
* | ||||
* The function prints an error message and terminates the test by calling | ||||
* fail() if the pointers are not equal. | ||||
* | ||||
* @param[in] a The first pointer to compare. | ||||
* | ||||
* @param[in] b The pointer to compare against the first one. | ||||
*/ | ||||
void assert_ptr_equal(void *a, void *b); | ||||
#else | ||||
#define assert_ptr_equal(a, b) \ | ||||
_assert_int_equal(cast_ptr_to_largest_integral_type(a), \ | ||||
cast_ptr_to_largest_integral_type(b), \ | ||||
__FILE__, __LINE__) | ||||
#endif | ||||
#ifdef DOXYGEN | ||||
/** | ||||
* @brief Assert that the two given pointers are not equal. | ||||
* | ||||
* The function prints an error message and terminates the test by calling | ||||
* fail() if the pointers are equal. | ||||
* | ||||
* @param[in] a The first pointer to compare. | ||||
* | ||||
* @param[in] b The pointer to compare against the first one. | ||||
*/ | ||||
void assert_ptr_not_equal(void *a, void *b); | ||||
#else | ||||
#define assert_ptr_not_equal(a, b) \ | ||||
_assert_int_not_equal(cast_ptr_to_largest_integral_type(a), \ | ||||
cast_ptr_to_largest_integral_type(b), \ | ||||
__FILE__, __LINE__) | ||||
#endif | ||||
#ifdef DOXYGEN | ||||
/** | ||||
* @brief Assert that the two given integers are equal. | * @brief Assert that the two given integers are equal. | |||
* | * | |||
* The function prints an error message to standard error and terminates th e | * The function prints an error message to standard error and terminates th e | |||
* test by calling fail() if the integers are not equal. | * test by calling fail() if the integers are not equal. | |||
* | * | |||
* @param[in] a The first integer to compare. | * @param[in] a The first integer to compare. | |||
* | * | |||
* @param[in] b The integer to compare against the first one. | * @param[in] b The integer to compare against the first one. | |||
*/ | */ | |||
void assert_int_equal(int a, int b); | void assert_int_equal(int a, int b); | |||
skipping to change at line 1497 | skipping to change at line 1532 | |||
* if (*answer == NULL) { | * if (*answer == NULL) { | |||
* return -1; | * return -1; | |||
* } | * } | |||
* *answer = 42; | * *answer = 42; | |||
* | * | |||
* *state = answer; | * *state = answer; | |||
* | * | |||
* return 0; | * return 0; | |||
* } | * } | |||
* | * | |||
* static void teardown(void **state) { | * static int teardown(void **state) { | |||
* free(*state); | * free(*state); | |||
* | * | |||
* return 0; | * return 0; | |||
* } | * } | |||
* | * | |||
* static void null_test_success(void **state) { | * static void null_test_success(void **state) { | |||
* (void) state; | * (void) state; | |||
* } | * } | |||
* | * | |||
* static void int_test_success(void **state) { | * static void int_test_success(void **state) { | |||
skipping to change at line 1565 | skipping to change at line 1600 | |||
* if (*answer == NULL) { | * if (*answer == NULL) { | |||
* return -1; | * return -1; | |||
* } | * } | |||
* *answer = 42; | * *answer = 42; | |||
* | * | |||
* *state = answer; | * *state = answer; | |||
* | * | |||
* return 0; | * return 0; | |||
* } | * } | |||
* | * | |||
* static void teardown(void **state) { | * static int teardown(void **state) { | |||
* free(*state); | * free(*state); | |||
* | * | |||
* return 0; | * return 0; | |||
* } | * } | |||
* | * | |||
* static void null_test_success(void **state) { | * static void null_test_success(void **state) { | |||
* (void) state; | * (void) state; | |||
* } | * } | |||
* | * | |||
* static void int_test_success(void **state) { | * static void int_test_success(void **state) { | |||
End of changes. 5 change blocks. | ||||
7 lines changed or deleted | 42 lines changed or added | |||