-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created crack class and crack test. Also checked passing args inside …
…class.
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Crack | ||
attr_reader :encrypted_message, | ||
:date | ||
def initialize(encrypted_message, | ||
date = Date.today.strftime('%d%m%y')) | ||
|
||
@encrypted_message = encrypted_message | ||
@date = date | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
require 'minitest/autorun' | ||
require 'minitest/pride' | ||
require './lib/key_generator' | ||
require './lib/offset' | ||
require './lib/encryptor' | ||
require './lib/decryptor' | ||
require './lib/enigma' | ||
require './lib/crack' | ||
|
||
class CrackTest < Minitest::Test | ||
|
||
def test_does_it_exisit | ||
crack = Crack.new('ksadfkcdfkdls', '070218') | ||
|
||
assert_instance_of Crack, crack | ||
end | ||
|
||
def test_it_can_pass_encrypted_message | ||
crack = Crack.new('ksadfkcdfkdls', '070218') | ||
|
||
assert_equal 'ksadfkcdfkdls', crack.encrypted_message | ||
assert_equal '070218', crack.date | ||
end | ||
|
||
def test_can_compare_encrypted_and_decrypted_index_position | ||
crack = Crack.new('5', '070218') | ||
|
||
assert_equal 3, crack.compare_position | ||
|
||
end | ||
end |