Real test coverage dor SAVE_TAMPERING.
This commit is contained in:
parent
43af075fa9
commit
5929a68b88
5 changed files with 26 additions and 3 deletions
|
@ -161,8 +161,8 @@ int restore(FILE* fp)
|
||||||
if (save.version != VRSION) {
|
if (save.version != VRSION) {
|
||||||
rspeak(VERSION_SKEW, save.version / 10, MOD(save.version, 10), VRSION / 10, MOD(VRSION, 10));
|
rspeak(VERSION_SKEW, save.version / 10, MOD(save.version, 10), VRSION / 10, MOD(VRSION, 10));
|
||||||
} else if (!is_valid(save.game)) {
|
} else if (!is_valid(save.game)) {
|
||||||
rspeak(SAVE_TAMPERING); // LCOV_EXCL_LINE
|
rspeak(SAVE_TAMPERING);
|
||||||
exit(EXIT_SUCCESS); // LCOV_EXCL_LINE
|
exit(EXIT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
game = save.game;
|
game = save.game;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,8 @@ savegames:
|
||||||
@$(PARDIR)/cheat -d -900 -o cheat_numdie.adv > /tmp/cheat_numdie
|
@$(PARDIR)/cheat -d -900 -o cheat_numdie.adv > /tmp/cheat_numdie
|
||||||
@$(ECHO) "cheat: Generate save file with -1000 deaths"
|
@$(ECHO) "cheat: Generate save file with -1000 deaths"
|
||||||
@$(PARDIR)/cheat -d -1000 -o cheat_numdie1000.adv > /tmp/cheat_numdie1000
|
@$(PARDIR)/cheat -d -1000 -o cheat_numdie1000.adv > /tmp/cheat_numdie1000
|
||||||
|
@$(ECHO) "cheat: Generate tamper-detection test"
|
||||||
|
@$(PARDIR)/cheat -d 2000 -o cheat_savetamper.adv > /tmp/cheat_savetamper
|
||||||
@$(ECHO) "cheat: Generate save file with version -1337"
|
@$(ECHO) "cheat: Generate save file with version -1337"
|
||||||
@$(PARDIR)/cheat -v -1337 -o resume_badversion.adv > /tmp/cheat_badversion
|
@$(PARDIR)/cheat -v -1337 -o resume_badversion.adv > /tmp/cheat_badversion
|
||||||
@$(ECHO) "cheat: Generate save file 1000 saves"
|
@$(ECHO) "cheat: Generate save file 1000 saves"
|
||||||
|
|
|
@ -25,7 +25,7 @@ YAML_PATH = "../adventure.yaml"
|
||||||
HTML_TEMPLATE_PATH = "../templates/coverage_dungeon.html.tpl"
|
HTML_TEMPLATE_PATH = "../templates/coverage_dungeon.html.tpl"
|
||||||
DEFAULT_HTML_OUTPUT_PATH = "../coverage/adventure.yaml.html"
|
DEFAULT_HTML_OUTPUT_PATH = "../coverage/adventure.yaml.html"
|
||||||
DANGLING_ACTIONS = ["ACT_VERSION"]
|
DANGLING_ACTIONS = ["ACT_VERSION"]
|
||||||
DANGLING_MESSAGES = ["SAVERESUME_DISABLED", "SAVE_TAMPERING"]
|
DANGLING_MESSAGES = ["SAVERESUME_DISABLED"]
|
||||||
|
|
||||||
STDOUT_REPORT_CATEGORY = " {name:.<19}: {percent:5.1f}% covered ({covered} of {total})\n"
|
STDOUT_REPORT_CATEGORY = " {name:.<19}: {percent:5.1f}% covered ({covered} of {total})\n"
|
||||||
|
|
||||||
|
|
17
tests/savetamper.chk
Normal file
17
tests/savetamper.chk
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
Welcome to Adventure!! Would you like instructions?
|
||||||
|
|
||||||
|
> n
|
||||||
|
|
||||||
|
You are standing at the end of a road before a small brick building.
|
||||||
|
Around you is a forest. A small stream flows out of the building and
|
||||||
|
down a gully.
|
||||||
|
|
||||||
|
> resume
|
||||||
|
|
||||||
|
A dark fog creeps in to surround you. From somewhere in the fog you
|
||||||
|
hear a stern voice. "This Adventure has been tampered with! You have
|
||||||
|
been dabbling in magic, knowing not the havoc you might cause thereby.
|
||||||
|
Leave at once, before you do irrevocable harm!" The fog thickens,
|
||||||
|
until at last you can see nothing at all. Your vision then clears,
|
||||||
|
and you find yourself back in The Real World.
|
4
tests/savetamper.log
Normal file
4
tests/savetamper.log
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
## Resume from artificial "corrupted" save
|
||||||
|
n
|
||||||
|
resume
|
||||||
|
cheat_savetamper.adv
|
Loading…
Add table
Add a link
Reference in a new issue