From fcdff3180a2bb7f65b9a5fb9485b6b2c4523e2f2 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 24 Dec 2012 12:43:16 +0100 Subject: [PATCH] Tests for the previous vector-liferange change --- tests/uninit.qc | 25 +++++++++++++++++++++++++ tests/uninit.tmpl | 4 ++++ tests/uninit2.tmpl | 4 ++++ 3 files changed, 33 insertions(+) create mode 100644 tests/uninit.qc create mode 100644 tests/uninit.tmpl create mode 100644 tests/uninit2.tmpl diff --git a/tests/uninit.qc b/tests/uninit.qc new file mode 100644 index 0000000..3d75f07 --- /dev/null +++ b/tests/uninit.qc @@ -0,0 +1,25 @@ +void print(...) = #1; +string ftos (float) = #2; +string vtos (vector) = #5; + +vector main(float a, vector vin) { + vector v; + + if (a < 4) { + v = vin; + v_x += 1; + v_y += 1; + v_z += 1; + return v; + } + else if (a < 5) { + v_x = 3; + v_y = 3; +#ifdef UNINIT + print(vtos(v), "\n"); +#endif + v_z = 3; + return v; + } + return '0 0 0'; +} diff --git a/tests/uninit.tmpl b/tests/uninit.tmpl new file mode 100644 index 0000000..040f1d0 --- /dev/null +++ b/tests/uninit.tmpl @@ -0,0 +1,4 @@ +I: uninit.qc +D: catch another case of unused vector accesses +T: -compile +C: -std=fteqcc -Wall -Werror diff --git a/tests/uninit2.tmpl b/tests/uninit2.tmpl new file mode 100644 index 0000000..2c4be19 --- /dev/null +++ b/tests/uninit2.tmpl @@ -0,0 +1,4 @@ +I: uninit.qc +D: catch another case of unused vector accesses - should fail +T: -fail +C: -std=fteqcc -Wall -Werror -DUNINIT -- 2.39.2