Files
mrmanlikesbt b08ec39e1b Better Unit Tests - Runs All Of Them On A Single Map (exc. map unit tests) and C&D Split-Up (#96368)
## About The Pull Request

### Don't run every single test

I've had this on my mind for several months and it being brought up
recently reminded me so here we are.

Unit tests only run on `runtimestation_minimal.dmm` now with the
exception of map tests. The following unit tests are declared as map
tests but I didn't see any map dependent logic so 🤷
- `/datum/unit_test/maptest_baseturfs_unmodified_scrape`
- `/datum/unit_test/maptest_baseturfs_placed_on_top`
- `/datum/unit_test/maptest_baseturfs_placed_on_bottom`
- `/datum/unit_test/maptest_get_turf_pixel`
- `/datum/unit_test/maptest_load_map_security`
- `/datum/unit_test/maptest_modular_map_loader`
- `/datum/unit_test/maptest_turf_icons`

`/datum/unit_test/subsystem_init` isn't really a mapping unit test but I
figured somehow, someway, maps might fuck with subsystem initializations
so I just decided to include it.

### Splits up the create & destroy test

Idk, pretty simple. Create & destroy is now split up across all
integration tests and ran in parallel.

## Why It's Good For The Game

oranges promised me "500 nzd" yo

## Changelog

No player facing changes
2026-06-09 06:00:03 +02:00

36 lines
1.7 KiB
Plaintext

/// Verifies that an area's perception of their "turfs" is correct, and no other area overlaps with them
/// Quite slow, but needed
/datum/unit_test/maptest_area_contents
test_flags = UNIT_TEST_MAP_TEST
priority = TEST_LONGER
/datum/unit_test/maptest_area_contents/Run()
// First, we check that there are no entries in more then one area
// That or duplicate entries
for (var/area/area_to_test in GLOB.areas)
area_to_test.cannonize_contained_turfs()
for (var/i in 1 to area_to_test.turfs_by_zlevel.len)
if (!islist(area_to_test.turfs_by_zlevel[i]))
TEST_FAIL("zlevel index [i] in [area_to_test.type] is not a list.")
for (var/turf/turf_to_check as anything in area_to_test.turfs_by_zlevel[i])
if (!isturf(turf_to_check))
TEST_FAIL("Found a [turf_to_check.type] in [area_to_test.type]'s turf listing")
if (turf_to_check.in_contents_of)
var/area/existing = turf_to_check.in_contents_of
if (existing == turf_to_check.loc)
TEST_FAIL("Found a duplicate turf [turf_to_check.type] [COORD(turf_to_check)] inside [area_to_test.type]'s turf listing")
else
TEST_FAIL("Found a shared turf [turf_to_check.type] [COORD(turf_to_check)] between [area_to_test.type] and [existing.type]'s turf listings")
var/area/turfs_actual_area = turf_to_check.loc
if (turfs_actual_area != area_to_test)
TEST_FAIL("Found a turf [turf_to_check.type] [COORD(turf_to_check)] which is IN [turfs_actual_area.type], but is registered as being in [area_to_test.type]")
turf_to_check.in_contents_of = turfs_actual_area
for(var/turf/position in ALL_TURFS())
if(!position.in_contents_of)
TEST_FAIL("Found a turf [position.type] [COORD(position)] inside [position.loc.type] that is NOT stored in any area's turf listing")