1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #ifndef CORE_TEST_H
- #define CORE_TEST_H
- #include "core/Types.h"
- void coreFinalizeTests(void);
- #define CORE_TEST_ARGS const char *file, int line
- #define CORE_TEST_FUNCTION(name, type) \
- bool coreTest##name(CORE_TEST_ARGS, type wanted, type actual)
- CORE_TEST_FUNCTION(Int, int);
- CORE_TEST_FUNCTION(I64, i64);
- CORE_TEST_FUNCTION(U64, u64);
- CORE_TEST_FUNCTION(Size, size_t);
- CORE_TEST_FUNCTION(Bool, bool);
- CORE_TEST_FUNCTION(String, const char*);
- bool coreTestFloat(CORE_TEST_ARGS, float wanted, float actual, float error);
- bool coreTestNull(CORE_TEST_ARGS, const void* p);
- bool coreTestNotNull(CORE_TEST_ARGS, const void* p);
- #define CORE_TEST(wanted, actual, name) \
- coreTest##name(__FILE__, __LINE__, wanted, actual)
- #define CORE_TEST_FLOAT(wanted, actual, error) \
- coreTestFloat(__FILE__, __LINE__, wanted, actual, error)
- #define CORE_TEST_BOOL(wanted, actual) CORE_TEST(wanted, actual, Bool)
- #define CORE_TEST_INT(wanted, actual) CORE_TEST(wanted, actual, Int)
- #define CORE_TEST_I64(wanted, actual) CORE_TEST(wanted, actual, I64)
- #define CORE_TEST_U64(wanted, actual) CORE_TEST(wanted, actual, U64)
- #define CORE_TEST_SIZE(wanted, actual) CORE_TEST(wanted, actual, Size)
- #define CORE_TEST_STRING(wanted, actual) CORE_TEST(wanted, actual, String)
- #define CORE_TEST_FALSE(actual) CORE_TEST(false, actual, Bool)
- #define CORE_TEST_TRUE(actual) CORE_TEST(true, actual, Bool)
- #define CORE_TEST_NULL(actual) coreTestNull(__FILE__, __LINE__, actual)
- #define CORE_TEST_NOT_NULL(actual) coreTestNotNull(__FILE__, __LINE__, actual)
- bool coreTestVectorN(CORE_TEST_ARGS, const float* wanted, const float* actual,
- size_t n);
- #define CORE_TEST_V2(wanted, actual) \
- coreTestVectorN(__FILE__, __LINE__, (wanted)->data, (actual)->data, 2)
- #define CORE_TEST_V3(wanted, actual) \
- coreTestVectorN(__FILE__, __LINE__, (wanted)->data, (actual)->data, 3)
- #define CORE_TEST_V4(wanted, actual) \
- coreTestVectorN(__FILE__, __LINE__, (wanted)->data, (actual)->data, 4)
- bool coreTestIntVectorN(CORE_TEST_ARGS, const int* wanted, const int* actual,
- size_t n);
- #define CORE_TEST_IV2(wanted, actual) \
- coreTestIntVectorN(__FILE__, __LINE__, (wanted)->data, (actual)->data, 2)
- #define CORE_TEST_IV3(wanted, actual) \
- coreTestIntVectorN(__FILE__, __LINE__, (wanted)->data, (actual)->data, 3)
- #define CORE_TEST_IV4(wanted, actual) \
- coreTestIntVectorN(__FILE__, __LINE__, (wanted)->data, (actual)->data, 4)
- #endif
|