test/sdl4r/parser_test.rb in sdl4r-0.9.3 vs test/sdl4r/parser_test.rb in sdl4r-0.9.4
- old
+ new
@@ -16,18 +16,12 @@
#++
module SDL4R
+ require 'bigdecimal'
require 'test/unit'
-
- begin
- # Try to use the Flt library, which defines DecNum
- require "flt"
- rescue LoadError
- # Well, shouganai.
- end
require File.dirname(__FILE__) + '/../../lib/sdl4r/tag'
require File.dirname(__FILE__) + '/../../lib/sdl4r/sdl_binary'
class ParserTest < Test::Unit::TestCase
@@ -204,18 +198,12 @@
assert_equal(123.45, values[4])
assert_equal(67.8, values[5])
assert_equal(910.11, values[6])
assert_equal(12.13, values[7])
assert_equal(1415.16, values[8])
- if defined? Flt::DecNum
- assert_equal(Flt::DecNum("171.8"), values[9])
- assert_equal(Flt::DecNum("1.920"), values[10])
- assert_equal(Flt::DecNum("12345678901234567890"), values[11])
- else
- assert_equal(171.8, values[9])
- assert_equal(1.920, values[10])
- assert_equal(12345678901234567890, values[11])
- end
+ assert_equal(BigDecimal("171.8"), values[9])
+ assert_equal(BigDecimal("1.920"), values[10])
+ assert_equal(BigDecimal("12345678901234567890"), values[11])
end
def test_booleans
tag1 = parse_one_tag1("tag1 b1=true b2=false b3=on b4=off")
assert_equal(true, tag1.attribute("b1"))
\ No newline at end of file