Title: [247338] trunk/LayoutTests
Revision
247338
Author
[email protected]
Date
2019-07-10 17:59:10 -0700 (Wed, 10 Jul 2019)

Log Message

[WHLSL] Import all tests that pass without compiler changes from the JS reference test suite
https://bugs.webkit.org/show_bug.cgi?id=199595

Rubber stamped by Robin Morisset.

* webgpu/whlsl-argument-evaluation-order-expected.txt: Added.
* webgpu/whlsl-argument-evaluation-order.html: Added.
* webgpu/whlsl-array-length-spec-tests-expected.txt: Added.
* webgpu/whlsl-array-length-spec-tests.html: Added.
* webgpu/whlsl-array-spec-tests-expected.txt:
* webgpu/whlsl-array-spec-tests.html:
* webgpu/whlsl-bad-add-expected.txt: Added.
* webgpu/whlsl-bad-add.html: Added.
* webgpu/whlsl-bools-expected.txt: Added.
* webgpu/whlsl-bools.html: Added.
* webgpu/whlsl-casts-expected.txt: Added.
* webgpu/whlsl-casts.html: Added.
* webgpu/whlsl-comment-parsing-expected.txt: Added.
* webgpu/whlsl-comment-parsing.html: Added.
* webgpu/whlsl-copy-expected.txt: Added.
* webgpu/whlsl-copy.html: Added.
* webgpu/whlsl-dereference-ordering-expected.txt: Added.
* webgpu/whlsl-dereference-ordering.html: Added.
* webgpu/whlsl-double-not-expected.txt: Added.
* webgpu/whlsl-double-not.html: Added.
* webgpu/whlsl-duplicates-expected.txt: Added.
* webgpu/whlsl-duplicates.html: Added.
* webgpu/whlsl-increment-decrement-expected.txt: Added.
* webgpu/whlsl-increment-decrement.html: Added.
* webgpu/whlsl-index-ander-expected.txt: Added.
* webgpu/whlsl-index-ander.html: Added.
* webgpu/whlsl-index-setter-getter-expected.txt: Added.
* webgpu/whlsl-index-setter-getter.html: Added.
* webgpu/whlsl-logical-negation-expected.txt: Added.
* webgpu/whlsl-logical-negation.html: Added.
* webgpu/whlsl-lots-of-local-variables-expected.txt: Added.
* webgpu/whlsl-lots-of-local-variables.html: Added.
* webgpu/whlsl-lvalues-expected.txt: Added.
* webgpu/whlsl-lvalues.html: Added.
* webgpu/whlsl-null-arg-expected.txt: Added.
* webgpu/whlsl-null-arg.html: Added.
* webgpu/whlsl-operator-overload-expected.txt: Added.
* webgpu/whlsl-operator-overload.html: Added.
* webgpu/whlsl-overload-expected.txt: Added.
* webgpu/whlsl-overload.html: Added.
* webgpu/whlsl-setter-spec-tests-expected.txt: Added.
* webgpu/whlsl-setter-spec-tests.html: Added.
* webgpu/whlsl-store-null-expected.txt: Added.
* webgpu/whlsl-store-null.html: Added.
* webgpu/whlsl-struct-expected.txt: Added.
* webgpu/whlsl-struct.html: Added.
* webgpu/whlsl-switch-expected.txt: Added.
* webgpu/whlsl-switch.html: Added.
* webgpu/whlsl-variable-shadowing-expected.txt: Added.
* webgpu/whlsl-variable-shadowing.html: Added.
* webgpu/whlsl-vector-syntax-expected.txt: Added.
* webgpu/whlsl-vector-syntax.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (247337 => 247338)


