summaryrefslogtreecommitdiff
path: root/libgo/go/utf8/string_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/utf8/string_test.go')
-rw-r--r--libgo/go/utf8/string_test.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/libgo/go/utf8/string_test.go b/libgo/go/utf8/string_test.go
index 9dd84724730..f376b628c73 100644
--- a/libgo/go/utf8/string_test.go
+++ b/libgo/go/utf8/string_test.go
@@ -45,7 +45,12 @@ func TestScanBackwards(t *testing.T) {
}
}
-const randCount = 100000
+func randCount() int {
+ if testing.Short() {
+ return 100
+ }
+ return 100000
+}
func TestRandomAccess(t *testing.T) {
for _, s := range testStrings {
@@ -58,7 +63,7 @@ func TestRandomAccess(t *testing.T) {
t.Errorf("%s: expected %d runes; got %d", s, len(runes), str.RuneCount())
break
}
- for j := 0; j < randCount; j++ {
+ for j := 0; j < randCount(); j++ {
i := rand.Intn(len(runes))
expect := runes[i]
got := str.At(i)
@@ -80,7 +85,7 @@ func TestRandomSliceAccess(t *testing.T) {
t.Errorf("%s: expected %d runes; got %d", s, len(runes), str.RuneCount())
break
}
- for k := 0; k < randCount; k++ {
+ for k := 0; k < randCount(); k++ {
i := rand.Intn(len(runes))
j := rand.Intn(len(runes) + 1)
if i > j { // include empty strings