Skip to content

Instantly share code, notes, and snippets.

@rdammkoehler
Created September 17, 2011 17:39
Show Gist options
  • Save rdammkoehler/1224169 to your computer and use it in GitHub Desktop.
Save rdammkoehler/1224169 to your computer and use it in GitHub Desktop.
Teaching my 10yr old daughter about ROT-13
require 'test/unit'
$alphabet = 'abcdefghijklmnopqrstuvwxyz'
$rot13 = 'nopqrstuvwxyzabcdefghijklm'
class Rot13 < Test::Unit::TestCase
@@message = "the quick brown fox jumps over the lazy dog"
@@encoded = "gur dhvpx oebja sbk whzcf bire gur ynml qbt"
def test_encode
assert_equal @@encoded, @@message.tr($alphabet, $rot13)
end
def test_decode
assert_equal @@message, @@encoded.tr($rot13, $alphabet)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment