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:
20
tests/test_state_transitions.cpp
Normal file
20
tests/test_state_transitions.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <cassert>
|
||||
#include "radhook/radhook.h"
|
||||
|
||||
static int fn() { return 42; }
|
||||
static int detour() { return 1337; }
|
||||
|
||||
int main() {
|
||||
RadHookHandle h = nullptr;
|
||||
|
||||
assert(RadHookCreate((void*)fn, (void*)detour, &h) == RadHookResult::Success);
|
||||
|
||||
// idempotent enable/disable behavior
|
||||
assert(RadHookEnable(h) != RadHookResult::Unknown);
|
||||
assert(RadHookEnable(h) == RadHookResult::AlreadyEnabled || RadHookIsEnabled(h));
|
||||
|
||||
assert(RadHookDisable(h) != RadHookResult::Unknown);
|
||||
assert(!RadHookIsEnabled(h) || RadHookDisable(h) == RadHookResult::AlreadyDisabled);
|
||||
|
||||
RadHookDestroy(h);
|
||||
}
|
||||
Reference in New Issue
Block a user