stash_test library

Provides testing support to third party extensions

Classes

BoolGenerator
A bool implementation of a ValueGenerator which produces a bool from a provided seed
DoubleGenerator
A double implementation of a ValueGenerator which produces a double from a provided seed
IntGenerator
A int implementation of a ValueGenerator which produces a int from a provided seed
IteratorGenerator
A Iterator implementation of a ValueGenerator which produces a Iterator from a provided seed and a element ValueGenerator
MapGenerator
A Map implementation of a ValueGenerator which produces a Map from a provided seed
SampleClass
A sample class used to test class serialization / deserialization scenarios
SampleClassGenerator
A SampleClass implementation of a ValueGenerator which produces a SampleClass from a provided seed
StringGenerator
A String implementation of a ValueGenerator which produces a String from a provided seed and a optional prefix
TestContext<T extends CacheStore>
Base class for all the test contexts.
ValueGenerator
Generic definition of a value generator

Enums

CacheTest
The supported cache tests
StoreTest
The supported cache tests
TypeTest
The range of supported type tests

Extensions

TypeTestValue on TypeTest

Properties

typeTests Map<TypeTest, ValueGenerator Function()>
List of type tests
getter/setter pair

Functions

check<T extends CacheStore>(TestContext<T> ctx, dynamic actual, dynamic matcher, String reason) → void
Assert that actual matches matcher in a specific test ctx.
newDefaultCache<T extends CacheStore>(T store, {String? name, ExpiryPolicy? expiryPolicy, KeySampler? sampler, EvictionPolicy? evictionPolicy, int? maxEntries, CacheLoader? cacheLoader, Clock? clock, EventListenerMode? eventListenerMode}) → Cache
Creates a new DefaultCache bound to an implementation of the CacheStore interface
newEntry(ValueGenerator generator, int seed, {String? key, DateTime? expiryTime, DateTime? creationTime, DateTime? accessTime, DateTime? updateTime, int? hitCount}) → CacheEntry
Creates a new CacheEntry with the provided ValueGenerator and seed
testCache<T extends CacheStore>(TestContextBuilder<T> newTestContext, {Map<TypeTest, Function>? types, Set<CacheTest> tests = _cacheTests}) → void
Default cache test
testCacheWith<T extends CacheStore>(TestContext<T> ctx, {Set<CacheTest> tests = _cacheTests}) Future<void>
Entry point for the cache testing harness. It delegates most of the construction to user provided functions that are responsible for the CacheStore creation, the Cache creation and by the generation of testing values (with a provided ValueGenerator instance). They are encapsulated in provided TestContext object
testStore<T extends CacheStore>(TestContextBuilder<T> newTestContext, {Map<TypeTest, Function>? types, Set<StoreTest> tests = _storeTests}) → void
Default store test
testStoreWith<T extends CacheStore>(TestContext<T> ctx, {Set<StoreTest> tests = _storeTests}) Future<void>
Entry point for the store testing harness. It delegates most of the construction to user provided functions that are responsible for the CacheStore creation, and the generation of testing values (with a provided ValueGenerator instance). They are encapsulated in provided TestContext object

Typedefs

CacheBuilder<T extends CacheStore> = DefaultCache Function(T store, {CacheLoader cacheLoader, Clock clock, EvictionPolicy evictionPolicy, ExpiryPolicy expiryPolicy, int maxEntries, String name, KeySampler sampler})
Cache builder function
StoreBuilder<T extends CacheStore> = Future<T> Function()
Store builder function
TestContextBuilder<T extends CacheStore> = TestContext<T> Function(ValueGenerator generator)
TestContext builder function