import { assertEquals } from "assert"; import { b } from "../helpers.ts"; import crc32 from "../../public/png/crc32.js"; Deno.test("computes CRC32s", () => { // These tests are lifted from the following Go 1.19.3 code: // // ``` // crc := crc32.NewIEEE() // fmt.Println(crc.Sum32()) // crc.Write([]byte{}) // fmt.Println(crc.Sum32()) // crc.Write([]byte{1, 2, 3}) // fmt.Println(crc.Sum32()) // crc.Write([]byte{4, 5, 6}) // fmt.Println(crc.Sum32()) // ``` assertEquals(crc32(), 0); assertEquals(crc32(b(1, 2, 3)), 1438416925); assertEquals(crc32(b(1, 2, 3, 4, 5, 6)), 2180413220); });