summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/empty-switch.slang29
-rw-r--r--tests/bugs/empty-switch.slang.expected.txt4
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/bugs/empty-switch.slang b/tests/bugs/empty-switch.slang
new file mode 100644
index 000000000..104c63367
--- /dev/null
+++ b/tests/bugs/empty-switch.slang
@@ -0,0 +1,29 @@
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute
+//TEST(compute,vulkan):COMPARE_COMPUTE_EX:-vk -slang -compute
+//TEST(compute):COMPARE_COMPUTE_EX:-cpu -slang -compute
+//TEST(compute):COMPARE_COMPUTE_EX:-cuda -slang -compute
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out, name outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int index = int(dispatchThreadID.x);
+
+ int a = index;
+
+ // This is kind of silly - but it is a valid construct.
+ // We want to check condition expression is executed though
+ switch (++a)
+ {
+ }
+
+ switch (index)
+ {
+ // This should not be executed
+ a += 10;
+ }
+
+ outputBuffer[index] = a;
+} \ No newline at end of file
diff --git a/tests/bugs/empty-switch.slang.expected.txt b/tests/bugs/empty-switch.slang.expected.txt
new file mode 100644
index 000000000..94ebaf900
--- /dev/null
+++ b/tests/bugs/empty-switch.slang.expected.txt
@@ -0,0 +1,4 @@
+1
+2
+3
+4