Add a runtime-disabled dialog element skeleton
[WebKit-https.git] / LayoutTests / webgpu / whlsl-index-ander.html
1 <!DOCTYPE html>
2 <html>
3 <meta charset=utf-8>
4 <meta name="timeout" content="long">
5 <title>Test structs.</title>
6 <script src="js/whlsl-test-harness.js"></script>
7 <script src="js/webgpu-functions.js"></script>
8 <script src="../resources/testharness.js"></script>
9 <script src="../resources/testharnessreport.js"></script>
10 <script>
11 const whlslTests = {};
12
13 whlslTests.indexAnderWithNothingWrong = async () =>
14 {
15     let program = `
16         struct Foo {
17             int x;
18         }
19         thread int* operator&[](thread Foo* foo, uint)
20         {
21             return &foo->x;
22         }
23         int foo()
24         {
25             Foo x;
26             x.x = 13;
27             return x[666];
28         }
29     `;
30     assert_equals(await callIntFunction(program, "foo", []), 13);
31 }
32
33 whlslTests.indexAnderWithWrongNumberOfArguments = async () =>
34 {
35     await checkFail(
36         `
37             thread int* operator&[]()
38             {
39                 int x;
40                 return &x;
41             }
42         `);
43         
44     await checkFail(
45         `
46             struct Foo {
47                 int x;
48             }
49             thread int* operator&[](thread Foo* foo)
50             {
51                 return &foo->x;
52             }
53         `);
54         
55     await checkFail(
56         `
57             struct Foo {
58                 int x;
59             }
60             thread int* operator&[](thread Foo* foo, uint, uint)
61             {
62                 return &foo->x;
63             }
64         `);
65 }
66
67 runTests(whlslTests);
68 </script>
69 </html>