diff options
Diffstat (limited to 'src/vm/instruction.test.js')
-rw-r--r-- | src/vm/instruction.test.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vm/instruction.test.js b/src/vm/instruction.test.js index cf23404..279b9b8 100644 --- a/src/vm/instruction.test.js +++ b/src/vm/instruction.test.js @@ -393,6 +393,21 @@ test('JMP correctly jumps', () => { }); +test('JMP correctly responds to B-field predecrement', () => { + const core = new Core(CORESIZE); + const pc = 2; + core.data[pc] = { + opcode: 'JMP', + a: { mode: 'direct', value: -3 }, + b: { mode: 'predecrement', value: 1 }, + }; + const ins = core.data[pc]; + + expect(JMP(core, pc, ins)).toEqual([CORESIZE-1]); + expect(core.data[pc+1].b.value).toBe(-1); +}); + + test('JMZ correctly jumps in non-immediate mode', () => { const core = new Core(CORESIZE); const pc = 2; |