test: both fire starters on a campfire, a candle and stone

The corpus held level random seeds only, so the probe always asked for the
fire charge's sound: FlintAndSteelItem's branch, its pitch formula and the one
draw it makes were never compared, and the charge's own useOn was never called
at all.

Each of the 20,006 seeds now runs both items against a campfire, a candle and
stone: 120,036 cases through the real useOn of each item.
This commit is contained in:
MSedgeMC committed 2026-11-02 23:33:43 +00:00
1 parent 31f83499b6
commit 73a8f221f9
1 file changed
+11 -6
+11 -6
View File
@@ -1,8 +1,8 @@
#!/usr/bin/env python3
"""Compare the fire charge's use sound with the pinned client: the real
FireChargeItem.playSound (lighting a campfire or candle and placing fire both
use it) on level randoms from many seeds, comparing the sound, its volume and
pitch bits, and the level random's next value (how many values it drew)."""
"""Compare both fire starters' use sound with the pinned client: the real
FireChargeItem.useOn and FlintAndSteelItem.useOn on a campfire, a candle and a
stone block, on level randoms from many seeds, comparing the sound, its volume
and pitch bits, and the level random's next value (how many values it drew)."""
import random
try:
@@ -11,12 +11,17 @@ except ImportError:
import lab, oracle_harness as harness
ITEMS = ['fire_charge', 'flint_and_steel']
TARGETS = ['campfire', 'candle', 'stone']
def make_cases(build):
path = build / 'cases.txt'
rng = random.Random(0x46495245)
seeds = [0, 1, -1, 42, 2**63 - 1, -2**63] + [rng.randrange(-2**63, 2**63) for _ in range(20000)]
path.write_text(''.join(f'{s}\n' for s in seeds))
return path, len(seeds)
cases = [f'{item} {target} {seed}' for seed in seeds for item in ITEMS for target in TARGETS]
path.write_text(''.join(f'{c}\n' for c in cases))
return path, len(cases)
def main():