From 9b585f40d815b2f7ff0bfa8bed7892002bd7014f Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 16 Jul 2017 05:33:43 -0400 Subject: [PATCH] Two coverage imprivenents, one by recognizing dead code. --- advent.h | 1 - main.c | 3 -- tests/bearbridge.chk | 113 ++++++++++++++++++++++++++++++++++++++----- tests/bearbridge.log | 23 +++++++++ 4 files changed, 125 insertions(+), 15 deletions(-) diff --git a/advent.h b/advent.h index 34b855f..b9f24fe 100644 --- a/advent.h +++ b/advent.h @@ -101,7 +101,6 @@ enum phase_codes { GO_TOP, GO_CLEAROBJ, GO_CHECKHINT, - GO_CHECKFOO, GO_DIRECTION, GO_LOOKUP, GO_WORD2, diff --git a/main.c b/main.c index a558f7e..c9aca31 100644 --- a/main.c +++ b/main.c @@ -1103,7 +1103,6 @@ Lclearobj: if (!get_command_input(&command)) return false; -Lclosecheck: ++game.turns; if (closecheck()) { @@ -1194,8 +1193,6 @@ Lookup: return true; case GO_TOP: continue; /* back to top of main interpreter loop */ - case GO_CHECKFOO: - goto Lclosecheck; case GO_LOOKUP: goto Lookup; case GO_WORD2: diff --git a/tests/bearbridge.chk b/tests/bearbridge.chk index b466a52..3734552 100644 --- a/tests/bearbridge.chk +++ b/tests/bearbridge.chk @@ -1450,6 +1450,10 @@ OK OK +> take coins + +OK + > plugh >>Foof!<< @@ -1728,7 +1732,7 @@ There are rare spices here! > take spices -OK +You can't carry anything more. You'll have to drop something first. > drop keys @@ -1826,8 +1830,6 @@ A precious jade necklace has been dropped here! There is precious jewelry here! -There are many coins here! - > inven You're not carrying anything. @@ -1876,8 +1878,6 @@ A precious jade necklace has been dropped here! There is precious jewelry here! -There are many coins here! - > plugh >>Foof!<< @@ -1910,9 +1910,9 @@ You're on sw side of chasm. There is an empty bottle here. -Off to one side lies a glistening pearl! +There are many coins here! -There are rare spices here! +Off to one side lies a glistening pearl! There is a golden chain lying in a heap on the floor! @@ -1929,9 +1929,9 @@ You're on sw side of chasm. There is an empty bottle here. -Off to one side lies a glistening pearl! +There are many coins here! -There are rare spices here! +Off to one side lies a glistening pearl! There is a golden chain lying in a heap on the floor! @@ -1948,6 +1948,10 @@ Don't be ridiculous! For crying out loud, the poor thing is already dead! +> take coins + +OK + > sw You're in sloping corridor. @@ -2020,9 +2024,96 @@ There is no way across the fissure. You're on east bank of fissure. +> wave rod + +A crystal bridge now spans the fissure. + +> across + +You're on west bank of fissure. + +A crystal bridge spans the fissure. + +> w + +You're at west end of Hall of Mists. + +> w + +You're at east end of long hall. + +> w + +You're at west end of long hall. + +> s + +You are in a maze of twisty little passages, all different. + +> s + +You are in a maze of twisting little passages, all different. + +> sw + +You are in a twisting little maze of passages, all different. + +> se + +You are in a twisting maze of little passages, all different. + +> s + +You are in a little maze of twisting passages, all different. + +> s + +Dead end + +There is a massive vending machine here, swung back to reveal a +southward passage. + +> drop coins + +There are fresh batteries here. + +> look + +Sorry, but I am not allowed to give more detail. I will repeat the +long description of your location. + +Dead end + +There are fresh batteries here. + +There is a massive vending machine here, swung back to reveal a +southward passage. + +> n + +You are in a little maze of twisting passages, all different. + +> z + +OK + +> z + +OK + +> z + +OK + +> z + +Your lamp is getting dim. You'd best go back for those batteries. + +OK + -You scored 243 out of a possible 430, using 330 turns. +You scored 233 out of a possible 430, using 350 turns. You may now consider yourself a "Seasoned Adventurer". -To achieve the next higher rating, you need 8 more points. +To achieve the next higher rating, you need 18 more points. diff --git a/tests/bearbridge.log b/tests/bearbridge.log index 7e34abf..c9bdba1 100644 --- a/tests/bearbridge.log +++ b/tests/bearbridge.log @@ -246,6 +246,7 @@ drop emerald drop ebony take keys take food +take coins plugh on s @@ -322,6 +323,8 @@ up over feed bear attack bear +# We'll need these when the game times out +take coins # Back to fissure to test OVER sw d @@ -338,3 +341,23 @@ w take rod wave rod across +# Next, buy batteries but don't take them. +wave rod +across +w +w +w +s +s +sw +se +s +s +drop coins +look +n +z +z +z +z +# Battery warning happens here. -- 2.31.1