fakes

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package fakes holds the deterministic test doubles wowapi injects through the same constructors production uses (08 §2): a manual-advance clock and a deterministic IDGen. No test hooks live in production code — tests supply these where production supplies real implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

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

Clock is a manual-advance fake time source. It satisfies the ambient interface{ Now() time.Time } the kernel expects, but never moves on its own — tests call Advance to make time pass deterministically. Safe for concurrent use.

func NewClock

func NewClock(start time.Time) *Clock

NewClock returns a Clock pinned at start.

func (*Clock) Advance

func (c *Clock) Advance(d time.Duration)

Advance moves the clock forward by d.

func (*Clock) Now

func (c *Clock) Now() time.Time

Now returns the current fake time.

type IDGen

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

IDGen is a deterministic model.IDGen: every New() encodes a seed in byte 0 and a big-endian counter in the last 8 bytes, with valid RFC 4122 v7 version and variant bits set. The result is stable across runs and readable in failure output — e.g. seed 0x01, first call → 01000000-0000-7000-8000-000000000001. Safe for concurrent use.

func NewIDGen

func NewIDGen(seed byte) *IDGen

NewIDGen returns a deterministic generator whose UUIDs carry seed in byte 0.

func (*IDGen) New

func (g *IDGen) New() uuid.UUID

New returns the next UUID in the deterministic sequence.

Jump to

Keyboard shortcuts

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