Files
Bubberstation/code/modules/unit_tests/area_contents.dm
SimplyLogan 2faa874b3b Speed up Mapper testing with a prefix "maptest_" in VSCode (#93238)
## About The Pull Request

One of the development hell cycles with mapping is how long it takes to
fix quality or run issues with maps.

By adding a prefix called "maptest_" to some of the unit tests it allows
mappers to only target some tests instead of the usual 350+ tests to run
each time or trying to trigger them individually and faffing.

This does not rename the unit test files themselves to preserve history
but just the "/datum/unit_test/" in each file.

This does not break the current CI or obstruct other tests - A few other
map files that call these tests specifically have been edited to point
at the new datum name.

This assumes you are using the TG testing extension to do this.

| All Tests | maptest_ |
|--------|--------|
| <img width="426" height="106" alt="image"
src="https://github.com/user-attachments/assets/d1d6f81e-16bd-473a-88da-e8b56f8bd3d0"
/> | <img width="434" height="96" alt="image"
src="https://github.com/user-attachments/assets/ea1c47fe-a6ce-40c6-b2cb-65b9c8e94a29"
/> |
| <img width="360" height="886" alt="image"
src="https://github.com/user-attachments/assets/65bcd774-79ad-432e-8211-c67fb9d3e443"
/> | <img width="370" height="833" alt="Screenshot 2025-10-01 204609"
src="https://github.com/user-attachments/assets/ad360796-5698-42fd-bd2e-51de1a02ab87"
/> |
## Why It's Good For The Game

- Should make it easier for mappers to test locally, saving CI/Github
resource for TG
- Mappers can now test their work 56% faster
## Changelog
🆑
code: Mappers can now run just mapping unit tests - Should be 56% faster
- Should have no player impact
/🆑

Co-authored-by: loganuk <falseemail@aol.com>
2025-10-05 16:25:51 -06:00

35 lines
1.6 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
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] inside [area_to_test.type]'s turf listing")
else
TEST_FAIL("Found a shared turf [turf_to_check.type] 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] 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] inside [position.loc.type] that is NOT stored in any area's turf listing")