From 851f90cdf7c2ef627a8a14caa4cdaad644c7b60b Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 16 Jun 2017 15:40:46 -0400 Subject: [PATCH] Improve test coverage. --- actions.c | 12 ++++++------ tests/barehands.chk | 6 +++++- tests/barehands.log | 1 + tests/illformed.chk | 8 ++++++-- tests/illformed.log | 1 + 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/actions.c b/actions.c index 0e56f25..9b09183 100644 --- a/actions.c +++ b/actions.c @@ -644,12 +644,12 @@ int light(token_t verb, token_t obj) } if (obj == URN) { - spk=URN_EMPTY; - if (game.prop[URN] == 0) - {RSPEAK(spk); return GO_CLEAROBJ;} - spk=URN_LIT; - game.prop[URN]=2; - RSPEAK(spk); + if (game.prop[URN] == 0) { + RSPEAK(URN_EMPTY); + } else { + game.prop[URN] = 2; + RSPEAK(URN_LIT); + } return GO_CLEAROBJ; } else { if (obj != LAMP) diff --git a/tests/barehands.chk b/tests/barehands.chk index 91337da..c39f450 100644 --- a/tests/barehands.chk +++ b/tests/barehands.chk @@ -261,6 +261,10 @@ The dragon is sprawled out on a persian rug!! The little bird attacks the green dragon, and in an astounding flurry gets burnt to a cinder. The ashes blow away. +> extinguish dragon + +It is beyond your power to do that. + > kill dragon With what? Your bare hands? @@ -276,7 +280,7 @@ A huge green fierce dragon bars the way! The dragon is sprawled out on a persian rug!! -You scored 77 out of a possible 430, using 47 turns. +You scored 77 out of a possible 430, using 48 turns. Your score qualifies you as a novice class adventurer. diff --git a/tests/barehands.log b/tests/barehands.log index d4a5751..81bc521 100644 --- a/tests/barehands.log +++ b/tests/barehands.log @@ -47,5 +47,6 @@ n sw w drop bird +extinguish dragon kill dragon n diff --git a/tests/illformed.chk b/tests/illformed.chk index 3730e9f..2677507 100644 --- a/tests/illformed.chk +++ b/tests/illformed.chk @@ -167,6 +167,10 @@ Don't be ridiculous! OK +> feed keys + +I'm game. Would you care to explain how? + > throw keys OK @@ -296,7 +300,7 @@ Okay, "BOO". > score -You have garnered 27 out of a possible 430 points, using 55 turns. +You have garnered 27 out of a possible 430 points, using 56 turns. > quit bottle @@ -310,7 +314,7 @@ Do you really want to quit now? OK -You scored 27 out of a possible 430, using 57 turns. +You scored 27 out of a possible 430, using 58 turns. You are obviously a rank amateur. Better luck next time. diff --git a/tests/illformed.log b/tests/illformed.log index 31c1669..6bc8ac6 100644 --- a/tests/illformed.log +++ b/tests/illformed.log @@ -32,6 +32,7 @@ off keys break keys wake keys take keys +feed keys throw keys eat food drink blood -- 2.31.1