assertions

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Cond_false = iota
	Cond_true
	Was_hit
	Not_hit
	Must_be_hit
	Optionally_hit
	Universal_test
	Existential_test
	Reachability_test
	Num_conditions
)

Variables

This section is empty.

Functions

func GenerateAssertionsCatalog added in v0.2.10

func GenerateAssertionsCatalog(moduleName string, genInfo *GenInfo)

func IsGeneratedFile

func IsGeneratedFile(file_name string) bool

Types

type AntExpect

type AntExpect struct {
	*AssertionFuncInfo
	Assertion string
	Message   string
	Classname string
	Funcname  string
	Receiver  string
	Filename  string
	Line      int
}

type AntGuidance added in v0.4.0

type AntGuidance struct {
	*GuidanceFuncInfo
	Assertion string
	Message   string
	Classname string
	Funcname  string
	Receiver  string
	Filename  string
	Line      int
}

type AssertionFuncInfo

type AssertionFuncInfo struct {
	TargetFunc string
	AssertType string
	MustHit    bool
	Condition  bool
	MessageArg int
}

-------------------------------------------------------------------------------- Assertion Hints --------------------------------------------------------------------------------

type AssertionHints

type AssertionHints map[string]*AssertionFuncInfo

func SetupHintMap

func SetupHintMap() AssertionHints

func (AssertionHints) HintsForName

func (m AssertionHints) HintsForName(name string) *AssertionFuncInfo

type AssertionScanner

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

Capitalized struct items are accessed outside this file

func NewAssertionScanner

func NewAssertionScanner(verbose bool, moduleName string, symbolTableName string, sourceDir string, targetDir string) *AssertionScanner

func (*AssertionScanner) GetLogger

func (aScanner *AssertionScanner) GetLogger() *common.LogWriter

func (*AssertionScanner) HasAssertionsDefined added in v0.2.10

func (aScanner *AssertionScanner) HasAssertionsDefined() bool

func (*AssertionScanner) ScanFile

func (aScanner *AssertionScanner) ScanFile(file_path string)

func (*AssertionScanner) SummarizeWork

func (aScanner *AssertionScanner) SummarizeWork()

func (*AssertionScanner) WriteAssertionCatalog

func (aScanner *AssertionScanner) WriteAssertionCatalog(versionText string)

type GenInfo

type GenInfo struct {
	ConstMap map[string]bool

	AssertPackageName   string
	VersionText         string
	CreateDate          string
	ExpectedVals        []*AntExpect
	NumericGuidanceVals []*AntGuidance
	BooleanGuidanceVals []*AntGuidance
	HasAssertions       bool
	HasNumericGuidance  bool
	HasBooleanGuidance  bool
	// contains filtered or unexported fields
}

type GuidanceFnType added in v0.4.0

type GuidanceFnType int

A type for writing raw assertions. GuidanceFnType allows the assertion to provide guidance to the Antithesis platform when testing in Antithesis. Regular users of the assert package should not use it.

const (
	GuidanceFnMaximize GuidanceFnType = iota // Maximize (left - right) values
	GuidanceFnMinimize                       // Minimize (left - right) values
	GuidanceFnWantAll                        // Encourages fuzzing explorations where boolean values are true
	GuidanceFnWantNone                       // Encourages fuzzing explorations where boolean values are false
	GuidanceFnExplore
)

type GuidanceFuncInfo added in v0.4.0

type GuidanceFuncInfo struct {
	AssertionFuncInfo
	GuidanceFn GuidanceFnType
}

-------------------------------------------------------------------------------- Guidance Hints --------------------------------------------------------------------------------

type GuidanceHints added in v0.4.0

type GuidanceHints map[string]*GuidanceFuncInfo

func SetupGuidanceHintMap added in v0.4.0

func SetupGuidanceHintMap() GuidanceHints

func (GuidanceHints) GuidanceHintsForName added in v0.4.0

func (m GuidanceHints) GuidanceHintsForName(name string) *GuidanceFuncInfo

Jump to

Keyboard shortcuts

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