Compare commits
2 Commits
ca2485b725
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 0324724fb7 | |||
| 7e5a65e281 |
+1
-1
@@ -81,7 +81,7 @@ func TestStringifyIntList(t *testing.T) {
|
|||||||
myList := intListGen().Draw(t, "myList")
|
myList := intListGen().Draw(t, "myList")
|
||||||
s := myList.String()
|
s := myList.String()
|
||||||
r := regexp.MustCompile(`^\([\d\s-]*\)$`)
|
r := regexp.MustCompile(`^\([\d\s-]*\)$`)
|
||||||
assert.Equal(t, true, r.Match([]byte(s)), s+" looks like a stringified list")
|
assert.True(t, r.Match([]byte(s)), s+" looks like a stringified list")
|
||||||
if !myList.IsEmpty() {
|
if !myList.IsEmpty() {
|
||||||
assert.Equal(t, myList.Len(), strings.Count(s, " ")+1, "number of spaces in string should match count of elements")
|
assert.Equal(t, myList.Len(), strings.Count(s, " ")+1, "number of spaces in string should match count of elements")
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+4
-4
@@ -56,11 +56,11 @@ func TestReadList(t *testing.T) {
|
|||||||
func StringifiedFormGen() *rapid.Generator[string] {
|
func StringifiedFormGen() *rapid.Generator[string] {
|
||||||
return rapid.OneOf(rapid.Custom(func(t *rapid.T) string {
|
return rapid.OneOf(rapid.Custom(func(t *rapid.T) string {
|
||||||
myList := list.Empty()
|
myList := list.Empty()
|
||||||
i := 200
|
i := 0
|
||||||
t.Repeat(map[string]func(*rapid.T){
|
t.Repeat(map[string]func(*rapid.T){
|
||||||
"conj": func(t *rapid.T) {
|
"conj": func(t *rapid.T) {
|
||||||
if i < 50 {
|
if i < 100 {
|
||||||
myList = myList.Conj(StringifiedFormGen().Draw(t, "el"))
|
myList = myList.Conj(rapid.Int().Draw(t, "el"))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -78,7 +78,7 @@ func StringifiedFormGen() *rapid.Generator[string] {
|
|||||||
func TestRead(t *testing.T) {
|
func TestRead(t *testing.T) {
|
||||||
rapid.Check(t, func(t *rapid.T) {
|
rapid.Check(t, func(t *rapid.T) {
|
||||||
input := StringifiedFormGen().Draw(t, "input")
|
input := StringifiedFormGen().Draw(t, "input")
|
||||||
_, err, _ := readForm(input, 0, "user")
|
_, err := ReadString(input)
|
||||||
assert.Nil(t, err, err)
|
assert.Nil(t, err, err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user