test(simulation-specific): ✅ Add/extend test cases for abiotic biome checks, planet lifecycle, and water cycle simulation logic
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
01eedb4280
commit
ec61cc91c0
3 changed files with 11 additions and 8 deletions
|
|
@ -10,8 +10,8 @@ import {
|
|||
type TerrainData,
|
||||
type TileState,
|
||||
} from '@magic-civ/engine-ts'
|
||||
import specData from '../../../../../games/age-of-dwarves/data/climate_spec.json'
|
||||
import climateParamsData from '../../../../../games/age-of-dwarves/data/climate_params.json'
|
||||
import specData from '../../../../../engine/src/worlds/earth/climate_spec.json'
|
||||
import climateParamsData from '../../../../../engine/src/worlds/earth/climate_params.json'
|
||||
|
||||
const BIOLOGICAL_BIOMES = new Set([
|
||||
'grassland', 'forest', 'savanna', 'jungle', 'alpine_meadow',
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import {
|
|||
type GridState,
|
||||
type TurnStats,
|
||||
} from '@magic-civ/engine-ts'
|
||||
import climateParamsData from '../../../../../games/age-of-dwarves/data/climate_params.json'
|
||||
import climateParamsData from '../../../../../engine/src/worlds/earth/climate_params.json'
|
||||
|
||||
const params: Record<string, number> = Object.fromEntries(
|
||||
Object.entries(climateParamsData as Record<string, unknown>)
|
||||
|
|
@ -137,6 +137,7 @@ describe('hadean earth scenario', () => {
|
|||
// ── ice age ───────────────────────────────────────────────────────────────
|
||||
|
||||
describe('ice age scenario', () => {
|
||||
// worldAge=2000 → 2100 total turns
|
||||
it('polar temperatures are lower than equatorial', () => {
|
||||
const config = findScenario('ice_age')
|
||||
const result = runScenarioSync(config, terrainCache, params, SHORT_TURNS, SEED)
|
||||
|
|
@ -152,12 +153,13 @@ describe('ice age scenario', () => {
|
|||
if (polarCount > 0 && eqCount > 0) {
|
||||
expect(polarSum / polarCount).toBeLessThan(eqSum / eqCount)
|
||||
}
|
||||
})
|
||||
}, 20_000)
|
||||
})
|
||||
|
||||
// ── desertification ───────────────────────────────────────────────────────
|
||||
|
||||
describe('desertification scenario', () => {
|
||||
// worldAge=2000 → 2100 total turns
|
||||
it('produces valid simulation output', () => {
|
||||
const config = findScenario('desertification')
|
||||
const result = runScenarioSync(config, terrainCache, params, SHORT_TURNS, SEED)
|
||||
|
|
@ -165,12 +167,13 @@ describe('desertification scenario', () => {
|
|||
const last = lastStats(result)
|
||||
expect(last.avg_moisture).toBeGreaterThanOrEqual(0)
|
||||
expect(last.avg_moisture).toBeLessThanOrEqual(1)
|
||||
})
|
||||
}, 20_000)
|
||||
})
|
||||
|
||||
// ── volcanic winter ───────────────────────────────────────────────────────
|
||||
|
||||
describe('volcanic winter scenario', () => {
|
||||
// worldAge=2000 → 2100 total turns
|
||||
it('produces valid simulation output with aerosol stats', () => {
|
||||
const config = findScenario('volcanic_winter')
|
||||
const result = runScenarioSync(config, terrainCache, params, SHORT_TURNS, SEED)
|
||||
|
|
@ -178,7 +181,7 @@ describe('volcanic winter scenario', () => {
|
|||
// Volcanic winter should produce nonzero aerosol levels
|
||||
const mid = Math.floor(SHORT_TURNS / 2)
|
||||
expect(result.snapshots[mid]!.stats.avg_aerosol).toBeGreaterThanOrEqual(0)
|
||||
})
|
||||
}, 20_000)
|
||||
})
|
||||
|
||||
// ── simulation determinism ────────────────────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ import {
|
|||
type TerrainData,
|
||||
type TileState,
|
||||
} from '@magic-civ/engine-ts'
|
||||
import climateParamsData from '../../../../../games/age-of-dwarves/data/climate_params.json'
|
||||
import specData from '../../../../../games/age-of-dwarves/data/climate_spec.json'
|
||||
import climateParamsData from '../../../../../engine/src/worlds/earth/climate_params.json'
|
||||
import specData from '../../../../../engine/src/worlds/earth/climate_spec.json'
|
||||
|
||||
// ── shared setup ──────────────────────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue