| <!DOCTYPE html> |
| <html> |
| <meta charset=utf-8> |
| <meta name="timeout" content="long"> |
| <title>Test int bit math.</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.bitAndWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator&(Foo) { return 32; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator&(Foo) { return 534; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator&(Foo, Foo, Foo) { return 76; } |
| `); |
| |
| } |
| whlslTests.bitNotWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| int operator~() { return 32; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator~(Foo, Foo) { return 534; } |
| `); |
| |
| } |
| whlslTests.bitOrWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator|() { return 32; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator|(Foo) { return 534; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator|(Foo, Foo, Foo) { return 76; } |
| `); |
| |
| } |
| whlslTests.bitXorWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| int operator^() { return 32; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator^(Foo) { return 534; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator^(Foo, Foo, Foo) { return 76; } |
| `); |
| |
| } |
| whlslTests.decWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| int operator--() { return 32; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator--(Foo, Foo) { return 76; } |
| `); |
| |
| } |
| whlslTests.divideWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| int operator/() { return 32; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator/(Foo) { return 534; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator/(Foo, Foo, Foo) { return 76; } |
| `); |
| |
| } |
| whlslTests.dotOperatorSetterWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| struct Foo { } |
| Foo operator.foo=() { return 42; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| Foo operator.foo=(Foo) { return 42; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| Foo operator.foo=(Foo, int, int) { return 42; } |
| `); |
| |
| } |
| whlslTests.dotOperatorWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| int operator.foo() { return 42; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator.foo(Foo, int) { return 42; } |
| `); |
| |
| } |
| whlslTests.greaterEqualWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| bool operator>=() { return true; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| bool operator>=(Foo) { return true; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| bool operator>=(Foo, Foo, Foo) { return true; } |
| `); |
| |
| } |
| whlslTests.greaterWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| bool operator>() { return true; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| bool operator>(Foo) { return true; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| bool operator>(Foo, Foo, Foo) { return true; } |
| `); |
| |
| } |
| whlslTests.incWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| int operator++() { return 32; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator++(Foo, Foo) { return 76; } |
| `); |
| |
| } |
| whlslTests.indexOperatorSetterWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| int operator[]=() { return 42; } |
| `); |
| |
| await checkFail( |
| ` |
| int operator[]=(int) { return 42; } |
| `); |
| |
| await checkFail( |
| ` |
| int operator[]=(int, int) { return 42; } |
| `); |
| |
| await checkFail( |
| ` |
| int operator[]=(int, int, int, int) { return 42; } |
| `); |
| |
| } |
| whlslTests.indexOperatorWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| int operator[]() { return 42; } |
| `); |
| |
| await checkFail( |
| ` |
| int operator[](int) { return 42; } |
| `); |
| |
| await checkFail( |
| ` |
| int operator[](int, int, int) { return 42; } |
| `); |
| |
| } |
| whlslTests.lShiftWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| int operator<<() { return 32; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator<<(Foo) { return 534; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator<<(Foo, Foo, Foo) { return 76; } |
| `); |
| |
| } |
| whlslTests.minusWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| int operator-() { return 32; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator-(Foo, Foo, Foo) { return 76; } |
| `); |
| |
| } |
| whlslTests.moduloWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| int operator%() { return 32; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator%(Foo) { return 534; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator%(Foo, Foo, Foo) { return 76; } |
| `); |
| |
| } |
| whlslTests.plusWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| int operator+() { return 32; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator+(Foo, Foo, Foo) { return 76; } |
| `); |
| |
| } |
| whlslTests.rShiftWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| int operator>>() { return 32; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator>>(Foo) { return 534; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator>>(Foo, Foo, Foo) { return 76; } |
| `); |
| |
| } |
| whlslTests.timesWrongArgumentLength = async () => |
| { |
| await checkFail( |
| ` |
| int operator*() { return 32; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator*(Foo) { return 534; } |
| `); |
| |
| await checkFail( |
| ` |
| struct Foo { } |
| int operator*(Foo, Foo, Foo) { return 76; } |
| `); |
| |
| } |
| |
| runTests(whlslTests); |
| </script> |
| </html> |