diff options
author | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2024-01-06 13:34:24 +0100 |
---|---|---|
committer | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2024-01-06 13:34:24 +0100 |
commit | 3911f51480bae09baeb2942249ff5bba07258ff0 (patch) | |
tree | f2f5838d61fa67823bae101f7d78b6de086044da | |
parent | 0dbb2b025a1a71fe3f2559ff442b60455db828b5 (diff) | |
download | fuzzer-3911f51480bae09baeb2942249ff5bba07258ff0.tar.gz |
detect undo causing an active player switch
-rwxr-xr-x | rtt-module.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/rtt-module.js b/rtt-module.js index b7e727d..af49030 100755 --- a/rtt-module.js +++ b/rtt-module.js @@ -31,6 +31,8 @@ module.exports.fuzz = function(fuzzerInputData) { let seed = data.consumeIntegralInRange(1, 2**35-31) let scenarios = Array.isArray(RULES.scenarios) ? RULES.scenarios : Object.values(RULES.scenarios).flat() let scenario = data.pickValue(scenarios) + // if (scenario.startsWith("Random")) + // return // TODO randomize options const options = {} @@ -133,6 +135,11 @@ module.exports.fuzz = function(fuzzerInputData) { log_crash(game_setup, state, view, step, active, action, args) throw new RulesCrashError(e, e.stack) } + + if (action === "undo" && state.active !== active) { + log_crash(game_setup, state, view, step, active) + throw new UndoActiveError(`undo caused active to switch from ${active} to ${state.active}`) + } step += 1 } } @@ -181,6 +188,13 @@ class InvalidActionArgument extends Error { } } +class UndoActiveError extends Error { + constructor(message) { + super(message) + this.name = "UndoActiveError" + } +} + class RulesCrashError extends Error { constructor(message, stack) { super(message) |