summary refs log tree commit diff stats
path: root/go/two-fer/two_fer_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/two-fer/two_fer_test.go')
-rw-r--r--go/two-fer/two_fer_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/go/two-fer/two_fer_test.go b/go/two-fer/two_fer_test.go
new file mode 100644
index 0000000..f4ce158
--- /dev/null
+++ b/go/two-fer/two_fer_test.go
@@ -0,0 +1,31 @@
+package twofer
+
+import "testing"
+
+// Define a function ShareWith(string) string.
+
+var tests = []struct {
+	name, expected string
+}{
+	{"", "One for you, one for me."},
+	{"Alice", "One for Alice, one for me."},
+	{"Bob", "One for Bob, one for me."},
+}
+
+func TestShareWith(t *testing.T) {
+	for _, test := range tests {
+		if observed := ShareWith(test.name); observed != test.expected {
+			t.Fatalf("ShareWith(%s) = \"%v\", want \"%v\"", test.name, observed, test.expected)
+		}
+	}
+}
+
+func BenchmarkShareWith(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+
+		for _, test := range tests {
+			ShareWith(test.name)
+		}
+
+	}
+}
ta.io> 2019-12-20 00:14:09 -0800 committer Ensa <psychoticfervor@tuta.io> 2019-12-20 00:14:09 -0800 first significant commit' href='/ensa/cfg/commit/DEPENDENCIES.md?id=4684d80b6271dd775cd23dabf2b91d6ce56fa33a'>4684d80 ^
8fa69fc ^
4684d80 ^
8fa69fc ^
4684d80 ^







8fa69fc ^
4684d80 ^




8fa69fc ^


4684d80 ^
8fa69fc ^


4684d80 ^
4684d80 ^

















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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106