(t *testing.T)
| 85 | } |
| 86 | |
| 87 | func 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 | |
| 103 | func testLeftShifter(input int, shiftIn bool, expectedOutput int, expectedShiftOut bool, t *testing.T) { |
| 104 | l := NewLeftShifter() |
nothing calls this directly
no test coverage detected