-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into fast_world_contents
- Loading branch information
Showing
98 changed files
with
2,254 additions
and
1,031 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/datum | ||
var/composite_expr = 4 * sin(3 + cos(2)) | ||
var/sintest = sin(45) | ||
var/costest = cos(123) | ||
var/tantest = tan(123) | ||
var/sqrttest = sqrt(123) | ||
var/arcsintest = arcsin(sin(45)) | ||
var/arccostest = arccos(cos(123)) | ||
var/arctantest = arctan(tan(69)) | ||
var/log_test = log(10) | ||
var/log10_test = log(10, 100) | ||
var/arctan2_test = arctan(1, 3) | ||
var/abs_test = abs(-213) | ||
|
||
#define EPSILON 4e-6 | ||
#define APX_EQUAL(a, b) ASSERT(abs(a - b) < EPSILON) | ||
|
||
/proc/RunTest() | ||
var/break_const_eval = null | ||
var/datum/d = new /datum | ||
|
||
APX_EQUAL(initial(d.composite_expr), 4 * sin(3 + cos(break_const_eval || 2))) | ||
APX_EQUAL(d.composite_expr, 4 * sin(3 + cos(break_const_eval || 2))) | ||
|
||
APX_EQUAL(d.sintest, sin(break_const_eval || 45)) | ||
APX_EQUAL(d.sintest, 0.707106769084930419921875) | ||
|
||
APX_EQUAL(d.costest, cos(break_const_eval || 123)) | ||
APX_EQUAL(d.costest, -0.544639050960540771484375) | ||
|
||
APX_EQUAL(d.tantest, tan(break_const_eval || 123)) | ||
APX_EQUAL(d.tantest, -1.539865016937255859375) | ||
|
||
APX_EQUAL(d.sqrttest, sqrt(break_const_eval || 123)) | ||
APX_EQUAL(d.sqrttest, 11.0905361175537109375) | ||
|
||
APX_EQUAL(d.arcsintest, arcsin(sin(break_const_eval || 45))) | ||
APX_EQUAL(d.arcsintest, 45) | ||
|
||
APX_EQUAL(d.arccostest, arccos(cos(break_const_eval || 123))) | ||
APX_EQUAL(d.arccostest, 123) | ||
|
||
APX_EQUAL(d.arctantest, arctan(tan(break_const_eval || 69))) | ||
APX_EQUAL(d.arctantest, 69) | ||
|
||
APX_EQUAL(d.log_test, log(break_const_eval || 10)) | ||
APX_EQUAL(d.log_test, 2.302585124969482421875) | ||
|
||
APX_EQUAL(d.log10_test, log(break_const_eval || 10, 100)) | ||
APX_EQUAL(d.log10_test, 2) | ||
|
||
APX_EQUAL(d.arctan2_test, arctan(break_const_eval || 1, 3)) | ||
APX_EQUAL(d.arctan2_test, 71.5650482177734375) | ||
|
||
APX_EQUAL(d.abs_test, abs(break_const_eval || -213)) | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
#include "Shared/operator_testing.dm" | ||
|
||
/proc/add(a, b) | ||
return a + b | ||
|
||
/proc/RunTest() | ||
var/list/expected = list( | ||
20, | ||
"Error", | ||
10, | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"ABCABC", | ||
"ABC", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"ABC/datum/proc", | ||
"ABC/datum/verb", | ||
10, | ||
"ABC", | ||
null, | ||
'Shared/file.txt', | ||
list("A"), | ||
operator_test_object, | ||
/datum, | ||
/datum/proc/foo, | ||
/datum/verb/bar, | ||
/datum/proc, | ||
/datum/verb, | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
list("A", 10), | ||
list("A", "ABC"), | ||
list("A", null), | ||
list("A", 'Shared/file.txt'), | ||
list("A", "A"), | ||
list("A", operator_test_object), | ||
list("A", /datum), | ||
list("A", /datum/proc/foo), | ||
list("A", /datum/verb/bar), | ||
list("A", /datum/proc), | ||
list("A", /datum/verb), | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"/datum/procABC", | ||
"/datum/proc", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"/datum/proc/datum/proc", | ||
"/datum/proc/datum/verb", | ||
"Error", | ||
"/datum/verbABC", | ||
"/datum/verb", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"Error", | ||
"/datum/verb/datum/proc", | ||
"/datum/verb/datum/verb" | ||
) | ||
|
||
test_operator(/proc/add, expected) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Used in operator_testing.dm |
37 changes: 37 additions & 0 deletions
37
Content.Tests/DMProject/Tests/Operators/Shared/operator_testing.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// IGNORE | ||
|
||
// A helper method for testing operators against many kinds of values | ||
|
||
/var/datum/operator_test_object = new /datum() | ||
|
||
/datum/proc/foo() | ||
/datum/verb/bar() | ||
|
||
/proc/test_operator(var/operator_proc, var/list/expected) | ||
var/list/values = list( | ||
10, | ||
"ABC", | ||
null, | ||
'file.txt', | ||
list("A"), | ||
operator_test_object, | ||
/datum, | ||
/datum/proc/foo, | ||
/datum/verb/bar, | ||
/datum/proc, | ||
/datum/verb | ||
) | ||
|
||
var/i = 1 | ||
for (var/a in values) | ||
for (var/b in values) | ||
var/expected_result = expected[i++] | ||
var/result | ||
|
||
try | ||
result = call(operator_proc)(a, b) | ||
catch | ||
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)]") |
10 changes: 10 additions & 0 deletions
10
Content.Tests/DMProject/Tests/Preprocessor/Pragma/warning_quote.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#define CONDITION_TRUE | ||
|
||
#ifdef CONDITION_TRUE | ||
#warn Oh no you're gonna have a bad time | ||
#endif | ||
|
||
/proc/RunTest() | ||
return | ||
|
||
#warn end of file |
12 changes: 6 additions & 6 deletions
12
Content.Tests/DMProject/Tests/Special Procs/issaved/issaved_vars_index.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.