mirror of
https://git.sfja.dk/Mikkel/slige.git
synced 2025-01-18 18:56:31 +00:00
19 lines
548 B
TypeScript
19 lines
548 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("30"), 30);
|
|
assertEquals(stringToInt("0xf"), 15);
|
|
assertEquals(stringToInt("0x1f"), 31);
|
|
assertEquals(stringToInt("0b110"), 6);
|
|
assertEquals(stringToInt("06"), 6);
|
|
assertEquals(stringToInt("060"), 6*8);
|
|
assertEquals(stringToInt(""), NaN);
|
|
assertEquals(stringToInt("10f"), NaN);
|
|
|
|
|
|
|
|
});
|