Unified · Split
| @@ -23,6 +23,14 @@ func genBool(t *T) bool { · 22 unmodified lines | ||
| 23 | 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 | 34 | func genSlice(t *T) []uint64 { |
| 27 | 35 | return []uint64{ |
| 28 | 36 | Uint64().Draw(t, "").(uint64), |
| @@ -42,6 +50,7 @@ func TestCustom(t *testing.T) { · 13 unmodified lines | ||
| 42 | 50 | |
| 43 | 51 | gens := []*Generator{ |
| 44 | 52 | Custom(genBool), |
| 53 | + Custom(genInterface), | |
| 45 | 54 | Custom(genSlice), |
| 46 | 55 | Custom(genStruct), |
| 47 | 56 | } |