mirror of
https://git.sfja.dk/Mikkel/slige.git
synced 2025-01-18 12:46:31 +00:00
tdd survey
This commit is contained in:
parent
736953d9e9
commit
c2a5b66318
10
surveys/code_coverage/program_2_phami_test.ts
Normal file
10
surveys/code_coverage/program_2_phami_test.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { assertEquals } from "jsr:@std/assert";
|
||||||
|
import { stringToInt } from "./program_2.ts";
|
||||||
|
|
||||||
|
Deno.test("must work", () => {
|
||||||
|
assertEquals(stringToInt("0"), 0);
|
||||||
|
assertEquals(stringToInt(""), NaN);
|
||||||
|
assertEquals(stringToInt("0b10"), 2)
|
||||||
|
assertEquals(stringToInt("0x10"), 16)
|
||||||
|
assertEquals(stringToInt("010"), 8)
|
||||||
|
});
|
18
surveys/code_coverage/program_2_teis_test.ts
Normal file
18
surveys/code_coverage/program_2_teis_test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user