summaryrefslogtreecommitdiff
path: root/caesar_test.go
diff options
context:
space:
mode:
authorBen Burwell <ben@benburwell.com>2019-09-12 16:21:08 -0400
committerBen Burwell <ben@benburwell.com>2019-09-12 16:30:00 -0400
commit528352cddbe0290653c56a27a4134637ad0624e5 (patch)
tree4cb4b626ec97b3256e6187670d5888449cdf6350 /caesar_test.go
Initial commit
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)
+ }
+}