summaryrefslogtreecommitdiff
path: root/caesar_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'caesar_test.go')
-rw-r--r--caesar_test.go21
1 files changed, 19 insertions, 2 deletions
diff --git a/caesar_test.go b/caesar_test.go
index e7dc3c0..04b853b 100644
--- a/caesar_test.go
+++ b/caesar_test.go
@@ -4,14 +4,31 @@ import (
"testing"
)
+func TestEncode(t *testing.T) {
+ msg := "Attack at dawn"
+ if Encode(msg) != "Dwwdfn dw gdzq" {
+ t.Fail()
+ }
+}
+
func TestCaesar(t *testing.T) {
+ if testing.Short() {
+ t.Skip()
+ }
msg := "Attack at dawn"
+ t.Logf("testing encoding message %s", msg)
encoded := Encode(msg)
if encoded == msg {
- t.Errorf("expected ciphertext and plaintext to differ")
+ t.Log("expected ciphertext and plaintext to differ")
+ t.Fail()
}
decoded := Decode(encoded)
if decoded != msg {
- t.Errorf("expected recovered plaintext to match message, but got: %s", decoded)
+ t.Logf("expected recovered plaintext to match message, but got: %s", decoded)
+ t.Fail()
}
}
+
+func BenchmarkCaesar(b *testing.B) {
+ b.Fail()
+}