MCPcopy Create free account
hub / github.com/djhworld/simple-computer / testJMPR

Function testJMPR

cpu/cpu_test.go:330–348  ·  view source on GitHub ↗
(instruction uint16, inputRegisters [4]uint16, expectedIAR uint16, t *testing.T)

Source from the content-addressed store, hash-verified

328}
329
330func testJMPR(instruction uint16, inputRegisters [4]uint16, expectedIAR uint16, t *testing.T) {
331 c := SetUpCPU()
332 var insAddr uint16 = 0x0000
333
334 // JMPR
335 setMemoryLocation(c, insAddr, instruction)
336
337 c.SetIAR(insAddr)
338
339 setRegisters(c, inputRegisters)
340
341 doFetchDecodeExecute(c)
342
343 // registers shouldn't change
344 checkRegisters(c, inputRegisters[0], inputRegisters[1], inputRegisters[2], inputRegisters[3], t)
345
346 // check IAR has jumped to the new location
347 checkIAR(c, expectedIAR, t)
348}
349
350func TestJMP(t *testing.T) {
351 ClearMem()

Callers 1

TestJMPRFunction · 0.85

Calls 7

SetUpCPUFunction · 0.85
setMemoryLocationFunction · 0.85
setRegistersFunction · 0.85
doFetchDecodeExecuteFunction · 0.85
checkRegistersFunction · 0.85
checkIARFunction · 0.85
SetIARMethod · 0.80

Tested by

no test coverage detected