Sha256: 7cca9a41fa38a89bf664cf5c24ff41f6a6b2300194bfe3b97feb714bed23c9b7

Contents?: true

Size: 946 Bytes

Versions: 1

Compression:

Stored size: 946 Bytes

Contents

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

require 'units'

class TC_unit_create < Test::Unit::TestCase

  understands UnitsTest
  
  def test_unit_create
    
    Units.create :length do |m|
      m.system 'english' do |s|
        s.unit :name => 'inch'
        s.unit :name => 'foot'
      end
    end
    
    inch = Units.length.english.inch
    foot = Units.length.english.foot
    assert(inch.kind_of?(UnitsUnit))
    assert(foot.kind_of?(UnitsUnit))
    assert(inch.name == 'inch')
    assert(foot.name == 'foot')
    assert(inch.units_system == Units.length.english)
    assert(foot.units_system == Units.length.english)
    assert(inch.units_system.units_measure == Units.length)
    assert(foot.units_system.units_measure == Units.length)
    assert(Units.length.english.keys.index('inch') != nil)
    assert(Units.length.english.keys.index('foot') != nil)
    assert(Units.length.english.keys.index('foo') == nil)
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eymiha_units-0.1.0 test/tc_unit_create.rb