--- trunk/LayoutTests/ChangeLog	2019-07-11 00:43:07 UTC (rev 247337)
+++ trunk/LayoutTests/ChangeLog	2019-07-11 00:59:10 UTC (rev 247338)
@@ -1,3 +1,63 @@
+2019-07-10  Saam Barati  <[email protected]>
+
+        [WHLSL] Import all tests that pass without compiler changes from the JS reference test suite
+        https://bugs.webkit.org/show_bug.cgi?id=199595
+
+        Rubber stamped by Robin Morisset.
+
+        * webgpu/whlsl-argument-evaluation-order-expected.txt: Added.
+        * webgpu/whlsl-argument-evaluation-order.html: Added.
+        * webgpu/whlsl-array-length-spec-tests-expected.txt: Added.
+        * webgpu/whlsl-array-length-spec-tests.html: Added.
+        * webgpu/whlsl-array-spec-tests-expected.txt:
+        * webgpu/whlsl-array-spec-tests.html:
+        * webgpu/whlsl-bad-add-expected.txt: Added.
+        * webgpu/whlsl-bad-add.html: Added.
+        * webgpu/whlsl-bools-expected.txt: Added.
+        * webgpu/whlsl-bools.html: Added.
+        * webgpu/whlsl-casts-expected.txt: Added.
+        * webgpu/whlsl-casts.html: Added.
+        * webgpu/whlsl-comment-parsing-expected.txt: Added.
+        * webgpu/whlsl-comment-parsing.html: Added.
+        * webgpu/whlsl-copy-expected.txt: Added.
+        * webgpu/whlsl-copy.html: Added.
+        * webgpu/whlsl-dereference-ordering-expected.txt: Added.
+        * webgpu/whlsl-dereference-ordering.html: Added.
+        * webgpu/whlsl-double-not-expected.txt: Added.
+        * webgpu/whlsl-double-not.html: Added.
+        * webgpu/whlsl-duplicates-expected.txt: Added.
+        * webgpu/whlsl-duplicates.html: Added.
+        * webgpu/whlsl-increment-decrement-expected.txt: Added.
+        * webgpu/whlsl-increment-decrement.html: Added.
+        * webgpu/whlsl-index-ander-expected.txt: Added.
+        * webgpu/whlsl-index-ander.html: Added.
+        * webgpu/whlsl-index-setter-getter-expected.txt: Added.
+        * webgpu/whlsl-index-setter-getter.html: Added.
+        * webgpu/whlsl-logical-negation-expected.txt: Added.
+        * webgpu/whlsl-logical-negation.html: Added.
+        * webgpu/whlsl-lots-of-local-variables-expected.txt: Added.
+        * webgpu/whlsl-lots-of-local-variables.html: Added.
+        * webgpu/whlsl-lvalues-expected.txt: Added.
+        * webgpu/whlsl-lvalues.html: Added.
+        * webgpu/whlsl-null-arg-expected.txt: Added.
+        * webgpu/whlsl-null-arg.html: Added.
+        * webgpu/whlsl-operator-overload-expected.txt: Added.
+        * webgpu/whlsl-operator-overload.html: Added.
+        * webgpu/whlsl-overload-expected.txt: Added.
+        * webgpu/whlsl-overload.html: Added.
+        * webgpu/whlsl-setter-spec-tests-expected.txt: Added.
+        * webgpu/whlsl-setter-spec-tests.html: Added.
+        * webgpu/whlsl-store-null-expected.txt: Added.
+        * webgpu/whlsl-store-null.html: Added.
+        * webgpu/whlsl-struct-expected.txt: Added.
+        * webgpu/whlsl-struct.html: Added.
+        * webgpu/whlsl-switch-expected.txt: Added.
+        * webgpu/whlsl-switch.html: Added.
+        * webgpu/whlsl-variable-shadowing-expected.txt: Added.
+        * webgpu/whlsl-variable-shadowing.html: Added.
+        * webgpu/whlsl-vector-syntax-expected.txt: Added.
+        * webgpu/whlsl-vector-syntax.html: Added.
+
 2019-07-10  Truitt Savell  <[email protected]>
 
         Marking webgpu/whlsl-builtin-vectors-2.html as Slow after https://trac.webkit.org/changeset/247319/webkit

Added: trunk/LayoutTests/webgpu/whlsl-argument-evaluation-order-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-argument-evaluation-order-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-argument-evaluation-order-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS evaluationOrderForArguments 
+

Added: trunk/LayoutTests/webgpu/whlsl-argument-evaluation-order.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-argument-evaluation-order.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-argument-evaluation-order.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Copying.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.evaluationOrderForArguments = async () => {
+    const program = `
+        int foo() { return *bar(10) + *bar(20); }
+
+        thread int* bar(int value)
+        {
+            int x = value;
+            return &x;
+        }
+
+        int baz() { return plus(bar(10), bar(20)); }
+
+        int plus(thread int* x, thread int* y)
+        {
+            return *x + *y;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 30);
+    assert_equals(await callIntFunction(program, "baz", []), 40);
+};
+
+runTests(whlslTests);
+</script>
+</html>
+

Added: trunk/LayoutTests/webgpu/whlsl-array-length-spec-tests-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-array-length-spec-tests-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-array-length-spec-tests-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,4 @@
+
+PASS nonArrayRefArrayLengthFail 
+PASS nonArrayRefArrayLengthSucceed 
+

Added: trunk/LayoutTests/webgpu/whlsl-array-length-spec-tests.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-array-length-spec-tests.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-array-length-spec-tests.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test structs.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.nonArrayRefArrayLengthFail = async () =>
+{
+    await checkFail(
+        `
+            thread uint* lengthPtr()
+            {
+                int[42] array;
+                return &(array.length);
+            }
+        `);
+}
+
+whlslTests.nonArrayRefArrayLengthSucceed = async () =>
+{
+    let program = `
+        uint foo()
+        {
+            float[754] array;
+            return array.length;
+        }
+        uint bar()
+        {
+            int[754] array;
+            return array.length;
+        }
+    `;
+    assert_equals(await callUintFunction(program, "foo", []), 754);
+    assert_equals(await callUintFunction(program, "bar", []), 754);
+}
+
+runTests(whlslTests);
+</script>
+</html>

Modified: trunk/LayoutTests/webgpu/whlsl-array-spec-tests-expected.txt (247337 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-array-spec-tests-expected.txt	2019-07-11 00:43:07 UTC (rev 247337)
+++ trunk/LayoutTests/webgpu/whlsl-array-spec-tests-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -4,4 +4,5 @@
 PASS assignLengthHelper 
 PASS buildArrayThenSumIt 
 PASS buildArrayThenSumItUsingArrayReference 
+PASS passingArrayToFunction 
 

Modified: trunk/LayoutTests/webgpu/whlsl-array-spec-tests.html (247337 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-array-spec-tests.html	2019-07-11 00:43:07 UTC (rev 247337)
+++ trunk/LayoutTests/webgpu/whlsl-array-spec-tests.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -95,6 +95,28 @@
     assert_equals(await callIntFunction(program, "foo", []), 42 * 5 + 42 * 41 / 2);
 }
 
+whlslTests.passingArrayToFunction = async () =>
+{
+    let program = `
+        int foo()
+        {
+            int[10] arr;
+            for (uint i = 0; i < arr.length; i++)
+                arr[i] = int(i) + 1;
+            return sum(arr);
+        }
+
+        int sum(int[10] xs)
+        {
+            int t = 0;
+            for (uint i = 0; i < xs.length; i++)
+                t = t + xs[i];
+            return t;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 55);
+}
+
 runTests(whlslTests);
 </script>
 </html>

