Skip to content

Commit

Permalink
Merge branch 'master' into tracy
Browse files Browse the repository at this point in the history
  • Loading branch information
amylizzle authored Jan 5, 2025
2 parents 163e83f + 6582337 commit 27c1291
Show file tree
Hide file tree
Showing 160 changed files with 1,898 additions and 877 deletions.
Binary file added Content.IntegrationTests/DMProject/Tests/icons.dmi
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
plane = 123
icon_state = "subclass"

/proc/RunTest()
/proc/test_images()
ASSERT(image('icons.dmi', "mob") != null)

var/image/test = new /image/subclass
ASSERT(test.plane == 123)
ASSERT(test.icon_state == "subclass")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
out += dir
ASSERT(out == 14)

/proc/RunTest()
/proc/test_nonlocal_var()
var/mob/m = new
m.dodir()
2 changes: 2 additions & 0 deletions Content.IntegrationTests/DMProject/code.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@
test_color_matrix()
test_range()
test_verb_duplicate()
test_nonlocal_var()
test_images()
test_filter_init()
world.log << "IntegrationTests successful, /world/New() exiting..."
2 changes: 2 additions & 0 deletions Content.IntegrationTests/DMProject/environment.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "Tests/color_matrix.dm"
#include "Tests/range.dm"
#include "Tests/verb_duplicate.dm"
#include "Tests/nonlocal_var.dm"
#include "Tests/image.dm"
#include "Tests/filter_initial.dm"
#include "map.dmm"
#include "interface.dmf"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// COMPILE ERROR
// COMPILE ERROR OD0011

var/a = 1 / 0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// COMPILE ERROR
// COMPILE ERROR OD0011

var/static/a = 1 / 0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// COMPILE ERROR
// COMPILE ERROR OD0011

/proc/one()
return 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// COMPILE ERROR
// COMPILE ERROR OD0011

var/const/a = 0
var/b = 1 / a
Expand Down
2 changes: 0 additions & 2 deletions Content.Tests/DMProject/Tests/Image/Image.dm

This file was deleted.

18 changes: 9 additions & 9 deletions Content.Tests/DMProject/Tests/Operators/Division.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,39 @@
var/list/expected = list(
1,
"Error",
10,
"Error",
"Error", // index 5
"Error",
"Error",
"Error",
"Error",
"Error", // index 10
"Error",
"Error",
"Error",
"Error",
"Error", // index 15
"Error",
"Error",
"Error",
"Error",
"Error", // index 20
"Error",
"Error",
"Error",
"Error",
"Error",
"Error",
"Error",
0,
0,
0,
0, // index 25
0,
0,
0,
0,
0, // index 30
0,
0,
0,
0,
"Error",
"Error",
"Error", // index 35
"Error",
"Error",
"Error",
Expand Down Expand Up @@ -128,4 +128,4 @@
"Error"
)

