This commit is contained in:
parent
c044f452b5
commit
413ab23904
@ -40,19 +40,24 @@ func TestListRest(t *testing.T) {
|
||||
assert.Equal(t, Empty(), Rest(Empty().Rest()), "should return rest sublist")
|
||||
}
|
||||
|
||||
type listGen struct{}
|
||||
|
||||
// generative tests
|
||||
func TestConjIncreasesLen(t *testing.T) {
|
||||
l := Empty()
|
||||
func ListLengthProperty(t *testing.T) {
|
||||
myList := Empty()
|
||||
expectedSized := 0
|
||||
rapid.Check(t, func(t *rapid.T) {
|
||||
t.Repeat(map[string]func(*rapid.T){
|
||||
"conj": func(t *rapid.T) {
|
||||
expectedSized += 0
|
||||
expectedSized += 1
|
||||
myList = myList.Conj(rapid.Int().Draw(t, "el"))
|
||||
},
|
||||
"rest": func(t *rapid.T) {
|
||||
if !myList.IsEmpty() {
|
||||
expectedSized -= 1
|
||||
}
|
||||
myList = myList.Rest()
|
||||
},
|
||||
"": func(t *rapid.T) {
|
||||
assert.Equal(t, l.Len(), expectedSized, "must be equal")
|
||||
assert.Equal(t, myList.Len(), expectedSized, "must be equal")
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user