Sha256: 56e3fcd6e89b5c84bf65810215e2ae35193999a3078e8cb5b52544daf94fe58d
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
# encoding: UTF-8 $:.unshift File.expand_path( '../lib/', File.dirname( __FILE__)) require 'minitest/autorun' require 'luhnar' class LuhnarTest < MiniTest::Unit::TestCase DATA = %w( 89490240001434017831 89490240001434017849 89490240001434017856 89490240001434017864 89490240001434017872 89490240001434017880 89490240001434017898 89490240001434017906 89490240001434017914 89490240001434017922 89490240001434017930 89490240001434017948 89490240001434017955 89490240001434017963 89490240001434017971 89490240001434017989 89490240001434017997 89490240001434018003 89490240001434018011 89490240001434018029 89490240001434018037 89490240001434018045 89490240001434018052 89490240001434018060 89490240001434018078 89490240001434018086 89490240001434018094 89490240001434018102 89490240001434018110 89490240001434018128 89490240001434018136 89490240001434018144 89490240001434018151 89490240001434018169 ) def test_compute_all DATA.each do |i| i.chomp! digit = i.slice(-1..-1) number = i.chop assert_equal digit.to_i, Luhnar.compute( number ) end end def test_compute assert_equal 3, Luhnar.compute( '8949024000143401782' ) end def test_compute_number assert_equal 3, Luhnar.compute( 8949024000143401782 ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
luhnar-1.0.1 | test/luhnar_test.rb |
luhnar-1.0.0 | test/luhnar_test.rb |