Added: trunk/LayoutTests/webgpu/whlsl-bad-add-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-bad-add-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-bad-add-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS badAdd 
+

Added: trunk/LayoutTests/webgpu/whlsl-bad-add.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-bad-add.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-bad-add.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Bad add.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.badAdd = async () =>
+{
+    await checkFail(
+        `
+            void foo(int x, uint y)
+            {
+                uint z = x + y;
+            }
+        `);
+}
+
+runTests(whlslTests);
+</script>
+</html>

Added: trunk/LayoutTests/webgpu/whlsl-bools-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-bools-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-bools-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,6 @@
+
+PASS booleanMath 
+PASS identityBool 
+PASS literalBool 
+PASS operatorBool 
+

Added: trunk/LayoutTests/webgpu/whlsl-bools.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-bools.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-bools.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,124 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Bools.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.booleanMath = async () =>
+{
+    let program = `
+        bool foo()
+        {
+            return true && true;
+        }
+        bool foo2()
+        {
+            return true && false;
+        }
+        bool foo3()
+        {
+            return false && true;
+        }
+        bool foo4()
+        {
+            return false && false;
+        }
+        bool foo5()
+        {
+            return true || true;
+        }
+        bool foo6()
+        {
+            return true || false;
+        }
+        bool foo7()
+        {
+            return false || true;
+        }
+        bool foo8()
+        {
+            return false || false;
+        }
+    `;
+    assert_equals(await callBoolFunction(program, "foo", []), true);
+    assert_equals(await callBoolFunction(program, "foo2", []), false);
+    assert_equals(await callBoolFunction(program, "foo3", []), false);
+    assert_equals(await callBoolFunction(program, "foo4", []), false);
+    assert_equals(await callBoolFunction(program, "foo5", []), true);
+    assert_equals(await callBoolFunction(program, "foo6", []), true);
+    assert_equals(await callBoolFunction(program, "foo7", []), true);
+    assert_equals(await callBoolFunction(program, "foo8", []), false);
+}
+
+
+whlslTests.identityBool = async () => {
+    let program = "bool foo(bool x) { return x; }";
+    assert_equals(await callBoolFunction(program, "foo", [makeBool(true)]), true);
+    assert_equals(await callBoolFunction(program, "foo", [makeBool(false)]), false);
+}
+
+whlslTests.literalBool = async () => {
+    let program = "bool foo() { return true; }";
+    assert_equals(await callBoolFunction(program, "foo", []), true);
+}
+
+whlslTests.operatorBool = async () =>
+{
+    let program = `
+        bool boolFromUcharFalse() { return bool(uchar(0)); }
+        bool boolFromUcharTrue() { return bool(uchar(1)); }
+
+        bool boolFromUintFalse() { return bool(uint(0)); }
+        bool boolFromUintTrue() { return bool(uint(1)); }
+
+        bool boolFromIntFalse() { return bool(int(0)); }
+        bool boolFromIntTrue() { return bool(int(1)); }
+
+        bool boolFromFloatFalse() { return bool(float(0)); }
+        bool boolFromFloatTrue() { return bool(float(1)); }
+        bool boolFromFloatNaN(float arg) { return bool(arg); }
+    `;
+
+    assert_equals(await callBoolFunction(program, "boolFromUcharFalse", []), false);
+    assert_equals(await callBoolFunction(program, "boolFromUcharTrue", []), true);
+
+    assert_equals(await callBoolFunction(program, "boolFromUintFalse", []), false);
+    assert_equals(await callBoolFunction(program, "boolFromUintTrue", []), true);
+
+    assert_equals(await callBoolFunction(program, "boolFromIntFalse", []), false);
+    assert_equals(await callBoolFunction(program, "boolFromIntTrue", []), true);
+
+    assert_equals(await callBoolFunction(program, "boolFromFloatFalse", []), false);
+    assert_equals(await callBoolFunction(program, "boolFromFloatTrue", []), true);
+    assert_equals(await callBoolFunction(program, "boolFromFloatNaN", [makeFloat(program, NaN)]), true);
+
+    await checkFail(
+        `
+            void foo()
+            {
+                float3 x;
+                bool r = bool(x);
+            }
+        `);
+        
+
+    await checkFail(
+        `
+            void foo()
+            {
+                float3x3 x;
+                bool r = bool(x);
+            }
+        `);
+        
+}
+
+runTests(whlslTests);
+</script>
+</html>

