testalu

package
v0.0.0-...-8bbb003 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Some functions to facilitate ALU testing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunALUTest

func RunALUTest(t *testing.T, tc ALUTestCase, result ALUTest, expected ALUTest)

func RunFullRandomALUTests

func RunFullRandomALUTests(t *testing.T, n int, result ALUTest)

func RunRandomALUTest

func RunRandomALUTest(t *testing.T, op int, result ALUTest, expected ALUTest)

func RunRandomALUTests

func RunRandomALUTests(t *testing.T, n int, op int, result ALUTest, expected ALUTest)

Types

type ALUTest

type ALUTest func(ALUTestCase) ALUTestCase

type ALUTestCase

type ALUTestCase struct {
	A, B, C, OP         int
	CI, CO, ALO, EQO, Z bool
}

func Add

func Add(tc ALUTestCase) ALUTestCase

Add simulates an ADDer

func And

func And(tc ALUTestCase) ALUTestCase

And simulates an ANDder

func Cmp

func Cmp(tc ALUTestCase) ALUTestCase

Cmp simulates a Comparer

func GetALUExpectedResult

func GetALUExpectedResult(tc ALUTestCase) ALUTestCase

func NewALUTestCase

func NewALUTestCase(a int, b int, ci bool, op int) ALUTestCase

func NewRandomALUTestCase

func NewRandomALUTestCase(op int) ALUTestCase

func Not

func Not(tc ALUTestCase) ALUTestCase

Not simulates a NOTter

func Or

func Or(tc ALUTestCase) ALUTestCase

Or simulates an ORrer

func ShiftLeft

func ShiftLeft(tc ALUTestCase) ALUTestCase

ShiftLeft simulates a ShiftLeftter

func ShiftRight

func ShiftRight(tc ALUTestCase) ALUTestCase

func XOr

func XOr(tc ALUTestCase) ALUTestCase

Xor simulates an XORrer

func Zero

func Zero(tc ALUTestCase) ALUTestCase

Zero simulates a Comparer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL