From df23b580326ea88e584551912d79d3a05f41940f Mon Sep 17 00:00:00 2001 From: NHOrus Date: Fri, 26 May 2017 09:41:54 +0300 Subject: [PATCH] Different, correct fix of tests Now without caching .data and extended cleanup --- Makefile | 3 +- tests/Makefile | 12 +- tests/death-jump.chk | 144 ++++++++++++++++ tests/death-jump.log | 22 +++ tests/dwarf.chk | 395 ++++++++++++++++++++++++++++++++++++++++++- tests/quit.chk | 26 +++ tests/quit.log | 4 + 7 files changed, 599 insertions(+), 7 deletions(-) create mode 100644 tests/death-jump.chk create mode 100644 tests/death-jump.log create mode 100644 tests/quit.chk create mode 100644 tests/quit.log diff --git a/Makefile b/Makefile index aef58ba..d13aa7c 100644 --- a/Makefile +++ b/Makefile @@ -24,8 +24,9 @@ misc.o: misc.h main.h clean: rm -f *.o advent advent.html advent.6 adventure.data + cd tests; $(MAKE) --quiet clean -check: +check: advent cd tests; $(MAKE) --quiet # Requires asciidoc and xsltproc/docbook stylesheets. diff --git a/tests/Makefile b/tests/Makefile index fd802f6..2fdb8aa 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -20,7 +20,7 @@ all: listcheck regress .SUFFIXES: .chk clean: - rm -fr *~ + rm -fr *~ adventure.text adventure.data # Show summary lines for all tests. testlist: @@ -33,19 +33,23 @@ listcheck: # General regression testing of commands and output; look at the *.log and # corresponding *.chk files to see which tests this runs. TESTLOADS := $(shell ls -1 *.log | sed '/.log/s///') -buildregress: +buildregress: adventure.data @for file in $(TESTLOADS); do \ echo "Remaking $${file}.chk"; \ $(REPOSURGEON) advent <$${file}.log >$${file}.chk \ 2>&1 || exit 1; \ done -regress: +regress: adventure.data @for file in $(TESTLOADS); do \ $(ECHO) -n " $${file} "; grep --text '##' $${file}.log || echo ' ## (no description)'; \ - if advent $${file}.log >/tmp/regress$$$$ 2>&1; \ + if advent < $${file}.log >/tmp/regress$$$$ 2>&1; \ then diff --text -u $${file}.chk /tmp/regress$$$$ || exit 1; \ else echo "*** Nonzero return status on $${file}!"; exit 1; fi \ done @rm -f /tmp/regress$$$$ +adventure.data: + cp "$(realpath ..)"/adventure.text . + timeout 1 advent >/dev/null 2>&1; true + # end diff --git a/tests/death-jump.chk b/tests/death-jump.chk new file mode 100644 index 0000000..6bc9e72 --- /dev/null +++ b/tests/death-jump.chk @@ -0,0 +1,144 @@ + +Welcome to Adventure!! Would you like instructions? + +> ##First death by jump into fissure + +Please stick to 1- and 2-word commands. + +> 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. + +> seed 1495774850 +Seed set to 1495774850 + +You're in front of building. + +> in + +You are inside a building, a well house for a large spring. + +There are some keys on the ground here. + +There is a shiny brass lamp nearby. + +There is food here. + +There is a bottle of water here. + +> take keys + +OK + +> take lamp + +OK + +> out + +You're in front of building. + +> s + +You are in a valley in the forest beside a stream tumbling along a +rocky bed. + +> s + +At your feet all the water of the stream splashes into a 2-inch slit +in the rock. Downstream the streambed is bare rock. + +> s + +You are in a 20-foot depression floored with bare dirt. Set into the +dirt is a strong steel grate mounted in concrete. A dry streambed +leads into the depression. + +The grate is locked. + +> open grate + +The grate is now unlocked. + +> d + +You are in a small chamber beneath a 3x3 steel grate to the surface. +A low crawl over cobbles leads inward to the west. + +The grate is open. + +> w + +You are crawling over cobbles in a low passage. There is a dim light +at the east end of the passage. + +There is a small wicker cage discarded nearby. + +> w + +It is now pitch dark. If you proceed you will likely fall into a pit. + +> light lamp + +Your lamp is now on. + +You are in a debris room filled with stuff washed in from the surface. +A low wide passage with cobbles becomes plugged with mud and debris +here, but an awkward canyon leads upward and west. In the mud someone +has scrawled, "MAGIC WORD XYZZY". + +A three foot black rod with a rusty star on an end lies nearby. + +> w + +You are in an awkward sloping east/west canyon. + +> w + +You are in a splendid chamber thirty feet high. The walls are frozen +rivers of orange stone. An awkward canyon and a good passage exit +from east and west sides of the chamber. + +A cheerful little bird is sitting here singing. + +> w + +At your feet is a small pit breathing traces of white mist. An east +passage ends here except for a small crack leading on. + +Rough stone steps lead down the pit. + +> down + +You are at one end of a vast hall stretching forward out of sight to +the west. There are openings to either side. Nearby, a wide stone +staircase leads downward. The hall is filled with wisps of white mist +swaying to and fro almost as if alive. A cold wind blows up the +staircase. There is a passage at the top of a dome behind you. + +Rough stone steps lead up the dome. + +> w + +You are on the east bank of a fissure slicing clear across the hall. +The mist is quite thick here, and the fissure is too wide to jump. + +> jump + +You didn't make it. + +Oh dear, you seem to have gotten yourself killed. I might be able to +help you out, but I've never really done this before. Do you want me +to try to reincarnate you? + +> n + +OK + +You scored 51 out of a possible 430, using 19 turns. + +Your score qualifies you as a novice class adventurer. + +To achieve the next higher rating, you need 70 more points. diff --git a/tests/death-jump.log b/tests/death-jump.log new file mode 100644 index 0000000..7ea8387 --- /dev/null +++ b/tests/death-jump.log @@ -0,0 +1,22 @@ +##First death by jump into fissure +n +seed 1495774850 +in +take keys +take lamp +out +s +s +s +open grate +d +w +w +light lamp +w +w +w +down +w +jump +n diff --git a/tests/dwarf.chk b/tests/dwarf.chk index ae601a2..d2c9d79 100644 --- a/tests/dwarf.chk +++ b/tests/dwarf.chk @@ -1,2 +1,393 @@ -Couldn't find adventure.data, using adventure.text... -Can't read adventure.text! + +Welcome to Adventure!! Would you like instructions? + +> ## Dwarf appears in soutth side chamber, where the coins are. + +Please stick to 1- and 2-word commands. + +> 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. + +> seed 1495763690 +Seed set to 1495763690 + +You're in front of building. + +> seed 1495752222 +Seed set to 1495752222 + +You're in front of building. + +> in + +You are inside a building, a well house for a large spring. + +There are some keys on the ground here. + +There is a shiny brass lamp nearby. + +There is food here. + +There is a bottle of water here. + +> take keys + +OK + +> take lamp + +OK + +> out + +You're in front of building. + +> down + +You are in a valley in the forest beside a stream tumbling along a +rocky bed. + +> s + +At your feet all the water of the stream splashes into a 2-inch slit +in the rock. Downstream the streambed is bare rock. + +> s + +You are in a 20-foot depression floored with bare dirt. Set into the +dirt is a strong steel grate mounted in concrete. A dry streambed +leads into the depression. + +The grate is locked. + +> open grate + +The grate is now unlocked. + +> down + +You are in a small chamber beneath a 3x3 steel grate to the surface. +A low crawl over cobbles leads inward to the west. + +The grate is open. + +> west + +You are crawling over cobbles in a low passage. There is a dim light +at the east end of the passage. + +There is a small wicker cage discarded nearby. + +> take cage + +OK + +> west + +It is now pitch dark. If you proceed you will likely fall into a pit. + +> light lamp + +Your lamp is now on. + +You are in a debris room filled with stuff washed in from the surface. +A low wide passage with cobbles becomes plugged with mud and debris +here, but an awkward canyon leads upward and west. In the mud someone +has scrawled, "MAGIC WORD XYZZY". + +A three foot black rod with a rusty star on an end lies nearby. + +> take rod + +OK + +> xyzzy + +>>Foof!<< + +You're inside building. + +There is food here. + +There is a bottle of water here. + +> xyzzy + +>>Foof!<< + +You're in debris room. + +> west + +You are in an awkward sloping east/west canyon. + +> drop rod + +OK + +> west + +You are in a splendid chamber thirty feet high. The walls are frozen +rivers of orange stone. An awkward canyon and a good passage exit +from east and west sides of the chamber. + +A cheerful little bird is sitting here singing. + +> take bird + +OK + +> east + +You are in an awkward sloping east/west canyon. + +A three foot black rod with a rusty star on an end lies nearby. + +> take rod + +OK + +> west + +You're in bird chamber. + +> west + +At your feet is a small pit breathing traces of white mist. An east +passage ends here except for a small crack leading on. + +Rough stone steps lead down the pit. + +> down + +You are at one end of a vast hall stretching forward out of sight to +the west. There are openings to either side. Nearby, a wide stone +staircase leads downward. The hall is filled with wisps of white mist +swaying to and fro almost as if alive. A cold wind blows up the +staircase. There is a passage at the top of a dome behind you. + +Rough stone steps lead up the dome. + +> south + +This is a low room with a crude note on the wall. The note says, +"You won't get it up the steps". + +There is a large sparkling nugget of gold here! + +> take gold + +OK + +> n + +You're in Hall of Mists. + +> n + +You are in the Hall of the Mountain King, with passages off in all +directions. + +A huge green fierce snake bars the way! + +> drop bird + +The little bird attacks the green snake, and in an astounding flurry +drives the snake away. + +> west + +You are in the west side chamber of the Hall of the Mountain King. +A passage continues west and up here. + +There are many coins here! + +> take coins + +OK + +> e + +You're in Hall of Mt King. + +A cheerful little bird is sitting here singing. + +> s + +A little dwarf just walked around a corner, saw you, threw a little +axe at you which missed, cursed, and ran away. + +You are in the south side chamber. + +There is a little axe here. + +There is precious jewelry here! + +> take jewelry + +OK + +> n + +There is a threatening little dwarf in the room with you! + +One sharp nasty knife is thrown at you! + +It misses! + +You're in Hall of Mt King. + +A cheerful little bird is sitting here singing. + +> n + +There is a threatening little dwarf in the room with you! + +You are in a low n/s passage at a hole in the floor. The hole goes +down to an e/w passage. + +There are bars of silver here! + +> take silver + +You can't carry anything more. You'll have to drop something first. + +> drop cage + +OK + +> take silver + +OK + +> n + +There is a threatening little dwarf in the room with you! + +You are in a large room, with a passage to the south, a passage to the +west, and a wall of broken rock to the east. There is a large "Y2" on +a rock in the room's center. + +> plugh + +>>Foof!<< + +You're inside building. + +There is food here. + +There is a bottle of water here. + +> inven + +You are currently holding the following: +Set of keys +Brass lantern +Black rod +Large gold nugget +Bars of silver +Precious jewelry +Rare coins + +> drop jewelry + +OK + +> drop gold + +OK + +> drop silver + +OK + +> inven + +You are currently holding the following: +Set of keys +Brass lantern +Black rod +Rare coins + +> drop keys + +OK + +> plugh + +>>Foof!<< + +There are 2 threatening little dwarves in the room with you. + +One sharp nasty knife is thrown at you! + +It misses! + +You're at "Y2". + +> take knife + +The dwarves' knives vanish as they strike the walls of the cave. + +> throw axe + +I see no axe here. + +> s + +There are 2 threatening little dwarves in the room with you. + +You're in n/s passage above e/w passage. + +There is a small wicker cage discarded nearby. + +> s + +There are 2 threatening little dwarves in the room with you. + +You're in Hall of Mt King. + +A cheerful little bird is sitting here singing. + +> up + +There are 2 threatening little dwarves in the room with you. + +You're in Hall of Mists. + +Rough stone steps lead up the dome. + +> w + +There are 2 threatening little dwarves in the room with you. + +You are on the east bank of a fissure slicing clear across the hall. +The mist is quite thick here, and the fissure is too wide to jump. + +> wave rod + +A crystal bridge now spans the fissure. + +> w + +There are 2 threatening little dwarves in the room with you. + +You are on the west side of the fissure in the Hall of Mists. + +There are diamonds here! + +A crystal bridge now spans the fissure. + +> take diamonds + +OK + +> +You scored 97 out of a possible 430, using 60 turns. + +Your score qualifies you as a novice class adventurer. + +To achieve the next higher rating, you need 24 more points. diff --git a/tests/quit.chk b/tests/quit.chk new file mode 100644 index 0000000..183d633 --- /dev/null +++ b/tests/quit.chk @@ -0,0 +1,26 @@ + +Welcome to Adventure!! Would you like instructions? + +> ##Just straight quit. + +Please stick to 1- and 2-word commands. + +> 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. + +> quit + +Do you really want to quit now? + +> yes + +OK + +You scored 32 out of a possible 430, using 1 turn. + +You are obviously a rank amateur. Better luck next time. + +To achieve the next higher rating, you need 14 more points. diff --git a/tests/quit.log b/tests/quit.log new file mode 100644 index 0000000..5b9ab9c --- /dev/null +++ b/tests/quit.log @@ -0,0 +1,4 @@ +##Just straight quit. +n +quit +yes -- 2.31.1