Added: trunk/LayoutTests/webgpu/whlsl-casts-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-casts-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-casts-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,4 @@
+
+PASS casts 
+PASS selfCasts 
+

Added: trunk/LayoutTests/webgpu/whlsl-casts.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-casts.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-casts.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Bad add.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.casts = async () =>
+{
+    let program = `
+        struct Foo {
+            int x;
+        }
+        struct Bar {
+            int y;
+        }
+        operator Bar(Foo foo) {
+            Bar b;
+            b.y = foo.x + 7;
+            return b;
+        }
+        int baz(int z) {
+            Foo foo;
+            foo.x = z;
+            Bar b = Bar(foo);
+            return b.y;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "baz", [makeInt(6)]), 13);
+}
+
+whlslTests.selfCasts = async () =>
+{
+    let program = `
+        struct Foo {
+            int x;
+        }
+        int foo()
+        {
+            Foo foo;
+            foo.x = 21;
+            Foo bar = Foo(foo);
+            bar.x = 42;
+            return foo.x + bar.x;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 21 + 42);
+}
+
+runTests(whlslTests);
+</script>
+</html>
+

Added: trunk/LayoutTests/webgpu/whlsl-comment-parsing-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-comment-parsing-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-comment-parsing-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS commentParsing 
+

Added: trunk/LayoutTests/webgpu/whlsl-comment-parsing.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-comment-parsing.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-comment-parsing.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test structs.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.commentParsing = async () => {
+    let program = `
+        /* this comment
+        runs over multiple lines */
+        bool foo() { return true; }
+    `;
+    assert_equals(await callBoolFunction(program, "foo", []), true);
+
+    await checkFail(
+        `
+        /* this comment
+        runs over multiple lines
+        bool foo() { return true; }
+        `);
+}
+
+runTests(whlslTests);
+</script>
+</html>
+

Added: trunk/LayoutTests/webgpu/whlsl-copy-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-copy-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-copy-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS copyArray 
+

Added: trunk/LayoutTests/webgpu/whlsl-copy.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-copy.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-copy.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Copying.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.copyArray = async () =>
+{
+    let program = `
+        int foo()
+        {
+            int[10] xs;
+            for (uint i = 0; i < xs.length; i++)
+                xs[i] = int(i) + 1;
+            int[10] ys = xs;
+            for (uint i = 0; i < xs.length; i++)
+                xs[i] = 0;
+            int sum = 0;
+            for (uint i = 0; i < ys.length; i++)
+                sum = sum + ys[i];
+            return sum;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 55);
+}
+
+runTests(whlslTests);
+</script>
+</html>

Added: trunk/LayoutTests/webgpu/whlsl-dereference-ordering-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-dereference-ordering-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-dereference-ordering-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS callArgumentsAreCopiedImmediatelyAfterEvaluation 
+

Added: trunk/LayoutTests/webgpu/whlsl-dereference-ordering.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-dereference-ordering.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-dereference-ordering.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Dereference ordering.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.callArgumentsAreCopiedImmediatelyAfterEvaluation = async () => {
+    let program = `
+        int foo()
+        {
+            return *bar(5) + *bar(7);
+        }
+
+        thread int* bar(int value)
+        {
+            int x = value;
+            return &x;
+        }
+    `;
+
+    assert_equals(await callIntFunction(program, "foo", []), 12);
+};
+
+runTests(whlslTests);
+</script>
+</html>

Added: trunk/LayoutTests/webgpu/whlsl-double-not-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-double-not-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-double-not-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS doubleNot 
+

Added: trunk/LayoutTests/webgpu/whlsl-double-not.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-double-not.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-double-not.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Copying.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.doubleNot = async () =>
+{
+    let program = `
+        bool foo(bool x)
+        {
+            return !!x;
+        }
+    `;
+    assert_equals(await callBoolFunction(program, "foo", [makeBool(true)]), true);
+    assert_equals(await callBoolFunction(program, "foo", [makeBool(false)]), false);
+}
+
+runTests(whlslTests);
+</script>
+</html>

Added: trunk/LayoutTests/webgpu/whlsl-duplicates-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-duplicates-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-duplicates-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS duplicateFunctions 
+

Added: trunk/LayoutTests/webgpu/whlsl-duplicates.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-duplicates.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-duplicates.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test prefix/postfix.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.duplicateFunctions = async () => {
+    await checkFail(`
+        void foo() { }
+        void foo() { }
+    `);
+
+    await checkFail(`
+        void foo(int x) { }
+        typedef A = int;
+        void foo(A x) { }
+    `);
+
+    const program = `
+        int bar() {
+            return 42;
+        }
+        int bar(int x) {
+            return x;
+        }
+        int foo()
+        {
+            return bar();
+        }
+        int baz()
+        {
+            return bar(3);
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 42);
+    assert_equals(await callIntFunction(program, "baz", []), 3);
+
+    await checkFail(`
+        int operator&[](thread int[] a, uint b) {
+            return 4;
+        }
+    `);
+
+    await checkFail(`
+        uint operator.length(thread int[] a) {
+            return 4;
+        }
+    `);
+
+    await checkFail(`
+        bool operator==(thread int[] a, thread int[] b) {
+            return true;
+        }
+    `);
+
+    await checkFail(`
+        bool operator==(thread int* a, thread int* b) {
+            return true;
+        }
+    `);
+};
+
+runTests(whlslTests);
+</script>
+</html>

