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

Function testLeftShifter

components/components_test.go:103–114  ·  view source on GitHub ↗
(input int, shiftIn bool, expectedOutput int, expectedShiftOut bool, t *testing.T)

Source from the content-addressed store, hash-verified

101}
102
103func testLeftShifter(input int, shiftIn bool, expectedOutput int, expectedShiftOut bool, t *testing.T) {
104 l := NewLeftShifter()
105 setWireOnComponent16(l, input)
106 l.Update(shiftIn)
107 if output := getValueOfOutput(l, arch.BUS_WIDTH); output != expectedOutput {
108 t.Logf("expected 0x%X got 0x%X", expectedOutput, output)
109 t.FailNow()
110 }
111 if l.shiftOut.Get() != expectedShiftOut {
112 t.FailNow()
113 }
114}
115
116func TestRightShifter(t *testing.T) {
117 //right shifter always applies the same output

Callers 1

TestLeftShifterFunction · 0.85

Calls 5

UpdateMethod · 0.95
NewLeftShifterFunction · 0.85
setWireOnComponent16Function · 0.85
getValueOfOutputFunction · 0.85
GetMethod · 0.45

Tested by

no test coverage detected