From 1b8b9b48170f5e2f95205adb984ce892fcd0efbf Mon Sep 17 00:00:00 2001 From: Shane McGovern Date: Tue, 22 Sep 2026 03:34:47 +0100 Subject: [PATCH] test(game3): make the plural-verb checks ROM-free MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bufferitemnameplural checks asserted hard-coded item names, but those come from data/generated/gba/items/pack.lua, which does not exist in a ROM-free checkout. CI failed 2/70 there ("got BERRIES"), while a machine with an imported pack passed, so the suite was green locally and red in CI. Assert the pluralisation rule against each item's own singular name (ItemsData.displayName) instead: a Poké Ball stack gains "S", a berry stack has its final letter replaced by "IES", and quantity 1 stays singular. 72/72 with and without the pack; the full engine tier is 616/616 with no ROM data. --- .../engine/game3_script_verbs_subset_test.lua | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/tests/engine/game3_script_verbs_subset_test.lua b/tests/engine/game3_script_verbs_subset_test.lua index 7c4bde6a..01e12380 100644 --- a/tests/engine/game3_script_verbs_subset_test.lua +++ b/tests/engine/game3_script_verbs_subset_test.lua @@ -128,17 +128,25 @@ eq(vm.ctx.comparisonResult, 1, "comparestat reports EQ at the stat") Ops.dispatch(vm, { op = "comparestat", [1] = 5, [2] = 9 }) eq(vm.ctx.comparisonResult, 2, "comparestat reports GT above the stat") --- 9. bufferitemnameplural (src/scrcmd.c:1637) pluralises like the ROM. -vm = new_vm() -local STR = { op = "bufferitemnameplural", [1] = 0, [2] = 4, [3] = 2 } -Ops.dispatch(vm, STR) -eq(vm.ctx.stringVars[1], "POKé BALLS", "Poké Balls pluralise with S") -STR = { op = "bufferitemnameplural", [1] = 0, [2] = 133, [3] = 2 } -Ops.dispatch(vm, STR) -eq(vm.ctx.stringVars[1], "CHERI BERRIES", "berries pluralise to IES") -STR = { op = "bufferitemnameplural", [1] = 0, [2] = 133, [3] = 1 } -Ops.dispatch(vm, STR) -eq(vm.ctx.stringVars[1], "CHERI BERRY", "a single berry stays singular") +-- 9. bufferitemnameplural (src/scrcmd.c:1637) pluralises like the ROM: "S" after +-- a Poké Ball stack, and the final letter replaced by "IES" for a berry +-- stack. The names themselves come from the item pack, which does not exist +-- in a ROM-free checkout, so assert the rule against each item's own singular +-- name rather than a hard-coded one. +local ItemsData = require("src.core.game3.items_data") +local function plural(item, qty) + local vm = new_vm() + Ops.dispatch(vm, { op = "bufferitemnameplural", [1] = 0, [2] = item, [3] = qty }) + return vm.ctx.stringVars[1] +end +local ballName = ItemsData.displayName(4) +eq(plural(4, 2), ballName .. "S", "a Poké Ball stack pluralises with S") +eq(plural(4, 1), ballName, "...and stays singular at one") +local berryName = ItemsData.displayName(133) +eq(ItemsData.isBerry(133), true, "the berry item is classified as a berry") +eq(plural(133, 2), berryName:sub(1, -2) .. "IES", + "a berry stack replaces the final letter with IES") +eq(plural(133, 1), berryName, "...and stays singular at one") -- 10-12. The party-mon verbs (src/scrcmd.c:1767, :2239, :2248, :2256) use -- 0-based party indices and move slots.