MCPcopy Create free account
hub / github.com/RealTimeGenomics/rtg-tools / sameLines

Method sameLines

src/test/java/com/rtg/util/TestUtils.java:673–688  ·  view source on GitHub ↗

Compares the lines in two strings for equivalence, ignoring line endings and whitespace. @param expected a string. @param actual a string. @param sort true iff the lines aer to be sorted before a comparison is done (use it if there is non-determinism in the order of the results) @return true if the

(final String expected, final String actual, final boolean sort)

Source from the content-addressed store, hash-verified

671 * @return true if the lines are the same.
672 */
673 public static boolean sameLines(final String expected, final String actual, final boolean sort) {
674 final String[] erecs = splitLines(expected.trim());
675 if (sort) {
676 Arrays.sort(erecs);
677 }
678 final String[] arecs = splitLines(actual.trim());
679 if (sort) {
680 Arrays.sort(arecs);
681 }
682 final boolean same = sameLines(erecs, arecs);
683 if (!same) {
684 System.err.println("Actual output was:\n" + actual);
685 System.err.println("Expected output was:\n" + expected);
686 }
687 return same;
688 }
689
690 /**
691 * Checks whether two arrays of lines are the same.

Callers 1

checkWriteMethod · 0.95

Calls 5

splitLinesMethod · 0.95
compareLinesMethod · 0.95
printlnMethod · 0.80
trimMethod · 0.65
sortMethod · 0.45

Tested by

no test coverage detected