summaryrefslogtreecommitdiff
path: root/test/visitors/test_yast_builder.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2009-09-30 13:07:06 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2009-09-30 13:07:06 -0700
commitb4ea13ae1e13e03c4f9293d091d1535e52a6c17e (patch)
tree0c26d31bf056bfcce7ba081fdca3a43fdb21db52 /test/visitors/test_yast_builder.rb
parent1ecabe15cca7df942f9b3a8684145c5b8e3f0dda (diff)
downloadpsych-b4ea13ae1e13e03c4f9293d091d1535e52a6c17e.zip
float numeric edge cases
Diffstat (limited to 'test/visitors/test_yast_builder.rb')
-rw-r--r--test/visitors/test_yast_builder.rb16
1 files changed, 16 insertions, 0 deletions
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