tester: simplify adding test files
This commit is contained in:
parent
1fc7e80bdb
commit
e4b6fedfb9
6 changed files with 25 additions and 22 deletions
|
|
@ -218,20 +218,9 @@ int main(int argc, char** argv, char** envp) {
|
||||||
|
|
||||||
NLog::log("{}Loaded plugin", Colors::YELLOW);
|
NLog::log("{}Loaded plugin", Colors::YELLOW);
|
||||||
|
|
||||||
// now we can start issuing stuff.
|
for (const auto& fn : testFns) {
|
||||||
NLog::log("{}testing windows", Colors::YELLOW);
|
EXPECT(fn(), true);
|
||||||
EXPECT(testWindows(), true);
|
}
|
||||||
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
|
||||||
|
|
||||||
NLog::log("{}testing groups", Colors::YELLOW);
|
|
||||||
EXPECT(testGroups(), true);
|
|
||||||
|
|
||||||
NLog::log("{}testing workspaces", Colors::YELLOW);
|
|
||||||
EXPECT(testWorkspaces(), true);
|
|
||||||
|
|
||||||
NLog::log("{}testing misc variables", Colors::YELLOW);
|
|
||||||
EXPECT(testMisc(), true);
|
|
||||||
|
|
||||||
NLog::log("{}running plugin test", Colors::YELLOW);
|
NLog::log("{}running plugin test", Colors::YELLOW);
|
||||||
EXPECT(testPlugin(), true);
|
EXPECT(testPlugin(), true);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ using namespace Hyprutils::Memory;
|
||||||
#define UP CUniquePointer
|
#define UP CUniquePointer
|
||||||
#define SP CSharedPointer
|
#define SP CSharedPointer
|
||||||
|
|
||||||
bool testGroups() {
|
static bool test() {
|
||||||
NLog::log("{}Testing groups", Colors::GREEN);
|
NLog::log("{}Testing groups", Colors::GREEN);
|
||||||
|
|
||||||
// test on workspace "window"
|
// test on workspace "window"
|
||||||
|
|
@ -175,3 +175,5 @@ bool testGroups() {
|
||||||
|
|
||||||
return !ret;
|
return !ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
REGISTER_TEST_FN(test)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ using namespace Hyprutils::Memory;
|
||||||
#define UP CUniquePointer
|
#define UP CUniquePointer
|
||||||
#define SP CSharedPointer
|
#define SP CSharedPointer
|
||||||
|
|
||||||
bool testMisc() {
|
static bool test() {
|
||||||
NLog::log("{}Testing config: misc:", Colors::GREEN);
|
NLog::log("{}Testing config: misc:", Colors::GREEN);
|
||||||
|
|
||||||
NLog::log("{}Testing close_special_on_empty", Colors::YELLOW);
|
NLog::log("{}Testing close_special_on_empty", Colors::YELLOW);
|
||||||
|
|
@ -140,3 +140,5 @@ bool testMisc() {
|
||||||
|
|
||||||
return !ret;
|
return !ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
REGISTER_TEST_FN(test);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
bool testGroups();
|
#include <vector>
|
||||||
bool testWindows();
|
#include <functional>
|
||||||
bool testWorkspaces();
|
|
||||||
bool testMisc();
|
inline std::vector<std::function<bool()>> testFns;
|
||||||
|
|
||||||
|
#define REGISTER_TEST_FN(fn) \
|
||||||
|
static auto _register_fn = [] { \
|
||||||
|
testFns.emplace_back(fn); \
|
||||||
|
return 1; \
|
||||||
|
}();
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ using namespace Hyprutils::Memory;
|
||||||
#define UP CUniquePointer
|
#define UP CUniquePointer
|
||||||
#define SP CSharedPointer
|
#define SP CSharedPointer
|
||||||
|
|
||||||
bool testWindows() {
|
static bool test() {
|
||||||
NLog::log("{}Testing windows", Colors::GREEN);
|
NLog::log("{}Testing windows", Colors::GREEN);
|
||||||
|
|
||||||
// test on workspace "window"
|
// test on workspace "window"
|
||||||
|
|
@ -94,3 +94,5 @@ bool testWindows() {
|
||||||
|
|
||||||
return !ret;
|
return !ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
REGISTER_TEST_FN(test)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ using namespace Hyprutils::Memory;
|
||||||
#define UP CUniquePointer
|
#define UP CUniquePointer
|
||||||
#define SP CSharedPointer
|
#define SP CSharedPointer
|
||||||
|
|
||||||
bool testWorkspaces() {
|
static bool test() {
|
||||||
NLog::log("{}Testing workspaces", Colors::GREEN);
|
NLog::log("{}Testing workspaces", Colors::GREEN);
|
||||||
|
|
||||||
// test on workspace "window"
|
// test on workspace "window"
|
||||||
|
|
@ -347,3 +347,5 @@ bool testWorkspaces() {
|
||||||
|
|
||||||
return !ret;
|
return !ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
REGISTER_TEST_FN(test)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue