dectest

package
v0.0.0-...-7b8028b Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Test

func Test(t *testing.T, file string)

Types

type Case

type Case struct {
	ID         string
	Prec       int
	Clamp      bool
	Mode       RoundingMode
	MaxScale   int
	MinScale   int
	Op         Op
	Inputs     []Data
	Output     Data
	Conditions Condition
}

func (Case) ShortString

func (c Case) ShortString(length int) string

ShortString returns the same as String, except long data values are capped at length digits.

func (Case) String

func (c Case) String() string

type Condition

type Condition uint32

Condition is a bitmask value raised after or during specific operations.

const (
	Clamped Condition = 1 << iota
	ConversionSyntax
	DivisionByZero
	DivisionImpossible
	DivisionUndefined
	Inexact
	InsufficientStorage
	InvalidContext
	InvalidOperation
	Overflow
	Rounded
	Subnormal
	Underflow
	LostDigits
)

func (Condition) String

func (c Condition) String() string

type Data

type Data string

Data is input or output from a test case.

const NoData Data = "?"

NoData is output when the operation throws some sort of Condition and does not "return" any data.

func (Data) IsInf

func (i Data) IsInf() (int, bool)

IsInf returns a boolean indicating whether the data is an Infinity and an int indicating the signedness of the Infinity.

func (Data) IsNaN

func (i Data) IsNaN() (nan, signal bool)

IsNaN returns two booleans indicating whether the data is a NaN value and whether it's signaling or not.

func (Data) TrimQuotes

func (i Data) TrimQuotes() Data

type Op

type Op uint8

Op is a specific operation the test case must perform.

const (
	UnknownOp Op = iota
	Abs
	Add
	And
	Apply
	Canonical
	Class
	Compare
	CompareSig
	CompareTotal
	CompareTotMag
	Copy
	CopyAbs
	CopyNegate
	CopySign
	Divide
	DivideInt
	Exp
	FMA
	Invert
	Ln
	Log10
	LogB
	Max
	MaxMag
	Min
	MinMag
	Minus
	Multiply
	NextMinus
	NextPlus
	NextToward
	Or
	Plus
	Power
	Quantize
	Reduce
	Remainder
	RemainderNear
	Rescale
	Rotate
	SameQuantum
	ScaleB
	Shift
	SquareRoot
	Subtract
	ToEng
	ToIntegral
	ToIntegralX
	ToSci
	Trim
	Xor
)

func (Op) String

func (i Op) String() string

type RoundingMode

type RoundingMode int
const (
	Ceiling RoundingMode = iota
	Down
	Floor
	HalfDown
	HalfEven
	HalfUp
	Up
	ZeroFiveUp
)

func (RoundingMode) String

func (i RoundingMode) String() string

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

func NewScanner

func NewScanner(r io.Reader) *Scanner

func (*Scanner) Case

func (s *Scanner) Case() *Case

func (*Scanner) Err

func (s *Scanner) Err() error

func (*Scanner) Scan

func (s *Scanner) Scan() bool

Jump to

Keyboard shortcuts

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