Files
libradhook/tests/test_lifecycle.cpp
nexusverypro 3192afe07d initial commit
2026-07-03 02:00:27 +01:00

23 lines
575 B
C++

#include <cassert>
#include "radhook/radhook.h"
static int fn() { return 42; }
static int detour() { return 1337; }
int main() {
RadHookHandle h = nullptr;
// destroy before create safety
assert(RadHookDestroy(nullptr) != RadHookResult::Success);
RadHookCreate((void*)fn, (void*)detour, &h);
RadHookDestroy(h);
// use after destroy safety
assert(RadHookEnable(h) != RadHookResult::Success);
assert(RadHookDisable(h) != RadHookResult::Success);
assert(RadHookIsValid(h) == false || true); // depends on implementation
return 0;
}