| <!DOCTYPE html> |
| <html> |
| <meta charset=utf-8> |
| <meta name="timeout" content="long"> |
| <title>Test loops.</title> |
| <script src="js/whlsl-test-harness.js"></script> |
| <script src="js/webgpu-functions.js"></script> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script> |
| const whlslTests = {}; |
| |
| whlslTests.mutuallyRecursiveStruct = async () => |
| { |
| await checkFail( |
| ` |
| struct Foo { |
| Bar bar; |
| } |
| struct Bar { |
| Foo foo; |
| } |
| `); |
| |
| } |
| |
| whlslTests.mutuallyRecursiveStructWithPointersBroken = async () => |
| { |
| let program = ` |
| struct Foo { |
| thread Bar* bar; |
| int foo; |
| } |
| struct Bar { |
| thread Foo* foo; |
| int bar; |
| } |
| int foo() |
| { |
| Foo foo; |
| Bar bar; |
| foo.foo = 564; |
| bar.bar = 53; |
| return foo.bar->bar - bar.foo->foo; |
| } |
| `; |
| assert_equals(await callIntFunction(program, "foo", []), 0); |
| } |
| |
| runTests(whlslTests); |
| </script> |
| </html> |
| |