blob: 56f6d8e4ccd6f55c825ffb994d0232be5aa7f38f [file] [log] [blame]
<!DOCTYPE html>
<html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Test prefix/postfix.</title>
<script src="js/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.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>