-
-
Save ga-wolf/f938a31a3ed666c05a28 to your computer and use it in GitHub Desktop.
Crypto Test Suite
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 'minitest/autorun' | |
require 'minitest/pride' | |
require 'pry' | |
require_relative './crypto_square' | |
class CryptoTest < MiniTest::Test | |
def test_normalize_strange_characters | |
# Calls the initialize method and instantiates the plaintext variable | |
crypto = Crypto.new('s#$%^&plunk') | |
# Checks to see if the result of normalize_plaintext on the new instance is equal to splunk | |
assert_equal "splunk", crypto.normalize_plaintext | |
end | |
def test_normalize_with_numbers | |
skip | |
crypto = Crypto.new('1, 2, 3 GO!') | |
assert_equal "123go", crypto.normalize_plaintext | |
end | |
def test_size_of_small_square | |
skip | |
crypto = Crypto.new('1234') | |
assert_equal 2, crypto.size | |
end | |
def test_size_of_slightly_larger_square | |
skip | |
crypto = Crypto.new('123456789') | |
assert_equal 3, crypto.size | |
end | |
def test_size_of_non_perfect_square | |
skip | |
crypto = Crypto.new('123456789abc') | |
assert_equal 4, crypto.size | |
end | |
def test_plaintext_segments | |
skip | |
crypto = Crypto.new('Never vex thine heart with idle woes') | |
assert_equal ["neverv", "exthin", "eheart", "withid", "lewoes"], crypto.plaintext_segments | |
end | |
def test_other_plaintext_segments | |
skip | |
crypto = Crypto.new('ZOMG! ZOMBIES!!!') | |
assert_equal ["zomg", "zomb", "ies"], crypto.plaintext_segments | |
end | |
def test_ciphertext | |
skip | |
crypto = Crypto.new('Time is an illusion. Lunchtime doubly so.') | |
assert_equal "tasneyinicdsmiohooelntuillibsuuml", crypto.ciphertext | |
end | |
def test_another_ciphertext | |
skip | |
crypto = Crypto.new('We all know interspecies romance is weird.') | |
assert_equal "wneiaweoreneawssciliprerlneoidktcms", crypto.ciphertext | |
end | |
def test_normalized_ciphertext | |
skip | |
crypto = Crypto.new('Madness, and then illumination.') | |
assert_equal 'msemo aanin dninn dlaet ltshu i', crypto.normalize_ciphertext | |
end | |
def test_more_normalized_ciphertext | |
skip | |
crypto = Crypto.new('Vampires are people too!') | |
assert_equal 'vrela epems etpao oirpo', crypto.normalize_ciphertext | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment