summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/src/webgpu/shader/execution/expression/unary/bool_logical.spec.ts
blob: 01eaaab43a5179028bd1231ee0b1219d457d627f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
export const description = `
Execution Tests for the boolean unary logical expression operations
`;

import { makeTestGroup } from '../../../../../common/framework/test_group.js';
import { GPUTest } from '../../../../gpu_test.js';
import { bool, TypeBool } from '../../../../util/conversion.js';
import { allInputSources, run } from '../expression.js';

import { unary } from './unary.js';

export const g = makeTestGroup(GPUTest);

g.test('negation')
  .specURL('https://www.w3.org/TR/WGSL/#logical-expr')
  .desc(
    `
Expression: !e

Logical negation. The result is true when e is false and false when e is true. Component-wise when T is a vector.
`
  )
  .params(u =>
    u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const)
  )
  .fn(async t => {
    const cases = [
      { input: bool(true), expected: bool(false) },
      { input: bool(false), expected: bool(true) },
    ];

    await run(t, unary('!'), [TypeBool], TypeBool, t.params, cases);
  });