TheAlgorithms-Ruby/ciphers/caesar_test.rb
Kaíque Kandy Koga db5a8181b6 Add Caesar
extra line
2021-07-25 16:21:30 -03:00

22 lines
485 B
Ruby

require 'minitest/autorun'
require_relative 'caesar'
class CaesarCipherTest < Minitest::Test
def test_shift4
run_tests('apple', 'ettpi', 4)
end
def test_shift27
run_tests('amateur', 'bnbufvs', 27)
end
private
def run_tests(plaintext, expected_cipher, shift)
encrypted = CaesarCipher.encrypt(plaintext, shift)
assert_equal encrypted, expected_cipher
decrypted = CaesarCipher.decrypt(encrypted, shift)
assert_equal decrypted, plaintext
end
end