MCPcopy Create free account
hub / github.com/google/pprof / interleave

Function interleave

internal/driver/interactive_test.go:160–177  ·  view source on GitHub ↗
(input []string, seed int64)

Source from the content-addressed store, hash-verified

158}
159
160func 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
179func TestInteractiveCommands(t *testing.T) {
180 type interactiveTestcase struct {

Callers 1

TestShellFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…