Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1446)

Side by Side Diff: src/pkg/bytes/bytes_test.go

Issue 8056043: code review 8056043: runtime: Implement faster equals for strings and bytes. (Closed)
Patch Set: diff -r d040d5f08d5d https://khr%40golang.org@code.google.com/p/go/ Created 11 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package bytes_test 5 package bytes_test
6 6
7 import ( 7 import (
8 . "bytes" 8 . "bytes"
9 "math/rand" 9 "math/rand"
10 "reflect" 10 "reflect"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 {[]byte(""), []byte(""), 0}, 54 {[]byte(""), []byte(""), 0},
55 {[]byte("a"), []byte(""), 1}, 55 {[]byte("a"), []byte(""), 1},
56 {[]byte(""), []byte("a"), -1}, 56 {[]byte(""), []byte("a"), -1},
57 {[]byte("abc"), []byte("abc"), 0}, 57 {[]byte("abc"), []byte("abc"), 0},
58 {[]byte("ab"), []byte("abc"), -1}, 58 {[]byte("ab"), []byte("abc"), -1},
59 {[]byte("abc"), []byte("ab"), 1}, 59 {[]byte("abc"), []byte("ab"), 1},
60 {[]byte("x"), []byte("ab"), 1}, 60 {[]byte("x"), []byte("ab"), 1},
61 {[]byte("ab"), []byte("x"), -1}, 61 {[]byte("ab"), []byte("x"), -1},
62 {[]byte("x"), []byte("a"), 1}, 62 {[]byte("x"), []byte("a"), 1},
63 {[]byte("b"), []byte("x"), -1}, 63 {[]byte("b"), []byte("x"), -1},
64 {[]byte("abcdefgh"), []byte("abcdefgh"), 0},
bradfitz 2013/03/27 23:35:20 comment above this line about what these are testi
65 {[]byte("abcdefghi"), []byte("abcdefghi"), 0},
66 {[]byte("abcdefghi"), []byte("abcdefghj"), -1},
64 // nil tests 67 // nil tests
65 {nil, nil, 0}, 68 {nil, nil, 0},
66 {[]byte(""), nil, 0}, 69 {[]byte(""), nil, 0},
67 {nil, []byte(""), 0}, 70 {nil, []byte(""), 0},
68 {[]byte("a"), nil, 1}, 71 {[]byte("a"), nil, 1},
69 {nil, []byte("a"), -1}, 72 {nil, []byte("a"), -1},
70 } 73 }
71 74
72 func TestCompare(t *testing.T) { 75 func TestCompare(t *testing.T) {
73 for _, tt := range compareTests { 76 for _, tt := range compareTests {
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 FieldsFunc(fieldsInput, unicode.IsSpace) 1076 FieldsFunc(fieldsInput, unicode.IsSpace)
1074 } 1077 }
1075 } 1078 }
1076 1079
1077 func BenchmarkTrimSpace(b *testing.B) { 1080 func BenchmarkTrimSpace(b *testing.B) {
1078 s := []byte(" Some text. \n") 1081 s := []byte(" Some text. \n")
1079 for i := 0; i < b.N; i++ { 1082 for i := 0; i < b.N; i++ {
1080 TrimSpace(s) 1083 TrimSpace(s)
1081 } 1084 }
1082 } 1085 }
OLDNEW
« no previous file with comments | « src/pkg/bytes/asm_arm.s ('k') | src/pkg/runtime/alg.c » ('j') | src/pkg/runtime/mapspeed_test.go » ('J')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b