summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/src/webgpu/shader/validation/decl/override.spec.ts
blob: 82a35a2f596d74770c417c7614179ff72b647a4e (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
export const description = `
Validation tests for override declarations
`;

import { makeTestGroup } from '../../../../common/framework/test_group.js';
import { ShaderValidationTest } from '../shader_validation_test.js';

export const g = makeTestGroup(ShaderValidationTest);

g.test('no_direct_recursion')
  .desc('Test that direct recursion of override declarations is rejected')
  .params(u => u.combine('target', ['a', 'b']))
  .fn(t => {
    const wgsl = `
override a : i32 = 42;
override b : i32 = ${t.params.target};
`;
    t.expectCompileResult(t.params.target === 'a', wgsl);
  });

g.test('no_indirect_recursion')
  .desc('Test that indirect recursion of override declarations is rejected')
  .params(u => u.combine('target', ['a', 'b']))
  .fn(t => {
    const wgsl = `
override a : i32 = 42;
override b : i32 = c;
override c : i32 = ${t.params.target};
`;
    t.expectCompileResult(t.params.target === 'a', wgsl);
  });