Class: TC_SolitaireCipher
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- TC_SolitaireCipher
show all
- Defined in:
- lib/quiz1/t/solutions/Jamis Buck/test/tc_solitaire-cipher.rb
Defined Under Namespace
Classes: MockAlgorithm, MockAlgorithms, MockDeck
Instance Method Summary
collapse
Instance Method Details
#test_decrypt_bad ⇒ Object
46
47
48
49
50
51
52
53
54
|
# File 'lib/quiz1/t/solutions/Jamis Buck/test/tc_solitaire-cipher.rb', line 46
def test_decrypt_bad
assert_raise( RuntimeError ) do
@cipher.decrypt( "not good" )
end
assert_raise( RuntimeError ) do
@cipher.decrypt( "BOGUS 12345" )
end
end
|
#test_decrypt_good ⇒ Object
56
57
58
59
60
61
62
63
64
|
# File 'lib/quiz1/t/solutions/Jamis Buck/test/tc_solitaire-cipher.rb', line 56
def test_decrypt_good
msg = "CLEPK HHNIY CFPWH FDFEH"
expected = "YOURCIPHERISWORKINGX"
assert_equal expected, @cipher.decrypt( msg )
msg = "ABVAW LWZSY OORYK DUPVH"
expected = "WELCOMETORUBYQUIZXXX"
assert_equal expected, @cipher.decrypt( msg )
end
|
#test_encrypt ⇒ Object
40
41
42
43
44
|
# File 'lib/quiz1/t/solutions/Jamis Buck/test/tc_solitaire-cipher.rb', line 40
def test_encrypt
msg = "Code in Ruby! Live longer."
expected = "GLNCQ MJAFF FVOMB JIYCB"
assert_equal expected, @cipher.encrypt( msg )
end
|
#test_use_algorithm ⇒ Object
34
35
36
37
38
|
# File 'lib/quiz1/t/solutions/Jamis Buck/test/tc_solitaire-cipher.rb', line 34
def test_use_algorithm
@cipher.use_algorithm "mock"
assert_equal "FCJJM", @cipher.encrypt( "HELLO" )
assert_equal "JGNNQ", @cipher.decrypt( "HELLO" )
end
|