Mercurial > dive4elements > river
changeset 8855:d7c005e12af0 3.2.x
Remove unused test code.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 18 Jan 2018 20:10:59 +0100 |
parents | 6a4bdcccfa4d |
children | 5e38e2924c07 |
files | backend/src/main/java/org/dive4elements/river/backend/utils/StringUtil.java |
diffstat | 1 files changed, 0 insertions(+), 132 deletions(-) [+] |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/backend/utils/StringUtil.java Tue Jan 16 18:39:52 2018 +0100 +++ b/backend/src/main/java/org/dive4elements/river/backend/utils/StringUtil.java Thu Jan 18 20:10:59 2018 +0100 @@ -687,138 +687,6 @@ } - public static void testQuote() { - System.err.println("testing quote:"); - - String cases [] = { - "", "''", - "test", "test", - "test test", "'test test'", - " test", "' test'", - "test ", "'test '", - " test ", "' test '", - "'test", "'\\'test'", - "'", "'\\''", - " ' ' ", "' \\' \\' '", - "te'st", "'te\\'st'" - }; - - int failed = 0; - - for (int i = 0; i < cases.length; i += 2) { - String in = cases[i]; - String out = cases[i+1]; - - String res = quote(in, '\''); - if (!res.equals(out)) { - ++failed; - System.err.println( - "quote failed on: >" + in + - "< result: >" + res + - "< expected: >" + out + "<"); - } - } - - int T = cases.length/2; - - System.err.println("tests total: " + T); - System.err.println("tests failed: " + failed); - System.err.println("tests passed: " + (T - failed)); - } - - public static void testQuoteReplacement() { - System.err.println("testing quoteReplacement:"); - - String cases [] = { - "", "", - "test", "test", - "$", "\\$", - "\\", "\\\\", - "\\$", "\\\\\\$", - "test\\$", "test\\\\\\$", - "\\test", "\\\\test", - "test$", "test\\$", - "test$test", "test\\$test", - "$test$", "\\$test\\$" - }; - - int failed = 0; - - for (int i = 0; i < cases.length; i += 2) { - String in = cases[i]; - String out = cases[i+1]; - - String res = quoteReplacement(in); - if (!res.equals(out)) { - ++failed; - System.err.println( - "quoteReplacement failed on: '" + in + - "' result: '" + res + - "' expected: '" + out + "'"); - } - } - - int T = cases.length/2; - - System.err.println("tests total: " + T); - System.err.println("tests failed: " + failed); - System.err.println("tests passed: " + (T - failed)); - } - - public static void testStringArray2D() { - int total = 0; - int fail = 0; - int passed = 0; - - System.err.println("testing StringArray2D:"); - - double[][] testarray = {{1.0, 2.0, 3.0}, - {1.1, 2.1, 3.1}, - {100.2, 200.2} - }; - String str = double2DArrayToString(testarray); - - total += 1; - if (str.equals("1.0;2.0;3.0:1.1;2.1;3.1:100.2;200.2")) { - passed +=1; - } - else { - fail +=1; - System.err.println("Der Ergebnis-String ist nicht richtig:"); - System.err.println(str); - } - - - - double[][] testarray2 = stringToDouble2DArray(str); - boolean failed = false; - - total +=1; - for (int i=0; i < testarray.length; i++) - for (int j=0; j < testarray[i].length; j++) - if (testarray[i][j] != testarray2[i][j]) { - System.err.println("Test scheitert bei i=" +i +" j=" +j); - System.err.println("alter Wert=" + testarray[i][j] +" neuer Wert=" +testarray2[i][j]); - failed = true; - } - if (failed) { - fail +=1; - } - else { - passed +=1; - } - System.err.println("tests total: "+ total); - System.err.println("tests failed: "+ fail); - System.err.println("tests passed: "+ passed); - } - - public static void main(String [] args) { - - testQuoteReplacement(); - testQuote(); - testStringArray2D(); - } - /** Check for occurence of needle in hay, converting both to lowercase * to be ignorant of cases. */ public static boolean containsIgnoreCase(String hay, String needle) {