diff --git a/test/hsmr_test.rb b/test/hsmr_test.rb index bc9fc13..1f7181b 100644 --- a/test/hsmr_test.rb +++ b/test/hsmr_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class TestHSMR < Test::Unit::TestCase - test "generate a component " do + def generate_a_component component_1 = HSMR::Component.new(nil, HSMR::SINGLE) component_2 = HSMR::Component.new(nil, HSMR::DOUBLE) component_3 = HSMR::Component.new(nil, HSMR::TRIPLE) @@ -11,7 +11,7 @@ class TestHSMR < Test::Unit::TestCase assert_equal 24, component_3.length end - test "caclulation of single length component KCV values" do + def caclulation_of_single_length_component_KCV_values component_1 = HSMR::Component.new("6DBF C180 4A01 5BAD") assert_equal "029E60", component_1.kcv @@ -43,7 +43,7 @@ class TestHSMR < Test::Unit::TestCase assert_equal "D9F7B3", component_10.kcv end - test "should calculate double length key KCV values" do + def should_calculate_double_length_key_KCV_values key_1 = HSMR::Key.new("ADE3 9B38 0DBC DF38 AE02 AECE 64B3 4373") assert_equal "3002D5", key_1.kcv @@ -75,12 +75,12 @@ class TestHSMR < Test::Unit::TestCase assert_equal "50E3F8", key_10.kcv end - test "should detect odd_parity in a key" do + def should_detect_odd_parity_in_a_key odd_key = HSMR::Key.new("41A2AC14A90C583741A2AC14A90C5837") assert_false odd_key.odd_parity? end - test "should set double length key parity to odd" do + def should_set_double_length_key_parity_to_odd odd_key = HSMR::Key.new("41A2AC14A90C583741A2AC14A90C5837") odd_key.set_odd_parity @@ -90,12 +90,12 @@ class TestHSMR < Test::Unit::TestCase assert_equal odd_key.key, even_key.key end - test "should detect odd_parity in a component" do + def should_detect_odd_parity_in_a_component odd_component = HSMR::Component.new("41A2AC14A90C583741A2AC14A90C5837") assert_false odd_component.odd_parity? end - test "should set double length component parity to odd" do + def should_set_double_length_component_parity_to_odd odd_component = HSMR::Component.new("41A2AC14A90C583741A2AC14A90C5837") odd_component.set_odd_parity @@ -105,7 +105,7 @@ class TestHSMR < Test::Unit::TestCase assert_equal odd_component.component, even_component.component end - test "Converting string to ascii works" do + def converting_string_to_ascii_works key_string = "E57A DF5B CEA7 F42A DFD9 E554 07A2 F891" key = HSMR::Key.new(key_string) @@ -117,7 +117,7 @@ class TestHSMR < Test::Unit::TestCase assert_equal comp.to_s, key_string end - test "tests CVC / CVC2 calculations" do + def tests_CVC_CVC2_calculations # Component 1 Component 2 PAN EXP SCode CVC # 1234567890ABCDEF FEDCBA1234567890 5656565656565656 1010 ___ 922 # 1234567890ABCDEF FEDCBA1234567890 5656565656565656 1010 000 922 @@ -134,7 +134,7 @@ class TestHSMR < Test::Unit::TestCase #HSMR.cvv(kl, kr, "4509494222049051", "0907", "1010") end - test "Test PIN, PVV, CVV and CVV2 generation" do + def test_PIN_PVV_CVV_and_CVV2_generation cases=[] # Account Exp PIN PVV CVV2 CVV PGK1 PGK2 PVKI PVK1 PVK2 CVKA CVKB DEC # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 @@ -181,7 +181,7 @@ class TestHSMR < Test::Unit::TestCase end end - #test "cvv generation" do + #def cvv_generation # keya=HSMR::Key.new("0123456789ABCDEF") # keyb=HSMR::Key.new("FEDCBA1234567890") # key =HSMR::Key.new("0123456789ABCDEFFEDCBA1234567890")