Created
March 12, 2009 00:47
-
-
Save julik/77845 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$KCODE = 'u' | |
require 'test/unit' | |
module Vodka | |
const_set("TАБЛИЦА", { | |
"R" => "Я", | |
"Y" => "Ч", | |
"U" => "Ц", | |
"B" => "Б", | |
"N" => "И", | |
"R" => "Я", | |
"O" => "Ф", | |
"S" => "З", | |
"F" => "Г", | |
"H" => "Н", | |
"C" => "С", | |
"A" => "А", | |
"P" => "Р" | |
}) | |
def to_crappy_vodka_name | |
Vodka.const_get("TАБЛИЦА").keys.zip(Vodka.const_get("TАБЛИЦА").values).inject(self) do | s, (f, t)| | |
s.gsub(/#{f}/, t) | |
end | |
end | |
end | |
String.send(:include, Vodka) | |
class VodkaTest < Test::Unit::TestCase | |
def test_vodka_name | |
assert_equal "ЯЦБЧ", "RUBY".to_crappy_vodka_name | |
assert_equal "НEIИEKEИ", "HEINEKEN".to_crappy_vodka_name | |
assert_equal "ЯEАСН", "REACH".to_crappy_vodka_name | |
assert_equal "САИИФT", "CANNOT".to_crappy_vodka_name | |
assert_equal "РАЯTЗ", "PARTS".to_crappy_vodka_name | |
assert_equal "ЯEГЯEЗНEЗ", "REFRESHES".to_crappy_vodka_name | |
assert_equal "РETЯФГГ ФЯ ЗЦСН ИФИЗEИЗE", "PETROFF OR SUCH NONSENSE".to_crappy_vodka_name | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment