mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-25 22:12:58 +01:00
Refactor of, and more, unit tests (#16065)
* Initial experiment * holy shit the pain of this rabbit hole * F * F * F * F * FFF * FFFF * FFFFFFFFF * FFFFFFFFFF * FF * ffffff * ffffffff * F^F * FFFFFF * F * Robusted * F * Some readability, hopefully * Fear * Aurora was a mistake * Horrors beyond our comprehension * Use the appropriate macro across the tests * Brah * FF * Mute janitors robusting the ling * Frail doctors revealing to be more trained than a KGB sleeper agent when the crew armory opens * FFFFFFF * gujbjh * Shitcode, shitcode everywhere * Pain * Cursed codebase * Fix AI mask qdel, SQL tests to macro * Attempt at github grouping * Take two * Brah * Maybe this looks better * Different formatting * FFS * Visuals * pain * FFFFF * hyuh * fgdsgd * igyguybujgb * Just calling the parent here * dsfs * fdsaf * Move more pieces to use the macros * Finish moving to macro * gah * Changelog, some touchups * Fix another found runtime * GDI
This commit is contained in:
@@ -3,15 +3,14 @@
|
||||
|
||||
/datum/unit_test/sql_preferences_columns/start_test()
|
||||
if(!config.sql_enabled)
|
||||
log_unit_test("[ascii_yellow]--------------- Database not Configured - Skipping Preference Column UT")
|
||||
return TRUE
|
||||
|
||||
log_unit_test("[ascii_yellow]--------------- Database Configured - Running SQL Preference UTs")
|
||||
|
||||
TEST_WARN("--------------- Database not Configured - Skipping Preference Column UT")
|
||||
return UNIT_TEST_PASSED
|
||||
|
||||
TEST_DEBUG("--------------- Database Configured - Running SQL Preference UTs")
|
||||
|
||||
if(!establish_db_connection(dbcon))
|
||||
log_unit_test("[ascii_red]--------------- Unable to establish database connection.")
|
||||
fail("Database connection could not be established.")
|
||||
return TRUE
|
||||
TEST_FAIL("Database connection could not be established.")
|
||||
return UNIT_TEST_FAILED
|
||||
|
||||
var/faults = 0
|
||||
var/valid_columns = list()
|
||||
@@ -31,9 +30,8 @@
|
||||
get_cs.Execute(list("table" = T))
|
||||
|
||||
if (get_cs.ErrorMsg())
|
||||
log_unit_test("[ascii_red]--------------- SQL error encountered: [get_cs.ErrorMsg()].[ascii_reset]")
|
||||
fail("SQL error encountered.")
|
||||
return TRUE
|
||||
TEST_FAIL("SQL error encountered: [get_cs.ErrorMsg()]")
|
||||
return UNIT_TEST_FAILED
|
||||
|
||||
valid_columns[T] = list()
|
||||
|
||||
@@ -66,7 +64,7 @@
|
||||
|
||||
if (unfound.len)
|
||||
for (var/C in unfound)
|
||||
log_unit_test("[ascii_red]--------------- load parameter '[C]' not found in any queries for '[A.name]':[A.type].[ascii_reset]")
|
||||
TEST_FAIL("load parameter '[C]' not found in any queries for '[A.name]':[A.type].")
|
||||
faults++
|
||||
temp.Cut()
|
||||
|
||||
@@ -81,21 +79,21 @@
|
||||
for (var/B in test_columns)
|
||||
var/list/valids = valid_columns[B]
|
||||
if (!valids || !valids.len)
|
||||
log_unit_test("[ascii_red]--------------- table '[B]' referenced but not found for '[A.name]':[A.type].[ascii_reset]")
|
||||
TEST_FAIL("table '[B]' referenced but not found for '[A.name]':[A.type].")
|
||||
faults++
|
||||
continue
|
||||
|
||||
for (var/C in test_columns[B])
|
||||
if (!(C in valids))
|
||||
log_unit_test("[ascii_red]--------------- column '[C]' referenced but not in table '[B]' for item '[A.name]':[A.type].[ascii_reset]")
|
||||
TEST_FAIL("column '[C]' referenced but not in table '[B]' for item '[A.name]':[A.type].")
|
||||
faults++
|
||||
|
||||
if (faults)
|
||||
fail("\[[faults]\] faults found in the SQL preferences setup.")
|
||||
TEST_FAIL("\[[faults]\] faults found in the SQL preferences setup.")
|
||||
return UNIT_TEST_FAILED
|
||||
else
|
||||
pass("No faults found in the SQL preferences setup.")
|
||||
|
||||
return TRUE
|
||||
TEST_PASS("No faults found in the SQL preferences setup.")
|
||||
return UNIT_TEST_PASSED
|
||||
|
||||
/datum/unit_test/sql_preferences_vars
|
||||
name = "SQL: Preferences Variables"
|
||||
@@ -126,12 +124,12 @@
|
||||
total += test.len
|
||||
for (var/V in test)
|
||||
if (!(V in P.vars))
|
||||
log_unit_test("[ascii_red]--------------- variable '[V]' referenced by, but not found in preferences class variables, '[A.name]':[A.type].[ascii_reset]")
|
||||
TEST_FAIL("variable '[V]' referenced by, but not found in preferences class variables, '[A.name]':[A.type].")
|
||||
faults++
|
||||
|
||||
if (faults)
|
||||
fail("\[[faults] / [total]\] variable references found invalid in the SQL preferences setup.")
|
||||
TEST_FAIL("\[[faults] / [total]\] variable references found invalid in the SQL preferences setup.")
|
||||
return UNIT_TEST_FAILED
|
||||
else
|
||||
pass("All \[[total]\] variable references found valid in the SQL preferences setup.")
|
||||
|
||||
return TRUE
|
||||
TEST_PASS("All \[[total]\] variable references found valid in the SQL preferences setup.")
|
||||
return UNIT_TEST_PASSED
|
||||
|
||||
Reference in New Issue
Block a user