Added: trunk/LayoutTests/webgpu/whlsl-increment-decrement-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-increment-decrement-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-increment-decrement-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS incrementAndDecrement 
+

Added: trunk/LayoutTests/webgpu/whlsl-increment-decrement.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-increment-decrement.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-increment-decrement.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Copying.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.incrementAndDecrement = async () => {
+    let program = `
+        int foo1() { int x = 0; return x++; }
+        int foo2() { int x = 0; x++; return x; }
+        int foo3() { int x = 0; return ++x; }
+        int foo4() { int x = 0; ++x; return x; }
+        int foo5() { int x = 0; return x--; }
+        int foo6() { int x = 0; x--; return x; }
+        int foo7() { int x = 0; return --x; }
+        int foo8() { int x = 0; --x; return x; }
+    `;
+    assert_equals(await callIntFunction(program, "foo1", []), 0);
+    assert_equals(await callIntFunction(program, "foo2", []), 1);
+    assert_equals(await callIntFunction(program, "foo3", []), 1);
+    assert_equals(await callIntFunction(program, "foo4", []), 1);
+    assert_equals(await callIntFunction(program, "foo5", []), 0);
+    assert_equals(await callIntFunction(program, "foo6", []), -1);
+    assert_equals(await callIntFunction(program, "foo7", []), -1);
+    assert_equals(await callIntFunction(program, "foo8", []), -1);
+};
+
+runTests(whlslTests);
+</script>
+</html>
+

Added: trunk/LayoutTests/webgpu/whlsl-index-ander-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-index-ander-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-index-ander-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,4 @@
+
+PASS indexAnderWithNothingWrong 
+PASS indexAnderWithWrongNumberOfArguments 
+

