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

Function testShift

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

Source from the content-addressed store, hash-verified

844}
845
846func testShift(instruction uint16, inputRegisters [4]uint16, expectedOutputRegisters [4]uint16, shifts uint16, t *testing.T) {
847 c := SetUpCPU()
848
849 var i uint16
850 for i = 0; i < shifts; i++ {
851 setMemoryLocation(c, i, instruction)
852 }
853
854 for i, r := range inputRegisters {
855 setRegister(c, i, r)
856 }
857
858 c.SetIAR(0x0000)
859
860 for i = 0; i < shifts; i++ {
861 doFetchDecodeExecute(c)
862 }
863
864 checkRegisters(c, expectedOutputRegisters[0], expectedOutputRegisters[1], expectedOutputRegisters[2], expectedOutputRegisters[3], t)
865}
866
867func TestSubtract(t *testing.T) {
868 ClearMem()

Callers 2

TestALUShiftLeftFunction · 0.85
TestALUShiftRightFunction · 0.85

Calls 6

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

Tested by

no test coverage detected