Add two tests to strtod.
authorfloitschV8@gmail.com <floitschV8@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 9 Feb 2011 14:12:31 +0000 (14:12 +0000)
committerfloitschV8@gmail.com <floitschV8@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 9 Feb 2011 14:12:31 +0000 (14:12 +0000)
Review URL: http://codereview.chromium.org/6461018

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6700 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

test/cctest/test-strtod.cc

index f5547dbc0326bb6a6a9f4318df067a764e9719ab..da6b07bb8b96659649939195d4918d96f879db09 100644 (file)
@@ -324,6 +324,25 @@ TEST(Strtod) {
            StrtodChar("5708990770823839207320493820740630171355185151999", -3));
   CHECK_EQ(5708990770823839524233143877797980545530986496.0,
            StrtodChar("5708990770823839207320493820740630171355185152001", -3));
+
+  // The following test-cases got some public attention in early 2011 when they
+  // sent Java and PHP into an infinite loop.
+  CHECK_EQ(2.225073858507201e-308, StrtodChar("22250738585072011", -324));
+  CHECK_EQ(2.22507385850720138309e-308,
+           StrtodChar("22250738585072011360574097967091319759348195463516456480"
+                      "23426109724822222021076945516529523908135087914149158913"
+                      "03962110687008643869459464552765720740782062174337998814"
+                      "10632673292535522868813721490129811224514518898490572223"
+                      "07285255133155755015914397476397983411801999323962548289"
+                      "01710708185069063066665599493827577257201576306269066333"
+                      "26475653000092458883164330377797918696120494973903778297"
+                      "04905051080609940730262937128958950003583799967207254304"
+                      "36028407889577179615094551674824347103070260914462157228"
+                      "98802581825451803257070188608721131280795122334262883686"
+                      "22321503775666622503982534335974568884423900265498198385"
+                      "48794829220689472168983109969836584681402285424333066033"
+                      "98508864458040010349339704275671864433837704860378616227"
+                      "71738545623065874679014086723327636718751", -1076));
 }