diff options
Diffstat (limited to 'dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/flow_control/return.spec.ts')
-rw-r--r-- | dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/flow_control/return.spec.ts | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/flow_control/return.spec.ts b/dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/flow_control/return.spec.ts new file mode 100644 index 0000000000..ddfb20044c --- /dev/null +++ b/dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/flow_control/return.spec.ts @@ -0,0 +1,56 @@ +export const description = ` +Flow control tests for return statements. +`; + +import { makeTestGroup } from '../../../../common/framework/test_group.js'; +import { GPUTest } from '../../../gpu_test.js'; + +import { runFlowControlTest } from './harness.js'; + +export const g = makeTestGroup(GPUTest); + +g.test('return') + .desc("Test that flow control does not execute after a 'return' statement") + .params(u => u.combine('preventValueOptimizations', [true, false])) + .fn(t => { + runFlowControlTest( + t, + f => ` + ${f.expect_order(0)} + return; + ${f.expect_not_reached()} +` + ); + }); + +g.test('return_conditional_true') + .desc("Test that flow control does not execute after a 'return' statement in a if (true) block") + .params(u => u.combine('preventValueOptimizations', [true, false])) + .fn(t => { + runFlowControlTest( + t, + f => ` + ${f.expect_order(0)} + if (${f.value(true)}) { + return; + } + ${f.expect_not_reached()} +` + ); + }); + +g.test('return_conditional_false') + .desc("Test that flow control does not execute after a 'return' statement in a if (false) block") + .params(u => u.combine('preventValueOptimizations', [true, false])) + .fn(t => { + runFlowControlTest( + t, + f => ` + ${f.expect_order(0)} + if (${f.value(false)}) { + return; + } + ${f.expect_order(1)} +` + ); + }); |