| <!DOCTYPE html> |
| <html> |
| <meta charset=utf-8> |
| <meta name="timeout" content="long"> |
| <title>Test structs.</title> |
| <script src="js/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.nonArrayRefArrayLengthFail = async () => |
| { |
| await checkFail( |
| ` |
| thread uint* lengthPtr() |
| { |
| int[42] array; |
| return &(array.length); |
| } |
| `); |
| } |
| |
| whlslTests.nonArrayRefArrayLengthSucceed = async () => |
| { |
| let program = ` |
| uint foo() |
| { |
| float[754] array; |
| return array.length; |
| } |
| uint bar() |
| { |
| int[754] array; |
| return array.length; |
| } |
| `; |
| assert_equals(await callUintFunction(program, "foo", []), 754); |
| assert_equals(await callUintFunction(program, "bar", []), 754); |
| } |
| |
| runTests(whlslTests); |
| </script> |
| </html> |