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

Function testALUAddWithCarry

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

Source from the content-addressed store, hash-verified

668}
669
670func testALUAddWithCarry(instruction uint16, inputRegisters, expectedOutputRegisters [4]uint16, t *testing.T) {
671 c := SetUpCPU()
672
673 setMemoryLocation(c, 0x0000, instruction)
674 setMemoryLocation(c, 0x0001, instruction)
675
676 c.SetIAR(0x0000)
677
678 setRegisters(c, inputRegisters)
679 doFetchDecodeExecute(c)
680 setRegisters(c, [4]uint16{0x0000, 0x0000, 0x0000, 0x0000}) // zeros so that we can see the carry flag cause a change
681 doFetchDecodeExecute(c)
682
683 checkRegisters(c, expectedOutputRegisters[0], expectedOutputRegisters[1], expectedOutputRegisters[2], expectedOutputRegisters[3], t)
684}
685
686func TestALUNOT(t *testing.T) {
687 ClearMem()

Callers 1

TestALUAddWithCarryFunction · 0.85

Calls 6

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

Tested by

no test coverage detected