blob: 79da040f53d38ae820d5912e6144842c39eca2f0 [file] [log] [blame]
<!DOCTYPE html>
<html>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>==.</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 = {};
const epsilon = 0.0001;
whlslTests.matrixEqual = async () => {
const program = `
bool foo() {
float2x2 m;
m[0] = float2(20, 30);
m[1] = float2(40, 50);
float2x2 m3 = m;
m3[0][1] += 10.0;
bool2x2 m2 = m == m3;
return m2[0][0] && !m2[0][1] && m2[1][0] && m2[1][1];
}
`;
assert_equals(await callBoolFunction(program, "foo", []), true);
};
whlslTests.vectorEquals = async () => {
const program = `
bool foo() {
float2 v = float2(10.0, 20.0);
float2 v2 = v;
bool2 result = v2 == v;
return result.x && result.y;
}
`;
assert_equals(await callBoolFunction(program, "foo", []), true);
};
whlslTests.scalarEquals = async () => {
const program = `
bool foo() {
float x = 10.0;
float y = x;
return x == y;
}
`;
assert_equals(await callBoolFunction(program, "foo", []), true);
};
runTests(whlslTests);
</script>
</html>