- Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.test.ts
40 lines (35 loc) · 920 Bytes
/
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
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{MinStack}from"./index.ts";
log.info("155. Min Stack");
Deno.test({
name: `
Input
["MinStack","push","push","push","getMin","pop","top","getMin"]
[[],[-2],[0],[-3],[],[],[],[]]
Output
[null,null,null,null,-3,null,0,-2]
`,
fn(): void{
constresult: MinStack[]=[];
constminStack=newMinStack();
result.push(minStack);
result.push(minStack.push(-2));
result.push(minStack.push(0));
result.push(minStack.push(-3));
result.push(minStack.getMin());
result.push(minStack.pop());
result.push(minStack.top());
result.push(minStack.getMin());
asserts.assertEquals([
minStack,
undefined,
undefined,
undefined,
-3,
undefined,
0,
-2,
],result);
},
});