| <!DOCTYPE html> |
| <html> |
| <meta charset=utf-8> |
| <meta name="timeout" content="long"> |
| <title>Test the WHLSL test harness.</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.simpleGetter = async () => { |
| let program = ` |
| struct Foo { |
| int x; |
| } |
| int operator.y(Foo foo) |
| { |
| return foo.x; |
| } |
| int foo() |
| { |
| Foo foo; |
| foo.x = 7804; |
| return foo.y; |
| } |
| `; |
| assert_equals(await callIntFunction(program, "foo", []), 7804); |
| }; |
| |
| whlslTests.simpleSetter = async () => { |
| let program = ` |
| struct Foo { |
| int x; |
| } |
| int operator.y(Foo foo) |
| { |
| return foo.x; |
| } |
| Foo operator.y=(Foo foo, int value) |
| { |
| foo.x = value; |
| return foo; |
| } |
| int foo() |
| { |
| Foo foo; |
| foo.y = 7804; |
| return foo.x; |
| } |
| `; |
| assert_equals(await callIntFunction(program, "foo", []), 7804); |
| }; |
| |
| runTests(whlslTests); |
| </script> |
| </html> |