Sha256: 66e715e466170503e423ecf8718a74a76c89778d7c8ea36a0d2f3101788fe7f7

Contents?: true

Size: 1.35 KB

Versions: 7

Compression:

Stored size: 1.35 KB

Contents

require 'test_helper'
require 'indirizzo/numbers'

include Indirizzo

class TestAddress < Test::Unit::TestCase
  def test_number_to_cardinal
    assert_equal 'one', Cardinals[1]
    assert_equal 'ten', Cardinals[10] 
    assert_equal 'twelve', Cardinals[12] 
    assert_equal 'eighty-seven', Cardinals[87]
  end

  def test_cardinal_to_number
    assert_equal 1,   Cardinals['one'] 
    assert_equal 1,   Cardinals['One']
    assert_equal 10,  Cardinals['ten']
    assert_equal 12,  Cardinals['twelve']
    assert_equal 87,  Cardinals['eighty-seven']
    assert_equal 87,  Cardinals['eighty seven']
    assert_equal 87,  Cardinals['eightyseven']
  end

  def test_number_to_ordinal
    assert_equal 'first', Ordinals[1]
    assert_equal 'second', Ordinals[2]
    assert_equal 'tenth', Ordinals[10] 
    assert_equal 'twelfth', Ordinals[12] 
    assert_equal 'twentieth', Ordinals[20]
    assert_equal 'twenty-second', Ordinals[22]
    assert_equal 'eighty-seventh', Ordinals[87]
  end

  def test_ordinal_to_number
    assert_equal 1,   Ordinals['first'] 
    assert_equal 1,   Ordinals['First']
    assert_equal 10,  Ordinals['tenth']
    assert_equal 12,  Ordinals['twelfth']
    assert_equal 73,  Ordinals['seventy-third']
    assert_equal 74,  Ordinals['seventy  fourth']
    assert_equal 75,  Ordinals['seventyfifth']
    assert_equal nil, Ordinals['seventy-eleventh']
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
HornsAndHooves-indirizzo-0.1.7.1 test/test_numbers.rb
Indirizzo-0.1.7 test/test_numbers.rb
Indirizzo-0.1.5 test/test_numbers.rb
Indirizzo-0.1.4 test/test_numbers.rb
Indirizzo-0.1.3 test/test_numbers.rb
Indirizzo-0.1.1 test/test_numbers.rb
Indirizzo-0.1.0 test/test_numbers.rb