Sha256: ea58e3e3719cbfe373908bece3331c5dde177417e7b4ac7a6281b452fea698da

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

require 'test/unit'
require 'test/framework'

require 'units'

class TC_unit_ambiguity < Test::Unit::TestCase
  
  understands UnitsTest

  def test_unit_ambiguity
    
    Units.create :volume do |m|
      m.system :english do |s|
        s.unit :name => :ounce, :abbrev => :oz
      end
    end
    volume_ounce = Units.volume.english.ounce
    Units.create :mass do |m|
      m.system :english do |s|
        s.unit :name => :ounce, :abbrev => :oz
      end
    end
    mass_ounce = Units.mass.english.ounce
    
    assert(volume_ounce.equals.unit == {volume_ounce => 1})
    assert(mass_ounce.equals.unit == {mass_ounce => 1})
    
    Units.create :volume do |m|
      m.system :english do |s|
        s.unit :name => :cup, :abbrev => :c, :equals => 16.ounces
      end
    end
    cup = Units.volume.english.cup
    assert(cup.equals.unit == {volume_ounce => 1})

    Units.create :mass do |m|
      m.system :english do |s|
        s.unit :name => :pound, :abbrev => :lb, :equals => 16.ounces
      end
    end
    pound = Units.mass.english.pound
    assert(pound.equals.unit == {mass_ounce => 1})
    
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eymiha_units-0.1.0 test/tc_unit_ambiguity.rb