Adding parsing tests to validate we consider enough significant digits to always...
authorTanner Gooding <tagoo@outlook.com>
Fri, 1 Mar 2019 22:06:35 +0000 (14:06 -0800)
committerGitHub <noreply@github.com>
Fri, 1 Mar 2019 22:06:35 +0000 (14:06 -0800)
Commit migrated from https://github.com/dotnet/corefx/commit/34118b74d46129b3095e1b4dbad8441c4db62e33

src/libraries/Common/tests/System/RealParserTestsBase.netcoreapp.cs

index d32bab5..035bd7c 100644 (file)
@@ -282,6 +282,34 @@ namespace System.Tests
                     "58792562830275599565752445550725518931369083625477918694866799496832" +
                     "40497058210285131854513962138377228261454376934125320985913276672363" +
                     "28125001e-324", 0x0000000000000001)]
+        // This is the exact string for the largest denormal value and contains
+        // the most significant digits of any double-precision floating-point value
+        [InlineData("2.225073858507200889024586876085859887650423112240959465493524802562" +
+                    "44000922823569517877588880375915526423097809504343120858773871583572" +
+                    "91821993020294379224223559819827501242041788969571311791082261043971" +
+                    "97960400045489739193807919893608152561311337614984204327175103362739" +
+                    "15497827315941438281362751138386040942494649422863166954291050802018" +
+                    "15926642134996606517803095075913058719846423906068637102005108723282" +
+                    "78467884363194451586613504122347901479236958520832159762106637540161" +
+                    "37365830441936037147783553066828345356340050740730401356029680463759" +
+                    "18583163124224521599262546494300836851861719422417646455137135420132" +
+                    "21703137049658321015465406803539741790602258950302350193751977303094" +
+                    "57631732108525072993050897615825191597207572324554347709124613174935" +
+                    "80281734466552734375e-308", 0x000FFFFFFFFFFFFF)]
+        // This is the exact string for the largest denormal value plus an additional rounding digit.
+        // The rounding digit is such that the resulting value should still be the largest denormal.
+        [InlineData("2.225073858507200889024586876085859887650423112240959465493524802562" +
+                    "44000922823569517877588880375915526423097809504343120858773871583572" +
+                    "91821993020294379224223559819827501242041788969571311791082261043971" +
+                    "97960400045489739193807919893608152561311337614984204327175103362739" +
+                    "15497827315941438281362751138386040942494649422863166954291050802018" +
+                    "15926642134996606517803095075913058719846423906068637102005108723282" +
+                    "78467884363194451586613504122347901479236958520832159762106637540161" +
+                    "37365830441936037147783553066828345356340050740730401356029680463759" +
+                    "18583163124224521599262546494300836851861719422417646455137135420132" +
+                    "21703137049658321015465406803539741790602258950302350193751977303094" +
+                    "57631732108525072993050897615825191597207572324554347709124613174935" +
+                    "802817344665527343754e-308", 0x000FFFFFFFFFFFFF)]
         public void TestParserDouble_SpecificValues(string s, ulong expectedBits)
         {
             CheckOneDouble(s, expectedBits);
@@ -420,6 +448,10 @@ namespace System.Tests
         // 0.11111111111111111111111011
         //                          ^
         [InlineData("0.99999992549419403076171875", 0x3f7fffff)]
+        // This is the exact string for the largest denormal value and contains
+        // the most significant digits of any single-precision floating-point value
+        [InlineData("1.175494210692441075487029444849287348827052428745893333857174530571" +
+                    "588870475618904265502351336181163787841796875e-38", 0x007FFFFF)]
         public void TestParserSingle_SpecificValues(string s, uint expectedBits)
         {
             CheckOneSingle(s, expectedBits);