code/modules/unit_tests/_unit_tests.dm ![code/modules/unit_tests/_unit_tests.dm0](git.png)
TEST_FAIL | For advanced cases, fail unconditionally but don't return (so a test can return multiple results) |
---|---|
TEST_ASSERT | Asserts that a condition is true If the condition is not true, fails the test |
TEST_ASSERT_NOTNULL | Asserts that a parameter is not null |
TEST_ASSERT_NULL | Asserts that a parameter is null |
TEST_ASSERT_EQUAL | Asserts that the two parameters passed are equal, fails otherwise Optionally allows an additional message in the case of a failure |
TEST_ASSERT_NOTEQUAL | Asserts that the two parameters passed are not equal, fails otherwise Optionally allows an additional message in the case of a failure |
TEST_FOCUS | Only run the test provided within the parentheses
This is useful for debugging when you want to reduce noise, but should never be pushed
Intended to be used in the manner of TEST_FOCUS(/datum/unit_test/math) |
TEST_NOTICE | Logs a noticable message on GitHub, but will not mark as an error. Use this when something shouldn't happen and is of note, but shouldn't block CI. Does not mark the test as failed. |
UNIT_TEST_PASSED | Constants indicating unit test completion status |
TEST_LONGER | After most test steps, used for tests that run long so shorter issues can be noticed faster |
TEST_CREATE_AND_DESTROY | This must be the one of last tests to run due to the inherent nature of the test iterating every single tangible atom in the game and qdeleting all of them (while taking long sleeps to make sure the garbage collector fires properly) taking a large amount of time. |
TEST_AFTER_CREATE_AND_DESTROY | For tests that rely on create and destroy having iterated through every (tangible) atom so they don't have to do something similar. Keep in mind tho that create and destroy will absolutely break the test platform, anything that relies on its shape cannot come after it. |
TEST_OUTPUT_RED | Change color to red on ANSI terminal output, if enabled with -DANSICOLORS. |
TEST_OUTPUT_GREEN | Change color to green on ANSI terminal output, if enabled with -DANSICOLORS. |
TEST_OUTPUT_YELLOW | Change color to yellow on ANSI terminal output, if enabled with -DANSICOLORS. |
TRAIT_SOURCE_UNIT_TESTS | A trait source when adding traits through unit tests |
EASY_ALLOCATE | Helper to allocate a new object with the implied type (the type of the variable it's assigned to) in the corner of the test room |
Define Details
EASY_ALLOCATE ![code/modules/unit_tests/_unit_tests.dm 87](git.png)
Helper to allocate a new object with the implied type (the type of the variable it's assigned to) in the corner of the test room
TEST_AFTER_CREATE_AND_DESTROY ![code/modules/unit_tests/_unit_tests.dm 64](git.png)
For tests that rely on create and destroy having iterated through every (tangible) atom so they don't have to do something similar. Keep in mind tho that create and destroy will absolutely break the test platform, anything that relies on its shape cannot come after it.
TEST_ASSERT ![code/modules/unit_tests/_unit_tests.dm 11](git.png)
Asserts that a condition is true If the condition is not true, fails the test
TEST_ASSERT_EQUAL ![code/modules/unit_tests/_unit_tests.dm 21](git.png)
Asserts that the two parameters passed are equal, fails otherwise Optionally allows an additional message in the case of a failure
TEST_ASSERT_NOTEQUAL ![code/modules/unit_tests/_unit_tests.dm 31](git.png)
Asserts that the two parameters passed are not equal, fails otherwise Optionally allows an additional message in the case of a failure
TEST_ASSERT_NOTNULL ![code/modules/unit_tests/_unit_tests.dm 14](git.png)
Asserts that a parameter is not null
TEST_ASSERT_NULL ![code/modules/unit_tests/_unit_tests.dm 17](git.png)
Asserts that a parameter is null
TEST_CREATE_AND_DESTROY ![code/modules/unit_tests/_unit_tests.dm 59](git.png)
This must be the one of last tests to run due to the inherent nature of the test iterating every single tangible atom in the game and qdeleting all of them (while taking long sleeps to make sure the garbage collector fires properly) taking a large amount of time.
TEST_FAIL ![code/modules/unit_tests/_unit_tests.dm 7](git.png)
For advanced cases, fail unconditionally but don't return (so a test can return multiple results)
TEST_FOCUS ![code/modules/unit_tests/_unit_tests.dm 42](git.png)
Only run the test provided within the parentheses
This is useful for debugging when you want to reduce noise, but should never be pushed
Intended to be used in the manner of TEST_FOCUS(/datum/unit_test/math)
TEST_LONGER ![code/modules/unit_tests/_unit_tests.dm 57](git.png)
After most test steps, used for tests that run long so shorter issues can be noticed faster
TEST_NOTICE ![code/modules/unit_tests/_unit_tests.dm 47](git.png)
Logs a noticable message on GitHub, but will not mark as an error. Use this when something shouldn't happen and is of note, but shouldn't block CI. Does not mark the test as failed.
TEST_OUTPUT_GREEN ![code/modules/unit_tests/_unit_tests.dm 76](git.png)
Change color to green on ANSI terminal output, if enabled with -DANSICOLORS.
TEST_OUTPUT_RED ![code/modules/unit_tests/_unit_tests.dm 70](git.png)
Change color to red on ANSI terminal output, if enabled with -DANSICOLORS.
TEST_OUTPUT_YELLOW ![code/modules/unit_tests/_unit_tests.dm 82](git.png)
Change color to yellow on ANSI terminal output, if enabled with -DANSICOLORS.
TRAIT_SOURCE_UNIT_TESTS ![code/modules/unit_tests/_unit_tests.dm 85](git.png)
A trait source when adding traits through unit tests
UNIT_TEST_PASSED ![code/modules/unit_tests/_unit_tests.dm 50](git.png)
Constants indicating unit test completion status