From 9264436f35e2c4e94adfdf2a8ea23a346ace3a65 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Fri, 5 Dec 2025 14:16:22 +0000 Subject: desktop: rewrite reserved area handling + improve tests (#12383) --- hyprtester/src/shared.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'hyprtester/src/shared.hpp') 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__); \ -- cgit v1.2.3