objtest

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package objtest is the conformance suite for the cacheobj contract. It IS the contract: any Cache[*Val] built by the supplied factory must pass Run, the same way cachetest.Run anchors the byte-cache family.

A factory (not a finished cache) is taken so the suite can construct caches with its own deterministic clock and assorted options.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, bounded bool, f Factory)

Run executes the full conformance suite against caches built by f. Bounded indicates whether f produces a capacity-bounded cache (some checks — LRU eviction — only apply when bounded).

Types

type Factory

type Factory func(opts ...cacheobj.Option) cacheobj.Cache[*Val]

Factory builds a Cache[*Val] from the given options. Implementations pass cacheobj.New[*Val]. The suite appends its own WithClock so it controls time.

type Val

type Val struct{ N int }

Val is the reference value type the suite caches. It is a pointer target so the suite can assert reference identity (the defining behavior: Get returns the same object that was Set).

Jump to

Keyboard shortcuts

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