-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchallenge23.test.js
More file actions
96 lines (91 loc) · 1.17 KB
/
challenge23.test.js
File metadata and controls
96 lines (91 loc) · 1.17 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
const executeCommands = require('./index.js')
test("Test #1 - Returns an array", () => {
expect(
Array.isArray(
executeCommands([
'MOV 5,V00',
'MOV 10,V01',
'DEC V00',
'ADD V00,V01',
])
)
).toStrictEqual(true)
})
test("Test #2", () => {
expect(
executeCommands([
'MOV 5,V00',
'MOV 10,V01',
'DEC V00',
'ADD V00,V01',
])
).toStrictEqual([
14,
10,
0,
0,
0,
0,
0,
0
])
})
test("Test #3", () => {
expect(
executeCommands([
'MOV 255,V00',
'INC V00',
'DEC V01',
'DEC V01'
])
).toStrictEqual([
0,
254,
0,
0,
0,
0,
0,
0
])
})
test("Test #4", () => {
expect(
executeCommands([
'MOV 10,V00',
'DEC V00',
'INC V01',
'JMP 1',
'INC V06'
])
).toStrictEqual([
0,
10,
0,
0,
0,
0,
1,
0
])
})
test("Test #5", () => {
expect(
executeCommands([
'MOV 10,V00',
'MOV V00,V01',
'MOV V01,V02',
'MOV V02,V03',
'MOV V03,V04'
])
).toStrictEqual([
10,
10,
10,
10,
10,
0,
0,
0
])
})