You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2019/10/15 21:34:09 UTC
[commons-rng] 02/03: APT results format to highlight RNGs with no
systematic failures.
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git
commit 9e54c48cd134e7dbfd9071d1471986d62c3fd4f2
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Tue Oct 15 21:57:29 2019 +0100
APT results format to highlight RNGs with no systematic failures.
Highlight is in bold.
Optionally add systematic failures in brackets.
---
.../rng/examples/stress/ResultsCommand.java | 45 ++++++++++++++++------
1 file changed, 34 insertions(+), 11 deletions(-)
diff --git a/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/ResultsCommand.java b/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/ResultsCommand.java
index 4c5eeb7..d366834 100644
--- a/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/ResultsCommand.java
+++ b/commons-rng-examples/examples-stress/src/main/java/org/apache/commons/rng/examples/stress/ResultsCommand.java
@@ -861,25 +861,40 @@ class ResultsCommand implements Callable<Void> {
output.newLine();
output.write(separator);
+ final StringBuilder sb = new StringBuilder();
+
// This will collate results for each combination of 'RandomSource + bitReversed'
for (final RandomSource randomSource : randomSources) {
for (final boolean reversed : bitReversed) {
- output.write('|');
- writeAPTColumn(output, randomSource.toString());
+ // Highlight in bold a RNG with no systematic failures
+ boolean highlight = true;
+
+ // Buffer the column output
+ sb.setLength(0);
+
if (showBitReversedColumn) {
- writeAPTColumn(output, Boolean.toString(reversed));
+ writeAPTColumn(sb, Boolean.toString(reversed), false);
}
for (final String testName : testNames) {
final List<TestResult> testResults = getTestResults(results, randomSource, reversed, testName);
String text = testResults.stream()
.map(toAPTString)
.collect(Collectors.joining(", "));
- // Add systematic failures in brackets
+ // Identify RNGs with no systematic failures
+ final int count = getSystematicFailures(testResults).size();
+ if (count != 0) {
+ highlight = false;
+ }
if (showFailedTests) {
- text += " (" + getSystematicFailures(testResults).size() + ")";
+ // Add systematic failures in brackets
+ text += " (" + count + ")";
}
- writeAPTColumn(output, text);
+ writeAPTColumn(sb, text, false);
}
+
+ output.write('|');
+ writeAPTColumn(output, randomSource.toString(), highlight);
+ output.write(sb.toString());
output.newLine();
output.write(separator);
}
@@ -1032,13 +1047,21 @@ class ResultsCommand implements Callable<Void> {
*
* @param output Output.
* @param text Text.
+ * @param highlight If {@code true} highlight the text in bold.
* @throws IOException Signals that an I/O exception has occurred.
*/
- private static void writeAPTColumn(BufferedWriter output,
- String text) throws IOException {
- output.write(' ');
- output.write(text);
- output.write(" |");
+ private static void writeAPTColumn(Appendable output,
+ String text,
+ boolean highlight) throws IOException {
+ output.append(' ');
+ if (highlight) {
+ output.append("<<");
+ }
+ output.append(text);
+ if (highlight) {
+ output.append(">>");
+ }
+ output.append(" |");
}
/**