package testing

import "github.com/IBM/fp-go/optics/lens/testing"

Index

Functions

func AssertLaws

func AssertLaws[S, A any](
	t *testing.T,
	eqa E.Eq[A],
	eqs E.Eq[S],
) func(l L.Lens[S, A]) func(s S, a A) bool

AssertLaws tests the lens laws

get(set(a)(s)) = a set(get(s))(s) = s set(a)(set(a)(s)) = set(a)(s)

func LensGet

func LensGet[S, A any](
	t *testing.T,
	eqa E.Eq[A],
) func(l L.Lens[S, A]) func(s S, a A) bool

LensGet tests the law: get(set(a)(s)) = a

func LensSet

func LensSet[S, A any](
	t *testing.T,
	eqs E.Eq[S],
) func(l L.Lens[S, A]) func(s S, a A) bool

LensSet tests the laws: set(get(s))(s) = s set(a)(set(a)(s)) = set(a)(s)

Source Files

laws.go

Version
v1.0.151 (latest)
Published
Nov 23, 2024
Platform
linux/amd64
Imports
4 packages
Last checked
5 months ago

Tools for package owners.