-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathbaseturfs.dm
76 lines (54 loc) · 3.57 KB
/
baseturfs.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#define EXPECTED_FLOOR_TYPE /turf/open/floor/plasteel
// Do this instead of just ChangeTurf to guarantee that baseturfs is completely default on-init behavior
#define RESET_TO_EXPECTED(turf) \
turf.ChangeTurf(EXPECTED_FLOOR_TYPE);\
turf.assemble_baseturfs(initial(turf.baseturfs))
/// 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 a plasteel floor")
RESET_TO_EXPECTED(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()
RESET_TO_EXPECTED(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 a plasteel floor")
// Do this instead of just ChangeTurf to guarantee that baseturfs is completely default on-init behavior
RESET_TO_EXPECTED(run_loc_floor_bottom_left)
run_loc_floor_bottom_left.place_on_top(/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")
/datum/unit_test/baseturfs_placed_on_top/Destroy()
RESET_TO_EXPECTED(run_loc_floor_bottom_left)
return ..()
/// 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 a plasteel floor")
// Do this instead of just ChangeTurf to guarantee that baseturfs is completely default on-init behavior
RESET_TO_EXPECTED(run_loc_floor_bottom_left)
run_loc_floor_bottom_left.place_on_bottom(/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, "Plasteel 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()
RESET_TO_EXPECTED(run_loc_floor_bottom_left)
return ..()
#undef RESET_TO_EXPECTED
#undef EXPECTED_FLOOR_TYPE