Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Content.Tests/DMProject/Tests/Builtins/Max.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
// Various comparisons between null and other values
ASSERT(max(null, null, null) == null)
ASSERT(max(null, "") == "")
ASSERT(max("", null) == "")
ASSERT(max("", "str", null) == "str")
ASSERT(max("", "str", "", null) == "str")
ASSERT(max("", null) == null)
ASSERT(max("", "str", null) == null)
ASSERT(max("", "str", "", null) == null)
ASSERT(max(5, null) == 5)
ASSERT(max(-3, null) == null) // null > -3

// null and 0 are equal here so the last one is returned
ASSERT(max(0, null) == null)
ASSERT(max(0, null) == 0)
ASSERT(max(null, 0) == 0)
2 changes: 1 addition & 1 deletion Content.Tests/DMProject/Tests/Builtins/world_config.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@

world.SetConfig("env", env_var, env_value)
world.SetConfig("env", env_var, 17)
ASSERT(world.GetConfig("env", env_var) == null)
ASSERT(world.GetConfig("env", env_var) == "")
2 changes: 1 addition & 1 deletion Content.Tests/DMProject/Tests/Database/clear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
query.Add()

// Execute without a command does nothing
query.Execute()
query.Execute(db)

// and shouldn't report an error
ASSERT(!query.Error())
Expand Down
6 changes: 3 additions & 3 deletions Content.Tests/DMProject/Tests/Database/no_entries.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

query.Add("SELECT * FROM foobar")
query.Execute(db)
query.NextRow()
ASSERT(!query.NextRow())

query.GetRowData()
ASSERT(query.GetRowData()["id"] == null)

ASSERT(query.Error() && query.ErrorMsg())
ASSERT(!query.Error())

del(query)
del(db)
Expand Down
18 changes: 9 additions & 9 deletions Content.Tests/DMProject/Tests/Database/read.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@
ASSERT(assoc["name"] == "foo")
ASSERT(assoc["points"] == 1.5)

ASSERT(query.GetColumn(0) == 1)
ASSERT(query.GetColumn(1) == "foo")
ASSERT(query.GetColumn(2) == 1.5)
ASSERT(query.GetColumn(1) == 1)
ASSERT(query.GetColumn(2) == "foo")
ASSERT(query.GetColumn(3) == 1.5)

var/list/columns = query.Columns()
ASSERT(columns[1] == "id")
ASSERT(columns[2] == "name")
ASSERT(columns[3] == "points")

ASSERT(query.Columns(0) == "id")
ASSERT(query.Columns(1) == "name")
ASSERT(query.Columns(2) == "points")
ASSERT(query.Columns(1) == "id")
ASSERT(query.Columns(2) == "name")
ASSERT(query.Columns(3) == "points")

ASSERT(!query.Columns(10))

ASSERT(query.Error() && query.ErrorMsg())
ASSERT(!query.Error())

query.Close()
db.Close()
Expand All @@ -46,10 +46,10 @@
query.Execute(db)
query.NextRow()

ASSERT(query.GetColumn(0) == 1)
ASSERT(query.GetColumn(1) == 1)

ASSERT(!query.GetColumn(10))
ASSERT(query.Error() && query.ErrorMsg())
ASSERT(!query.Error())

del(query)
del(db)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#define FILE_DIR .

/proc/RunTest()
var/resource = 'data/test.txt'
ASSERT(file2text(resource) == "Test resource file's content")

// Compile-time resources always use a forward slash
// file() does not
ASSERT("['data/test.txt']" == "data/test.txt")
ASSERT("['data\\test.txt']" == "data/test.txt")
//ASSERT("['data\\test.txt']" == "data/test.txt")
ASSERT("['./data/test.txt']" == "data/test.txt")
ASSERT("['.\\data\\test.txt']" == "data/test.txt")
//ASSERT("['.\\data\\test.txt']" == "data/test.txt")
ASSERT("[file("data/test.txt")]" == "data/test.txt")
ASSERT("[file("./data/test.txt")]" == "./data/test.txt")
ASSERT("[file("data\\test.txt")]" == "data\\test.txt") // Note the backslash here
Expand Down
4 changes: 2 additions & 2 deletions Content.Tests/DMProject/Tests/Math/minmax.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ASSERT(min(1, null) == null)
ASSERT(min(-1, null) == -1)
ASSERT(min(1, null) == null)
ASSERT(min(0, null) == null)
ASSERT(min(0, null) == 0)
ASSERT(min(null, 0) == 0)
ASSERT(min("a","b","c")=="a")
ASSERT(min("b","a","c")=="a")
Expand All @@ -16,7 +16,7 @@
ASSERT(max(1,null) == 1)
ASSERT(max(-1,null) == null)
ASSERT(max(1, null) == 1)
ASSERT(max(0, null) == null)
ASSERT(max(0, null) == 0)
ASSERT(max(null, 0) == 0)
ASSERT(max("a","b","c")=="c")
ASSERT(max("b","a","c")=="c")
4 changes: 2 additions & 2 deletions Content.Tests/DMProject/Tests/Sleeping/New.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ var/call_number = 0
var/datum/inner_object/i = new

New()
AssertCallNumber(4)
AssertCallNumber(3)
sleep(0)
AssertCallNumber(5)

/datum/inner_object
New()
AssertCallNumber(2)
sleep(0)
AssertCallNumber(3)
AssertCallNumber(4)

/proc/RunTest()
AssertCallNumber(1)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/proc/RunTest()
ASSERT(text("[]", "TEST") == "TEST")
ASSERT(text("[ ]", "TEST") == "TEST")
Loading