Sha256: 47689edb6e76ad95992694af006371963dad91efebaf84e70fcf65d95af455fe
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 KB
Contents
require 'test/unit' require 'test/framework' require 'units' class TC_measure_derive < Test::Unit::TestCase understands UnitsTest def test_measure_derive assert((length = Units.create :length) == Units.length) assert(length.derived == nil) assert((distance = Units.derive 'distance', length) == Units.length) assert(distance.derived == nil) assert((area = Units.derive 'area', length**2) == Units.area) assert(area.derived.size == 1) assert(area.derived[Units.length] == 2) assert((volume = Units.derive 'volume', area*length) == Units.volume) assert(volume.derived.size == 1) assert(volume.derived[Units.length] == 3) assert((time = Units.create 'time') == Units.time) assert(time.derived == nil) assert((velocity = Units.derive :velocity, distance/time) == Units.velocity) assert(velocity.derived.size == 2) assert(velocity.derived[Units.distance] == 1) assert(velocity.derived[Units.time] == -1) assert((acceleration = Units.derive :acceleration, distance/time**2) == Units.acceleration) assert(acceleration.derived.size == 2) assert(acceleration.derived[Units.distance] == 1) assert(acceleration.derived[Units.time] == -2) assert(acceleration == Units.derive(:acceleration2, distance/time**2)) assert(Units.acceleration2 == Units.acceleration) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eymiha_units-0.1.0 | test/tc_measure_derive.rb |