Moved tests from scripts/ to test/scripts/

This commit is contained in:
2022-11-11 14:51:47 +00:00
parent 0aa6e4063b
commit 2c143a8be5
36 changed files with 10 additions and 10 deletions

View File

@@ -0,0 +1,40 @@
//test basic indexing
var greeting: string = "hello world";
assert greeting[1] == "e", "basic default index failed (first)";
assert greeting[:] == "hello world", "basic default index failed (first and second)";
assert greeting[::] == "hello world", "basic default index failed (first, second & third)";
assert greeting[0:4] == "hello", "basic indexing failed";
//test basic replacement
greeting[0:4] = "goodnight";
assert greeting == "goodnight world", "basic replacement failed";
//test backwards string
assert greeting[::-1] == "dlrow thgindoog", "backwards string failed";
assert greeting[11:15:-1] == "dlrow", "backwards indexed string failed";
//test string weird manipulation
var numbers = "0123456789";
numbers[::-2] = "abc";
assert numbers == "01234c6b8a", "string weird manipulation failed";
//test indexing with variables
var first = 11;
var second = 15;
var third = -1;
assert greeting[first:second:third] == "dlrow", "indexing with variables failed";
print "All good";