]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
vector initialization tests
authorWolfgang Bumiller <blub@speed.at>
Thu, 20 Dec 2012 13:12:22 +0000 (14:12 +0100)
committerWolfgang Bumiller <blub@speed.at>
Thu, 20 Dec 2012 13:12:22 +0000 (14:12 +0100)
tests/vector-init.qc [new file with mode: 0644]
tests/vector-init.tmpl [new file with mode: 0644]
tests/vector-init2.tmpl [new file with mode: 0644]
tests/vector-init3.tmpl [new file with mode: 0644]

diff --git a/tests/vector-init.qc b/tests/vector-init.qc
new file mode 100644 (file)
index 0000000..880bc39
--- /dev/null
@@ -0,0 +1,25 @@
+void   print(...)    = #1;
+string ftos (float)  = #2;
+string vtos (vector) = #5;
+
+void main() {
+    vector v;
+
+    //v_x = 0;
+    //v_y = 0;
+    //v_z = 0;
+#ifdef INIT_BY_VECTOR
+    v = '3 4 5';
+#elifdef INIT_BY_COMPONENTS
+    v_x = 3;
+    v_y = 4;
+    v_z = 5;
+#elifdef INIT_PARTS
+    v_z = 5;
+#endif
+
+    print(ftos(v_y), "\n");
+    print(ftos(v_x), "\n");
+    print(ftos(v_z), "\n");
+    print(vtos(v), "\n");
+}
diff --git a/tests/vector-init.tmpl b/tests/vector-init.tmpl
new file mode 100644 (file)
index 0000000..2457d77
--- /dev/null
@@ -0,0 +1,4 @@
+I: vector-init.qc
+D: vector init as a whole
+T: -compile
+C: -std=fteqcc -Wall -Werror -DINIT_BY_VECTOR
diff --git a/tests/vector-init2.tmpl b/tests/vector-init2.tmpl
new file mode 100644 (file)
index 0000000..4bb85df
--- /dev/null
@@ -0,0 +1,4 @@
+I: vector-init.qc
+D: vector init by components
+T: -compile
+C: -std=fteqcc -Wall -Werror -DINIT_BY_COMPONENTS
diff --git a/tests/vector-init3.tmpl b/tests/vector-init3.tmpl
new file mode 100644 (file)
index 0000000..99936e1
--- /dev/null
@@ -0,0 +1,4 @@
+I: vector-init.qc
+D: only partial vector init
+T: -fail
+C: -std=fteqcc -Wall -Werror -DINIT_PARTS