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