Added: trunk/LayoutTests/webgpu/whlsl-index-ander.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-index-ander.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-index-ander.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test structs.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.indexAnderWithNothingWrong = async () =>
+{
+    let program = `
+        struct Foo {
+            int x;
+        }
+        thread int* operator&[](thread Foo* foo, uint)
+        {
+            return &foo->x;
+        }
+        int foo()
+        {
+            Foo x;
+            x.x = 13;
+            return x[666];
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 13);
+}
+
+whlslTests.indexAnderWithWrongNumberOfArguments = async () =>
+{
+    await checkFail(
+        `
+            thread int* operator&[]()
+            {
+                int x;
+                return &x;
+            }
+        `);
+        
+    await checkFail(
+        `
+            struct Foo {
+                int x;
+            }
+            thread int* operator&[](thread Foo* foo)
+            {
+                return &foo->x;
+            }
+        `);
+        
+    await checkFail(
+        `
+            struct Foo {
+                int x;
+            }
+            thread int* operator&[](thread Foo* foo, uint, uint)
+            {
+                return &foo->x;
+            }
+        `);
+}
+
+runTests(whlslTests);
+</script>
+</html>

Added: trunk/LayoutTests/webgpu/whlsl-index-setter-getter-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-index-setter-getter-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-index-setter-getter-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,7 @@
+
+PASS indexSetterWithNoGetterOverload 
+PASS indexSetterWithNoGetterOverloadFixed 
+PASS notLoneIndexSetter 
+PASS loneIndexSetter 
+PASS loneIndexSetterPointer 
+

Added: trunk/LayoutTests/webgpu/whlsl-index-setter-getter.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-index-setter-getter.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-index-setter-getter.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,105 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test structs.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.indexSetterWithNoGetterOverload = async () =>
+{
+    await checkFail(
+        `
+            struct Foo { }
+            struct Bar { }
+            int operator[](Foo, uint)
+            {
+                return 534;
+            }
+            Bar operator[]=(Bar, uint, int)
+            {
+                return Bar();
+            }
+        `);
+        
+};
+
+whlslTests.indexSetterWithNoGetterOverloadFixed = async () =>
+{
+    const program = `
+        struct Bar { }
+        int operator[](Bar, uint)
+        {
+            return 534;
+        }
+        Bar operator[]=(Bar, uint, int)
+        {
+            return Bar();
+        }
+        int foo() { return Bar()[0]; }
+        int bar() {
+            Bar b;
+            b[0] = 400;
+            return b[0];
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 534);
+    assert_equals(await callIntFunction(program, "bar", []), 534);
+};
+
+whlslTests.notLoneIndexSetter = async () =>
+{
+    const program = `
+        int operator[](int, uint)
+        {
+            return 65;
+        }
+        int operator[]=(int, uint, int)
+        {
+            return 543;
+        }
+        int foo() {
+            int x;
+            return x[0];
+        }
+        int bar() {
+            int x;
+            x[0] = 42;
+            return x;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 65);
+    assert_equals(await callIntFunction(program, "bar", []), 543);
+};
+
+whlslTests.loneIndexSetter = async () =>
+{
+    await checkFail(
+        `
+            int operator[]=(int, uint, int)
+            {
+                return 543;
+            }
+        `);
+        
+};
+
+whlslTests.loneIndexSetterPointer = async () =>
+{
+    await checkFail(
+        `
+            thread int* operator[]=(thread int* ptr, uint, int)
+            {
+                return ptr;
+            }
+        `);
+        
+};
+
+runTests(whlslTests);
+</script>
+</html>

Added: trunk/LayoutTests/webgpu/whlsl-logical-negation-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-logical-negation-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-logical-negation-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS logicalNegation 
+

Added: trunk/LayoutTests/webgpu/whlsl-logical-negation.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-logical-negation.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-logical-negation.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Lvalues.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.logicalNegation = async () =>
+{
+    let program = "bool foo(bool x) { return !x; }";
+    assert_equals(await callBoolFunction(program, "foo", [makeBool(true)]), false);
+    assert_equals(await callBoolFunction(program, "foo", [makeBool(false)]), true);
+}
+
+runTests(whlslTests);
+</script>
+</html>

Added: trunk/LayoutTests/webgpu/whlsl-lots-of-local-variables-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-lots-of-local-variables-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-lots-of-local-variables-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS lotsOfLocalVariables 
+

Added: trunk/LayoutTests/webgpu/whlsl-lots-of-local-variables.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-lots-of-local-variables.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-lots-of-local-variables.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Lots of local variables.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.lotsOfLocalVariables = async () =>
+{
+    let src = "" sum() {\n";
+    src += "    int i = 0;\n";
+    let target = 0;
+    const numVars = 50;
+    for (let i = 0; i < numVars; i++) {
+        src += `   i = ${i};\n`;
+        src += `   int V${i} = (i + 3) * (i + 3);\n`;
+        target += (i + 3) * (i + 3);
+    }
+    src += "    int result = 0;\n";
+    for (let i = 0; i < numVars; i++) {
+        src += `    result += V${i};\n`;
+    }
+    src += "    return result;\n";
+    src += "}";
+    let program = src;
+    assert_equals(await callIntFunction(program, "sum", []), target);
+}
+
+runTests(whlslTests);
+</script>
+</html>
+

Added: trunk/LayoutTests/webgpu/whlsl-lvalues-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-lvalues-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-lvalues-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS lValues 
+

Added: trunk/LayoutTests/webgpu/whlsl-lvalues.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-lvalues.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-lvalues.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,106 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Lvalues.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.lValues = async () => {
+    await checkFail(`
+        int foo()
+        {
+            int x = 0;
+            thread int* y = &(x++);
+            return *y;
+        }
+    `); 
+    await checkFail(`
+        int foo()
+        {
+            int x = 0;
+            thread int* y = &(++x);
+            return *y;
+        }
+    `); 
+    await checkFail(`
+        int foo()
+        {
+            int x = 0;
+            thread int* y = &(x = 3);
+            return *y;
+        }
+    `); 
+    await checkFail(`
+        int foo()
+        {
+            int x = 0;
+            thread int* y = &3;
+            return *y;
+        }
+    `); 
+    await checkFail(`
+        int bar(int x) {
+            return x + 1;
+        }
+        int foo()
+        {
+            int x = 0;
+            thread int* y = &bar(3);
+            return *y;
+        }
+    `); 
+    await checkFail(`
+        int foo()
+        {
+            int x = 0;
+            thread int* y = &(7, x);
+            return *y;
+        }
+    `);
+    await checkFail(`
+        enum Days {
+            Monday,
+            Tuesday
+        }
+        int foo()
+        {
+            int x = 0;
+            thread int* y = &(Days.Monday);
+            return *y;
+        }
+    `); 
+    await checkFail(`
+        int foo()
+        {
+            thread bool* y = &(true && false);
+            return *y;
+        }
+    `); 
+    await checkFail(`
+        int foo()
+        {
+            thread bool* y = &(!true);
+            return *y;
+        }
+    `); 
+    const program = `
+        int foo()
+        {
+            int x = 3;
+            thread int* y = &x;
+            return *y;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 3);
+};
+
+runTests(whlslTests);
+</script>
+</html>
+
+

Added: trunk/LayoutTests/webgpu/whlsl-null-arg-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-null-arg-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-null-arg-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS passNullToPtrMonomorphic 
+

