Sha256: 52aa1095f06fd20a7c8f366722947acaee8a9bd4d4b49c1c3d9764c332c746f8
Contents?: true
Size: 1.66 KB
Versions: 1
Compression:
Stored size: 1.66 KB
Contents
require 'test/unit' require 'test/framework' require 'units' class TC_unit_identifiers < Test::Unit::TestCase understands UnitsTest def test_unit_identifiers Units.create :length do |m| m.system :english do |s| s.unit :name => :inch, :plural => :inches, :abbrev => :in s.unit :name => :foot, :plural => :feet, :abbrev => [ :ft ] s.unit :name => :yard, :abbrevs => :yd end end assert(Units.length.english.inch.kind_of?(UnitsUnit)) assert(Units.length.english.inch.plural == 'inches') assert(Units.length.english.inch.abbrevs == [ 'in' ]) assert(Units.length.english.foot.kind_of?(UnitsUnit)) assert(Units.length.english.foot.plural == 'feet') assert(Units.length.english.foot.abbrevs == [ 'ft' ]) assert(Units.length.english.yard.kind_of?(UnitsUnit)) assert(Units.length.english.yard.plural == 'yards') assert(Units.length.english.yard.abbrevs == [ 'yd' ]) assert_raise(UnitsException) { Units.length.english.unit({}) } assert(Units.lookup('inch')[0] == Units.length.english.inch) assert(Units.lookup('inches')[0] == Units.length.english.inch) assert(Units.lookup('in')[0] == Units.length.english.inch) assert(Units.lookup('foot')[0] == Units.length.english.foot) assert(Units.lookup('feet')[0] == Units.length.english.foot) assert(Units.lookup('ft')[0] == Units.length.english.foot) assert(Units.lookup('yard')[0] == Units.length.english.yard) assert(Units.lookup('yards')[0] == Units.length.english.yard) assert(Units.lookup('yd')[0] == Units.length.english.yard) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eymiha_units-0.1.0 | test/tc_unit_identifiers.rb |