Skip to content

Commit

Permalink
Add epsilon to float comparison
Browse files Browse the repository at this point in the history
Adds an epsilon when comparing float values in
conformance/extensions/webgl-depth-texture.html. As-is, it is possible
for tests to fail with output such as:

At 2,0, expected within [0.2,0.6], was 0.600
FAIL At 2,0, expected within [0.2,0.6], was 0.600
  • Loading branch information
Brian Sheedy committed Apr 3, 2024
1 parent 097c03d commit 600e4ab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sdk/tests/conformance/extensions/webgl-depth-texture.html
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@
const eMax = expectedMax[t];
let func = testPassed;
const text = `At ${xx},${yy}, expected within [${eMin},${eMax}], was ${was.toFixed(3)}`
if (was <= eMin || was >= eMax) {
if (was <= eMin - eps || was >= eMax + eps) {
func = testFailed;
}
func(text);
Expand Down

0 comments on commit 600e4ab

Please sign in to comment.