ShuffleStrings uses a seeded rand object
This commit is contained in:
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package rand
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
@@ -35,3 +36,17 @@ func TestString(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPerm(t *testing.T) {
|
||||
Seed(5)
|
||||
rand.Seed(5)
|
||||
for i := 1; i < 20; i++ {
|
||||
actual := Perm(i)
|
||||
expected := rand.Perm(i)
|
||||
for j := 0; j < i; j++ {
|
||||
if actual[j] != expected[j] {
|
||||
t.Errorf("Perm call result is unexpected")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user