History

Test that Custom() can generate interface{}

Gregory Petrosyan committed 6 years ago

Commit 0d4e2bb1 parent d17ccdb1 file · +9 −0Browse files

Unified · Split

combinators_external_test.go+9−0
@@ -23,6 +23,14 @@ func genBool(t *T) bool { · 22 unmodified lines
23 return Boolean().Draw(t, "").(bool)23 return Boolean().Draw(t, "").(bool)
24}24}
25 25
26func genInterface(t *T) interface{} {
27 if Boolean().Draw(t, "coinflip").(bool) {
28 return Int8().Draw(t, "")
29 } else {
30 return Float64().Draw(t, "")
31 }
32}
33
26func genSlice(t *T) []uint64 {34func genSlice(t *T) []uint64 {
27 return []uint64{35 return []uint64{
28 Uint64().Draw(t, "").(uint64),36 Uint64().Draw(t, "").(uint64),
@@ -42,6 +50,7 @@ func TestCustom(t *testing.T) { · 13 unmodified lines
42 50
43 gens := []*Generator{51 gens := []*Generator{
44 Custom(genBool),52 Custom(genBool),
53 Custom(genInterface),
45 Custom(genSlice),54 Custom(genSlice),
46 Custom(genStruct),55 Custom(genStruct),
47 }56 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t