-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsolution.spec.ts
51 lines (43 loc) · 1.14 KB
/
solution.spec.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
46
47
48
49
50
51
import fn from './solution'
describe('Challenge 25: return the value of the program after executing instructions sequence', () => {
it('Test 01', () => {
const result: number = fn('+++')
const expected: number = 3
expect(result).toBe(expected)
})
it('Test 02', () => {
const result: number = fn('+--')
const expected: number = -1
expect(result).toBe(expected)
})
it('Test 03', () => {
const result: number = fn('>+++[-]')
const expected: number = 0
expect(result).toBe(expected)
})
it('Test 04', () => {
const result: number = fn('>>>+{++}')
const expected: number = 3
expect(result).toBe(expected)
})
it('Test 05', () => {
const result: number = fn('+{[-]+}+')
const expected: number = 2
expect(result).toBe(expected)
})
it('Test 06', () => {
const result: number = fn('{+}{+}{+}')
const expected: number = 0
expect(result).toBe(expected)
})
it('Test 07', () => {
const result: number = fn('------[+]++')
const expected: number = 2
expect(result).toBe(expected)
})
it('Test 08', () => {
const result: number = fn('-[++{-}]+{++++}')
const expected: number = 5
expect(result).toBe(expected)
})
})