blob: a01f7873e77a20e41b39b6676bb074b82c38c5c6 [file] [log] [blame]
<!DOCTYPE html>
<html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Test the WHLSL test harness.</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.enumDuplicates = async () => {
await checkFail(`
enum Foo {
War = 42,
Famine = 0,
Pestilence = 23,
Death = 42
}
`);
};
whlslTests.defaultEnumConstructor = async () => {
const program = `
enum Weekday {
Monday,
Tuesday,
Wednesday,
Thursday,
Pizzaday
}
int foo()
{
Weekday x = Weekday();
return 42;
}
`;
assert_equals(await callIntFunction(program, "foo", []), 42);
};
whlslTests.enumArrayRefBase = async () => {
await checkFail(
`
enum Foo : thread int[] {
Bar
}
`);
}
whlslTests.enumFloatBase = async () => {
await checkFail(
`
enum Foo : float {
Bar
}
`);
}
whlslTests.enumPtrBase = async () => {
await checkFail(
`
enum Foo : thread int* {
Bar
}
`);
}
whlslTests.enumStructBase = async () => {
await checkFail(
`
struct Thingy { }
enum Foo : Thingy {
Bar
}
`);
};
whlslTests.enumNoMembers = async () => {
await checkFail(
`
enum Foo { }
`);
};
runTests(whlslTests);
</script>
</html>