impure

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package impure is an acceptance-test fixture: a machine whose Fire consults a helper package's hidden state, so replaying the same path can reach a different world.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actions

type Actions struct{}

Actions is always empty.

type Event

type Event uint8

Event is an input to Fire.

const (
	EvStep Event
)

Event values.

type Machine

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

Machine flips between Even and Odd by the clock, not by its own state.

func New

func New() Machine

New returns a machine in Even.

func (Machine) Fire

func (m Machine) Fire(e Event) (Machine, Actions, Outcome)

Fire reads the clock: the impurity under test.

func (Machine) Mode

func (m Machine) Mode() Mode

Mode is always Normal.

func (Machine) State

func (m Machine) State() State

State returns the control state.

type Mode

type Mode uint8

Mode is derived from State.

const (
	Normal Mode
)

Mode values.

type Outcome

type Outcome uint8

Outcome reports what Fire did.

const (
	Moved   Outcome
	Invalid // an impossible state, event or transition, refused with the machine unchanged
)

Outcome values.

type State

type State uint8

State is the control state.

const (
	Even State
	Odd
)

State values.

Directories

Path Synopsis
Package clock is a helper with hidden state, standing in for a wall clock: each call returns a different value.
Package clock is a helper with hidden state, standing in for a wall clock: each call returns a different value.

Jump to

Keyboard shortcuts

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