test: 109 Rust tests + 14 JSON scenarios, polish physics
Tests added: - physics_materials.rs: 15 tests (fire, smoke, steam, grass, dirt, bone, wood, stone, lava temp) - physics_interactions.rs: 12 tests (lava+water, fire spread, acid interactions, sand+water) - player_controls.rs: 12 tests (move L/R, jump, double jump, rapid input, wait, continuous) - collision_robust.rs: 10 tests (walls, ceiling, sliding, corridor, slope, dirt wall, unstick) - ragdoll_death.rs: 7 tests (death transition, ragdoll fall, progressive damage, corpse) - determinism.rs: 8 tests (same seed, replay exact, replay partial, recording, 100-tick) - edge_cases.rs: 19 tests (boundary, stress 20 goblins, fill/clear/paint, gravity, camera) - 6 new JSON scenarios (fire chain, lava pool, sand bury, entity fall, steam, acid wall) Fixes: - AABB resolve_aabb_y: add vertical overlap check (was pushing player down when jumping) - AABB resolve_aabb_x: velocity-aware resolution (player was stuck against walls) - check_on_ground: use fractional position check (was always true) - jump_force 1.5 (was 0.8) for 27-body entity - Gravity read from self.verlet (was from clone, SetGravity didn't work) - u8 overflow in lava color (saturating_add) 109 Rust tests, 14 JSON scenarios, 0 warnings, 0 failures
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "acid_eats_through_wall",
|
||||
"description": "Acid dissolves a thin wood wall",
|
||||
"seed": 42,
|
||||
"init_mode": "empty",
|
||||
"setup": [
|
||||
{"type": "fill_rect", "x": 100, "y": 125, "w": 20, "h": 1, "material": "stone"},
|
||||
{"type": "set_cell", "x": 108, "y": 124, "material": "wood"},
|
||||
{"type": "set_cell", "x": 108, "y": 123, "material": "wood"},
|
||||
{"type": "fill_rect", "x": 100, "y": 123, "w": 8, "h": 2, "material": "acid"}
|
||||
],
|
||||
"steps": 40,
|
||||
"assertions": [
|
||||
{"type": "no_material_in_region", "x": 107, "y": 122, "w": 3, "h": 4, "material": "wood"}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "entity_survives_fall",
|
||||
"description": "Goblin falls onto stone floor and survives",
|
||||
"seed": 42,
|
||||
"init_mode": "empty",
|
||||
"setup": [
|
||||
{"type": "fill_rect", "x": 100, "y": 130, "w": 20, "h": 5, "material": "stone"},
|
||||
{"type": "spawn", "kind": "goblin", "x": 110, "y": 115}
|
||||
],
|
||||
"steps": 60,
|
||||
"assertions": [
|
||||
{"type": "entity_alive", "id": 1},
|
||||
{"type": "player_alive"}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "fire_chain_wood",
|
||||
"description": "Fire spreads through a line of wood from left to right",
|
||||
"seed": 42,
|
||||
"init_mode": "empty",
|
||||
"setup": [
|
||||
{"type": "fill_rect", "x": 100, "y": 120, "w": 20, "h": 1, "material": "stone"},
|
||||
{"type": "fill_rect", "x": 100, "y": 119, "w": 15, "h": 1, "material": "wood"},
|
||||
{"type": "set_cell", "x": 100, "y": 119, "material": "fire"}
|
||||
],
|
||||
"steps": 50,
|
||||
"assertions": [
|
||||
{"type": "no_material_in_region", "x": 99, "y": 118, "w": 17, "h": 3, "material": "wood"}
|
||||
]
|
||||
}
|
||||
@@ -4,13 +4,13 @@
|
||||
"seed": 42,
|
||||
"init_mode": "empty",
|
||||
"setup": [
|
||||
{"type": "fill_rect", "x": 100, "y": 115, "w": 20, "h": 1, "material": "stone"},
|
||||
{"type": "fill_rect", "x": 100, "y": 100, "w": 20, "h": 1, "material": "stone"},
|
||||
{"type": "set_cell", "x": 105, "y": 110, "material": "lava"},
|
||||
{"type": "set_cell", "x": 106, "y": 110, "material": "water"}
|
||||
{"type": "fill_rect", "x": 100, "y": 120, "w": 20, "h": 1, "material": "stone"},
|
||||
{"type": "fill_rect", "x": 100, "y": 95, "w": 20, "h": 1, "material": "stone"},
|
||||
{"type": "fill_rect", "x": 102, "y": 112, "w": 4, "h": 4, "material": "lava"},
|
||||
{"type": "fill_rect", "x": 107, "y": 112, "w": 4, "h": 4, "material": "water"}
|
||||
],
|
||||
"steps": 15,
|
||||
"steps": 60,
|
||||
"assertions": [
|
||||
{"type": "no_material_in_region", "x": 100, "y": 105, "w": 20, "h": 10, "material": "lava"}
|
||||
{"type": "material_count_in_region", "x": 100, "y": 100, "w": 20, "h": 20, "material": "steam", "min": 1, "max": 30}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "lava_pool_interaction",
|
||||
"description": "Lava pool cools when water is poured on it",
|
||||
"seed": 42,
|
||||
"init_mode": "empty",
|
||||
"setup": [
|
||||
{"type": "fill_rect", "x": 100, "y": 125, "w": 20, "h": 3, "material": "stone"},
|
||||
{"type": "fill_rect", "x": 102, "y": 122, "w": 6, "h": 3, "material": "lava"},
|
||||
{"type": "fill_rect", "x": 110, "y": 122, "w": 6, "h": 3, "material": "water"}
|
||||
],
|
||||
"steps": 120,
|
||||
"assertions": [
|
||||
{"type": "material_count_in_region", "x": 100, "y": 118, "w": 20, "h": 10, "material": "stone", "min": 10, "max": 100}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "sand_buries_wood",
|
||||
"description": "Sand falling onto wood structure eventually covers it",
|
||||
"seed": 42,
|
||||
"init_mode": "empty",
|
||||
"setup": [
|
||||
{"type": "fill_rect", "x": 100, "y": 125, "w": 20, "h": 1, "material": "stone"},
|
||||
{"type": "set_cell", "x": 105, "y": 124, "material": "wood"},
|
||||
{"type": "fill_rect", "x": 103, "y": 115, "w": 5, "h": 5, "material": "sand"}
|
||||
],
|
||||
"steps": 30,
|
||||
"assertions": [
|
||||
{"type": "material_count_in_region", "x": 103, "y": 120, "w": 5, "h": 5, "material": "sand", "min": 3, "max": 30}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "steam_condenses",
|
||||
"description": "Steam in a closed chamber condenses to water over time",
|
||||
"seed": 42,
|
||||
"init_mode": "empty",
|
||||
"setup": [
|
||||
{"type": "fill_rect", "x": 100, "y": 130, "w": 20, "h": 1, "material": "stone"},
|
||||
{"type": "fill_rect", "x": 100, "y": 100, "w": 20, "h": 1, "material": "stone"},
|
||||
{"type": "fill_rect", "x": 99, "y": 101, "w": 1, "h": 29, "material": "stone"},
|
||||
{"type": "fill_rect", "x": 120, "y": 101, "w": 1, "h": 29, "material": "stone"},
|
||||
{"type": "set_cell", "x": 105, "y": 120, "material": "steam"},
|
||||
{"type": "set_cell", "x": 106, "y": 120, "material": "steam"},
|
||||
{"type": "set_cell", "x": 105, "y": 121, "material": "steam"},
|
||||
{"type": "set_cell", "x": 106, "y": 121, "material": "steam"}
|
||||
],
|
||||
"steps": 80,
|
||||
"assertions": [
|
||||
{"type": "material_count_in_region", "x": 100, "y": 105, "w": 20, "h": 25, "material": "water", "min": 1, "max": 20}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user