We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b119835 commit a898bfdCopy full SHA for a898bfd
1 file changed
L-I/0003 Stack ( L-I )/Test.js
@@ -0,0 +1,32 @@
1
+const { strict: assert } = require('assert')
2
+
3
+const Stack = require('./Stack.js')
4
5
+const stack = new Stack()
6
7
+stack.push('foo')
8
9
+assert.equal(stack.size, 1)
10
11
+stack.push('bar')
12
13
+assert.equal(stack.size, 2)
14
15
+assert.equal(stack.peek(), 'bar')
16
17
+assert.equal(stack.pop(), 'bar')
18
19
+assert.equal(stack.peek(), 'foo')
20
21
22
+stack.push('foobar')
23
24
25
+assert.equal(stack.peek(), 'foobar')
26
27
+assert.equal(stack.pop(), 'foobar')
28
29
+assert.equal(stack.pop(), 'foo')
30
+assert.equal(stack.size, 0)
31
32
+console.log('All tests success')
0 commit comments