Skip to content

Instantly share code, notes, and snippets.

@rdammkoehler
Created September 17, 2011 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • 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