[PATCH 1 of 5] Remove unused test code

Wald Commits scm-commit at wald.intevation.org
Thu Jan 18 20:57:38 CET 2018


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1516302659 -3600
# Branch 3.2.x
# Node ID d7c005e12af0926054a26e018bd64a09bcce5222
# Parent  6a4bdcccfa4dfa5c5c0e8a6544580dd930e5e28e
Remove unused test code.

diff -r 6a4bdcccfa4d -r d7c005e12af0 backend/src/main/java/org/dive4elements/river/backend/utils/StringUtil.java
--- 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) {


More information about the Dive4Elements-commits mailing list