From f312016e0b70f38b48e509472680bbf6cde64179 Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Mon, 23 Sep 2019 14:26:34 -0400 Subject: Simplify --- caesar_test.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'caesar_test.go') diff --git a/caesar_test.go b/caesar_test.go index 674870c..43bdc1e 100644 --- a/caesar_test.go +++ b/caesar_test.go @@ -12,7 +12,7 @@ func TestEncode(t *testing.T) { } } -func TestLong(t *testing.T) { +func TestRepeatedEncode(t *testing.T) { if testing.Short() { t.Skip() } @@ -29,7 +29,7 @@ func TestLong(t *testing.T) { } } -func TestEncoderTable(t *testing.T) { +func TestEncodeTable(t *testing.T) { tests := []struct { in string out string @@ -47,6 +47,20 @@ func TestEncoderTable(t *testing.T) { } } +func TestCoder(t *testing.T) { + coder := Coder{Key: 1, Ranges: []RuneRange{{'a', 'z'}}} + t.Run("Encode", func(t *testing.T) { + if coder.Encode("abc") != "bcd" { + t.Fail() + } + }) + t.Run("Decode", func(t *testing.T) { + if coder.Decode("bcd") != "abc" { + t.Fail() + } + }) +} + func BenchmarkEncode(b *testing.B) { for i := 0; i < b.N; i++ { Encode("attack at dawn") -- cgit v1.2.3