summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/src/unittests/crc32.spec.ts
blob: 5986823c8a3bd636f74c1a36aef01545abb95248 (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
export const description = `
Test for crc32 utility functions.
`;

import { makeTestGroup } from '../common/framework/test_group.js';
import { crc32, toHexString } from '../common/util/crc32.js';

import { UnitTest } from './unit_test.js';

class F extends UnitTest {
  test(content: string, expect: string): void {
    const got = toHexString(crc32(content));
    this.expect(
      expect === got,
      `
expected: ${expect}
got:      ${got}`
    );
  }
}

export const g = makeTestGroup(F);

g.test('strings').fn(t => {
  t.test('', '00000000');
  t.test('hello world', '0d4a1185');
  t.test('123456789', 'cbf43926');
});