summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/src/unittests/crc32.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to 'dom/webgpu/tests/cts/checkout/src/unittests/crc32.spec.ts')
-rw-r--r--dom/webgpu/tests/cts/checkout/src/unittests/crc32.spec.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/dom/webgpu/tests/cts/checkout/src/unittests/crc32.spec.ts b/dom/webgpu/tests/cts/checkout/src/unittests/crc32.spec.ts
new file mode 100644
index 0000000000..5986823c8a
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/src/unittests/crc32.spec.ts
@@ -0,0 +1,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');
+});