summaryrefslogtreecommitdiff
path: root/src/pkg/regexp/exec_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/regexp/exec_test.go')
-rw-r--r--src/pkg/regexp/exec_test.go20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/pkg/regexp/exec_test.go b/src/pkg/regexp/exec_test.go
index 9dfaed713..70d069c06 100644
--- a/src/pkg/regexp/exec_test.go
+++ b/src/pkg/regexp/exec_test.go
@@ -9,7 +9,6 @@ import (
"compress/bzip2"
"fmt"
"io"
- "math/rand"
"os"
"path/filepath"
"regexp/syntax"
@@ -67,13 +66,6 @@ func TestRE2Search(t *testing.T) {
testRE2(t, "testdata/re2-search.txt")
}
-func TestRE2Exhaustive(t *testing.T) {
- if testing.Short() {
- t.Skip("skipping TestRE2Exhaustive during short test")
- }
- testRE2(t, "testdata/re2-exhaustive.txt.bz2")
-}
-
func testRE2(t *testing.T, file string) {
f, err := os.Open(file)
if err != nil {
@@ -650,11 +642,17 @@ func makeText(n int) []byte {
return text[:n]
}
text = make([]byte, n)
+ x := ^uint32(0)
for i := range text {
- if rand.Intn(30) == 0 {
+ x += x
+ x ^= 1
+ if int32(x) < 0 {
+ x ^= 0x88888eef
+ }
+ if x%31 == 0 {
text[i] = '\n'
} else {
- text[i] = byte(rand.Intn(0x7E+1-0x20) + 0x20)
+ text[i] = byte(x%(0x7E+1-0x20) + 0x20)
}
}
return text
@@ -691,7 +689,7 @@ func BenchmarkMatchEasy1_1K(b *testing.B) { benchmark(b, easy1, 1<<10) }
func BenchmarkMatchEasy1_32K(b *testing.B) { benchmark(b, easy1, 32<<10) }
func BenchmarkMatchEasy1_1M(b *testing.B) { benchmark(b, easy1, 1<<20) }
func BenchmarkMatchEasy1_32M(b *testing.B) { benchmark(b, easy1, 32<<20) }
-func BenchmarkMatchMedium_32(b *testing.B) { benchmark(b, medium, 1<<0) }
+func BenchmarkMatchMedium_32(b *testing.B) { benchmark(b, medium, 32<<0) }
func BenchmarkMatchMedium_1K(b *testing.B) { benchmark(b, medium, 1<<10) }
func BenchmarkMatchMedium_32K(b *testing.B) { benchmark(b, medium, 32<<10) }
func BenchmarkMatchMedium_1M(b *testing.B) { benchmark(b, medium, 1<<20) }