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

Function TestIsZero

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

Source from the content-addressed store, hash-verified

462}
463
464func TestIsZero(t *testing.T) {
465 z := NewIsZero()
466 for i := 0; i < arch.BUS_WIDTH; i++ {
467 z.SetInputWire(i, false)
468 }
469
470 z.Update()
471
472 if z.output.Get() != true {
473 t.FailNow()
474 }
475
476 z = NewIsZero()
477 for i := 0; i < arch.BUS_WIDTH; i++ {
478 z.SetInputWire(i, true)
479 }
480
481 z.Update()
482
483 if z.output.Get() != false {
484 t.FailNow()
485 }
486
487 for i := 0; i < arch.BUS_WIDTH; i++ {
488 z := NewIsZero()
489
490 z.SetInputWire(i, true)
491
492 z.Update()
493
494 result := z.output.Get()
495
496 if result != false {
497 t.FailNow()
498 }
499 }
500
501}
502
503func TestBusOne(t *testing.T) {
504 inputBus := NewBus(arch.BUS_WIDTH)

Callers

nothing calls this directly

Calls 4

SetInputWireMethod · 0.95
UpdateMethod · 0.95
NewIsZeroFunction · 0.85
GetMethod · 0.45

Tested by

no test coverage detected