Sha256: efa1ef32ac1f445c84ecd50a65fffd5a9cf2d60de240e03acece15ec3160f64d
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
require 'test/unit' require 'test/framework' require 'eymiha/units' class TC_unit_forward_reference < Test::Unit::TestCase include UnitsTest def test_unit_forward_reference Units.create :length do |m| m.system :english do |s| s.unit :name => :yard, :abbrevs => :yd, :equals => 3.feet s.unit :name => :foot, :plural => :feet, :abbrev => [ :ft ], :equals => 12.inches s.unit :name => :inch, :plural => :inches, :abbrev => :in end end inch = Units.length.english.inch foot = Units.length.english.foot yard = Units.length.english.yard assert(inch.equals.numeric == 1) assert(inch.equals.unit == {inch => 1}) assert(foot.equals.numeric == 12) assert(foot.equals.unit == {inch => 1}) assert(yard.equals.numeric == 36) assert(yard.equals.unit == {inch => 1}) assert(inch.equals.to_s == "1 inch") assert(foot.equals.to_s == "12 inches") assert(yard.equals.to_s == "36 inches") end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
eymiha_units-1.0.1 | test/tc_unit_forward_reference.rb |
eymiha_units-1.0.0 | test/tc_unit_forward_reference.rb |