summaryrefslogtreecommitdiff
path: root/go/bob/bob_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/bob/bob_test.go')
-rw-r--r--go/bob/bob_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/go/bob/bob_test.go b/go/bob/bob_test.go
new file mode 100644
index 0000000..e53226d
--- /dev/null
+++ b/go/bob/bob_test.go
@@ -0,0 +1,30 @@
+package bob
+
+import "testing"
+
+const targetTestVersion = 2
+
+func TestHeyBob(t *testing.T) {
+ if testVersion != targetTestVersion {
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
+ }
+ for _, tt := range testCases {
+ actual := Hey(tt.input)
+ if actual != tt.expected {
+ msg := `
+ ALICE (%s): %q
+ BOB: %s
+
+ Expected Bob to respond: %s`
+ t.Fatalf(msg, tt.description, tt.input, actual, tt.expected)
+ }
+ }
+}
+
+func BenchmarkBob(b *testing.B) {
+ for _, tt := range testCases {
+ for i := 0; i < b.N; i++ {
+ Hey(tt.input)
+ }
+ }
+}