diff options
Diffstat (limited to 'testing/web-platform/mozilla/tests/webgpu/webgpu/shader/execution/flow_control/for.spec.js')
-rw-r--r-- | testing/web-platform/mozilla/tests/webgpu/webgpu/shader/execution/flow_control/for.spec.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/testing/web-platform/mozilla/tests/webgpu/webgpu/shader/execution/flow_control/for.spec.js b/testing/web-platform/mozilla/tests/webgpu/webgpu/shader/execution/flow_control/for.spec.js index 182f1e999a..4f7714cf42 100644 --- a/testing/web-platform/mozilla/tests/webgpu/webgpu/shader/execution/flow_control/for.spec.js +++ b/testing/web-platform/mozilla/tests/webgpu/webgpu/shader/execution/flow_control/for.spec.js @@ -268,4 +268,54 @@ fn((t) => { ${f.expect_order(9)} ` ); +}); + +g.test('for_logical_and_condition'). +desc('Test flow control for a for-loop with a logical and condition'). +params((u) => u.combine('preventValueOptimizations', [true, false])). +fn((t) => { + runFlowControlTest(t, (f) => ({ + entrypoint: ` + ${f.expect_order(0)} + for (var i = ${f.value(0)}; a(i) && b(i); i++) { + ${f.expect_order(3, 6)} + } + ${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('for_logical_or_condition'). +desc('Test flow control for a for-loop with a logical or condition'). +params((u) => u.combine('preventValueOptimizations', [true, false])). +fn((t) => { + runFlowControlTest(t, (f) => ({ + entrypoint: ` + ${f.expect_order(0)} + for (var i = ${f.value(0)}; a(i) || b(i); i++) { + ${f.expect_order(2, 4, 7, 10)} + } + ${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)}; +} + ` + })); });
\ No newline at end of file |