12 lines
383 B
TypeScript
12 lines
383 B
TypeScript
|
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);
|
||
|
});
|