- Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.test.ts
45 lines (41 loc) · 1.37 KB
/
index.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import*asassertsfrom"https://deno.land/std@0.125.0/testing/asserts.ts";
import*aslogfrom"https://deno.land/std@0.125.0/log/mod.ts";
import{addBinary}from"./index.ts";
log.info("0067. Add Binary");
Deno.test({
name: `
Input: a = "11", b = "1"
Output: "100"
`,
fn(): void{
constresult: string=addBinary("11","1");
asserts.assertEquals(result,"100");
},
});
Deno.test({
name: `
Input: a = "1010", b = "1011"
Output: "10101"
`,
fn(): void{
constresult: string=addBinary("1010","1011");
asserts.assertEquals(result,"10101");
},
});
Deno.test({
name: `
Input: a = "10100000100100110110010000010101111011011001101110111111111101000000101111001110001111100001101",
b = "110101001011101110001111100110001010100001101011101010000011011011001011101111001100000011011110011"
Output: "110111101100010011000101110110100000011101000101011001000011011000001100011110011010010011000000000"
`,
fn(): void{
constresult: string=addBinary(
"10100000100100110110010000010101111011011001101110111111111101000000101111001110001111100001101",
"110101001011101110001111100110001010100001101011101010000011011011001011101111001100000011011110011",
);
asserts.assertEquals(
result,
"110111101100010011000101110110100000011101000101011001000011011000001100011110011010010011000000000",
);
},
});