feat: the kata machine
This commit is contained in:
commit
dc0e0e0358
20 changed files with 2771 additions and 0 deletions
22
src/__tests__/stack.ts
Normal file
22
src/__tests__/stack.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import Stack from "@code/stack";
|
||||
|
||||
test("queue", function() {
|
||||
const list = new Stack<number>();
|
||||
|
||||
list.push(5);
|
||||
list.push(7);
|
||||
list.push(9);
|
||||
|
||||
expect(list.pop()).toEqual(9);
|
||||
expect(list.length).toEqual(2);
|
||||
|
||||
list.push(11);
|
||||
expect(list.pop()).toEqual(11);
|
||||
expect(list.pop()).toEqual(7);
|
||||
expect(list.peek()).toEqual(5);
|
||||
expect(list.pop()).toEqual(5);
|
||||
expect(list.pop()).toEqual(undefined);
|
||||
});
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue