tester: simplify adding test files

This commit is contained in:
Vaxry 2025-06-27 12:18:45 +02:00
parent 1fc7e80bdb
commit e4b6fedfb9
No known key found for this signature in database
GPG key ID: 665806380871D640
6 changed files with 25 additions and 22 deletions

View file

@ -18,7 +18,7 @@ using namespace Hyprutils::Memory;
#define UP CUniquePointer
#define SP CSharedPointer
bool testGroups() {
static bool test() {
NLog::log("{}Testing groups", Colors::GREEN);
// test on workspace "window"
@ -175,3 +175,5 @@ bool testGroups() {
return !ret;
}
REGISTER_TEST_FN(test)

View file

@ -18,7 +18,7 @@ using namespace Hyprutils::Memory;
#define UP CUniquePointer
#define SP CSharedPointer
bool testMisc() {
static bool test() {
NLog::log("{}Testing config: misc:", Colors::GREEN);
NLog::log("{}Testing close_special_on_empty", Colors::YELLOW);
@ -140,3 +140,5 @@ bool testMisc() {
return !ret;
}
REGISTER_TEST_FN(test);

View file

@ -1,6 +1,12 @@
#pragma once
bool testGroups();
bool testWindows();
bool testWorkspaces();
bool testMisc();
#include <vector>
#include <functional>
inline std::vector<std::function<bool()>> testFns;
#define REGISTER_TEST_FN(fn) \
static auto _register_fn = [] { \
testFns.emplace_back(fn); \
return 1; \
}();

View file

@ -18,7 +18,7 @@ using namespace Hyprutils::Memory;
#define UP CUniquePointer
#define SP CSharedPointer
bool testWindows() {
static bool test() {
NLog::log("{}Testing windows", Colors::GREEN);
// test on workspace "window"
@ -94,3 +94,5 @@ bool testWindows() {
return !ret;
}
REGISTER_TEST_FN(test)

View file

@ -18,7 +18,7 @@ using namespace Hyprutils::Memory;
#define UP CUniquePointer
#define SP CSharedPointer
bool testWorkspaces() {
static bool test() {
NLog::log("{}Testing workspaces", Colors::GREEN);
// test on workspace "window"
@ -347,3 +347,5 @@ bool testWorkspaces() {
return !ret;
}
REGISTER_TEST_FN(test)