|
| 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