]> de.git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Actually add the tests
authorDale Weiler <killfieldengine@gmail.com>
Sat, 17 Nov 2012 08:31:23 +0000 (08:31 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Sat, 17 Nov 2012 08:31:23 +0000 (08:31 +0000)
tests/calls.qc [new file with mode: 0644]
tests/calls.tmpl [new file with mode: 0644]
tests/equality.qc [new file with mode: 0644]
tests/equality.tmpl [new file with mode: 0644]
tests/fieldparms.qc [new file with mode: 0644]
tests/fieldparms.tmpl [new file with mode: 0644]

diff --git a/tests/calls.qc b/tests/calls.qc
new file mode 100644 (file)
index 0000000..d55598e
--- /dev/null
@@ -0,0 +1,14 @@
+void(string, ...) print = #1;
+string(float) ftos = #2;
+
+float(float x, float y, float z) sum = {
+    return x + y + z;
+};
+
+void(float a, float b, float c) main = {
+    local float f;
+    f = sum(sum(a, sum(a, b, c), c),
+            sum(sum(sum(a, b, c), b, sum(a, b, c)), b, sum(a, b, sum(a, b, c))),
+            sum(sum(a, b, c), b, c));
+    print(ftos(f), "\n");
+};
diff --git a/tests/calls.tmpl b/tests/calls.tmpl
new file mode 100644 (file)
index 0000000..3c551af
--- /dev/null
@@ -0,0 +1,8 @@
+I: calls.qc
+D: test calls
+T: -execute
+C: -std=gmqcc
+E: -float 100 -float 200 -float 300
+F: calls failed
+S: calls worked
+M: 4600
diff --git a/tests/equality.qc b/tests/equality.qc
new file mode 100644 (file)
index 0000000..bc134b0
--- /dev/null
@@ -0,0 +1,11 @@
+void(string, ...) print = #1;
+string(float) ftos = #2;
+
+void(float a, float b) main = {
+    if (a == b) print("eq,");
+    if (a != b) print("ne,");
+    if (a >  b) print("gt,");
+    if (a <  b) print("lt,");
+    if (a >= b) print("ge,");
+    if (a <= b) print("le,");
+};
diff --git a/tests/equality.tmpl b/tests/equality.tmpl
new file mode 100644 (file)
index 0000000..18c3750
--- /dev/null
@@ -0,0 +1,8 @@
+I: equality.qc
+D: test equality
+T: -execute
+C: -std=gmqcc
+E: -float 100 -float 200
+F: equality failed
+S: equality worked
+M: ne,lt,le,
diff --git a/tests/fieldparms.qc b/tests/fieldparms.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/fieldparms.tmpl b/tests/fieldparms.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