From c8dbb241e87d600776932dd20935513579fa597c Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 18 Jun 2017 07:11:20 -0400 Subject: [PATCH] Rxtend test coverage, remove magic numbers. --- actions.c | 4 ++-- tests/drown.chk | 6 +++++- tests/drown.log | 1 + tests/illformed.chk | 12 ++++++++++-- tests/illformed.log | 2 ++ 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/actions.c b/actions.c index 59f9942..70d5acd 100644 --- a/actions.c +++ b/actions.c @@ -558,7 +558,7 @@ int fill(token_t verb, token_t obj) spk = URN_NOPOUR; if (LIQUID() != 0) spk = BOTTLE_FULL; - if (spk == 107) { + if (spk == BOTTLED_WATER) { game.prop[BOTTLE] = MOD(COND[game.loc], 4) / 2 * 2; k = LIQUID(); if (TOTING(BOTTLE)) @@ -982,7 +982,7 @@ static int wave(token_t verb, token_t obj) return GO_CLEAROBJ; } if (HERE(BIRD))spk = FREE_FLY + MOD(game.prop[BIRD], 2); - if (spk == 206 && game.loc == game.place[STEPS] && game.prop[JADE] < 0) { + if (spk == FREE_FLY && game.loc == game.place[STEPS] && game.prop[JADE] < 0) { DROP(JADE, game.loc); game.prop[JADE] = 0; --game.tally; diff --git a/tests/drown.chk b/tests/drown.chk index 59fa202..2d431a9 100644 --- a/tests/drown.chk +++ b/tests/drown.chk @@ -924,6 +924,10 @@ You're in west pit. There is a 12-foot-tall beanstalk stretching up out of the pit, bellowing "WATER!! WATER!!" +> H'CFL + +Nothing happens. + > u You're at west end of Twopit Room. @@ -970,7 +974,7 @@ to try to reincarnate you? OK -You scored 177 out of a possible 430, using 154 turns. +You scored 177 out of a possible 430, using 155 turns. You may now consider yourself a "Seasoned Adventurer". diff --git a/tests/drown.log b/tests/drown.log index 784c102..dad9b22 100644 --- a/tests/drown.log +++ b/tests/drown.log @@ -150,6 +150,7 @@ slab s d water plant +H'CFL u w u diff --git a/tests/illformed.chk b/tests/illformed.chk index 5459984..3cf7518 100644 --- a/tests/illformed.chk +++ b/tests/illformed.chk @@ -46,6 +46,10 @@ Your feet are now wet. The stream is gurgling placidly. +> carry + +Carry what? + > forward I am unsure how you are facing. Use compass points or nearby objects. @@ -183,6 +187,10 @@ OK I'm game. Would you care to explain how? +> fly keys + +I'm game. Would you care to explain how? + > throw keys OK @@ -312,7 +320,7 @@ Okay, "BOO". > score -You have garnered 27 out of a possible 430 points, using 59 turns. +You have garnered 27 out of a possible 430 points, using 61 turns. > quit bottle @@ -326,7 +334,7 @@ Do you really want to quit now? OK -You scored 27 out of a possible 430, using 61 turns. +You scored 27 out of a possible 430, using 63 turns. You are obviously a rank amateur. Better luck next time. diff --git a/tests/illformed.log b/tests/illformed.log index af281b2..dae0e25 100644 --- a/tests/illformed.log +++ b/tests/illformed.log @@ -5,6 +5,7 @@ seed 1801426495 cave enter stream listen +carry forward eat drink @@ -36,6 +37,7 @@ break keys wake keys take keys feed keys +fly keys throw keys eat food drink blood -- 2.31.1