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

Function testCMP

cpu/cpu_test.go:791–806  ·  view source on GitHub ↗
(instruction uint16, inputRegisters [4]uint16, expectedOutputRegisters [4]uint16, compareA, compareB int, t *testing.T)

Source from the content-addressed store, hash-verified

789}
790
791func testCMP(instruction uint16, inputRegisters [4]uint16, expectedOutputRegisters [4]uint16, compareA, compareB int, t *testing.T) {
792 c := SetUpCPU()
793
794 setMemoryLocation(c, 0x0000, instruction)
795
796 for i, r := range inputRegisters {
797 setRegister(c, i, r)
798 }
799
800 c.SetIAR(0x0000)
801
802 doFetchDecodeExecute(c)
803
804 checkRegisters(c, expectedOutputRegisters[0], expectedOutputRegisters[1], expectedOutputRegisters[2], expectedOutputRegisters[3], t)
805 checkFlagsRegister(c, false, inputRegisters[compareA] > inputRegisters[compareB], inputRegisters[compareA] == inputRegisters[compareB], false, t)
806}
807
808func testInstruction(instruction uint16, inputRegisters [4]uint16, expectedOutputRegisters [4]uint16, t *testing.T) {
809 c := SetUpCPU()

Callers 1

TestCMPFunction · 0.85

Calls 7

SetUpCPUFunction · 0.85
setMemoryLocationFunction · 0.85
setRegisterFunction · 0.85
doFetchDecodeExecuteFunction · 0.85
checkRegistersFunction · 0.85
checkFlagsRegisterFunction · 0.85
SetIARMethod · 0.80

Tested by

no test coverage detected