2024-01-12 22:32:45 +01:00
|
|
|
#ifndef tester_hpp_INCLUDED
|
|
|
|
#define tester_hpp_INCLUDED
|
|
|
|
|
|
|
|
class Tester {
|
|
|
|
|
|
|
|
public:
|
|
|
|
Tester(std::string test_name);
|
|
|
|
|
|
|
|
Tester(Tester* tester_parent, std::string test_name);
|
2024-01-17 12:25:06 +01:00
|
|
|
Tester(Tester* tester_parent, std::string test_name, bool show_details);
|
2024-01-12 22:32:45 +01:00
|
|
|
|
|
|
|
template<typename T, typename U>
|
|
|
|
void assert_eq(std::string test_name, T got, U expected) {
|
|
|
|
char got_s[10], expected_s[10];
|
|
|
|
snprintf(got_s, sizeof got_s, "%08x", got);
|
|
|
|
snprintf(expected_s, sizeof expected_s, "%08x", expected);
|
|
|
|
|
|
|
|
assert_eq_str(test_name, got == expected, got_s, expected_s);
|
|
|
|
}
|
|
|
|
void assert_eq_str(std::string test_name, bool correct, std::string got_s, std::string expected_s);
|
|
|
|
|
|
|
|
|
|
|
|
~Tester();
|
|
|
|
|
|
|
|
void intro();
|
|
|
|
void finish();
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::optional<Tester*> parent;
|
|
|
|
std::string name;
|
|
|
|
int succeeded, failed;
|
2024-01-17 12:25:06 +01:00
|
|
|
bool detailed;
|
2024-01-12 22:32:45 +01:00
|
|
|
|
|
|
|
int depth();
|
2024-01-17 12:25:06 +01:00
|
|
|
bool shown();
|
2024-01-12 22:32:45 +01:00
|
|
|
std::string full_name();
|
|
|
|
std::string prefix();
|
2024-01-17 14:38:14 +01:00
|
|
|
std::chrono::time_point<std::chrono::steady_clock> started;
|
2024-01-12 22:32:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // tester_hpp_INCLUDED
|