blob: 3c15f392b1df9f277f8980e93db465a8c2999d12 [file] [log] [blame]
<!DOCTYPE html>
<html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Test structs.</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.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>