Created
September 17, 2011 17:39
-
-
Save rdammkoehler/1224169 to your computer and use it in GitHub Desktop.
Teaching my 10yr old daughter about ROT-13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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