mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-15 15:37:51 -04:00
Improve the test utilities
This commit is contained in:
parent
32e0a80eb2
commit
d30253b05f
@ -58,3 +58,22 @@ void check_equals(long value, long expected, const char* message){
|
|||||||
printf("\t expected: %ld was: %ld\n", expected, value);
|
printf("\t expected: %ld was: %ld\n", expected, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void check(bool condition, const char* where, size_t line){
|
||||||
|
if(!condition){
|
||||||
|
printf("%s:%lu Check failed\n", where, line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void check(bool condition, const char* message, const char* where, size_t line){
|
||||||
|
if(!condition){
|
||||||
|
printf("%s:%lu Check failed: \"%s\"\n", where, line, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void check_equals(long value, long expected, const char* message, const char* where, size_t line){
|
||||||
|
if(value != expected){
|
||||||
|
printf("%s:%lu Check failed: \"%s\"\n", where, line, message);
|
||||||
|
printf("\t expected: %ld was: %ld\n", expected, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -8,6 +8,13 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
#define CHECK(cond, message) check(cond, message, __PRETTY_FUNCTION__, __LINE__)
|
||||||
|
#define CHECK_EQUALS(a, b, message) check_equals(a, b, message, __PRETTY_FUNCTION__, __LINE__)
|
||||||
|
|
||||||
void check(bool condition);
|
void check(bool condition);
|
||||||
void check(bool condition, const char* message);
|
void check(bool condition, const char* message);
|
||||||
void check_equals(long value, long expected, const char* message);
|
void check_equals(long value, long expected, const char* message);
|
||||||
|
|
||||||
|
void check(bool condition, const char* where, size_t line);
|
||||||
|
void check(bool condition, const char* message, const char* where, size_t line);
|
||||||
|
void check_equals(long value, long expected, const char* message, const char* where, size_t line);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user