mirror of
https://git.recroomarchive.org/Radium/libradhook.git
synced 2026-08-07 09:10:59 +00:00
initial commit
This commit is contained in:
23
tests/test_lifecycle.cpp
Normal file
23
tests/test_lifecycle.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user