# _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # # for lib/facets/more/units.rb # # Extracted Wed Aug 23 18:22:52 EDT 2006 # Unit Tools Reap Test Extractor # require 'facets/more/units.rb' require 'test/unit' include Units class TC01 < Test::Unit::TestCase def test_01_001 assert_equal( "65.0 bit/s", (1.bit/s + 8.bytes/s).to_s ) end def test_01_002 assert_equal( "0.125 byte/s", ((1.bit/s).to(byte/s)).to_s ) end def test_01_003 assert_equal( "5280.0 feet", (1.mile.to(feet)).to_s ) end def test_01_004 assert_equal( "4840.0 yd**2", (1.acre.to(yd**2)).to_s ) end def test_01_005 assert_equal( "4840.0 sq_yd", (1.acre.to(sq_yd)).to_s ) end def test_01_006 assert_equal( "3.785411784 L", (1.gallon.to(self.L)).to_s ) end def test_01_007 assert_equal( "0.45359237 kg", (1.lb.to(kg)).to_s ) end def test_01_008 r = (1.m.s.to(m.s)).to_s assert( "1 s m" == r || "1 m s" == r ) end def test_01_009 assert_equal( "2.589988110336 km**2", (1.sq_mi.to(km**2)).to_s ) end def test_01_010 assert_equal( "1.609344 km", (1.mile.to(km)).to_s ) end # currency rates change frequently, temp commented #def test_01_011 # assert_equal( "33.2750003803837 twd", (1.usd.to(twd)).to_s ) #end def test_01_012 with_unit_converter(:uk) { assert_equal( "112.0 lb", 1.cwt.to(lb).to_s ) } end def test_01_013 with_unit_converter(:us) { assert_equal( "100.0 lb", 1.cwt.to(lb).to_s ) } end def test_01_014 assert_equal( "112.0 lb", (1.cwt(:uk).to(lb(:uk))).to_s ) assert_equal( "100.0 lb", (1.cwt(:us).to(lb(:us))).to_s ) end def test_01_015 assert_equal( "lb", (Converter.current.lb).to_s ) end def test_01_016 assert( [:us, :cex, :default, :uk].all? { |c| Converter.registered_converters.include?( c ) } ) end # Money exchange is off line at the moment #def test_01_017 # assert_raises(TypeError) { # 1.try.to(usd) # } #end #def test_01_016 # assert_equal( "33.2190007563597 twd", (1.usd(:cex).to(twd(:cex))).to_s ) #end end