Zebediah Figura : tests: Add some tests for #ifdef and defined().

Alexandre Julliard julliard at winehq.org
Mon Nov 23 15:41:30 CST 2020


Module: vkd3d
Branch: master
Commit: f8ad29aad0927be9cef85355c0968a75fa2bc74c
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=f8ad29aad0927be9cef85355c0968a75fa2bc74c

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Sat Nov 21 17:23:46 2020 -0600

tests: Add some tests for #ifdef and defined().

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 Makefile.am                     |  2 +
 tests/preproc-ifdef.shader_test | 89 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 91 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 60789f4..0ee7eda 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -65,6 +65,7 @@ vkd3d_shader_tests = \
 	tests/hlsl-vector-indexing-uniform.shader_test \
 	tests/math.shader_test \
 	tests/preproc-if.shader_test \
+	tests/preproc-ifdef.shader_test \
 	tests/swizzle-0.shader_test \
 	tests/swizzle-1.shader_test \
 	tests/swizzle-2.shader_test \
@@ -208,6 +209,7 @@ XFAIL_TESTS = \
 	tests/hlsl-vector-indexing-uniform.shader_test \
 	tests/math.shader_test \
 	tests/preproc-if.shader_test \
+	tests/preproc-ifdef.shader_test \
 	tests/swizzle-0.shader_test \
 	tests/swizzle-1.shader_test \
 	tests/swizzle-2.shader_test \
diff --git a/tests/preproc-ifdef.shader_test b/tests/preproc-ifdef.shader_test
new file mode 100644
index 0000000..b31aeb9
--- /dev/null
+++ b/tests/preproc-ifdef.shader_test
@@ -0,0 +1,89 @@
+[preproc]
+#define KEY
+#ifdef KEY
+pass
+#endif
+
+[preproc]
+#define KEY
+#if defined(KEY)
+pass
+#endif
+
+[preproc]
+#define KEY
+#if defined KEY
+pass
+#endif
+
+[preproc]
+#ifndef KEY
+pass
+#endif
+
+[preproc]
+#if !defined(KEY)
+pass
+#endif
+
+[preproc]
+#define KEY
+#ifndef KEY
+fail
+#else
+pass
+#endif
+
+[preproc]
+#ifdef KEY
+fail
+#else
+pass
+#endif
+
+[preproc]
+#define KEY(a, b)
+#ifdef KEY
+pass
+#endif
+
+[preproc]
+#ifdef KEY
+fail
+#endif
+#define KEY
+pass
+
+[preproc]
+#define KEY 0
+#ifdef KEY
+pass
+#endif
+
+[preproc]
+#define KEY
+#undef KEY
+#ifndef KEY
+pass
+#endif
+
+[preproc]
+#if KEY
+fail
+#else
+pass
+#endif
+
+[preproc]
+#if KEY == 0
+pass
+#else
+fail
+#endif
+
+[preproc]
+#if KEY == 1
+fail
+#else
+pass
+#endif




More information about the wine-cvs mailing list