From 1cfffa55894eb8a95e1fd4a4e19f2f9cc442ca41 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 13 Jan 2017 14:30:36 -0500 Subject: [PATCH] Use exactly representable floating point numbers in tests CDRIVER-1945 increased the precision when rendering floating point numbers in JavaScript. Using numbers that can be exactly represented in floating point will allow us to keep the expected output consistent with our input. --- tests/bson/bson-decode-001.phpt | 5 ++--- tests/bson/bson-encode-001.phpt | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/bson/bson-decode-001.phpt b/tests/bson/bson-decode-001.phpt index 2153dd95..64b24430 100644 --- a/tests/bson/bson-decode-001.phpt +++ b/tests/bson/bson-decode-001.phpt @@ -10,8 +10,7 @@ $tests = array( array((object)array("hello" => "world")), array(null), array(123), - - array(4.23), + array(4.125), array(true), array(false), array("string"), @@ -60,7 +59,7 @@ Test#2 { "0" : null } OK Test#3 { "0" : 123 } OK -Test#4 { "0" : 4.23 } +Test#4 { "0" : 4.125 } OK Test#5 { "0" : true } OK diff --git a/tests/bson/bson-encode-001.phpt b/tests/bson/bson-encode-001.phpt index 257e0de3..f3d2649d 100644 --- a/tests/bson/bson-encode-001.phpt +++ b/tests/bson/bson-encode-001.phpt @@ -15,7 +15,7 @@ $tests = array( array(array("0" => 1, "1" => 2, "2" => 3, "3" => 4, "4" => 5, "5" => 6, "6" => 7, "7" => 8, "8" => 9)), array(null), array(123), - array(4.23), + array(4.125), array(true), array(false), array("string"), @@ -74,8 +74,8 @@ Test#7 { "0" : null } 0 : 08 00 00 00 0a 30 00 00 [.....0..] Test#8 { "0" : 123 } 0 : 0c 00 00 00 10 30 00 7b 00 00 00 00 [.....0.{....] -Test#9 { "0" : 4.23 } - 0 : 10 00 00 00 01 30 00 ec 51 b8 1e 85 eb 10 40 00 [.....0..Q.....@.] +Test#9 { "0" : 4.125 } + 0 : 10 00 00 00 01 30 00 00 00 00 00 00 80 10 40 00 [.....0........@.] Test#10 { "0" : true } 0 : 09 00 00 00 08 30 00 01 00 [.....0...] Test#11 { "0" : false }