| <!DOCTYPE html> |
| <html> |
| <meta charset=utf-8> |
| <meta name="timeout" content="long"> |
| <title>Test int bit math.</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.decWrongTypes = async () => |
| { |
| await checkFail( |
| ` |
| int operator--(float) { return 32; } |
| `); |
| |
| } |
| |
| whlslTests.incWrongTypes = async () => |
| { |
| await checkFail( |
| ` |
| int operator++(float) { return 32; } |
| `); |
| |
| } |
| |
| whlslTests.greaterThanWrongReturnType = async () => |
| { |
| await checkFail( |
| ` |
| int operator>(int a, int b) { return a + b; } |
| `); |
| |
| } |
| |
| whlslTests.greaterEqualWrongReturnType = async () => |
| { |
| await checkFail( |
| ` |
| int operator>=(int a, int b) { return a + b; } |
| `); |
| |
| } |
| |
| whlslTests.indexSetterWithMismatchedType = async () => |
| { |
| checkFail( |
| ` |
| float operator[](int, uint) |
| { |
| return 5.43; |
| } |
| int operator[]=(int, uint, int) |
| { |
| return 543; |
| } |
| `); |
| } |
| |
| whlslTests.setterWithMismatchedType = async () => |
| { |
| checkFail( |
| ` |
| float operator.foo(int) |
| { |
| return 5.43; |
| } |
| int operator.foo=(int, int) |
| { |
| return 543; |
| } |
| `); |
| } |
| |
| runTests(whlslTests); |
| </script> |
| </html> |