12345678910111213141516171819202122232425262728293031323334353637383940 |
- #ifndef CORE_TEST_H
- #define CORE_TEST_H
- #include "utils/Logger.h"
- namespace Core {
- class Test final {
- int tests;
- int successTests;
- String name;
- public:
- Test(const String& name);
- void finalize();
- template<typename T>
- void checkEqual(const T& wanted, const T& actual, const char* text) {
- tests++;
- if(wanted == actual) {
- successTests++;
- } else {
- (void)text;
- LOG_ERROR("# Test #: # - expected '#' got '#'", name, tests,
- text, wanted, actual)
- }
- }
- void checkEqual(float wanted, float actual, const char* text);
- void checkFloat(float wanted, float actual, float error,
- const char* text);
- void checkTrue(bool actual, const char* text);
- void checkFalse(bool actual, const char* text);
- void checkUnsigned8(u8 wanted, u8 actual, const char* text);
- void checkUnsigned16(u16 wanted, u16 actual, const char* text);
- void checkSigned8(i8 wanted, i8 actual, const char* text);
- void checkSigned16(i16 wanted, i16 actual, const char* text);
- };
- }
- #endif
|