How erdii/matrix works
Matrix is a small Go library for generating Cartesian products of test dimensions. A test author calls Generate with a struct prototype and one value slice per exported field; the API validates the inputs, creates a lazy iterator, and materializes one struct per combination as the consumer ranges over it. GenerateAndCollect provides an eager slice variant. The runtime map is based on README and the sampled matrix.go implementation.
Components 7
Matrix Runtime
- Generate API
matrix.go - Input Validation
matrix.go - Cartesian Iterator
matrix.go - Case Materializer
matrix.go - GenerateAndCollect API
matrix.go
Other components
- Test Author
- Test Consumer
Connections 9
- Test Author → Generate API: calls
- Generate API → Input Validation: validates inputs
- Generate API → Cartesian Iterator: creates iterator
- Cartesian Iterator → Case Materializer: builds cases
- Cartesian Iterator → Test Consumer: yields cases
- Test Author → GenerateAndCollect API: calls
- GenerateAndCollect API → Generate API: calls
- Generate API → GenerateAndCollect API: returns iterator
- GenerateAndCollect API → Test Consumer: returns slice