1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-07-17 01:32:23 +02:00

fix: more tests

Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
Dr. Carsten Leue
2024-05-26 16:23:40 +02:00
parent 391754e5a6
commit fdff4e4735
2 changed files with 55 additions and 10 deletions

View File

@ -16,21 +16,13 @@
package option
import (
"fmt"
"testing"
TST "github.com/IBM/fp-go/internal/testing"
"github.com/stretchr/testify/assert"
)
func TestSequenceRecord(t *testing.T) {
assert.Equal(t, Of(map[string]string{
"a": "A",
"b": "B",
}), SequenceRecord(map[string]Option[string]{
"a": Of("A"),
"b": Of("B"),
}))
}
func TestCompactRecord(t *testing.T) {
// make the map
m := make(map[string]Option[int])
@ -45,3 +37,18 @@ func TestCompactRecord(t *testing.T) {
assert.Equal(t, exp, m1)
}
func TestSequenceRecord(t *testing.T) {
s := TST.SequenceRecordTest(
FromStrictEquals[bool](),
Pointed[string](),
Pointed[bool](),
Functor[map[string]string, bool](),
SequenceRecord[string, string],
)
for i := 0; i < 10; i++ {
t.Run(fmt.Sprintf("TestSequenceRecord %d", i), s(i))
}
}