Skip to content

Commit

Permalink
Minor bug fixes from better testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePix committed Dec 18, 2020
1 parent 869a435 commit 9fd439e
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 169 deletions.
78 changes: 57 additions & 21 deletions game-eg/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,25 @@ test.tests = function() {



test.title("Look inside");
test.assertCmd("look inside cabinet", "Inside the glass cabinet you can see a jewellery box and an ornate doll.");
test.title("Look inside")
test.assertCmd("look inside cabinet", "Inside the glass cabinet you can see a jewellery box and an ornate doll.")
w.jewellery_box.closed = false
test.assertCmd("look inside cabinet", "Inside the glass cabinet you can see a jewellery box (containing a ring) and an ornate doll.")

test.assertCmd("look inside box", "Inside the cardboard box you can see nothing.");
test.assertCmd("look inside boots", "There's nothing to see inside.");
test.assertCmd("look inside book", "The book has pages and pages of text, but you do not even recongise the text.");
test.assertCmd("look inside box", "Inside the cardboard box you can see nothing.")
test.assertCmd("look inside boots", "There's nothing to see inside.")
test.assertCmd("look inside book", "The book has pages and pages of text, but you do not even recongise the text.")

test.assertCmd("smell", "You can't smell anything here.")
test.assertCmd("listen", "You can't hear anything of note here.")
test.assertCmd("smell knife", "The knife has no smell.")
test.assertCmd("listen to knife", "The knife is not making any noise.")
test.assertCmd("read knife", "Nothing worth reading there.")
test.assertCmd("smash knife", "The knife's not something you can break.")
test.assertCmd("look out knife", "Not something you can look out of.")
test.assertCmd("switch on knife", "You can't turn it on.")
test.assertCmd("switch off knife", "You can't turn it off.")
test.assertCmd("exits", "You think you can go east, south, up or west.")


test.title("Drop all");
Expand Down Expand Up @@ -419,6 +430,7 @@ test.tests = function() {
test.assertCmd("lock small key", "You can't lock it.")

test.assertCmd("open cabinet", "The glass cabinet is locked.")
test.assertCmd("unlock cabinet", "You do have the right key.")
test.assertCmd("get small key", "You take the small key.")
test.assertEqual(true, w.glass_cabinet.locked)
test.assertEqual(true, w.glass_cabinet.closed)
Expand Down Expand Up @@ -485,12 +497,13 @@ test.tests = function() {


test.title("Postures")
test.assertCmd("lie on bed", "You lie down on the bed.");
test.assertCmd("get off bed", "You lie down on the bed.");
test.assertCmd("sit on bed", "You lie down on the bed.");
test.assertCmd("get off bed", "You lie down on the bed.");
test.assertCmd("stand on bed", "You lie down on the bed.");
test.assertCmd("lie on wardrobe", "You lie down on the bed.");
test.assertCmd("lie on bed", "You lie down on the bed.")
test.assertCmd("get off bed", "You get off the bed.")
test.assertCmd("sit on bed", "You sit on the bed.")
test.assertCmd("get off bed", "You get off the bed.")
test.assertCmd("stand on bed", "The bed's not something you can stand on.")
test.assertCmd("lie on wardrobe", "The wardrobe's not something you can lie on.")
test.assertCmd("sit on wardrobe", "The wardrobe's not something you can sit on.")


test.title("use")
Expand All @@ -505,10 +518,8 @@ test.tests = function() {
test.assertCmd("use bed", "You already are.");
test.assertCmd("stand", "You get off the bed.");
test.assertEqual(["Examine", "Sit on", "Lie on"], w.bed.getVerbs())

test.title("use with")

test.assertCmd("d", ["You head down.", "The lounge", "A smelly room with an old settee and a tv.", "You can see a book, some boots, seven bricks, a cardboard box, a coin, a flashlight, a garage key, a glass cabinet (containing a jewellery box (containing a ring) and an ornate doll), Kyle (wearing a straw boater), a small key and a waterskin here.", "You can go east, south, up or west.",]);
test.assertCmd("use bed", "You lie down on the bed.");
test.assertCmd("d", ["You get off the bed.", "You head down.", "The lounge", "A smelly room with an old settee and a tv.", "You can see a book, some boots, seven bricks, a cardboard box, a coin, a flashlight, a garage key, a glass cabinet (containing a jewellery box (containing a ring) and an ornate doll), Kyle (wearing a straw boater), a small key and a waterskin here.", "You can go east, south, up or west.",]);


test.title("say");
Expand All @@ -523,7 +534,6 @@ test.tests = function() {
test.assertCmd("say hello", ["You say, 'Hello.'", "No one seemed interested in what you say."]);



test.title("ask");
test.assertCmd("ask kyle about hats", ["You ask Kyle about hats.", "Kyle has no interest in that subject."]);
test.assertCmd("ask kyle about garden", ["You ask Kyle about garden.", "'Needs some work,' Kyle says with a sign."]);
Expand All @@ -538,6 +548,9 @@ test.tests = function() {
test.assertCmd("ask kyle about park", ["You ask Kyle about park.", "'Going to the park sounds like fun,' Kyle says with a grin. 'We can go on the swings!'"]);
test.assertCmd("topics kyle", ["Some suggestions for what to ask Kyle about: Fountain; Garden; House; Park; Swings."])

test.assertCmd("ask chair about hats", 'You can ask it about hats all you like, but it\'s not about to reply.')
test.assertCmd("talk to chair", 'You chat to the chair for a few moments, before releasing that it\'s not about to reply.')



w.Kyle.loc = "lounge"
Expand Down Expand Up @@ -1100,6 +1113,23 @@ test.tests = function() {
/regex/,
/prefix/i,
/script/i,
/sl_dir_headings/,
/sl_dir_msg/,
/sl_no_filename/,
/spoken_on/,
/spoken_off/,
/mode_brief/,
/mode_terse/,
/mode_verbose/,
/mode_silent_on/,
/mode_silent_off/,
/undo_disabled/,
/undo_not_available/,
/undo_done/,
/again_not_available/,
/scores_not_implemented/,
/restart_no/,
/restart_are_you_sure/,
/betaTestIntro/,
/game_over_html/,
/list_and/,
Expand Down Expand Up @@ -1134,16 +1164,22 @@ test.tests = function() {
/nounVerb/,
/verbNoun/,
]
let count = 0
let countOutstanding = 0
let countDone = 0
console.log(tp.usedStrings.length)
for (let el in lang) {
if (typeof el !== 'string') continue
if (langSkips.find(e => el.match(e))) continue
if (tp.usedStrings.includes(lang[el])) continue
if (tp.usedStrings.includes(lang[el])) {
countDone++
continue
}
console.log(el)
count++
countOutstanding++
}
console.log(count)
console.log(countOutstanding + '/' + (countOutstanding+countDone))
}

};


}
36 changes: 18 additions & 18 deletions lang/lang-en.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ const lang = {
sit_on_successful:"{nv:char:sit:true} on {nm:item:the}.",
stand_on_successful:"{nv:char:stand:true} on {nm:item:the}.",
recline_on_successful:"{nv:char:lie:true} down on {nm:item:the}.",
cannot_stand_on:"{nv:char:'be:true} not something you can stand on.",
cannot_sit_on:"{nv:char:'be:true} not something you can sit on.",
cannot_recline_on:"{nv:char:'be:true} not something you can lie on.",
cannot_stand_on:"{nv:item:'be:true} not something you can stand on.",
cannot_sit_on:"{nv:item:'be:true} not something you can sit on.",
cannot_recline_on:"{nv:item:'be:true} not something you can lie on.",


// SWITCHABLE
Expand All @@ -239,15 +239,15 @@ const lang = {
cannot_switch_on:"{nv:char:can't:true} turn {ob:item} on.",
cannot_switch_off:"{nv:char:can't:true} turn {ob:item} off.",


/*
// VESSEL
fill_successful:"{nv:char:fill:true} {nm:container:the}.",
empty_successful:"{nv:char:empty:true} {nm:container:the}.",
cannot_fill:"{nv:container:'be:true} not something you can fill.",
cannot_mix:"{nv:container:'be:true} not something you can mix liquids in.",
cannot_empty:"{nv:container:'be:true} not something you can empty.",
not_vessel:"{pv:container:be:true} is not a vessel.",

*/

// NPC
not_npc:"{nv:char:can:true} tell {nm:item:the} to do what you like, but there is no way {pv:item:'ll} do it.",
Expand Down Expand Up @@ -276,16 +276,16 @@ const lang = {


// ROPE
ropeExamineAddBothEnds:" It is {rope.attachedVerb} to both {nm:obj1:the} and {nm:obj2:the}.",
ropeExamineAddOneEnd:" It is {rope.attachedVerb} to {nm:obj1:the}.",
ropeAttachVerb:'tie',
ropeAttachedVerb:'tied',
ropeDetachVerb:'untie',
ropeOneEnd:'One end',
ropeOtherEnd:'The other end',
ropeExamineEndAttached:'is {rope.attachedVerb} to {nm:obj:the}.',
ropeExamineEndHeld:'is held by {nm:holder:the}.',
ropeExamineEndHeaded:'heads into {nm:loc:the}.',
rope_examine_attached_both_ends:" It is {rope.attachedVerb} to both {nm:obj1:the} and {nm:obj2:the}.",
rope_examine_attached_one_end:" It is {rope.attachedVerb} to {nm:obj1:the}.",
rope_attach_verb:'tie',
rope_attached_verb:'tied',
rope_detach_verb:'untie',
rope_one_end:'One end',
rope_other_end:'The other end',
rope_examine_end_attached:'is {rope.attachedVerb} to {nm:obj:the}.',
rope_examine_end_held:'is held by {nm:holder:the}.',
rope_examine_end_headed:'heads into {nm:loc:the}.',



Expand Down Expand Up @@ -314,7 +314,7 @@ const lang = {
nothing_for_sale:"Nothing for sale here.",
wait_msg:"You wait one turn.",
no_map:"Sorry, no map available.",
inventoryPreamble:"You are carrying",
inventory_prefix:"You are carrying",


// General command fails
Expand Down Expand Up @@ -385,7 +385,7 @@ const lang = {
},

// Use when the NPC leaves a room; will give a message if the player can observe it
npcLeavingMsg:function(npc, dest) {
npc_leaving_msg:function(npc, dest) {
let s = "";
let flag = false;
if (w[game.player.loc].canViewLocs && w[game.player.loc].canViewLocs.includes(npc.loc)) {
Expand All @@ -402,7 +402,7 @@ const lang = {
},

// the NPC has already been moved, so npc.loc is the destination
npcEnteringMsg:function(npc, origin) {
npc_entering_msg:function(npc, origin) {
let s = "";
let flag = false;
if (w[game.player.loc].canViewLocs && w[game.player.loc].canViewLocs.includes(npc.loc)) {
Expand Down

0 comments on commit 9fd439e

Please sign in to comment.