From 55491bbc234a1de31dfb43d1eab569e495cbb341 Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Sat, 17 Nov 2012 09:51:55 +0000 Subject: [PATCH] Added more tests, fixed existing ones, and some more test system changes. --- test.c | 3 --- tests/{fieldparms.qc => fieldparams.qc} | 0 tests/{fieldparms.tmpl => fieldparams.tmpl} | 0 tests/functions-as-params.qc | 13 +++++++++++++ tests/functions-as-params.tmpl | 8 ++++++++ tests/ifs.qc | 12 ++++++++++++ tests/ifs.tmpl | 8 ++++++++ tests/ngraphs.qc | 6 ++++++ tests/ngraphs.tmpl | 8 ++++++++ 9 files changed, 55 insertions(+), 3 deletions(-) rename tests/{fieldparms.qc => fieldparams.qc} (100%) rename tests/{fieldparms.tmpl => fieldparams.tmpl} (100%) create mode 100644 tests/functions-as-params.qc create mode 100644 tests/functions-as-params.tmpl create mode 100644 tests/ifs.qc create mode 100644 tests/ifs.tmpl create mode 100644 tests/ngraphs.qc create mode 100644 tests/ngraphs.tmpl 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/fieldparms.qc b/tests/fieldparams.qc similarity index 100% rename from tests/fieldparms.qc rename to tests/fieldparams.qc diff --git a/tests/fieldparms.tmpl b/tests/fieldparams.tmpl similarity index 100% rename from tests/fieldparms.tmpl rename to tests/fieldparams.tmpl 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: #^[]|{}~\%>|#^[]|{}~\%> -- 2.39.2