Merge branch 'master' of https://github.com/Yawn-Wider/YWPolarisVore into UpstreamMergeApril2020

This commit is contained in:
Erik
2020-04-11 16:53:35 -07:00
2323 changed files with 1758903 additions and 156537 deletions
+29
View File
@@ -0,0 +1,29 @@
/datum/unit_test/language_test_shall_have_distinct_names
name = "LANGUAGES: Entries shall have distinct names"
/datum/unit_test/language_test_shall_have_distinct_names/start_test()
if(length(GLOB.language_name_conflicts) != 0)
var/list/name_conflict_log = list()
for(var/conflicted_name in GLOB.language_name_conflicts)
name_conflict_log += "+[length(GLOB.language_name_conflicts[conflicted_name])] languages with name \"[conflicted_name]\"!"
for(var/datum/language/L in GLOB.language_name_conflicts[conflicted_name])
name_conflict_log += "+-+[L.type]"
fail("Some names are used by more than one language:\n" + name_conflict_log.Join("\n"))
else
pass("All languages have distinct names")
return 1
/datum/unit_test/language_test_shall_have_distinct_keys
name = "LANGUAGES: Entries shall have distinct keys"
/datum/unit_test/language_test_shall_have_distinct_keys/start_test()
if(length(GLOB.language_key_conflicts) != 0)
var/list/key_conflict_log = list()
for(var/conflicted_key in GLOB.language_key_conflicts)
key_conflict_log += "+[length(GLOB.language_key_conflicts[conflicted_key])] languages with key \"[conflicted_key]\"!"
for(var/datum/language/L in GLOB.language_key_conflicts[conflicted_key])
key_conflict_log += "+-+[L]([L.type])"
fail("Some keys are used by more than one language:\n" + key_conflict_log.Join("\n"))
else
pass("All languages in GLOB.all_languages have distinct keys")
return 1
+69
View File
@@ -0,0 +1,69 @@
/datum/unit_test/sqlite
name = "SQLite template" // Template has to be in the name or this test will be ran, and fail.
var/database/stub_sqlite_db = null
/datum/unit_test/sqlite/proc/setup_stub_db()
fdel("data/sqlite/testing_[name].db") // In case any remain from a previous local test, so we can have a clean new database.
stub_sqlite_db = new("data/sqlite/testing_[name].db") // Unfortunately, byond doesn't like having working sqlite stuff w/o a file existing.
SSsqlite.init_schema(stub_sqlite_db)
// Feedback table tests.
/datum/unit_test/sqlite/feedback/insert
name = "SQLITE FEEDBACK: Insert and Retrieve Data"
/datum/unit_test/sqlite/feedback/insert/start_test()
// Arrange.
setup_stub_db()
var/test_author = "alice"
var/test_topic = "Test"
var/test_content = "Bob is lame."
// Act.
SSsqlite.insert_feedback(author = test_author, topic = test_topic, content = test_content, sqlite_object = stub_sqlite_db)
var/database/query/Q = new("SELECT * FROM [SQLITE_TABLE_FEEDBACK]")
Q.Execute(stub_sqlite_db)
SSsqlite.sqlite_check_for_errors(Q, "Sqlite Insert Unit Test")
Q.NextRow()
// Assert.
var/list/row_data = Q.GetRowData()
if(row_data[SQLITE_FEEDBACK_COLUMN_AUTHOR] == test_author && row_data[SQLITE_FEEDBACK_COLUMN_TOPIC] == test_topic && row_data[SQLITE_FEEDBACK_COLUMN_CONTENT] == test_content)
pass("No issues found.")
else
fail("Data insert and loading failed to have matching information.")
return TRUE
/datum/unit_test/sqlite/feedback/cooldown
name = "SQLITE FEEDBACK: Cooldown"
/datum/unit_test/sqlite/feedback/cooldown/start_test()
// Arrange.
setup_stub_db()
var/days_to_wait = 1
var/issues = 0
// Act.
SSsqlite.insert_feedback(author = "Alice", topic = "Testing", content = "This is a test.", sqlite_object = stub_sqlite_db)
var/alice_cooldown_block = SSsqlite.get_feedback_cooldown("Alice", days_to_wait, stub_sqlite_db)
var/bob_cooldown = SSsqlite.get_feedback_cooldown("Bob", days_to_wait, stub_sqlite_db)
days_to_wait = 0
var/alice_cooldown_allow = SSsqlite.get_feedback_cooldown("Alice", days_to_wait, stub_sqlite_db)
// Assert.
if(alice_cooldown_block <= 0)
issues++
log_unit_test("User 'Alice' did not receive a cooldown, when they were supposed to.")
if(bob_cooldown > 0)
issues++
log_unit_test("User 'Bob' did receive a cooldown, when they did not do anything.")
if(alice_cooldown_allow > 0)
issues++
log_unit_test("User 'Alice' did receive a cooldown, when no cooldown is supposed to be enforced.")
if(issues)
fail("[issues] issues were found.")
else
pass("No issues found.")
return TRUE
+2 -2
View File
@@ -94,10 +94,10 @@ var/total_unit_tests = 0
if(all_unit_tests_passed)
log_unit_test("[ASCII_GREEN]*** All Unit Tests Passed \[[total_unit_tests]\] ***[ASCII_RESET]")
world.Del()
else
log_unit_test("[ASCII_RED]!!! \[[failed_unit_tests]\\[total_unit_tests]\] Unit Tests Failed !!![ASCII_RESET]")
world.Del()
log_unit_test("Caught [GLOB.total_runtimes] Runtime\s.")
world.Del()
/datum/unit_test/proc/get_standard_turf()
return locate(20,20,1)
+3 -3
View File
@@ -78,12 +78,12 @@
return 1
/datum/unit_test/zas_area_test/supply_centcomm
name = "ZAS: Supply Shuttle (CentCom)"
area_path = /area/supply/dock
name = "ZAS: Supply Shuttle"
area_path = /area/supply //yw edit: path changed
/datum/unit_test/zas_area_test/emergency_shuttle
name = "ZAS: Emergency Shuttle"
area_path = /area/shuttle/escape/centcom
area_path = /area/shuttle/escape
/datum/unit_test/zas_area_test/ai_chamber
name = "ZAS: AI Chamber"