Unified · Split
| @@ -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 | ||
| 26 | func 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 | |||
| 26 | func genSlice(t *T) []uint64 { | 34 | func 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 | } |