Added: trunk/LayoutTests/webgpu/whlsl-null-arg.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-null-arg.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-null-arg.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test structs.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.passNullToPtrMonomorphic = async () =>
+{
+    let program = `
+        int foo(thread int* ptr)
+        {
+            return *ptr;
+        }
+        int bar()
+        {
+            return foo(null);
+        }
+    `;
+    assert_equals(await callIntFunction(program, "bar", []), 0);
+}
+
+runTests(whlslTests);
+</script>
+</html>
+

Added: trunk/LayoutTests/webgpu/whlsl-operator-overload-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-operator-overload-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-operator-overload-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS operatorWithoutUninferrableTypeVariable 
+

Added: trunk/LayoutTests/webgpu/whlsl-operator-overload.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-operator-overload.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-operator-overload.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Operator+ overload.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.operatorWithoutUninferrableTypeVariable = async () => {
+    let program = `
+        struct Foo {
+            int x;
+        }
+        Foo operator+(Foo a, Foo b)
+        {
+            Foo result;
+            result.x = a.x + b.x;
+            return result;
+        }
+        int foo()
+        {
+            Foo a;
+            a.x = 645;
+            Foo b;
+            b.x = -35;
+            return (a + b).x;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 645 - 35);
+}
+
+runTests(whlslTests);
+</script>
+</html>

Added: trunk/LayoutTests/webgpu/whlsl-overload-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-overload-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-overload-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,5 @@
+
+PASS intOverloadResolution 
+PASS intOverloadResolutionReverseOrder 
+PASS notEqualsOverload 
+

Added: trunk/LayoutTests/webgpu/whlsl-overload.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-overload.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-overload.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Overload.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.intOverloadResolution = async () =>
+{
+    let program = `
+        int foo(int) { return 1; }
+        int foo(uint) { return 2; }
+        int foo(float) { return 3; }
+        int bar() { return foo(42); }
+    `;
+    assert_equals(await callIntFunction(program, "bar", []), 1);
+}
+
+whlslTests.intOverloadResolutionReverseOrder = async () =>
+{
+    let program = `
+        int foo(float) { return 3; }
+        int foo(uint) { return 2; }
+        int foo(int) { return 1; }
+        int bar() { return foo(42); }
+    `;
+    assert_equals(await callIntFunction(program, "bar", []), 1);
+}
+
+whlslTests.notEqualsOverload = async () =>
+{
+    await checkFail(
+        `
+            struct Foo { }
+            bool operator!=(Foo, Foo) { return true; }
+        `);
+}
+
+runTests(whlslTests);
+</script>
+</html>

Added: trunk/LayoutTests/webgpu/whlsl-setter-spec-tests-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-setter-spec-tests-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-setter-spec-tests-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,8 @@
+
+PASS setterWithMatchedType 
+PASS setterWithNoGetterOverload 
+PASS setterWithNoGetterOverloadFixed 
+PASS recursiveSetters 
+PASS loneSetter 
+PASS loneSetterPointer 
+

Added: trunk/LayoutTests/webgpu/whlsl-setter-spec-tests.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-setter-spec-tests.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-setter-spec-tests.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,134 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test structs.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.setterWithMatchedType = async () =>
+{
+    const program = `
+        int operator.foo(int)
+        {
+            return 5;
+        }
+        int operator.foo=(int, int)
+        {
+            return 543;
+        }
+        int foo() {
+            int x;
+            x.foo = 42;
+            return x;
+        }
+        int bar() {
+            int x;
+            return x.foo;
+        }
+    `;
+
+    assert_equals(await callIntFunction(program, "foo", []), 543);
+    //assert_equals(await callIntFunction(program, "bar", []), 5);
+}
+
+whlslTests.setterWithNoGetterOverload = async () =>
+{
+    await checkFail(
+        `
+            struct Foo { }
+            struct Bar { }
+            int operator.foo(Foo)
+            {
+                return 534;
+            }
+            Bar operator.foo=(Bar, int)
+            {
+                return Bar();
+            }
+        `);
+        
+}
+
+whlslTests.setterWithNoGetterOverloadFixed = async () =>
+{
+    const program =`
+        struct Bar { }
+        int operator.foo(Bar)
+        {
+            return 534;
+        }
+        Bar operator.foo=(Bar, int)
+        {
+            return Bar();
+        }
+        int foo() {
+            Bar bar;
+            return bar.foo;
+        }
+        int bar() {
+            Bar bar;
+            bar.foo = 52;
+            return bar.foo;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 534);
+    assert_equals(await callIntFunction(program, "bar", []), 534);
+}
+
+whlslTests.recursiveSetters = async () =>
+{
+    let program = `
+        struct Foo {
+            int x;
+            int y;
+        }
+        struct Bar {
+            int a;
+            int b;
+        }
+        int operator.c(Bar bar) { return bar.a; }
+        Bar operator.bar(Foo foo) { Bar b; b.a = foo.x; b.b = foo.y; return b; }
+        Bar operator.c=(Bar bar, int newval) { bar.a = newval; return bar; }
+        Foo operator.bar=(Foo foo, Bar newval) { foo.x = newval.a; foo.y = newval.b; return foo; }
+        int f() {
+            Foo foo;
+            foo.x = foo.y = 3;
+            foo.bar.c = 8;
+            return foo.x*10 + foo.y;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "f", []), 83);
+}
+
+whlslTests.loneSetter = async () =>
+{
+    await checkFail(
+        `
+            int operator.foo=(int, int)
+            {
+                return 543;
+            }
+        `);
+        
+}
+
+whlslTests.loneSetterPointer = async () =>
+{
+    await checkFail(
+        `
+            thread int* operator.foo=(thread int* ptr, int)
+            {
+                return ptr;
+            }
+        `);
+        
+}
+
+runTests(whlslTests);
+</script>
+</html>

Added: trunk/LayoutTests/webgpu/whlsl-store-null-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-store-null-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-store-null-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS storeNull 
+

Added: trunk/LayoutTests/webgpu/whlsl-store-null.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-store-null.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-store-null.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test structs.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.storeNull = async () =>
+{
+    await checkFail(
+        `
+            void foo() { *null = 42; }
+        `);
+}
+
+runTests(whlslTests);
+</script>
+</html>
+

Added: trunk/LayoutTests/webgpu/whlsl-struct-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-struct-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-struct-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,4 @@
+
+PASS emptyStruct 
+PASS settingAnArrayInsideAStruct 
+

Added: trunk/LayoutTests/webgpu/whlsl-struct.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-struct.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-struct.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test structs.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.emptyStruct = async () =>
+{
+    let program = `
+        struct Thingy { }
+        int foo()
+        {
+            Thingy thingy;
+            return 46;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 46);
+};
+
+whlslTests.settingAnArrayInsideAStruct = async () =>
+{
+    let program = `
+        struct Foo {
+            int[1] array;
+        }
+        int foo()
+        {
+            Foo foo;
+            thread Foo* bar = &foo;
+            bar->array[0] = 21;
+            return foo.array[0];
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 21);
+};
+
+runTests(whlslTests);
+</script>
+</html>

Added: trunk/LayoutTests/webgpu/whlsl-switch-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-switch-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-switch-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS switchBreak 
+

Added: trunk/LayoutTests/webgpu/whlsl-switch.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-switch.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-switch.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test prefix/postfix.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.switchBreak = async () =>
+{
+    let program = `
+        int foo(int x)
+        {
+            int result = 0;
+            switch (x) {
+            case 767:
+                result += 27;
+                break;
+            case 69:
+                result += 7624;
+                break;
+            default:
+                result += 49;
+                break;
+            }
+            return result;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", [makeInt(767)]), 27);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(69)]), 7624);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(0)]), 49);
+}
+
+runTests(whlslTests);
+</script>
+</html>

Added: trunk/LayoutTests/webgpu/whlsl-variable-shadowing-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-variable-shadowing-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-variable-shadowing-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS variableShadowing 
+

Added: trunk/LayoutTests/webgpu/whlsl-variable-shadowing.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-variable-shadowing.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-variable-shadowing.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test prefix/postfix.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.variableShadowing = async () =>
+{
+    let program = `
+        int foo()
+        {
+            int y;
+            int x = 7;
+            {
+                int x = 8;
+                y = x;
+            }
+            return y;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 8);
+
+    program = `
+        int foo()
+        {
+            int y;
+            int x = 7;
+            {
+                int x = 8;
+            }
+            y = x;
+            return y;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 7);
+}
+
+runTests(whlslTests);
+</script>
+</html>

Added: trunk/LayoutTests/webgpu/whlsl-vector-syntax-expected.txt (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-vector-syntax-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-vector-syntax-expected.txt	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,3 @@
+
+PASS vectorTypeSyntax 
+

Added: trunk/LayoutTests/webgpu/whlsl-vector-syntax.html (0 => 247338)


--- trunk/LayoutTests/webgpu/whlsl-vector-syntax.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-vector-syntax.html	2019-07-11 00:59:10 UTC (rev 247338)
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test structs.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.vectorTypeSyntax = async () =>
+{
+    let program = `
+        int foo2()
+        {
+            int2 x;
+            vector<int, 2> z = int2(3, 4);
+            x = z;
+            return x.y;
+        }
+
+        int foo3()
+        {
+            int3 x;
+            vector<int, 3> z = int3(3, 4, 5);
+            x = z;
+            return x.z;
+        }
+
+        int foo4()
+        {
+            int4 x;
+            vector<int,4> z = int4(3, 4, 5, 6);
+            x = z;
+            return x.w;
+        }`;
+
+    assert_equals(await callIntFunction(program, "foo2", []), 4);
+    assert_equals(await callIntFunction(program, "foo3", []), 5);
+    assert_equals(await callIntFunction(program, "foo4", []), 6);
+
+    program = `
+        typedef i = int;
+        int foo2()
+        {
+            int2 x;
+            vector<i, 2> z = int2(3, 4);
+            x = z;
+            return x.y;
+        }`;
+
+    assert_equals(await callIntFunction(program, "foo2", []), 4);
+}
+runTests(whlslTests);
+</script>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to