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

Function TestLeftShifter

components/components_test.go:87–101  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

85}
86
87func TestLeftShifter(t *testing.T) {
88 //left shifter always applies the same output
89 for i := 1; i < 32767; i *= 2 {
90 testLeftShifter(i, false, i*2, false, t)
91 }
92
93 testLeftShifter(0, false, 0, false, t)
94 testLeftShifter(0x8000, false, 0, true, t)
95 testLeftShifter(0xEEEF, false, 0xDDDE, true, t)
96 testLeftShifter(0xFFFF, false, 0xFFFE, true, t)
97
98 // shift in?
99 testLeftShifter(0x0000, true, 0x0001, false, t)
100 testLeftShifter(0x8000, true, 0x0001, true, t)
101}
102
103func testLeftShifter(input int, shiftIn bool, expectedOutput int, expectedShiftOut bool, t *testing.T) {
104 l := NewLeftShifter()

Callers

nothing calls this directly

Calls 1

testLeftShifterFunction · 0.85

Tested by

no test coverage detected