summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/mozilla/tests/webgpu/webgpu/shader/execution/expression/unary/bool_conversion.spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/mozilla/tests/webgpu/webgpu/shader/execution/expression/unary/bool_conversion.spec.js')
-rw-r--r--testing/web-platform/mozilla/tests/webgpu/webgpu/shader/execution/expression/unary/bool_conversion.spec.js85
1 files changed, 14 insertions, 71 deletions
diff --git a/testing/web-platform/mozilla/tests/webgpu/webgpu/shader/execution/expression/unary/bool_conversion.spec.js b/testing/web-platform/mozilla/tests/webgpu/webgpu/shader/execution/expression/unary/bool_conversion.spec.js
index d4bbbddce4..8da4619fe7 100644
--- a/testing/web-platform/mozilla/tests/webgpu/webgpu/shader/execution/expression/unary/bool_conversion.spec.js
+++ b/testing/web-platform/mozilla/tests/webgpu/webgpu/shader/execution/expression/unary/bool_conversion.spec.js
@@ -4,78 +4,14 @@
Execution Tests for the boolean conversion operations
`;import { makeTestGroup } from '../../../../../common/framework/test_group.js';
import { GPUTest } from '../../../../gpu_test.js';
-import { anyOf } from '../../../../util/compare.js';
-import {
- bool,
- f32,
- f16,
- i32,
-
- TypeBool,
- TypeF32,
- TypeF16,
- TypeI32,
- TypeU32,
- u32 } from
-'../../../../util/conversion.js';
-import {
- fullF32Range,
- fullF16Range,
- fullI32Range,
- fullU32Range,
- isSubnormalNumberF32,
- isSubnormalNumberF16 } from
-'../../../../util/math.js';
-import { makeCaseCache } from '../case_cache.js';
+import { Type } from '../../../../util/conversion.js';
import { allInputSources, run } from '../expression.js';
+import { d } from './bool_conversion.cache.js';
import { unary } from './unary.js';
export const g = makeTestGroup(GPUTest);
-export const d = makeCaseCache('unary/bool_conversion', {
- bool: () => {
- return [
- { input: bool(true), expected: bool(true) },
- { input: bool(false), expected: bool(false) }];
-
- },
- u32: () => {
- return fullU32Range().map((u) => {
- return { input: u32(u), expected: u === 0 ? bool(false) : bool(true) };
- });
- },
- i32: () => {
- return fullI32Range().map((i) => {
- return { input: i32(i), expected: i === 0 ? bool(false) : bool(true) };
- });
- },
- f32: () => {
- return fullF32Range().map((f) => {
- const expected = [];
- if (f !== 0) {
- expected.push(bool(true));
- }
- if (isSubnormalNumberF32(f)) {
- expected.push(bool(false));
- }
- return { input: f32(f), expected: anyOf(...expected) };
- });
- },
- f16: () => {
- return fullF16Range().map((f) => {
- const expected = [];
- if (f !== 0) {
- expected.push(bool(true));
- }
- if (isSubnormalNumberF16(f)) {
- expected.push(bool(false));
- }
- return { input: f16(f), expected: anyOf(...expected) };
- });
- }
-});
-
/** Generate expression builder based on how the test case is to be vectorized */
function vectorizeToExpression(vectorize) {
return vectorize === undefined ? unary('bool') : unary(`vec${vectorize}<bool>`);
@@ -95,7 +31,14 @@ u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3,
).
fn(async (t) => {
const cases = await d.get('bool');
- await run(t, vectorizeToExpression(t.params.vectorize), [TypeBool], TypeBool, t.params, cases);
+ await run(
+ t,
+ vectorizeToExpression(t.params.vectorize),
+ [Type.bool],
+ Type.bool,
+ t.params,
+ cases
+ );
});
g.test('u32').
@@ -113,7 +56,7 @@ u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3,
).
fn(async (t) => {
const cases = await d.get('u32');
- await run(t, vectorizeToExpression(t.params.vectorize), [TypeU32], TypeBool, t.params, cases);
+ await run(t, vectorizeToExpression(t.params.vectorize), [Type.u32], Type.bool, t.params, cases);
});
g.test('i32').
@@ -131,7 +74,7 @@ u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3,
).
fn(async (t) => {
const cases = await d.get('i32');
- await run(t, vectorizeToExpression(t.params.vectorize), [TypeI32], TypeBool, t.params, cases);
+ await run(t, vectorizeToExpression(t.params.vectorize), [Type.i32], Type.bool, t.params, cases);
});
g.test('f32').
@@ -149,7 +92,7 @@ u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3,
).
fn(async (t) => {
const cases = await d.get('f32');
- await run(t, vectorizeToExpression(t.params.vectorize), [TypeF32], TypeBool, t.params, cases);
+ await run(t, vectorizeToExpression(t.params.vectorize), [Type.f32], Type.bool, t.params, cases);
});
g.test('f16').
@@ -170,5 +113,5 @@ beforeAllSubcases((t) => {
}).
fn(async (t) => {
const cases = await d.get('f16');
- await run(t, vectorizeToExpression(t.params.vectorize), [TypeF16], TypeBool, t.params, cases);
+ await run(t, vectorizeToExpression(t.params.vectorize), [Type.f16], Type.bool, t.params, cases);
}); \ No newline at end of file