summaryrefslogtreecommitdiff
path: root/libgo/go/utf8/string_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-03-30 15:33:16 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-03-30 15:33:16 +0000
commitf72f4169133572cf62f1e872c5657cdbc4d5de2c (patch)
tree9382d76e5dc68294cdf3c4f2c03a9f61b44fb014 /libgo/go/utf8/string_test.go
parentf2034d064c29d9620c5562b2b5b517bdc6c7a672 (diff)
downloadgcc-f72f4169133572cf62f1e872c5657cdbc4d5de2c.tar.gz
Update to current Go library.
From-SVN: r171732
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