changeset 1079:f1ab355e5f76

7901235: ResultFormatTest.latex* fail with Russian locale. Summary: Make LaTeXResultFormat to disregard the locale as well.
author shade
date Mon, 12 Jan 2015 13:29:55 +0300
parents 5164ebcc4936
children 70019828fe4c
files jmh-core/src/main/java/org/openjdk/jmh/results/format/LaTeXResultFormat.java
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/results/format/LaTeXResultFormat.java	Mon Jan 12 12:42:25 2015 +0300
+++ b/jmh-core/src/main/java/org/openjdk/jmh/results/format/LaTeXResultFormat.java	Mon Jan 12 13:29:55 2015 +0300
@@ -32,6 +32,7 @@
 import java.io.PrintStream;
 import java.util.Collection;
 import java.util.HashSet;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.SortedSet;
@@ -106,8 +107,8 @@
             out.printf("\\texttt{%s}", escape(benchParams.getParam(p)));
             out.print(" & ");
         }
-        out.printf("\\texttt{%5.3f} & ", res.getScore());
-        out.printf("\\scriptsize $\\pm$ \\texttt{%5.3f}", res.getScoreError());
+        out.printf("\\texttt{%s} & ", emit(res.getScore()));
+        out.printf("\\scriptsize $\\pm$ \\texttt{%s}", emit(res.getScoreError()));
         if (!singleUnit) {
             out.printf(" & \\texttt{%s}", res.getScoreUnit());
         }
@@ -116,6 +117,10 @@
         out.print("\n");
     }
 
+    private static String emit(double d) {
+        return String.format(Locale.ROOT, "%5.3f", d);
+    }
+
     private static String escape(String s) {
         return s.replaceAll("_", "\\\\_");
     }