test_binary_operator(/proc/divide, expected)
test_binary_operator(/proc/divide, expected)
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var/list/operator_test_values = list(
result = "Error"

if (result ~! expected_result)
CRASH("Expected [json_encode(expected_result)] for [json_encode(a)], instead got [json_encode(result)]")
CRASH("Expected [json_encode(expected_result)] for [json_encode(a)], instead got [json_encode(result)] at index [i - 1]")

/proc/test_binary_operator(var/operator_proc, var/list/expected)
var/i = 1
Expand All @@ -48,4 +48,4 @@ var/list/operator_test_values = list(
result = "Error"

if (result ~! expected_result)
CRASH("Expected [json_encode(expected_result)] for [json_encode(a)] and [json_encode(b)], instead got [json_encode(result)]")
CRASH("Expected [json_encode(expected_result)] for [json_encode(a)] and [json_encode(b)], instead got [json_encode(result)] at index [i - 1]")
130 changes: 130 additions & 0 deletions Content.Tests/DMProject/Tests/Operators/valid_and_null.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
//simple test of all basic operators with valid and C(null) arguments
//We can't be having const folding in here
#define C(X) pick(X)
/proc/RunTest()
var/a = C(2)
ASSERT(!C(null) == C(1))
ASSERT(!!C(null) == C(0))

ASSERT(~C(1) == 16777214)
ASSERT(~C(0) == 16777215)
ASSERT(~C(null) == 16777215)

ASSERT(C(1) + C(1) == C(2))
ASSERT(C(null) + C(1) == C(1))
ASSERT(C(1) + C(null) == C(1))

ASSERT(C(1) - C(1) == C(0))
ASSERT(C(null) - C(1) == C(-1))
ASSERT(C(1) - C(null) == C(1))

a = C(2)
ASSERT(-a == C(-2))
a = C(null)
ASSERT(-a == C(0))

a = C(1)
ASSERT(a++ == C(1))
ASSERT(a == C(2))
ASSERT(++a == C(3))
ASSERT(a == C(3))

ASSERT(a-- == C(3))
ASSERT(a == C(2))
ASSERT(--a == C(1))
ASSERT(a == C(1))

a = C(null)
ASSERT(a-- == C(null))
ASSERT(a == C(-1))
a = C(null)
ASSERT(--a == C(-1))
ASSERT(a == C(-1))
a = C(null)
ASSERT(a++ == C(null))
ASSERT(a == C(1))
a = C(null)
ASSERT(++a == C(1))
ASSERT(a == C(1))

ASSERT(C(2) ** C(3) == 8)
ASSERT(C(2) ** C(null) == C(1))
ASSERT(C(null) ** C(2) == C(0))

ASSERT(C(2) * C(3) == 6)
ASSERT(C(2) * C(null) == C(0))
ASSERT(C(null) * C(2) == C(0))

ASSERT(C(4) / C(2) == C(2))
ASSERT(C(null) / C(2) == C(0))
ASSERT(C(2) / C(null) == C(2))
ASSERT(C(null) / C(null) == C(0))

ASSERT(C(4) % C(3) == C(1))
ASSERT(C(null) % C(3) == C(0))
//ASSERT(C(4) % C(null) == div by zero)

ASSERT(C(1) < C(1) == C(0))
ASSERT(C(null) < C(1) == C(1))
ASSERT(C(1) < C(null) == C(0))

ASSERT(C(1) <= C(1) == C(1))
ASSERT(C(null) <= C(1) == C(1))
ASSERT(C(1) <= C(null) == C(0))

ASSERT(C(1) > C(1) == C(0))
ASSERT(C(null) > C(1) == C(0))
ASSERT(C(1) > C(null) == C(1))

ASSERT(C(1) >= C(1) == C(1))
ASSERT(C(null) >= C(1) == C(0))
ASSERT(C(1) >= C(null) == C(1))

ASSERT(C(1) << C(1) == C(2))
ASSERT(C(null) << C(1) == C(0))
ASSERT(C(1) << C(null) == C(1))

ASSERT(C(1) >> C(1) == C(0))
ASSERT(C(null) >> C(1) == C(0))
ASSERT(C(1) >> C(null) == C(1))

ASSERT((C(1) == C(1)) == C(1))
ASSERT((C(null) == C(null)) == C(1))
ASSERT((C(null) == C(0)) == C(0))

ASSERT((C(1) != C(null)) == C(1))
ASSERT((C(null) != C(1)) == C(1))
ASSERT((C(null) != C(0)) == C(1))

ASSERT((C(1) <> C(null)) == C(1))
ASSERT((C(null) <> C(1)) == C(1))
ASSERT((C(null) <> C(0)) == C(1))

ASSERT((C(1) ~= C(1)) == C(1))
ASSERT((C(null) ~= C(null)) == C(1))
ASSERT((C(null) ~= C(0)) == C(0))

ASSERT((C(1) ~! C(1)) == C(0))
ASSERT((C(null) ~! C(null)) == C(0))
ASSERT((C(null) ~! C(0)) == C(1))

ASSERT((C(1) & C(1)) == C(1))
ASSERT((C(null) & C(1)) == C(0))
ASSERT((C(1) & C(null)) == C(0))

ASSERT((C(1) ^ C(1)) == C(0))
ASSERT((C(null) ^ C(5)) == C(5))
ASSERT((C(5) ^ C(null)) == C(5))

ASSERT((C(1) | C(1)) == C(1))
ASSERT((C(null) | C(1)) == C(1))
ASSERT((C(1) | C(null)) == C(1))

ASSERT((C(1) && C(1)) == C(1))
ASSERT((C(null) && C(1)) == C(null))
ASSERT((C(1) && C(null)) == C(null))

ASSERT((C(1) || C(1)) == C(1))
ASSERT((C(null) || C(1)) == C(1))
ASSERT((C(1) || C(null)) == C(1))

128 changes: 128 additions & 0 deletions Content.Tests/DMProject/Tests/Operators/valid_and_null_assign.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
//simple test of all basic assignment operators with valid and C(null) arguments
//We can't be having const folding in here
#define C(X) pick(X)
/proc/RunTest()
var/a = C(1)
a += C(1)
ASSERT(a == C(2))
a = null
a += C(1)
ASSERT(a == C(1))
a = C(1)
a += C(null)
ASSERT(a == C(1))

a = C(1)
a -= C(1)
ASSERT(a == C(0))
a = null
a -= C(1)
ASSERT(a == C(-1))
a = C(1)
a -= C(null)
ASSERT(a == C(1))

a = C(2)
a *= C(3)
ASSERT(a == C(6))
a = null
a *= C(2)
ASSERT(a == C(0))
a = C(2)
a *= C(null)
ASSERT(a == C(0))

a = C(4)
a /= C(2)
ASSERT(a == C(2))
a = null
a /= C(2)
ASSERT(a == C(0))
//a = C(2)
//a /= C(null) //Undefined operation error in BYOND
//ASSERT(a == C(2))

a = C(4)
a %= C(3)
ASSERT(a == C(1))
a = null
a %= C(3)
ASSERT(a == C(0))
//a = C(4)
//a %= C(null) //divide by zero error in byond
//ASSERT(a == C(4))

a = C(1)
a &= C(1)
ASSERT(a == C(1))
a = null
a &= C(1)
ASSERT(a == C(0))
a = C(1)
a &= C(null)
ASSERT(a == C(0))

a = C(1)
a |= C(1)
ASSERT(a == C(1))
a = null
a |= C(1)
ASSERT(a == C(1))
a = C(1)
a |= C(null)
ASSERT(a == C(1))

a = C(1)
a ^= C(1)
ASSERT(a == C(0))
a = null
a ^= C(1)
ASSERT(a == C(1))
a = C(1)
a ^= C(null)
ASSERT(a == C(1))

a = C(1)
a &&= C(1)
ASSERT(a == C(1))
a = null
a &&= C(1)
ASSERT(a == C(null))
a = C(1)
a &&= C(null)
ASSERT(a == C(null))

a = C(1)
a ||= C(1)
ASSERT(a == C(1))
a = null
a ||= C(1)
ASSERT(a == C(1))
a = C(1)
a ||= C(null)
ASSERT(a == C(1))

a = C(1)
a <<= C(1)
ASSERT(a == C(2))
a = null
a <<= C(1)
ASSERT(a == C(0))
a = C(1)
a <<= C(null)
ASSERT(a == C(1))

a = C(1)
a >>= C(1)
ASSERT(a == C(0))
a = null
a >>= C(1)
ASSERT(a == C(0))
a = C(1)
a >>= C(null)
ASSERT(a == C(1))

a := C(5)
ASSERT(a == C(5))
a := C(null)
ASSERT(a == null)
Loading

0 comments on commit 27c1291

Please sign in to comment.