slige/surveys/code_coverage/program_2_test.ts

12 lines
383 B
TypeScript
Raw Normal View History

2024-11-21 16:16:30 +01:00
import { assertEquals } from "jsr:@std/assert";
import { stringToInt } from "./program_2.ts";
Deno.test("must work", () => {
assertEquals(stringToInt("0"), 0);
assertEquals(stringToInt("10"), 10);
assertEquals(stringToInt("0b110"), 6);
assertEquals(stringToInt("071"), 57);
assertEquals(stringToInt("0xaa"), 170);
assertEquals(stringToInt("john"), NaN);
});