diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-12-05 14:16:22 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-05 14:16:22 +0000 |
| commit | 9264436f35e2c4e94adfdf2a8ea23a346ace3a65 (patch) | |
| tree | 9fe48ff4728060445e655d8a3b528999fd124ff8 /hyprtester/src/shared.hpp | |
| parent | d5c52ef58e57b371a9df8fd4404c5d55a1b26f34 (diff) | |
desktop: rewrite reserved area handling + improve tests (#12383)
Diffstat (limited to 'hyprtester/src/shared.hpp')
| -rw-r--r-- | hyprtester/src/shared.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/hyprtester/src/shared.hpp b/hyprtester/src/shared.hpp index 43944c3c..1090aa9a 100644 --- a/hyprtester/src/shared.hpp +++ b/hyprtester/src/shared.hpp @@ -18,6 +18,17 @@ namespace Colors { constexpr const char* RESET = "\x1b[0m"; }; +#define EXPECT_MAX_DELTA(expr, desired, delta) \ + if (const auto RESULT = expr; std::abs(RESULT - (desired)) > delta) { \ + NLog::log("{}Failed: {}{}, expected max delta of {}, got delta {} ({} - {}). Source: {}@{}.", Colors::RED, Colors::RESET, #expr, delta, (RESULT - (desired)), RESULT, \ + desired, __FILE__, __LINE__); \ + ret = 1; \ + TESTS_FAILED++; \ + } else { \ + NLog::log("{}Passed: {}{}. Got {}", Colors::GREEN, Colors::RESET, #expr, (RESULT - (desired))); \ + TESTS_PASSED++; \ + } + #define EXPECT(expr, val) \ if (const auto RESULT = expr; RESULT != (val)) { \ NLog::log("{}Failed: {}{}, expected {}, got {}. Source: {}@{}.", Colors::RED, Colors::RESET, #expr, val, RESULT, __FILE__, __LINE__); \ |
