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

Function TestBusOne

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

Source from the content-addressed store, hash-verified

501}
502
503func TestBusOne(t *testing.T) {
504 inputBus := NewBus(arch.BUS_WIDTH)
505 outputBus := NewBus(arch.BUS_WIDTH)
506 b := NewBusOne(inputBus, outputBus)
507 for i := 0; i < 65536; i++ {
508 testBusOneReturnsCorrectResult(b, inputBus, outputBus, i, false, i, t)
509 //should always return 1 regardless of input
510 testBusOneReturnsCorrectResult(b, inputBus, outputBus, i, true, 1, t)
511 }
512}
513
514func testBusOneReturnsCorrectResult(b *BusOne, inputBus, outputBus *Bus, input int, enableBus1 bool, expectedOutput int, t *testing.T) {
515 setWireOnComponent16(inputBus, input)

Callers

nothing calls this directly

Calls 3

NewBusFunction · 0.85
NewBusOneFunction · 0.85

Tested by

no test coverage detected