(input []string, seed int64)
| 158 | } |
| 159 | |
| 160 | func interleave(input []string, seed int64) []string { |
| 161 | var inputs [][]string |
| 162 | for _, s := range input { |
| 163 | inputs = append(inputs, strings.Split(s, ";")) |
| 164 | } |
| 165 | rand := rand.New(rand.NewSource(seed)) |
| 166 | var output []string |
| 167 | for len(inputs) > 0 { |
| 168 | next := rand.Intn(len(inputs)) |
| 169 | output = append(output, inputs[next][0]) |
| 170 | if tail := inputs[next][1:]; len(tail) > 0 { |
| 171 | inputs[next] = tail |
| 172 | } else { |
| 173 | inputs = append(inputs[:next], inputs[next+1:]...) |
| 174 | } |
| 175 | } |
| 176 | return output |
| 177 | } |
| 178 | |
| 179 | func TestInteractiveCommands(t *testing.T) { |
| 180 | type interactiveTestcase struct { |
no outgoing calls
no test coverage detected
searching dependent graphs…