<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[247319] trunk/LayoutTests</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/247319">247319</a></dd>
<dt>Author</dt> <dd>sbarati@apple.com</dd>
<dt>Date</dt> <dd>2019-07-10 13:01:55 -0700 (Wed, 10 Jul 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WHLSL Import more JS reference spec tests
https://bugs.webkit.org/show_bug.cgi?id=199651

Rubber stamped by Robin Morisset.

* webgpu/whlsl-builtin-vectors-2-expected.txt: Added.
* webgpu/whlsl-builtin-vectors-2.html: Added.
* webgpu/whlsl-builtin-vectors-expected.txt: Added.
* webgpu/whlsl-builtin-vectors.html: Added.
* webgpu/whlsl-getter-setter-type-expected.txt: Added.
* webgpu/whlsl-getter-setter-type.html: Added.
* webgpu/whlsl-loops-spec-tests-expected.txt: Added.
* webgpu/whlsl-loops-spec-tests.html: Added.
* webgpu/whlsl-null-array-ref.html: Added.
* webgpu/whlsl-override-subscript-expected.txt: Added.
* webgpu/whlsl-override-subscript.html: Added.
* webgpu/whlsl-plus-equals-expected.txt: Added.
* webgpu/whlsl-plus-equals.html: Added.
* webgpu/whlsl-recursive-structs-expected.txt: Added.
* webgpu/whlsl-recursive-structs.html: Added.
* webgpu/whlsl-ternary-spec-test-expected.txt: Added.
* webgpu/whlsl-ternary-spec-test.html: Added.
* webgpu/whlsl-wrong-argument-length-expected.txt: Added.
* webgpu/whlsl-wrong-argument-length.html: Added.
* webgpu/whlsl-wrong-types-expected.txt: Added.
* webgpu/whlsl-wrong-types.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestswebgpuwhlslbuiltinvectors2expectedtxt">trunk/LayoutTests/webgpu/whlsl-builtin-vectors-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslbuiltinvectors2html">trunk/LayoutTests/webgpu/whlsl-builtin-vectors-2.html</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslbuiltinvectorsexpectedtxt">trunk/LayoutTests/webgpu/whlsl-builtin-vectors-expected.txt</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslbuiltinvectorshtml">trunk/LayoutTests/webgpu/whlsl-builtin-vectors.html</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslgettersettertypeexpectedtxt">trunk/LayoutTests/webgpu/whlsl-getter-setter-type-expected.txt</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslgettersettertypehtml">trunk/LayoutTests/webgpu/whlsl-getter-setter-type.html</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslifstatementexpectedtxt">trunk/LayoutTests/webgpu/whlsl-if-statement-expected.txt</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslifstatementhtml">trunk/LayoutTests/webgpu/whlsl-if-statement.html</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslloopsspectestsexpectedtxt">trunk/LayoutTests/webgpu/whlsl-loops-spec-tests-expected.txt</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslloopsspectestshtml">trunk/LayoutTests/webgpu/whlsl-loops-spec-tests.html</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslnullarrayrefhtml">trunk/LayoutTests/webgpu/whlsl-null-array-ref.html</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlsloverridesubscriptexpectedtxt">trunk/LayoutTests/webgpu/whlsl-override-subscript-expected.txt</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlsloverridesubscripthtml">trunk/LayoutTests/webgpu/whlsl-override-subscript.html</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslplusequalsexpectedtxt">trunk/LayoutTests/webgpu/whlsl-plus-equals-expected.txt</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslplusequalshtml">trunk/LayoutTests/webgpu/whlsl-plus-equals.html</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslrecursivestructsexpectedtxt">trunk/LayoutTests/webgpu/whlsl-recursive-structs-expected.txt</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslrecursivestructshtml">trunk/LayoutTests/webgpu/whlsl-recursive-structs.html</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslternaryspectestexpectedtxt">trunk/LayoutTests/webgpu/whlsl-ternary-spec-test-expected.txt</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslternaryspectesthtml">trunk/LayoutTests/webgpu/whlsl-ternary-spec-test.html</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslwrongargumentlengthexpectedtxt">trunk/LayoutTests/webgpu/whlsl-wrong-argument-length-expected.txt</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslwrongargumentlengthhtml">trunk/LayoutTests/webgpu/whlsl-wrong-argument-length.html</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslwrongtypesexpectedtxt">trunk/LayoutTests/webgpu/whlsl-wrong-types-expected.txt</a></li>
<li><a href="#trunkLayoutTestswebgpuwhlslwrongtypeshtml">trunk/LayoutTests/webgpu/whlsl-wrong-types.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (247318 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2019-07-10 19:58:37 UTC (rev 247318)
+++ trunk/LayoutTests/ChangeLog 2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2019-07-10  Saam Barati  <sbarati@apple.com>
+
+        [WHLSL Import more JS reference spec tests
+        https://bugs.webkit.org/show_bug.cgi?id=199651
+
+        Rubber stamped by Robin Morisset.
+
+        * webgpu/whlsl-builtin-vectors-2-expected.txt: Added.
+        * webgpu/whlsl-builtin-vectors-2.html: Added.
+        * webgpu/whlsl-builtin-vectors-expected.txt: Added.
+        * webgpu/whlsl-builtin-vectors.html: Added.
+        * webgpu/whlsl-getter-setter-type-expected.txt: Added.
+        * webgpu/whlsl-getter-setter-type.html: Added.
+        * webgpu/whlsl-loops-spec-tests-expected.txt: Added.
+        * webgpu/whlsl-loops-spec-tests.html: Added.
+        * webgpu/whlsl-null-array-ref.html: Added.
+        * webgpu/whlsl-override-subscript-expected.txt: Added.
+        * webgpu/whlsl-override-subscript.html: Added.
+        * webgpu/whlsl-plus-equals-expected.txt: Added.
+        * webgpu/whlsl-plus-equals.html: Added.
+        * webgpu/whlsl-recursive-structs-expected.txt: Added.
+        * webgpu/whlsl-recursive-structs.html: Added.
+        * webgpu/whlsl-ternary-spec-test-expected.txt: Added.
+        * webgpu/whlsl-ternary-spec-test.html: Added.
+        * webgpu/whlsl-wrong-argument-length-expected.txt: Added.
+        * webgpu/whlsl-wrong-argument-length.html: Added.
+        * webgpu/whlsl-wrong-types-expected.txt: Added.
+        * webgpu/whlsl-wrong-types.html: Added.
+
</ins><span class="cx"> 2019-07-10  Commit Queue  <commit-queue@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r247223.
</span></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslbuiltinvectors2expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-builtin-vectors-2-expected.txt (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-builtin-vectors-2-expected.txt                            (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-builtin-vectors-2-expected.txt       2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+
+PASS builtinVectorGetters 
+PASS builtinVectorSetters 
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslbuiltinvectors2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-builtin-vectors-2.html (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-builtin-vectors-2.html                            (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-builtin-vectors-2.html       2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,80 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test loops.</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 = {};
+
+const checkFuncs = {
+    "uint": callUintFunction,
+    "int": callIntFunction,
+    "float": callFloatFunction
+};
+const typeNames = [ "uint", "int", "float" ];
+const sizes = [ 2, 3, 4 ];
+const elements = [ "x", "y", "z", "w" ];
+const initializerList = [ 1, 2, 3, 4 ];
+
+whlslTests.builtinVectorGetters = async () =>
+{
+
+    let tests = [];
+    let src = "";
+    for (let typeName of typeNames) {
+        for (let size of sizes) {
+            for (let i = 0; i < size; i++) {
+                const functionName = `${typeName}${size}${elements[i]}`;
+                src += `${typeName} ${functionName}()
+                        {
+                            ${typeName}${size} x = ${typeName}${size}(${initializerList.slice(0, size).join(", ")});
+                            return x.${elements[i]};
+                        }
+                        `;
+                tests.push({ type: typeName, name: functionName, expectation: initializerList[i] });
+            }
+        }
+    }
+
+    let program = src;
+    for (let test of tests) {
+        const checkFunc = checkFuncs[test.type];
+        assert_equals(await checkFunc(program, test.name, []), test.expectation);
+    }
+};
+
+whlslTests.builtinVectorSetters = async () =>
+{
+    let tests = [];
+    let src = "";
+    for (let typeName of typeNames) {
+        for (let size of sizes) {
+            for (let i = 0; i < size; i++) {
+                const functionName = `${typeName}${size}${elements[i]}`;
+                src += `${typeName} ${functionName}()
+                        {
+                            ${typeName}${size} x = ${typeName}${size}(${initializerList.slice(0, size).join(", ")});
+                            x.${elements[i]} = 34;
+                            return x.${elements[i]};
+                        }
+                        `;
+                tests.push({ type: typeName, name: functionName, expectation: 34 });
+            }
+        }
+    }
+
+    let program = src;
+    for (let test of tests) {
+        const checkFunc = checkFuncs[test.type];
+        assert_equals(await checkFunc(program, test.name, []), test.expectation);
+    }
+}
+
+runTests(whlslTests);
+</script>
+</html>
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslbuiltinvectorsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-builtin-vectors-expected.txt (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-builtin-vectors-expected.txt                              (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-builtin-vectors-expected.txt 2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+
+PASS builtinVectorIndexSetters 
+PASS builtinVectors 
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslbuiltinvectorshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-builtin-vectors.html (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-builtin-vectors.html                              (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-builtin-vectors.html 2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,191 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test loops.</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 = {};
+
+const checkFuncs = {
+    "uint": callUintFunction,
+    "int": callIntFunction,
+    "float": callFloatFunction
+};
+const typeNames = [ "uint", "int", "float" ];
+const sizes = [ 2, 3, 4 ];
+const elements = [ "x", "y", "z", "w" ];
+const initializerList = [ 1, 2, 3, 4 ];
+
+whlslTests.builtinVectorIndexSetters = async () =>
+{
+    let tests = [];
+    let src = "";
+    for (let typeName of typeNames) {
+        for (let size of sizes) {
+            for (let i = 0; i < size; i++) {
+                const functionName = `${typeName}${size}${elements[i]}`;
+                src += `${typeName} ${functionName}()
+                        {
+                            ${typeName}${size} x = ${typeName}${size}(${initializerList.slice(0, size).join(", ")});
+                            x[${i}] = 34;
+                            return x[${i}];
+                        }
+                        `;
+                tests.push({ type: typeName, name: functionName, expectation: 34 });
+            }
+        }
+    }
+
+    let program = src;
+    for (let test of tests) {
+        const checkFunc = checkFuncs[test.type];
+        assert_equals(await checkFunc(program, test.name, []), test.expectation);
+    }
+};
+
+whlslTests.builtinVectors = async () =>
+{
+    let program = `
+        int foo()
+        {
+            int2 a = int2(3, 4);
+            return a[0];
+        }
+        int foo2()
+        {
+            int2 a = int2(3, 4);
+            int3 b = int3(a, 5);
+            return b[1];
+        }
+        int foo3()
+        {
+            int3 a = int3(3, 4, 5);
+            int4 b = int4(6, a);
+            return b[1];
+        }
+        int foo4()
+        {
+            int2 a = int2(3, 4);
+            int2 b = int2(5, 6);
+            int4 c = int4(a, b);
+            return c[2];
+        }
+        bool foo5()
+        {
+            int4 a = int4(3, 4, 5, 6);
+            int2 b = int2(4, 5);
+            int4 c = int4(3, b, 6);
+            return a == c;
+        }
+        bool foo6()
+        {
+            int2 a = int2(4, 5);
+            int3 b = int3(3, a);
+            int3 c = int3(3, 4, 6);
+            return b == c;
+        }
+        uint foou()
+        {
+            uint2 a = uint2(3, 4);
+            return a[0];
+        }
+        uint foou2()
+        {
+            uint2 a = uint2(3, 4);
+            uint3 b = uint3(a, 5);
+            return b[1];
+        }
+        uint foou3()
+        {
+            uint3 a = uint3(3, 4, 5);
+            uint4 b = uint4(6, a);
+            return b[1];
+        }
+        uint foou4()
+        {
+            uint2 a = uint2(3, 4);
+            uint2 b = uint2(5, 6);
+            uint4 c = uint4(a, b);
+            return c[2];
+        }
+        bool foou5()
+        {
+            uint4 a = uint4(3, 4, 5, 6);
+            uint2 b = uint2(4, 5);
+            uint4 c = uint4(3, b, 6);
+            return a == c;
+        }
+        bool foou6()
+        {
+            uint2 a = uint2(4, 5);
+            uint3 b = uint3(3, a);
+            uint3 c = uint3(3, 4, 6);
+            return b == c;
+        }
+        float foof()
+        {
+            float2 a = float2(3., 4.);
+            return a[0];
+        }
+        float foof2()
+        {
+            float2 a = float2(3., 4.);
+            float3 b = float3(a, 5.);
+            return b[1];
+        }
+        float foof3()
+        {
+            float3 a = float3(3., 4., 5.);
+            float4 b = float4(6., a);
+            return b[1];
+        }
+        float foof4()
+        {
+            float2 a = float2(3., 4.);
+            float2 b = float2(5., 6.);
+            float4 c = float4(a, b);
+            return c[2];
+        }
+        bool foof5()
+        {
+            float4 a = float4(3., 4., 5., 6.);
+            float2 b = float2(4., 5.);
+            float4 c = float4(3., b, 6.);
+            return a == c;
+        }
+        bool foof6()
+        {
+            float2 a = float2(4., 5.);
+            float3 b = float3(3., a);
+            float3 c = float3(3., 4., 6.);
+            return b == c;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 3);
+    assert_equals(await callIntFunction(program, "foo2", []), 4);
+    assert_equals(await callIntFunction(program, "foo3", []), 3);
+    assert_equals(await callIntFunction(program, "foo4", []), 5);
+    assert_equals(await callBoolFunction(program, "foo5", []), true);
+    assert_equals(await callBoolFunction(program, "foo6", []), false);
+    assert_equals(await callUintFunction(program, "foou", []), 3);
+    assert_equals(await callUintFunction(program, "foou2", []), 4);
+    assert_equals(await callUintFunction(program, "foou3", []), 3);
+    assert_equals(await callUintFunction(program, "foou4", []), 5);
+    assert_equals(await callBoolFunction(program, "foou5", []), true);
+    assert_equals(await callBoolFunction(program, "foou6", []), false);
+    assert_equals(await callFloatFunction(program, "foof", []), 3);
+    assert_equals(await callFloatFunction(program, "foof2", []), 4);
+    assert_equals(await callFloatFunction(program, "foof3", []), 3);
+    assert_equals(await callFloatFunction(program, "foof4", []), 5);
+    assert_equals(await callBoolFunction(program, "foof5", []), true);
+    assert_equals(await callBoolFunction(program, "foof6", []), false);
+};
+
+runTests(whlslTests);
+</script>
+</html>
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslgettersettertypeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-getter-setter-type-expected.txt (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-getter-setter-type-expected.txt                           (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-getter-setter-type-expected.txt      2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+
+PASS getterType 
+PASS setterType 
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslgettersettertypehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-getter-setter-type.html (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-getter-setter-type.html                           (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-getter-setter-type.html      2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,103 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test loops.</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.getterType = async () => {
+    await checkFail(`
+        int operator.x(thread int[] foo)
+        {
+            return foo[0];
+        }
+    `); 
+    await checkFail(`
+        int operator.x(int[3] foo)
+        {
+            return foo[0];
+        }
+    `); 
+    await checkFail(`
+        int operator[](thread int[] foo, int index)
+        {
+            return foo[index];
+        }
+    `); 
+    await checkFail(`
+        int operator.x(int[3] foo)
+        {
+            return foo[0];
+        }
+    `); 
+    await checkFail(`
+        struct Foo {
+            int x;
+        }
+        int operator[](Foo foo, uint4 index)
+        {
+            return foo[index.x];
+        }
+    `); 
+};
+
+whlslTests.setterType = async () => {
+    await checkFail(`
+        thread int[] operator.x=(thread int[] foo, uint x)
+        {
+            return foo;
+        }
+    `); 
+    await checkFail(`
+        int[3] operator.x=(int[3] foo, uint x)
+        {
+            return foo;
+        }
+    `); 
+    await checkFail(`
+        thread int[] operator[]=(thread int[] foo, uint x, uint y)
+        {
+            return foo;
+        }
+    `); 
+    await checkFail(`
+        int[3] operator.x=(int[3] foo, uint x)
+        {
+            return foo;
+        }
+    `); 
+    await checkFail(`
+        struct Foo {
+            int x;
+        }
+        Foo operator[]=(Foo foo, float4 y, uint z)
+        {
+            return foo.x;
+        }
+    `); 
+    await checkFail(`
+        struct Foo {
+            int x;
+        }
+        int operator.y(Foo foo)
+        {
+            return foo.x;
+        }
+        Foo operator.y=(Foo foo, int4 x)
+        {
+            Foo result;
+            foo.x = x.x;
+            return result;
+        }
+    `); 
+};
+
+runTests(whlslTests);
+</script>
+</html>
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslifstatementexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-if-statement-expected.txt (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-if-statement-expected.txt                         (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-if-statement-expected.txt    2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+
+PASS ifStatement 
+PASS ifElseStatement 
+PASS ifElseIfStatement 
+PASS ifElseIfElseStatement 
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslifstatementhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-if-statement.html (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-if-statement.html                         (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-if-statement.html    2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,107 @@
</span><ins>+<!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.ifStatement = async () =>
+{
+    let program = `
+        int foo(int x)
+        {
+            int y = 6;
+            if (x == 7) {
+                y = 8;
+            }
+            return y;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", [makeInt(3)]), 6);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(4)]), 6);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(5)]), 6);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(6)]), 6);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(7)]), 8);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(8)]), 6);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(9)]), 6);
+}
+
+whlslTests.ifElseStatement = async () =>
+{
+    let program = `
+        int foo(int x)
+        {
+            int y = 6;
+            if (x == 7) {
+                y = 8;
+            } else {
+                y = 9;
+            }
+            return y;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", [makeInt(3)]), 9);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(4)]), 9);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(5)]), 9);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(6)]), 9);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(7)]), 8);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(8)]), 9);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(9)]), 9);
+}
+
+whlslTests.ifElseIfStatement = async () =>
+{
+    let program = `
+        int foo(int x)
+        {
+            int y = 6;
+            if (x == 7) {
+                y = 8;
+            } else if (x == 8) {
+                y = 9;
+            }
+            return y;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", [makeInt(3)]), 6);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(4)]), 6);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(5)]), 6);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(6)]), 6);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(7)]), 8);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(8)]), 9);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(9)]), 6);
+}
+
+whlslTests.ifElseIfElseStatement = async () =>
+{
+    let program = `
+        int foo(int x)
+        {
+            int y = 6;
+            if (x == 7) {
+                y = 8;
+            } else if (x == 8) {
+                y = 9;
+            } else {
+                y = 10;
+            }
+            return y;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", [makeInt(3)]), 10);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(4)]), 10);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(5)]), 10);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(6)]), 10);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(7)]), 8);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(8)]), 9);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(9)]), 10);
+}
+
+runTests(whlslTests);
+</script>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslloopsspectestsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-loops-spec-tests-expected.txt (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-loops-spec-tests-expected.txt                             (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-loops-spec-tests-expected.txt        2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+
+PASS doWhile 
+PASS simpleWhile 
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslloopsspectestshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-loops-spec-tests.html (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-loops-spec-tests.html                             (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-loops-spec-tests.html        2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test loops.</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.doWhile = async () =>
+{
+    let program = `
+        int foo1(int x)
+        {
+            int y = 7;
+            do {
+                y = 8;
+                break;
+            } while (x < 10);
+            return y;
+        }
+        int foo2(int x)
+        {
+            int y = 7;
+            do {
+                y = 8;
+                break;
+            } while (y == 7);
+            return y;
+        }
+        int foo3(int x)
+        {
+            int sum = 0;
+            do {
+                if (x == 11) {
+                    x = 15;
+                    continue;
+                }
+                sum = sum + x;
+                x = x + 1;
+            } while (x < 13);
+            return sum;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo1", [makeInt(1)]), 8);
+    assert_equals(await callIntFunction(program, "foo1", [makeInt(11)]), 8);
+    assert_equals(await callIntFunction(program, "foo2", [makeInt(1)]), 8);
+    assert_equals(await callIntFunction(program, "foo3", [makeInt(9)]), 19);
+}
+
+whlslTests.simpleWhile = async () =>
+{
+    let program = `
+        int foo(int x)
+        {
+            while (x < 13)
+                x = x * 2;
+            return x;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", [makeInt(1)]), 16);
+}
+
+runTests(whlslTests);
+</script>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslnullarrayrefhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-null-array-ref.html (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-null-array-ref.html                               (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-null-array-ref.html  2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,64 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test loops.</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.dereferenceDefaultNullArrayRef = async () =>
+{
+    let program = `
+        int foo()
+        {
+            thread int[] p;
+            return p[0];
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 0);
+}
+
+whlslTests.defaultInitializedNullArrayRefIntLiteral = async () =>
+{
+    let program = `
+        int foo()
+        {
+            thread int[] p = null;
+            return p[0];
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 0);
+}
+
+whlslTests.passNullToPtrMonomorphicArrayRef = async () =>
+{
+    let program = `
+        int foo(thread int[] ptr)
+        {
+            return ptr[0u];
+        }
+        int bar()
+        {
+            return foo(null);
+        }
+    `;
+    assert_equals(await callIntFunction(program, "bar", []), 0);
+}
+
+whlslTests.loadNull = async () =>
+{
+    await checkFail(
+        `
+            void sink(thread int* x) { }
+            void foo() { sink(*null); }
+        `);
+}
+
+runTests(whlslTests);
+</script>
+</html>
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlsloverridesubscriptexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-override-subscript-expected.txt (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-override-subscript-expected.txt                           (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-override-subscript-expected.txt      2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+
+PASS overrideSubscriptStruct 
+PASS overrideSubscriptStructAndDoStores 
+PASS overrideSubscriptStructAndUsePointers 
+PASS overrideSubscriptStructAndUsePointersIncorrectly 
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlsloverridesubscripthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-override-subscript.html (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-override-subscript.html                           (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-override-subscript.html      2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,128 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test override subscripts.</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.overrideSubscriptStruct = async () =>
+{
+    let program = `
+        struct Foo {
+            int x;
+            int y;
+        }
+        thread int* operator&[](thread Foo* foo, uint index)
+        {
+            if (index == 0)
+                return &foo->x;
+            if (index == 1)
+                return &foo->y;
+            return null;
+        }
+        int foo()
+        {
+            Foo foo;
+            foo.x = 498;
+            foo.y = 19;
+            return foo[0] + foo[1] * 3;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 498 + 19 * 3);
+}
+
+whlslTests.overrideSubscriptStructAndDoStores = async () =>
+{
+    let program = `
+        struct Foo {
+            int x;
+            int y;
+        }
+        thread int* operator&[](thread Foo* foo, uint index)
+        {
+            if (index == 0)
+                return &foo->x;
+            if (index == 1)
+                return &foo->y;
+            return null;
+        }
+        int foo()
+        {
+            Foo foo;
+            foo[0] = 498;
+            foo[1] = 19;
+            return foo.x + foo.y;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 498 + 19);
+}
+
+whlslTests.overrideSubscriptStructAndUsePointers = async () =>
+{
+    let program = `
+        struct Foo {
+            int x;
+            int y;
+        }
+        thread int* operator&[](thread Foo* foo, uint index)
+        {
+            if (index == 0)
+                return &foo->x;
+            if (index == 1)
+                return &foo->y;
+            return null;
+        }
+        int bar(thread Foo* foo)
+        {
+            return (*foo)[0] + (*foo)[1];
+        }
+        int foo()
+        {
+            Foo foo;
+            foo.x = 498;
+            foo.y = 19;
+            return bar(&foo);
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 498 + 19);
+}
+
+whlslTests.overrideSubscriptStructAndUsePointersIncorrectly = async () =>
+{
+    checkFail(
+        `
+            struct Foo {
+                int x;
+                int y;
+            }
+            thread int* operator&[](thread Foo* foo, uint index)
+            {
+                if (index == 0)
+                    return &foo->x;
+                if (index == 1)
+                    return &foo->y;
+                return null;
+            }
+            int bar(thread Foo* foo)
+            {
+                return foo[0] + foo[1];
+            }
+            int foo()
+            {
+                Foo foo;
+                foo.x = 498;
+                foo.y = 19;
+                return bar(&foo);
+            }
+        `);
+}
+
+runTests(whlslTests);
+</script>
+</html>
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslplusequalsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-plus-equals-expected.txt (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-plus-equals-expected.txt                          (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-plus-equals-expected.txt     2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+
+PASS plusEquals 
+PASS plusEqualsResult 
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslplusequalshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-plus-equals.html (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-plus-equals.html                          (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-plus-equals.html     2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test override subscripts.</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.plusEquals = async () =>
+{
+    let program = `
+        int foo(int x)
+        {
+            x += 42;
+            return x;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", [makeInt(385)]), 385 + 42);
+}
+
+whlslTests.plusEqualsResult = async () =>
+{
+    let program = `
+        int foo(int x)
+        {
+            return x += 42;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", [makeInt(385)]), 385 + 42);
+}
+
+runTests(whlslTests);
+</script>
+</html>
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslrecursivestructsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-recursive-structs-expected.txt (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-recursive-structs-expected.txt                            (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-recursive-structs-expected.txt       2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+
+PASS mutuallyRecursiveStruct 
+PASS mutuallyRecursiveStructWithPointersBroken 
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslrecursivestructshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-recursive-structs.html (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-recursive-structs.html                            (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-recursive-structs.html       2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>Test loops.</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.mutuallyRecursiveStruct = async () =>
+{
+    await checkFail(
+        `
+            struct Foo {
+                Bar bar;
+            }
+            struct Bar {
+                Foo foo;
+            }
+        `);
+        
+}
+
+whlslTests.mutuallyRecursiveStructWithPointersBroken = async () =>
+{
+    let program = `
+        struct Foo {
+            thread Bar* bar;
+            int foo;
+        }
+        struct Bar {
+            thread Foo* foo;
+            int bar;
+        }
+        int foo()
+        {
+            Foo foo;
+            Bar bar;
+            foo.foo = 564;
+            bar.bar = 53;
+            return foo.bar->bar - bar.foo->foo;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", []), 0);
+}
+
+runTests(whlslTests);
+</script>
+</html>
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslternaryspectestexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-ternary-spec-test-expected.txt (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-ternary-spec-test-expected.txt                            (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-ternary-spec-test-expected.txt       2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS ternaryExpression 
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslternaryspectesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-ternary-spec-test.html (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-ternary-spec-test.html                            (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-ternary-spec-test.html       2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,95 @@
</span><ins>+<!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.ternaryExpression = async () => {
+    let program = `
+        int foo(int x)
+        {
+            return x < 3 ? 4 : 5;
+        }
+        int bar(int x)
+        {
+            return x < 10 ? 11 : x < 12 ? 14 : 15;
+        }
+        int baz(int x)
+        {
+            return 3 < 4 ? x : 5;
+        }
+    `;
+    assert_equals(await callIntFunction(program, "foo", [makeInt(767)]), 5);
+    assert_equals(await callIntFunction(program, "foo", [makeInt(2)]), 4);
+    assert_equals(await callIntFunction(program, "bar", [makeInt(8)]), 11);
+    assert_equals(await callIntFunction(program, "bar", [makeInt(9)]), 11);
+    assert_equals(await callIntFunction(program, "bar", [makeInt(10)]), 14);
+    assert_equals(await callIntFunction(program, "bar", [makeInt(11)]), 14);
+    assert_equals(await callIntFunction(program, "bar", [makeInt(12)]), 15);
+    assert_equals(await callIntFunction(program, "bar", [makeInt(13)]), 15);
+    assert_equals(await callIntFunction(program, "baz", [makeInt(14)]), 14);
+    await checkFail(
+        `
+            int foo()
+            {
+                int x;
+                (4 < 5 ? x : 7) = 8;
+            }
+        `);
+    await checkFail(
+        `
+            int foo()
+            {
+                int x;
+                int y;
+                (0 < 1 ? x : y) = 42;
+                return x;
+            }
+        `);
+    await checkFail(
+        `
+            int foo()
+            {
+                int x;
+                int y;
+                thread int* z = &(0 < 1 ? x : y);
+                return *z;
+            }
+        `);
+    await checkFail(
+        `
+            int foo()
+            {
+                int x;
+                int y;
+                thread int[] z = @(0 < 1 ? x : y);
+                return *z;
+            }
+        `);
+    await checkFail(
+        `
+            int foo()
+            {
+                int x;
+                float y;
+                return 4 < 5 ? x : y;
+            }
+        `);
+    await checkFail(
+        `
+            int foo()
+            {
+                return 4 < 5 ? 6 : 7.0;
+            }
+        `);
+}
+
+runTests(whlslTests);
+</script>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslwrongargumentlengthexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-wrong-argument-length-expected.txt (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-wrong-argument-length-expected.txt                                (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-wrong-argument-length-expected.txt   2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+
+PASS bitAndWrongArgumentLength 
+PASS bitNotWrongArgumentLength 
+PASS bitOrWrongArgumentLength 
+PASS bitXorWrongArgumentLength 
+PASS decWrongArgumentLength 
+PASS divideWrongArgumentLength 
+PASS dotOperatorSetterWrongArgumentLength 
+PASS dotOperatorWrongArgumentLength 
+PASS greaterEqualWrongArgumentLength 
+PASS greaterWrongArgumentLength 
+PASS incWrongArgumentLength 
+PASS indexOperatorSetterWrongArgumentLength 
+PASS indexOperatorWrongArgumentLength 
+PASS lShiftWrongArgumentLength 
+PASS minusWrongArgumentLength 
+PASS moduloWrongArgumentLength 
+PASS plusWrongArgumentLength 
+PASS rShiftWrongArgumentLength 
+PASS timesWrongArgumentLength 
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslwrongargumentlengthhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-wrong-argument-length.html (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-wrong-argument-length.html                                (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-wrong-argument-length.html   2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,364 @@
</span><ins>+<!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>
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslwrongtypesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-wrong-types-expected.txt (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-wrong-types-expected.txt                          (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-wrong-types-expected.txt     2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+
+PASS decWrongTypes 
+PASS incWrongTypes 
+PASS greaterThanWrongReturnType 
+PASS greaterEqualWrongReturnType 
+PASS indexSetterWithMismatchedType 
+PASS setterWithMismatchedType 
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebgpuwhlslwrongtypeshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/whlsl-wrong-types.html (0 => 247319)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/whlsl-wrong-types.html                          (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl-wrong-types.html     2019-07-10 20:01:55 UTC (rev 247319)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+<!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.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>
</ins></span></pre>
</div>
</div>

</body>
</html>