import { kMaximumLimitBaseParams, makeLimitTestGroup } from './limit_utils.js';

const limit = 'maxComputeWorkgroupSizeZ';
export const { g, description } = makeLimitTestGroup(limit);

g.test('createComputePipeline,at_over')
  .desc(`Test using createComputePipeline(Async) at and over ${limit} limit`)
  .params(kMaximumLimitBaseParams.combine('async', [false, true] as const))
  .fn(async t => {
    const { limitTest, testValueName, async } = t.params;
    await t.testMaxComputeWorkgroupSize(limitTest, testValueName, async, 'Z');
  });

g.test('validate,maxComputeInvocationsPerWorkgroup')
  .desc(`Test that ${limit} <= maxComputeInvocationsPerWorkgroup`)
  .fn(t => {
    const { adapter, defaultLimit, adapterLimit } = t;
    t.expect(defaultLimit <= t.getDefaultLimit('maxComputeInvocationsPerWorkgroup'));
    t.expect(adapterLimit <= adapter.limits.maxComputeInvocationsPerWorkgroup);
  });
