]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Added more tests, fixed existing ones, and some more test system changes.
authorDale Weiler <killfieldengine@gmail.com>
Sat, 17 Nov 2012 09:51:55 +0000 (09:51 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Sat, 17 Nov 2012 09:51:55 +0000 (09:51 +0000)
test.c
tests/fieldparams.qc [new file with mode: 0644]
tests/fieldparams.tmpl [new file with mode: 0644]
tests/fieldparms.qc [deleted file]
tests/fieldparms.tmpl [deleted file]
tests/functions-as-params.qc [new file with mode: 0644]
tests/functions-as-params.tmpl [new file with mode: 0644]
tests/ifs.qc [new file with mode: 0644]
tests/ifs.tmpl [new file with mode: 0644]
tests/ngraphs.qc [new file with mode: 0644]
tests/ngraphs.tmpl [new file with mode: 0644]

diff --git a/test.c b/test.c
index 1ea5b6056ca39bb285676465a3b5528cb451f035..535d366914e331af56156b4c6e172ceb73a1ce26 100644 (file)
--- 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 (file)
index 0000000..9ca71d6
--- /dev/null
@@ -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 (file)
index 0000000..7d5217f
--- /dev/null
@@ -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 (file)
index 9ca71d6..0000000
+++ /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 (file)
index 7d5217f..0000000
+++ /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 (file)
index 0000000..7790e64
--- /dev/null
@@ -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 (file)
index 0000000..2c4504c
--- /dev/null
@@ -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 (file)
index 0000000..d3089ce
--- /dev/null
@@ -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 (file)
index 0000000..8ba64e3
--- /dev/null
@@ -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 (file)
index 0000000..330d625
--- /dev/null
@@ -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 (file)
index 0000000..f0c6f94
--- /dev/null
@@ -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: #^[]|{}~\%>|#^[]|{}~\%>