mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-24 08:02:57 +00:00
Adds some new procs relating to baseturfs that replaces some code that reads and sets them directly. Moves them to their own file. **To reviewers: Any proc in baseturfs.dm that is snake_case is mine, anything else is just moved**. Adds tests for the existing procs of baseturfs. I'm going to be doing some optimizations to baseturfs that change the actual representation of baseturfs, and so I'm prepping these to be implementation agnostic. Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
70 lines
3.3 KiB
Plaintext
70 lines
3.3 KiB
Plaintext
#define EXPECTED_FLOOR_TYPE /turf/open/floor/iron
|
|
|
|
/// Validates that unmodified baseturfs tear down properly
|
|
/datum/unit_test/baseturfs_unmodified_scrape
|
|
|
|
/datum/unit_test/baseturfs_unmodified_scrape/Run()
|
|
// What this is specifically doesn't matter, just as long as the test is built for it
|
|
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, EXPECTED_FLOOR_TYPE, "run_loc_floor_bottom_left should be an iron floor")
|
|
|
|
// Do this instead of ChangeTurf to guarantee that baseturfs is completely default on-init behavior
|
|
new EXPECTED_FLOOR_TYPE(run_loc_floor_bottom_left)
|
|
|
|
run_loc_floor_bottom_left.ScrapeAway()
|
|
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, /turf/open/floor/plating, "Iron floors should scrape away to plating")
|
|
|
|
run_loc_floor_bottom_left.ScrapeAway()
|
|
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, /turf/open/space, "Plating should scrape away to space")
|
|
|
|
run_loc_floor_bottom_left.ScrapeAway()
|
|
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, /turf/open/space, "Space should scrape away to space")
|
|
|
|
/datum/unit_test/baseturfs_unmodified_scrape/Destroy()
|
|
new EXPECTED_FLOOR_TYPE(run_loc_floor_bottom_left)
|
|
return ..()
|
|
|
|
/// Validates that specially placed baseturfs tear down properly
|
|
/datum/unit_test/baseturfs_placed_on_top
|
|
|
|
/datum/unit_test/baseturfs_placed_on_top/Run()
|
|
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, EXPECTED_FLOOR_TYPE, "run_loc_floor_bottom_left should be an iron floor")
|
|
|
|
// Do this instead of ChangeTurf to guarantee that baseturfs is completely default on-init behavior
|
|
new EXPECTED_FLOOR_TYPE(run_loc_floor_bottom_left)
|
|
|
|
run_loc_floor_bottom_left.PlaceOnTop(/turf/closed/wall/rock)
|
|
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, /turf/closed/wall/rock, "Rock wall should've been placed on top")
|
|
|
|
run_loc_floor_bottom_left.ScrapeAway()
|
|
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, EXPECTED_FLOOR_TYPE, "Rock wall should've been scraped off, back into the expected type")
|
|
|
|
/// Validates that specially placed baseturfs BELOW tear down properly
|
|
/datum/unit_test/baseturfs_placed_on_bottom
|
|
|
|
/datum/unit_test/baseturfs_placed_on_bottom/Run()
|
|
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, EXPECTED_FLOOR_TYPE, "run_loc_floor_bottom_left should be an iron floor")
|
|
|
|
// Do this instead of ChangeTurf to guarantee that baseturfs is completely default on-init behavior
|
|
new EXPECTED_FLOOR_TYPE(run_loc_floor_bottom_left)
|
|
|
|
run_loc_floor_bottom_left.PlaceOnBottom(fake_turf_type = /turf/closed/wall/rock)
|
|
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, EXPECTED_FLOOR_TYPE, "PlaceOnBottom shouldn't have changed turf")
|
|
|
|
run_loc_floor_bottom_left.ScrapeAway()
|
|
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, /turf/open/floor/plating, "Iron floors should scrape away to plating")
|
|
|
|
run_loc_floor_bottom_left.ScrapeAway()
|
|
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, /turf/open/space, "Plating should've scraped off to space")
|
|
|
|
run_loc_floor_bottom_left.ScrapeAway()
|
|
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, /turf/closed/wall/rock, "Space should've scraped down to a rock wall")
|
|
|
|
run_loc_floor_bottom_left.ScrapeAway()
|
|
TEST_ASSERT_EQUAL(run_loc_floor_bottom_left.type, /turf/open/floor/plating, "Rock wall should've scraped down back to plating (because it's a wall)")
|
|
|
|
/datum/unit_test/baseturfs_placed_on_bottom/Destroy()
|
|
new EXPECTED_FLOOR_TYPE(run_loc_floor_bottom_left)
|
|
return ..()
|
|
|
|
#undef EXPECTED_FLOOR_TYPE
|