Sha256: 2e4f60f9460413b24390bb27eeb86465eb63db4b801d60d6b39113952109d3fe

Contents?: true

Size: 949 Bytes

Versions: 2

Compression:

Stored size: 949 Bytes

Contents

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

require 'eymiha/units'

class TC_unit_create < Test::Unit::TestCase

  include 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

2 entries across 2 versions & 1 rubygems

Version Path
eymiha_units-1.0.0 test/tc_unit_create.rb
eymiha_units-1.0.1 test/tc_unit_create.rb