From: Dale Weiler Date: Sat, 17 Nov 2012 09:51:55 +0000 (+0000) Subject: Added more tests, fixed existing ones, and some more test system changes. X-Git-Tag: 0.1.9~412 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=55491bbc234a1de31dfb43d1eab569e495cbb341;p=xonotic%2Fgmqcc.git Added more tests, fixed existing ones, and some more test system changes. --- diff --git a/test.c b/test.c index 1ea5b60..535d366 100644 --- a/test.c +++ b/test.c @@ -507,15 +507,12 @@ bool task_propogate(const char *curdir) { void task_cleanup(const char *curdir) { DIR *dir; struct dirent *files; - struct stat directory; char buffer[4096]; dir = opendir(curdir); while ((files = readdir(dir))) { memset(buffer, 0, sizeof(buffer)); - stat(files->d_name, &directory); - if (strstr(files->d_name, "TMP")) { snprintf(buffer, sizeof(buffer), "%s/%s", curdir, files->d_name); if (remove(buffer)) diff --git a/tests/fieldparams.qc b/tests/fieldparams.qc new file mode 100644 index 0000000..9ca71d6 --- /dev/null +++ b/tests/fieldparams.qc @@ -0,0 +1,17 @@ +void(string, string) print = #1; +entity() spawn = #3; + +.string a; +.string b; + +void(entity e, .string s) callout = { + print(e.s, "\n"); +}; + +void() main = { + local entity e; + e = spawn(); + e.a = "foo"; + e.b = "bar"; + callout(e, b); +}; diff --git a/tests/fieldparams.tmpl b/tests/fieldparams.tmpl new file mode 100644 index 0000000..7d5217f --- /dev/null +++ b/tests/fieldparams.tmpl @@ -0,0 +1,8 @@ +I: fieldparams.qc +D: test field paramaters +T: -execute +C: -std=qcc +E: $null +F: field paramaters fail +S: field paramaters work +M: bar diff --git a/tests/fieldparms.qc b/tests/fieldparms.qc deleted file mode 100644 index 9ca71d6..0000000 --- a/tests/fieldparms.qc +++ /dev/null @@ -1,17 +0,0 @@ -void(string, string) print = #1; -entity() spawn = #3; - -.string a; -.string b; - -void(entity e, .string s) callout = { - print(e.s, "\n"); -}; - -void() main = { - local entity e; - e = spawn(); - e.a = "foo"; - e.b = "bar"; - callout(e, b); -}; diff --git a/tests/fieldparms.tmpl b/tests/fieldparms.tmpl deleted file mode 100644 index 7d5217f..0000000 --- a/tests/fieldparms.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -I: fieldparams.qc -D: test field paramaters -T: -execute -C: -std=qcc -E: $null -F: field paramaters fail -S: field paramaters work -M: bar diff --git a/tests/functions-as-params.qc b/tests/functions-as-params.qc new file mode 100644 index 0000000..7790e64 --- /dev/null +++ b/tests/functions-as-params.qc @@ -0,0 +1,13 @@ +void(string, string) print = #1; + +string() getter = { + return "correct"; +}; + +void(string() f) printer = { + print(f(), "\n"); +}; + +void() main = { + printer(getter); +}; diff --git a/tests/functions-as-params.tmpl b/tests/functions-as-params.tmpl new file mode 100644 index 0000000..2c4504c --- /dev/null +++ b/tests/functions-as-params.tmpl @@ -0,0 +1,8 @@ +I: functions-as-params.qc +D: test functions as paramaters +T: -execute +C: -std=gmqcc +E: $null +F: functions as paramaters failed +S: functions as paramaters passed +M: correct diff --git a/tests/ifs.qc b/tests/ifs.qc new file mode 100644 index 0000000..d3089ce --- /dev/null +++ b/tests/ifs.qc @@ -0,0 +1,12 @@ +void(string, ...) print = #1; + +void(float c) main = { + if (c == 1) + print("One\n"); + else if (c == 2) + print("Two\n"); + else if (c == 3) + print("Three\n"); + else + print("Else\n"); +}; diff --git a/tests/ifs.tmpl b/tests/ifs.tmpl new file mode 100644 index 0000000..8ba64e3 --- /dev/null +++ b/tests/ifs.tmpl @@ -0,0 +1,8 @@ +I: ifs.qc +D: test if statement +T: -execute +C: -std=gmqcc +E: -float 2 +F: if statement failed +S: if statement passed +M: Two diff --git a/tests/ngraphs.qc b/tests/ngraphs.qc new file mode 100644 index 0000000..330d625 --- /dev/null +++ b/tests/ngraphs.qc @@ -0,0 +1,6 @@ +void(...) print = %:1; + +void() main = ??< + print("??=??'??(??)??!????-??/??/%>|"); + print("#^[]|{}~\\%>\n"); +%>; diff --git a/tests/ngraphs.tmpl b/tests/ngraphs.tmpl new file mode 100644 index 0000000..f0c6f94 --- /dev/null +++ b/tests/ngraphs.tmpl @@ -0,0 +1,8 @@ +I: ngraphs.qc +D: test digraphs and trigraphs +T: -execute +C: -std=gmqcc +E: $null +F: digraphs and trigraphs failed +S: digraphs and trigraphs passed +M: #^[]|{}~\%>|#^[]|{}~\%>