diff options
Diffstat (limited to 'dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/flow_control/while.spec.ts')
-rw-r--r-- | dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/flow_control/while.spec.ts | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/flow_control/while.spec.ts b/dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/flow_control/while.spec.ts index 88ce6838a5..5ce6097a3a 100644 --- a/dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/flow_control/while.spec.ts +++ b/dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/flow_control/while.spec.ts @@ -138,3 +138,57 @@ g.test('while_nested_continue') ` ); }); + +g.test('while_logical_and_condition') + .desc('Test flow control for a while-loop with a logical and condition') + .params(u => u.combine('preventValueOptimizations', [true, false])) + .fn(t => { + runFlowControlTest(t, f => ({ + entrypoint: ` + ${f.expect_order(0)} + var i = ${f.value(0)}; + while (a(i) && b(i)) { + ${f.expect_order(3, 6)} + i++; + } + ${f.expect_order(8)} + `, + extra: ` +fn a(i : i32) -> bool { + ${f.expect_order(1, 4, 7)} + return i < ${f.value(2)}; +} +fn b(i : i32) -> bool { + ${f.expect_order(2, 5)} + return i < ${f.value(5)}; +} + `, + })); + }); + +g.test('while_logical_or_condition') + .desc('Test flow control for a while-loop with a logical or condition') + .params(u => u.combine('preventValueOptimizations', [true, false])) + .fn(t => { + runFlowControlTest(t, f => ({ + entrypoint: ` + ${f.expect_order(0)} + var i = ${f.value(0)}; + while (a(i) || b(i)) { + ${f.expect_order(2, 4, 7, 10)} + i++; + } + ${f.expect_order(13)} + `, + extra: ` +fn a(i : i32) -> bool { + ${f.expect_order(1, 3, 5, 8, 11)} + return i < ${f.value(2)}; +} +fn b(i : i32) -> bool { + ${f.expect_order(6, 9, 12)} + return i < ${f.value(4)}; +} + `, + })); + }); |