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

Function TestJMPFlagInstructionsString

asm/instructions_test.go:588–631  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

586}
587
588func TestJMPFlagInstructionsString(t *testing.T) {
589 var instructions []Instruction = []Instruction{
590 JMPF{[]string{"Z"}, LABEL{"foo1"}},
591 JMPF{[]string{"E"}, LABEL{"foo2"}},
592 JMPF{[]string{"E", "Z"}, LABEL{"foo3"}},
593 JMPF{[]string{"A"}, LABEL{"foo4"}},
594 JMPF{[]string{"A", "Z"}, LABEL{"foo5"}},
595 JMPF{[]string{"A", "E"}, LABEL{"foo6"}},
596 JMPF{[]string{"A", "E", "Z"}, LABEL{"foo7"}},
597 JMPF{[]string{"C"}, LABEL{"foo8"}},
598 JMPF{[]string{"C", "Z"}, LABEL{"foo9"}},
599 JMPF{[]string{"C", "E"}, LABEL{"foo10"}},
600 JMPF{[]string{"C", "E", "Z"}, LABEL{"foo11"}},
601 JMPF{[]string{"C", "A"}, LABEL{"foo12"}},
602 JMPF{[]string{"C", "A", "Z"}, LABEL{"foo13"}},
603 JMPF{[]string{"C", "A", "E"}, LABEL{"foo14"}},
604 JMPF{[]string{"C", "A", "E", "Z"}, LABEL{"foo15"}},
605 }
606
607 var expected []string = []string{
608 "JMPZ foo1",
609 "JMPE foo2",
610 "JMPEZ foo3",
611 "JMPA foo4",
612 "JMPAZ foo5",
613 "JMPAE foo6",
614 "JMPAEZ foo7",
615 "JMPC foo8",
616 "JMPCZ foo9",
617 "JMPCE foo10",
618 "JMPCEZ foo11",
619 "JMPCA foo12",
620 "JMPCAZ foo13",
621 "JMPCAE foo14",
622 "JMPCAEZ foo15",
623 }
624
625 for i, ins := range instructions {
626 if ins.String() != expected[i] {
627 t.Logf("Expected %s got %s when testing %s", expected[i], ins.String(), ins)
628 t.FailNow()
629 }
630 }
631}
632
633func TestJMPFlagInstructions(t *testing.T) {
634 var instructions []Instruction = []Instruction{

Callers

nothing calls this directly

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected