-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
40 lines (35 loc) · 1.36 KB
/
main_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
package main
import (
"testing"
"gihub.com/deloitte-api/pkg/replace"
)
func TestReplace(t *testing.T) {
tests := []struct {
input string
want string
}{
// Test cases.
{"We really like the new security features of Google Cloud and Amazon", "We really like the new security features of Google© Cloud and Amazon©"},
{"We really like the new security features of Google Cloud, Google and Amazon", "We really like the new security features of Google© Cloud, Google© and Amazon©"},
{"We really like the new security features of Oracle", "We really like the new security features of Oracle©"},
{"We really like the new security features of Microsoft", "We really like the new security features of Microsoft©"},
{"We really like the new security features of Amazon", "We really like the new security features of Amazon©"},
{"We really like the new security features of Deloitte", "We really like the new security features of Deloitte©"},
}
for _, tt := range tests {
t.Run(tt.input, func(t *testing.T) {
result := replace.Replace(tt.input)
if result != tt.want {
t.Errorf("Return is incorrect, got %s", result)
}
})
}
}
var bench_string = "We really like the new security features of Google Cloud"
func BenchmarkReplace(b *testing.B) {
// TODO: Initialize
for i := 0; i < b.N; i++ {
// TODO: Your Code Here
replace.Replace(bench_string)
}
}