diff options
author | Radu Ioan <ioan.radu.g@gmail.com> | 2012-09-09 01:02:51 +0300 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-09-10 20:25:30 +0000 |
commit | 6ffa064e7d8bfcdef815f24e2cfdb791dc960ba2 (patch) | |
tree | 4c7e91c77def17f6fc72a60fefa17b6b6c660154 /sal | |
parent | fdo#54542 fix start of table wizard IDs (diff) | |
download | core-6ffa064e7d8bfcdef815f24e2cfdb791dc960ba2.tar.gz core-6ffa064e7d8bfcdef815f24e2cfdb791dc960ba2.zip |
fdo#39625 Make existing cppunittests work
Make sal testHelperFunctions cppunit work
- removed call to simpleheader.hxx
- added call in Module_sal.mk for sal_testHelperFunctions
- created mk for cppunittest for sal_testHelperFunctions
- removed unused and unusefull function
Patch#2
- remove some unusefull include
- add bug number to commit message
Change-Id: I2f4e831cea0213a07f440bb00e0302eb1c4d7dc1
Reviewed-on: https://gerrit.libreoffice.org/588
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/CppunitTest_sal_testHelperFunctions.mk | 33 | ||||
-rw-r--r-- | sal/Module_sal.mk | 1 | ||||
-rw-r--r-- | sal/qa/testHelperFunctions/testHelperFunctions.cxx | 48 | ||||
-rw-r--r-- | sal/qa/testHelperFunctions/testHelperFunctions2.cxx | 8 |
4 files changed, 63 insertions, 27 deletions
diff --git a/sal/CppunitTest_sal_testHelperFunctions.mk b/sal/CppunitTest_sal_testHelperFunctions.mk new file mode 100644 index 000000000000..9e4ba1a78317 --- /dev/null +++ b/sal/CppunitTest_sal_testHelperFunctions.mk @@ -0,0 +1,33 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Major Contributor(s): +# Copyright (C) 2012 Radu Ioan <ioan.radu.g@gmail.com> (initial developer) +# +# All Rights Reserved. +# +# For minor contributions see the git repository. + +$(eval $(call gb_CppunitTest_CppunitTest,sal_testHelperFunctions)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sal_testHelperFunctions,\ + sal/qa/testHelperFunctions/testHelperFunctions \ + sal/qa/testHelperFunctions/testHelperFunctions2 \ +)) + +$(eval $(call gb_CppunitTest_set_include,sal_testHelperFunctions,\ + $$(INCLUDE) \ + -I$(SRCDIR)/sal/qa/inc \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,sal_testHelperFunctions,\ + sal \ + $(gb_STDLIBS) \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/sal/Module_sal.mk b/sal/Module_sal.mk index ec6545dfd30e..e693abc1f615 100644 --- a/sal/Module_sal.mk +++ b/sal/Module_sal.mk @@ -72,6 +72,7 @@ $(eval $(call gb_Module_add_check_targets,sal,\ CppunitTest_sal_rtl_strings \ CppunitTest_sal_rtl_uuid \ CppunitTest_sal_tcwf \ + CppunitTest_sal_testHelperFunctions \ CppunitTest_sal_types \ )) diff --git a/sal/qa/testHelperFunctions/testHelperFunctions.cxx b/sal/qa/testHelperFunctions/testHelperFunctions.cxx index b7781c33c49b..6b8d768ff40d 100644 --- a/sal/qa/testHelperFunctions/testHelperFunctions.cxx +++ b/sal/qa/testHelperFunctions/testHelperFunctions.cxx @@ -34,18 +34,18 @@ #include "stringhelper.hxx" -#include <testshl/simpleheader.hxx> +#include <rtl/ustring.hxx> + +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> -// void isJaBloed() -// { -// t_print("Ist ja echt bloed.\n"); -// } inline sal_Int64 t_abs64(sal_Int64 _nValue) { // std::abs() seems to have some ambiguity problems (so-texas) // return abs(_nValue); - t_print("t_abs64(%ld)\n", _nValue); + printf("t_abs64(%ld)\n", _nValue); // CPPUNIT_ASSERT(_nValue < 2147483647); if (_nValue < 0) @@ -108,7 +108,7 @@ namespace testOfHelperFunctions { // this values has an overrun! sal_Int32 n32 = 2147483648; - t_print("n32 should be -2^31 is: %d\n", n32); + printf("n32 should be -2^31 is: %d\n", n32); CPPUNIT_ASSERT_MESSAGE("n32!=2147483648", n32 == -2147483648 ); } @@ -118,7 +118,7 @@ namespace testOfHelperFunctions sal_Int64 n; n = 1073741824; n <<= 9; - t_print("Value of n is "); + printf("Value of n is "); t_print64(n); CPPUNIT_ASSERT_MESSAGE("n=2^30 << 9", t_abs64(n) > 0 ); } @@ -127,7 +127,7 @@ namespace testOfHelperFunctions { sal_Int64 n; n = 2147483648 << 8; - t_print("Value of n is "); + printf("Value of n is "); t_print64(n); CPPUNIT_ASSERT_MESSAGE("n=2^31 << 8", t_abs64(n) > 0 ); } @@ -135,7 +135,7 @@ namespace testOfHelperFunctions { sal_Int64 n; n = sal_Int64(2147483648) << 8; - t_print("Value of n is "); + printf("Value of n is "); t_print64(n); CPPUNIT_ASSERT_MESSAGE("n=2^31 << 8", t_abs64(n) > 0 ); } @@ -144,7 +144,7 @@ namespace testOfHelperFunctions { sal_Int64 n; n = 2147483648 << 1; - t_print("Value of n is "); + printf("Value of n is "); t_print64(n); CPPUNIT_ASSERT_MESSAGE("(2147483648 << 1) is != 0", n != 0 ); @@ -178,17 +178,17 @@ namespace testOfHelperFunctions { sal_Int64 n = 0; n = -1; - t_print("Value of n is -1 : "); + printf("Value of n is -1 : "); t_print64(n); CPPUNIT_ASSERT_MESSAGE("n=-1", t_abs64(n) > 0 ); n = -2147483648; - t_print("Value of n is -2^31 : "); + printf("Value of n is -2^31 : "); t_print64(n); CPPUNIT_ASSERT_MESSAGE("n=-2^31", t_abs64(n) > 0 ); n = -8589934592LL; - t_print("Value of n is -2^33 : "); + printf("Value of n is -2^33 : "); t_print64(n); CPPUNIT_ASSERT_MESSAGE("n=-2^33", t_abs64(n) > 0 ); } @@ -207,16 +207,16 @@ namespace testOfHelperFunctions void test_t_print::t_print_001( ) { - t_print("This is only a test of some helper functions\n"); + printf("This is only a test of some helper functions\n"); sal_Int32 nValue = 12345; - t_print("a value %d (should be 12345)\n", nValue); + printf("a value %d (should be 12345)\n", nValue); rtl::OString sValue("foo bar"); - t_print("a String '%s' (should be 'foo bar')\n", sValue.getStr()); + printf("a String '%s' (should be 'foo bar')\n", sValue.getStr()); rtl::OUString suValue("a unicode string"); sValue <<= suValue; - t_print("a String '%s'\n", sValue.getStr()); + printf("a String '%s'\n", sValue.getStr()); } @@ -395,7 +395,7 @@ void test_TimeValues::t_time1() void test_TimeValues::t_time2() { - t_print("Wait repeats 20 times.\n"); + printf("Wait repeats 20 times.\n"); int i=0; while(i++<20) { @@ -410,7 +410,7 @@ void test_TimeValues::t_time2() void test_TimeValues::t_time3() { - t_print("Wait repeats 100 times.\n"); + printf("Wait repeats 100 times.\n"); int i=0; while(i++<20) { @@ -445,11 +445,11 @@ void test_TimeValues::t_time3() } // namespace testOfHelperFunctions // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( testOfHelperFunctions::test_t_print, "helperFunctions" ); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( testOfHelperFunctions::test_t_abs64, "helperFunctions" ); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( testOfHelperFunctions::test_TimeValues, "helperFunctions" ); +CPPUNIT_TEST_SUITE_REGISTRATION( testOfHelperFunctions::test_t_print ); +CPPUNIT_TEST_SUITE_REGISTRATION( testOfHelperFunctions::test_t_abs64 ); +CPPUNIT_TEST_SUITE_REGISTRATION( testOfHelperFunctions::test_TimeValues ); // ----------------------------------------------------------------------------- -NOADDITIONAL; +CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/qa/testHelperFunctions/testHelperFunctions2.cxx b/sal/qa/testHelperFunctions/testHelperFunctions2.cxx index b6610f632c09..966b4954fd68 100644 --- a/sal/qa/testHelperFunctions/testHelperFunctions2.cxx +++ b/sal/qa/testHelperFunctions/testHelperFunctions2.cxx @@ -27,7 +27,9 @@ ************************************************************************/ -#include <testshl/simpleheader.hxx> +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/plugin/TestPlugIn.h> #include "stringhelper.hxx" namespace testOfHelperFunctions @@ -47,13 +49,13 @@ namespace testOfHelperFunctions rtl::OString sValue; rtl::OUString suValue("This is only a test of some helper functions"); sValue <<= suValue; - t_print("'%s'\n", sValue.getStr()); + printf("'%s'\n", sValue.getStr()); } } // namespace testOfHelperFunctions // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( testOfHelperFunctions::test_valueequal, "helperFunctions" ); +CPPUNIT_TEST_SUITE_REGISTRATION( testOfHelperFunctions::test_valueequal ); // ----------------------------------------------------------------------------- // This is only allowed to be in one file! |