2015-12-16 00:07:31 -05:00
|
|
|
# frozen_string_literal: false
|
2010-09-18 04:34:37 -04:00
|
|
|
require 'rexml/document'
|
|
|
|
require 'test/unit'
|
|
|
|
require 'rexml/functions'
|
|
|
|
|
2014-05-27 08:07:40 -04:00
|
|
|
module REXMLTests
|
2014-05-27 09:10:55 -04:00
|
|
|
class TC_Rexml_Functions_Number < Test::Unit::TestCase
|
2010-09-18 04:34:37 -04:00
|
|
|
|
2014-05-27 09:10:55 -04:00
|
|
|
def test_functions_number_int
|
|
|
|
telem = REXML::Element.new("elem")
|
|
|
|
telem.text="9"
|
|
|
|
assert_equal(9, REXML::Functions::number(telem))
|
|
|
|
end
|
|
|
|
def test_functions_number_float
|
|
|
|
telem = REXML::Element.new("elem")
|
|
|
|
telem.text="10.4"
|
|
|
|
assert_equal(10.4, REXML::Functions::number(telem))
|
|
|
|
end
|
|
|
|
def test_functions_number_negative_int
|
|
|
|
telem = REXML::Element.new("elem")
|
|
|
|
telem.text="-9"
|
|
|
|
assert_equal(-9, REXML::Functions::number(telem))
|
|
|
|
end
|
|
|
|
def test_functions_number_negative_float
|
|
|
|
telem = REXML::Element.new("elem")
|
|
|
|
telem.text="-9.13"
|
|
|
|
assert_equal(-9.13, REXML::Functions::number(telem))
|
|
|
|
end
|
|
|
|
#def test_functions_number_scientific_notation
|
|
|
|
# telem = REXML::Element.new("elem")
|
|
|
|
# telem.text="9.13E12"
|
|
|
|
# assert_equal(9.13E12, REXML::Functions::number(telem))
|
|
|
|
#end
|
2010-09-18 04:34:37 -04:00
|
|
|
end
|
2014-05-27 06:21:10 -04:00
|
|
|
end
|