diff options
author | Noel Grandin <noel@peralex.com> | 2016-02-02 16:15:51 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-02-08 06:08:14 +0000 |
commit | b14224fe97b8a44232c9c1401d3a49771f46582e (patch) | |
tree | 8f9cf31cf4b51a0edbb43022499a6acd17d0945d /comphelper/qa | |
parent | c474e610e453d0f38f7cc6cb9559ad7e7b5d69ca (diff) |
loplugin:unusedmethods
using an idea from dtardon:
<dtardon> noelgrandin, hi. could you try to run the unusedmethods clang
plugin with "make build-nocheck"? that would catch functions that are
only used in tests. e.g., i just removed the whole o3tl::range class,
which has not been used in many years, but htere was a test for it...
<noelgrandin> dtardon, interesting idea! Sure, I can do that.
Change-Id: I5653953a426a2186a1e43017212d87ffce520387
Reviewed-on: https://gerrit.libreoffice.org/22041
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'comphelper/qa')
-rw-r--r-- | comphelper/qa/string/test_string.cxx | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx index af030351607c..97814da5fe4c 100644 --- a/comphelper/qa/string/test_string.cxx +++ b/comphelper/qa/string/test_string.cxx @@ -43,8 +43,6 @@ public: void testDecimalStringToNumber(); void testIsdigitAsciiString(); void testReverseString(); - void testEqualsString(); - void testCompareVersionStrings(); CPPUNIT_TEST_SUITE(TestString); CPPUNIT_TEST(testNatural); @@ -57,8 +55,6 @@ public: CPPUNIT_TEST(testDecimalStringToNumber); CPPUNIT_TEST(testIsdigitAsciiString); CPPUNIT_TEST(testReverseString); - CPPUNIT_TEST(testEqualsString); - CPPUNIT_TEST(testCompareVersionStrings); CPPUNIT_TEST_SUITE_END(); }; @@ -398,59 +394,6 @@ void TestString::testReverseString() CPPUNIT_ASSERT(aOut == "CBA"); } -void TestString::testEqualsString() -{ - OString aIn("A"); - CPPUNIT_ASSERT(::comphelper::string::equals(aIn, 'A')); - CPPUNIT_ASSERT(!::comphelper::string::equals(aIn, 'B')); - aIn = OString("AA"); - CPPUNIT_ASSERT(!::comphelper::string::equals(aIn, 'A')); - aIn.clear(); - CPPUNIT_ASSERT(!::comphelper::string::equals(aIn, 'A')); -} - -int sign(int n) -{ - if (n == 0) - return 0; - if (n < 0) - return -1; - else - return 1; -} - -void TestString::testCompareVersionStrings() -{ -#ifdef TEST -#error TEST already defined -#endif -#define TEST(a,b,result) \ - CPPUNIT_ASSERT(sign(::comphelper::string::compareVersionStrings(a, b)) == result); \ - if ( result != 0 ) \ - CPPUNIT_ASSERT(sign(::comphelper::string::compareVersionStrings(b, a)) == -(result)) - - TEST("", "", 0); - TEST("", "0", -1); - TEST("", "a", -1); - TEST("0", "1", -1); - TEST("1", "2", -1); - TEST("2", "10", -1); - TEST("01", "1", -1); - TEST("01", "001", 1); - TEST("1.00", "1", 1); - TEST("1.2", "1", 1); - TEST("1.01", "1.1", -1); - TEST("1.001", "1.1", -1); - TEST("1.001", "1.010", -1); - TEST("1.2.a", "1.2.b", -1); - TEST("1.2.3 (foo,bar)", "1.2.9", -1); - TEST("1.2.3 (foo,bar)", "1.2.4 (foo,bar)", -1); - TEST("1.2.3 (foo,bar)", "1.2.3 (foo)", 1); // Neither ordering makes any more sense than the other here, as long as they compare unequal - TEST("1.2.3 (foo,bar)", "1.2.2 (foo,bar)", 1); - -#undef TEST -} - CPPUNIT_TEST_SUITE_REGISTRATION(TestString); } |