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

Function TestCMP

cpu/cpu_test.go:769–789  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

767}
768
769func TestCMP(t *testing.T) {
770 ClearMem()
771 var inputs [4]uint16 = [4]uint16{0xAB92, 0x0091, 0x0045, 0x00AF}
772
773 var instruction uint16 = 0x00F0
774 for a := 0; a < 4; a++ {
775 for b := 0; b < 4; b++ {
776 testCMP(instruction, inputs, inputs, a, b, t)
777 instruction++
778 }
779 }
780
781 var zeroes [4]uint16 = [4]uint16{0x0000, 0x0000, 0x0000, 0x0000}
782 instruction = 0x00F0
783 for a := 0; a < 4; a++ {
784 for b := 0; b < 4; b++ {
785 testCMP(instruction, zeroes, zeroes, a, b, t)
786 instruction++
787 }
788 }
789}
790
791func testCMP(instruction uint16, inputRegisters [4]uint16, expectedOutputRegisters [4]uint16, compareA, compareB int, t *testing.T) {
792 c := SetUpCPU()

Callers

nothing calls this directly

Calls 2

ClearMemFunction · 0.85
testCMPFunction · 0.85

Tested by

no test coverage detected