csptest

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertProcessesAreTraceEquivalent

func AssertProcessesAreTraceEquivalent(t *rapid.T, actual csp.Process, expected csp.Process)

AssertProcessHasTrace checks whether two processes have the same set of traces. (It does not do this exhaustively; it uses the property test harness to generate and test a particular trace.)

func EventsAsSlice

func EventsAsSlice(set csp.EventSet) []csp.Event

EventsAsSlice returns a slice containing all of the events in a set.

func PerformEvent

func PerformEvent(t *rapid.T, tc *csp.TraceChecker) states.Action

PerformEvent verifies that the “actual” and “expected” processes have the same set of allowed events at this point in the test. It then returns an [Action] that randomly selects one of those events and has both processes perform it.

func RandomEvent

func RandomEvent(max int) *rapid.Generator[Event]

RandomEvent returns a rapid.Generator that produces a random Event.

func SelectEvent

func SelectEvent(t *rapid.T, tp *csp.TracedProcess, f func(next csp.Event)) states.Action

SelectEvent returns an [Action] that randomly selects one of the process's available events, and invokes a callback with the selected event.

func SelectRandomEvent

func SelectRandomEvent(t *rapid.T, set csp.EventSet, f func(selected csp.Event)) states.Action

SelectRandomEvent returns a states.Action that selects an element of the event set at random, and then invokes a function with the selected event.

Types

type Event

type Event uint

Event is a simple event type that we can use in test cases.

func (Event) AsSet

func (te Event) AsSet() csp.EventSet

func (Event) Format

func (te Event) Format(f fmt.State, verb rune)

func (Event) String

func (te Event) String() string

type EventSet

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

EventSet is an event set that contains [Event]s.

func Events

func Events(set csp.EventSet) EventSet

Events returns the Event elements of a csp.EventSet.

func (EventSet) Contains

func (tes EventSet) Contains(ve any) bool

func (EventSet) Difference

func (tes EventSet) Difference(vother csp.UserEventSet) csp.UserEventSet

func (EventSet) Equal

func (tes EventSet) Equal(vother csp.UserEventSet) bool

func (EventSet) Format

func (tes EventSet) Format(f fmt.State, verb rune)

func (EventSet) HasNonemptyIntersection

func (tes EventSet) HasNonemptyIntersection(vother csp.UserEventSet) bool

func (EventSet) Intersection

func (tes EventSet) Intersection(vother csp.UserEventSet) csp.UserEventSet

func (EventSet) IsEmpty

func (tes EventSet) IsEmpty() bool

func (EventSet) Union

func (tes EventSet) Union(vother csp.UserEventSet) csp.UserEventSet

Jump to

Keyboard shortcuts

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