testutils

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package testutils contains general utilities for testing to help ensure consistency in output style.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertAnyErrorInChainMatchesTarget

func AssertAnyErrorInChainMatchesTarget(t *testing.T, target error, actual error)

AssertAnyErrorInChainMatchesTarget checks if any error in the error chain matches the target. If not, it reports a test failure.

func AssertBigIntNonZero

func AssertBigIntNonZero(t *testing.T, description string, actual *big.Int)

AssertBigIntNonZero checks if the provided not-nil big integer is non-zero. If the provided big integer is zero, it reports a test failure.

func AssertBigIntsEqual

func AssertBigIntsEqual(t *testing.T, description string, expected *big.Int, actual *big.Int)

AssertBigIntsEqual checks if two not-nil big integers are equal. If not, it reports a test failure.

func AssertBigIntsNotEqual

func AssertBigIntsNotEqual(t *testing.T, description string, a *big.Int, b *big.Int)

AssertBigIntsNotEqual checks if two not-nil big integers are not equal. If they are equal, reports a test failure.

func AssertBoolsEqual

func AssertBoolsEqual(t *testing.T, description string, expected bool, actual bool)

AssertBoolsEqual checks if two booleans are equal. If not, it reports a test failure.

func AssertBytesEqual

func AssertBytesEqual(t *testing.T, expectedBytes []byte, actualBytes []byte)

AssertBytesEqual checks if the two bytes array are equal. If not, it reports a test failure.

func AssertErrorsSame

func AssertErrorsSame(t *testing.T, expected error, actual error)

AssertErrorsSame checks if two errors are the same error. If not, it reports a test failure. Note that this function doesn't check errors deep equality but just checks whether both arguments point to the same underlying instance.

func AssertIntsEqual

func AssertIntsEqual(t *testing.T, description string, expected int, actual int)

AssertIntsEqual checks if two integers are equal. If not, it reports a test failure.

func AssertStringsEqual

func AssertStringsEqual(t *testing.T, description string, expected string, actual string)

AssertStringsEqual checks if two strings are equal. If not, it reports a test failure.

func AssertUintsEqual

func AssertUintsEqual(t *testing.T, description string, expected uint64, actual uint64)

AssertUintsEqual checks if two unsigned integers are equal. If not, it reports a test failure.

func NewRandInt

func NewRandInt(currentValue, max *big.Int) *big.Int

NewRandInt generates a random value in range [0, max), different from the passed current value.

Types

type MockLogger

type MockLogger struct{}

func (*MockLogger) Debug

func (ml *MockLogger) Debug(args ...interface{})

func (*MockLogger) Debugf

func (ml *MockLogger) Debugf(format string, args ...interface{})

func (*MockLogger) Error

func (ml *MockLogger) Error(args ...interface{})

func (*MockLogger) Errorf

func (ml *MockLogger) Errorf(format string, args ...interface{})

func (*MockLogger) Fatal

func (ml *MockLogger) Fatal(args ...interface{})

func (*MockLogger) Fatalf

func (ml *MockLogger) Fatalf(format string, args ...interface{})

func (*MockLogger) Info

func (ml *MockLogger) Info(args ...interface{})

func (*MockLogger) Infof

func (ml *MockLogger) Infof(format string, args ...interface{})

func (*MockLogger) Panic

func (ml *MockLogger) Panic(args ...interface{})

func (*MockLogger) Panicf

func (ml *MockLogger) Panicf(format string, args ...interface{})

func (*MockLogger) Warn

func (ml *MockLogger) Warn(args ...interface{})

func (*MockLogger) Warnf

func (ml *MockLogger) Warnf(format string, args ...interface{})

func (*MockLogger) Warning

func (ml *MockLogger) Warning(args ...interface{})

func (*MockLogger) Warningf

func (ml *MockLogger) Warningf(format string, args ...interface{})

Jump to

Keyboard shortcuts

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