forked from segmentio/go-snakecase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmarks_test.go
84 lines (74 loc) · 1.54 KB
/
benchmarks_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package snakecase
import (
"testing"
)
func BenchmarkUnchangedLong(b *testing.B) {
var s = "invite_your_customers_add_invites"
b.SetBytes(int64(len(s)))
for n := 0; n < b.N; n++ {
Snakecase(s)
}
}
func BenchmarkUnchangedSimple(b *testing.B) {
var s = "sample_text"
b.SetBytes(int64(len(s)))
for n := 0; n < b.N; n++ {
Snakecase(s)
}
}
func BenchmarkModifiedUnicode(b *testing.B) {
var s = "ß_ƒ_foo"
b.SetBytes(int64(len(s)))
for n := 0; n < b.N; n++ {
Snakecase(s)
}
}
func BenchmarkModifiedLong(b *testing.B) {
var s = "inviteYourCustomersAddInvites"
b.SetBytes(int64(len(s)))
for n := 0; n < b.N; n++ {
Snakecase(s)
}
}
func BenchmarkModifiedLongSpecialChars(b *testing.B) {
var s = "FOO:BAR$BAZ__Sample Text___"
b.SetBytes(int64(len(s)))
for n := 0; n < b.N; n++ {
Snakecase(s)
}
}
func BenchmarkModifiedSimple(b *testing.B) {
var s = "sample text"
b.SetBytes(int64(len(s)))
for n := 0; n < b.N; n++ {
Snakecase("sample text")
}
}
func BenchmarkModifiedUnicode2(b *testing.B) {
var s = "ẞ•¶§ƒ˚foo˙∆˚¬"
b.SetBytes(int64(len(s)))
for n := 0; n < b.N; n++ {
Snakecase(s)
}
}
func BenchmarkLeadingUnderscoresDigitUpper(b *testing.B) {
var s = "_5TEst"
b.SetBytes(int64(len(s)))
for n := 0; n < b.N; n++ {
Snakecase(s)
}
}
func BenchmarkDigitUpper(b *testing.B) {
var s = "5TEst"
b.SetBytes(int64(len(s)))
for n := 0; n < b.N; n++ {
Snakecase(s)
}
}
func BenchmarkDigitUpper2(b *testing.B) {
var s = "lk0B@bFmjrLQ_Z6YL"
b.SetBytes(int64(len(s)))
for n := 0; n < b.N; n++ {
Snakecase(s)
}
}