This repository has been archived by the owner on Mar 30, 2023. It is now read-only.
forked from PullRequestInc/go-gpt3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpt3_interview_test.go
78 lines (72 loc) · 1.88 KB
/
gpt3_interview_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
package gpt3
import (
"testing"
)
func TestStripLeadingNumbers(t *testing.T) {
type testCase struct {
name string
call func() string
expected string
}
testCases := []testCase{
{
"Paren Space",
func() string {
return stripLeadingNumbers("3) How has NetSuite helped you manage your construction business?")
},
"How has NetSuite helped you manage your construction business?",
},
{
"Period Space",
func() string {
return stripLeadingNumbers("3. How has NetSuite helped you manage your construction business?")
},
"How has NetSuite helped you manage your construction business?",
},
{
"No Space",
func() string {
return stripLeadingNumbers("3.How has NetSuite helped you manage your construction business?")
},
"How has NetSuite helped you manage your construction business?",
},
{
"Period embedded parens",
func() string {
return stripLeadingNumbers("3. What NAS Solutions (enterprise and scale-out) are you familiar with?")
},
"What NAS Solutions (enterprise and scale-out) are you familiar with?",
},
{
"No hits",
func() string {
return stripLeadingNumbers("How has NetSuite helped you manage your construction business?")
},
"How has NetSuite helped you manage your construction business?",
},
{
"Spaces trimmed",
func() string {
return stripLeadingNumbers(" How has NetSuite helped you manage your construction business? ")
},
"How has NetSuite helped you manage your construction business?",
},
{
"Empty string",
func() string {
return stripLeadingNumbers("")
},
"",
},
}
//3. What NAS Solutions (enterprise and scale-out) are you familiar with?
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
result := tc.call()
if result != tc.expected {
t.Errorf("\nGot: '%s'\nExpected: '%s'", result, tc.expected)
return
}
})
}
}