[WHLSL] Move WHLSL tests to their own folder
[WebKit-https.git] / LayoutTests / webgpu / whlsl / operator-overload.html
1 <!DOCTYPE html>
2 <html>
3 <meta charset=utf-8>
4 <meta name="timeout" content="long">
5 <title>Operator+ overload.</title>
6 <script src="js/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.operatorWithoutUninferrableTypeVariable = async () => {
14     let program = `
15         struct Foo {
16             int x;
17         }
18         Foo operator+(Foo a, Foo b)
19         {
20             Foo result;
21             result.x = a.x + b.x;
22             return result;
23         }
24         int foo()
25         {
26             Foo a;
27             a.x = 645;
28             Foo b;
29             b.x = -35;
30             return (a + b).x;
31         }
32     `;
33     assert_equals(await callIntFunction(program, "foo", []), 645 - 35);
34 }
35
36 runTests(whlslTests);
37 </script>
38 </html>