You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by di...@apache.org on 2009/11/24 11:21:08 UTC

svn commit: r883644 - in /incubator/lucene.net/trunk/C#/src: Lucene.Net/Search/FieldCache.cs Lucene.Net/SupportClass.cs Test/Search/TestSort.cs

Author: digy
Date: Tue Nov 24 10:21:06 2009
New Revision: 883644

URL: http://svn.apache.org/viewvc?rev=883644&view=rev
Log:
LUCENENET-307 TestSort.TestTypedSort fails. (patch for "double")

Modified:
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldCache.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs
    incubator/lucene.net/trunk/C#/src/Test/Search/TestSort.cs

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldCache.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/FieldCache.cs?rev=883644&r1=883643&r2=883644&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldCache.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldCache.cs Tue Nov 24 10:21:06 2009
@@ -290,7 +290,7 @@
 	{
 		public virtual double ParseDouble(System.String value_Renamed)
 		{
-			return System.Double.Parse(value_Renamed);
+			return SupportClass.Double.Parse(value_Renamed);
 		}
 		protected internal virtual System.Object ReadResolve()
 		{

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/SupportClass.cs?rev=883644&r1=883643&r2=883644&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs Tue Nov 24 10:21:06 2009
@@ -785,6 +785,24 @@
     /// <summary>
     /// 
     /// </summary>
+    public class Double
+    {
+        public static System.Double Parse(System.String s)
+        {
+            try
+            {
+                return System.Double.Parse(s.Replace(".", System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator));
+            }
+            catch (OverflowException)
+            {
+                return double.MaxValue;
+            }
+        }
+    }
+
+    /// <summary>
+    /// 
+    /// </summary>
     public class Single
     {
         /// <summary>

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestSort.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestSort.cs?rev=883644&r1=883643&r2=883644&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestSort.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestSort.cs Tue Nov 24 10:21:06 2009
@@ -262,21 +262,21 @@
 		// the string field to sort by string
 		// the i18n field includes accented characters for testing locale-specific sorting
         private System.String[][] data = new System.String[][] { 
-          //              tracer contents         int            float            string   custom   i18n               long                       double,                       'short',                    byte,                   'custom parser encoding'
-          new string[]{   "A",   "x a",           "5",           "4f",            "c",     "A-3",   "p\u00EAche",      "10",                      "-4.0",                       "3",                        "126",                      "J"},//A, x
-          new string[]{   "B",   "y a",           "5",           "3.4028235E38",  "i",     "B-10",  "HAT",             "1000000000",              "40.0",                       "24",                       "1",                        "I"},//B, y
-          new string[]{   "C",   "x a b c",       "2147483647",  "1.0",           "j",     "A-2",   "p\u00E9ch\u00E9", "99999999",                "40.00002343",                "125",                      "15",                       "H"},//C, x
-          new string[]{   "D",   "y a b c",       "-1",          "0.0f",          "a",     "C-0",   "HUT",             long.MaxValue.ToString(),  double.MinValue.ToString(),   short.MinValue.ToString(),  byte.MinValue.ToString(),   "G"},//D, y
-          new string[]{   "E",   "x a b c d",     "5",           "2f",            "h",     "B-8",   "peach",           long.MinValue.ToString(),  double.MaxValue.ToString(),   short.MaxValue.ToString(),  byte.MaxValue.ToString(),   "F"},//E,x
-          new string[]{   "F",   "y a b c d",     "2",           "3.14159f",      "g",     "B-1",   "H\u00C5T",        "-44",                     "343.034435444",              "-3",                       "0",                        "E"},//F,y
-          new string[]{   "G",   "x a b c d",     "3",           "-1.0",          "f",     "C-100", "sin",             "323254543543",            "4.043544",                   "5",                        "100",                      "D"},//G,x
-          new string[]{   "H",   "y a b c d",     "0",           "1.4E-45",       "e",     "C-88",  "H\u00D8T",        "1023423423005",           "4.043545",                   "10",                       "-50",                      "C"},//H,y
-          new string[]{   "I",   "x a b c d e f", "-2147483648", "1.0e+0",        "d",     "A-10",  "s\u00EDn",        "332422459999",            "4.043546",                   "-340",                     "51",                       "B"},//I,x
-          new string[]{   "J",   "y a b c d e f", "4",           ".5",            "b",     "C-7",   "HOT",             "34334543543",             "4.0000220343",               "300",                      "2",                        "A"},//J,y
-          new string[]{   "W",   "g",             "1",           null,            null,    null,    null,              null,                      null,                         null,                       null,                       null},
-          new string[]{   "X",   "g",             "1",           "0.1",           null,    null,    null,              null,                      null,                         null,                       null,                       null},
-          new string[]{   "Y",   "g",             "1",           "0.2",           null,    null,    null,              null,                      null,                         null,                       null,                       null},
-          new string[]{   "Z",   "f g",           null,          null,            null,    null,    null,              null,                      null,                         null,                       null,                       null}
+          //              tracer contents         int            float            string   custom   i18n               long                       double,                           'short',                    byte,                   'custom parser encoding'
+          new string[]{   "A",   "x a",           "5",           "4f",            "c",     "A-3",   "p\u00EAche",      "10",                      "-4.0",                           "3",                        "126",                      "J"},//A, x
+          new string[]{   "B",   "y a",           "5",           "3.4028235E38",  "i",     "B-10",  "HAT",             "1000000000",              "40.0",                           "24",                       "1",                        "I"},//B, y
+          new string[]{   "C",   "x a b c",       "2147483647",  "1.0",           "j",     "A-2",   "p\u00E9ch\u00E9", "99999999",                "40.00002343",                    "125",                      "15",                       "H"},//C, x
+          new string[]{   "D",   "y a b c",       "-1",          "0.0f",          "a",     "C-0",   "HUT",             long.MaxValue.ToString(),  double.MinValue.ToString("E16"),  short.MinValue.ToString(),  byte.MinValue.ToString(),   "G"},//D, y
+          new string[]{   "E",   "x a b c d",     "5",           "2f",            "h",     "B-8",   "peach",           long.MinValue.ToString(),  double.MaxValue.ToString("E16"),  short.MaxValue.ToString(),  byte.MaxValue.ToString(),   "F"},//E,x
+          new string[]{   "F",   "y a b c d",     "2",           "3.14159f",      "g",     "B-1",   "H\u00C5T",        "-44",                     "343.034435444",                  "-3",                       "0",                        "E"},//F,y
+          new string[]{   "G",   "x a b c d",     "3",           "-1.0",          "f",     "C-100", "sin",             "323254543543",            "4.043544",                       "5",                        "100",                      "D"},//G,x
+          new string[]{   "H",   "y a b c d",     "0",           "1.4E-45",       "e",     "C-88",  "H\u00D8T",        "1023423423005",           "4.043545",                       "10",                       "-50",                      "C"},//H,y
+          new string[]{   "I",   "x a b c d e f", "-2147483648", "1.0e+0",        "d",     "A-10",  "s\u00EDn",        "332422459999",            "4.043546",                       "-340",                     "51",                       "B"},//I,x
+          new string[]{   "J",   "y a b c d e f", "4",           ".5",            "b",     "C-7",   "HOT",             "34334543543",             "4.0000220343",                   "300",                      "2",                        "A"},//J,y
+          new string[]{   "W",   "g",             "1",           null,            null,    null,    null,              null,                      null,                             null,                       null,                       null},
+          new string[]{   "X",   "g",             "1",           "0.1",           null,    null,    null,              null,                      null,                             null,                       null,                       null},
+          new string[]{   "Y",   "g",             "1",           "0.2",           null,    null,    null,              null,                      null,                             null,                       null,                       null},
+          new string[]{   "Z",   "f g",           null,          null,            null,    null,    null,              null,                      null,                             null,                       null,                       null}
         };