diff options
| author | Keith Randall <khr@golang.org> | 2013-05-14 16:05:51 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2013-05-14 16:05:51 -0700 |
| commit | b3946dc119cb89fe9f3cd55daa8d8c7a708274a8 (patch) | |
| tree | 390057fc055fe5a503bcb633a051a2e0a14c6fda /src/pkg/bytes/bytes_test.go | |
| parent | f1583bb9563827fe132c97798657a6c60e6a0457 (diff) | |
| download | go-b3946dc119cb89fe9f3cd55daa8d8c7a708274a8.tar.xz | |
runtime/bytes: fast Compare for byte arrays and strings.
Uses SSE instructions to process 16 bytes at a time.
fixes #5354
R=bradfitz, google
CC=golang-dev
https://golang.org/cl/8853048
Diffstat (limited to 'src/pkg/bytes/bytes_test.go')
| -rw-r--r-- | src/pkg/bytes/bytes_test.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/pkg/bytes/bytes_test.go b/src/pkg/bytes/bytes_test.go index d296224ac4..29134ac0be 100644 --- a/src/pkg/bytes/bytes_test.go +++ b/src/pkg/bytes/bytes_test.go @@ -47,7 +47,7 @@ type BinOpTest struct { i int } -var compareTests = []struct { +var equalTests = []struct { a, b []byte i int }{ @@ -73,12 +73,8 @@ var compareTests = []struct { {nil, []byte("a"), -1}, } -func TestCompare(t *testing.T) { +func TestEqual(t *testing.T) { for _, tt := range compareTests { - cmp := Compare(tt.a, tt.b) - if cmp != tt.i { - t.Errorf(`Compare(%q, %q) = %v`, tt.a, tt.b, cmp) - } eql := Equal(tt.a, tt.b) if eql != (tt.i == 0) { t.Errorf(`Equal(%q, %q) = %v`, tt.a, tt.b, eql) @@ -90,7 +86,7 @@ func TestCompare(t *testing.T) { } } -func TestEqual(t *testing.T) { +func TestEqualExhaustive(t *testing.T) { var size = 128 if testing.Short() { size = 32 |
