Add whole-territory Truthtrance force questions
Verify and publish checkpoint container / container (push) Canceled after 0s

This commit is contained in:
Quintine committed 2026-10-29 03:37:52 +11:00
1 parent 7552bb5394
commit f1007a4ea8
9 files changed
+149 -21

No files matched your search

+24
View File
@@ -37,6 +37,7 @@ void test('parser accepts exact live pools and rejects extra, mutually exclusive
for (const zone of [
{ kind: 'reserves' },
{ kind: 'tanks' },
{ kind: 'territory', territory: 'imperial_basin' },
{ kind: 'location', territory: 'imperial_basin', sector: 9 },
])
assert.deepEqual(
@@ -47,6 +48,8 @@ void test('parser accepts exact live pools and rejects extra, mutually exclusive
for (const malformed of [
{ ...input, privateHint: true },
{ ...input, zone: { kind: 'reserves', territory: 'arrakeen' } },
{ ...input, zone: { kind: 'territory', territory: 'unknown' } },
{ ...input, zone: { kind: 'territory', territory: 'arrakeen', sector: 10 } },
{
...input,
zone: {
@@ -82,6 +85,27 @@ void test('parser accepts exact live pools and rejects extra, mutually exclusive
assert.throws(() => parseForceCountFact({ ...input, value }, locations));
});
void test('territory-wide facts sum physical sectors and their typed subsets without counting nearby or interior territories', () => {
const player: ForceCountPlayer = {
faction: 'ixians', reserves: 9, tanks: 0,
forces: { 'wind_pass:14': 4, 'wind_pass:15': 3, 'imperial_basin:9': 5, 'hidden_mobile_stronghold:0': 2 },
elites: { reserves: 1, tanks: 0, forces: { 'wind_pass:14': 1, 'wind_pass:15': 2 } },
};
const zone = { kind: 'territory', territory: 'wind_pass' } as const;
for (const [counter, value] of [['total', 7], ['normal', 4], ['elite', 3]] as const) {
assert.equal(forceCountFactMatches(player, fact(zone, counter, 'eq', value)), true);
assert.equal(forceCountFactMatches(player, fact(zone, counter, 'gte', value + 1)), false);
}
assert.equal(forceCountFactText(fact(zone, 'total', 'eq', 7)),
'you currently have exactly 7 physical forces in Wind Pass across all sectors');
assert.throws(() => forceCountFactMatches({ ...player,
elites: { ...player.elites!, forces: { 'wind_pass:14': 5 } } }, fact(zone)), /exceeds/);
assert.throws(() => forceCountFactMatches({ ...player,
forces: { ...player.forces, 'wind_pass:14': null } } as unknown as ForceCountPlayer, fact(zone)), /nonnegative/);
assert.throws(() => forceCountFactMatches({ ...player,
elites: { ...player.elites!, forces: { 'wind_pass:15': null } } } as unknown as ForceCountPlayer, fact(zone)), /nonnegative/);
});
void test('current totals include elites while normal counts subtract the tracked physical subset in every pool', () => {
const player: ForceCountPlayer = {
faction: 'ixians',