summaryrefslogtreecommitdiff
path: root/caesar_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'caesar_test.go')
-rw-r--r--caesar_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/caesar_test.go b/caesar_test.go
new file mode 100644
index 0000000..e7dc3c0
--- /dev/null
+++ b/caesar_test.go
@@ -0,0 +1,17 @@
+package caesar
+
+import (
+ "testing"
+)
+
+func TestCaesar(t *testing.T) {
+ msg := "Attack at dawn"
+ encoded := Encode(msg)
+ if encoded == msg {
+ t.Errorf("expected ciphertext and plaintext to differ")
+ }
+ decoded := Decode(encoded)
+ if decoded != msg {
+ t.Errorf("expected recovered plaintext to match message, but got: %s", decoded)
+ }
+}