From b4ea13ae1e13e03c4f9293d091d1535e52a6c17e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 30 Sep 2009 13:07:06 -0700 Subject: float numeric edge cases --- test/visitors/test_yast_builder.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/visitors/test_yast_builder.rb') diff --git a/test/visitors/test_yast_builder.rb b/test/visitors/test_yast_builder.rb index 91eef1c..2832da9 100644 --- a/test/visitors/test_yast_builder.rb +++ b/test/visitors/test_yast_builder.rb @@ -41,6 +41,22 @@ module Psych assert_round_trip :foo end + def test_int + assert_round_trip 1 + assert_round_trip(-1) + assert_round_trip '1' + assert_round_trip '-1' + end + + def test_float + assert_round_trip 1.2 + assert_round_trip '1.2' + + assert Psych.load(Psych.dump(0.0 / 0.0)).nan? + assert_equal 1, Psych.load(Psych.dump(1 / 0.0)).infinite? + assert_equal(-1, Psych.load(Psych.dump(-1 / 0.0)).infinite?) + end + # http://yaml.org/type/null.html def test_nil assert_round_trip nil -- cgit v1.2.3