Updated devtools

This commit is contained in:
Michaël Lemaire 2020-12-02 22:04:53 +01:00
parent 0fb07099a2
commit 74f4be962e
4 changed files with 7 additions and 7 deletions

View file

@ -1 +1 @@
export * from "https://code.thunderk.net/typescript/devtools/raw/1.0.0/testing.ts";
export * from "https://code.thunderk.net/typescript/devtools/raw/1.2.2/testing.ts";

View file

@ -1,9 +1,9 @@
import { test, expect } from "./deps.test.ts";
import { expect, it } from "./deps.test.ts";
import { Hasher, HashOutputMode } from "./hashing.ts";
const assertEquals = (a: any, b: any) => expect(a).toEqual(b);
test("hasher", () => {
it("hasher", () => {
assertEquals(Hasher.tagFromURL(""), null);
assertEquals(Hasher.tagFromURL("http://"), null);
assertEquals(Hasher.tagFromURL("http://localhost"), "localhost");

View file

@ -1,7 +1,7 @@
import { test, expect } from "./deps.test.ts";
import { expect, it } from "./deps.test.ts";
import { hex_sha1 } from "./sha.ts";
test("sha1", () => {
it("sha1", () => {
expect(hex_sha1("abc")).toEqual("a9993e364706816aba3e25717850c26c9cd0d89d");
expect(hex_sha1("test")).toEqual("a94a8fe5ccb19ba61c4c0873d391e987982fbbd3");
});

4
sha.ts
View file

@ -162,8 +162,8 @@ function str2binb(str: string): number[] {
/* SC - Get rid of warnings */
for (var i = 0; i < str.length * chrsz; i += chrsz) {
if (bin[i >> 5] != undefined) {
bin[i >> 5] |=
(str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i % 32);
bin[i >> 5] |= (str.charCodeAt(i / chrsz) & mask) <<
(32 - chrsz - i % 32);
} else {
bin[i >> 5] = (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i % 32);
}