Skip to content

Commit 2a6a421

Browse files
test(2019-day-02): specs for opp code behaviors
1 parent dc1eb3a commit 2a6a421

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

2019/day-02/intcodeParser.test.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* eslint-env mocha */
2+
const expect = require('chai').expect
3+
const { step } = require('./intcodeParser')
4+
5+
describe('--- 2019 Day 2: 1202 Program Alarm ---', () => {
6+
describe('Part 1', () => {
7+
describe('intcodeParser', () => {
8+
describe('step()', () => {
9+
it('can add', () => {
10+
const oppcode = 1
11+
const data = [oppcode, 5, 6, 3, 99, 2, 3]
12+
step({ position: 0, data })
13+
expect(data[3]).equals(5)
14+
})
15+
it('can multiply', () => {
16+
const oppcode = 2
17+
const data = [oppcode, 5, 6, 3, 99, 2, 3]
18+
step({ position: 0, data })
19+
expect(data[3]).equals(6)
20+
})
21+
it('can terminate', () => {
22+
const oppcode = 99
23+
const data = [oppcode, 5, 6, 3, 99, 2, 3]
24+
step({ position: 0, data })
25+
expect(data[3]).equals(3)
26+
})
27+
})
28+
})
29+
})
30+
})

0 commit comments

Comments
 (0)