diff options
author | Philipp Hofer <philipp.hofer@protonmail.com> | 2020-11-12 13:23:10 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-11-18 12:04:58 +0100 |
commit | 1582d9a2c5ef9f28bc97a74e25c3948a7611fac1 (patch) | |
tree | 854893c78571f69672be4e695c3069b3cab2f1b0 /tools/qa | |
parent | f5e3b2e83ab463064f100a9cd93f09cadaae2292 (diff) |
tdf#123936 Formatting files in module tools with clang-format
Change-Id: I0f66d02e67388cc4d21c5e96bf84b6848e8de63a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105721
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'tools/qa')
-rw-r--r-- | tools/qa/cppunit/test_date.cxx | 72 | ||||
-rw-r--r-- | tools/qa/cppunit/test_pathutils.cxx | 25 | ||||
-rw-r--r-- | tools/qa/cppunit/test_rectangle.cxx | 9 |
3 files changed, 50 insertions, 56 deletions
diff --git a/tools/qa/cppunit/test_date.cxx b/tools/qa/cppunit/test_date.cxx index ca6c39d84109..9a243cce504c 100644 --- a/tools/qa/cppunit/test_date.cxx +++ b/tools/qa/cppunit/test_date.cxx @@ -14,7 +14,6 @@ namespace tools { - class DateTest : public CppUnit::TestFixture { public: @@ -43,45 +42,45 @@ public: void DateTest::testDate() { - const Date aCE(1,1,1); // first day CE - const Date aBCE(31,12,-1); // last day BCE - const Date aMin(1,1,-32768); // minimum date - const Date aMax(31,12,32767); // maximum date + const Date aCE(1, 1, 1); // first day CE + const Date aBCE(31, 12, -1); // last day BCE + const Date aMin(1, 1, -32768); // minimum date + const Date aMax(31, 12, 32767); // maximum date Date aDate(Date::EMPTY); const sal_Int32 kMinDays = -11968265; - const sal_Int32 kMaxDays = 11967900; + const sal_Int32 kMaxDays = 11967900; // Last day BCE to first day CE is 1 day difference. - CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(1), aCE - aBCE); - CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(-1), aBCE - aCE); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aCE - aBCE); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1), aBCE - aCE); aDate = aBCE; aDate.AddDays(1); - CPPUNIT_ASSERT_EQUAL( aCE.GetDate(), aDate.GetDate()); + CPPUNIT_ASSERT_EQUAL(aCE.GetDate(), aDate.GetDate()); aDate = aCE; aDate.AddDays(-1); - CPPUNIT_ASSERT_EQUAL( aBCE.GetDate(), aDate.GetDate()); + CPPUNIT_ASSERT_EQUAL(aBCE.GetDate(), aDate.GetDate()); // The entire BCE and CE ranges cover that many days. Day 0 is -0001-12-31 - CPPUNIT_ASSERT_EQUAL( kMaxDays, aMax - aBCE); - CPPUNIT_ASSERT_EQUAL( kMinDays, aMin - aBCE); + CPPUNIT_ASSERT_EQUAL(kMaxDays, aMax - aBCE); + CPPUNIT_ASSERT_EQUAL(kMinDays, aMin - aBCE); // Truncate at limits, not under-/overflow or wrap. aDate = aMin; aDate.AddDays(-1); - CPPUNIT_ASSERT_EQUAL( aMin.GetDate(), aDate.GetDate()); + CPPUNIT_ASSERT_EQUAL(aMin.GetDate(), aDate.GetDate()); aDate = aMax; aDate.AddDays(1); - CPPUNIT_ASSERT_EQUAL( aMax.GetDate(), aDate.GetDate()); + CPPUNIT_ASSERT_EQUAL(aMax.GetDate(), aDate.GetDate()); aDate = aBCE; - aDate.AddDays(kMinDays-10); - CPPUNIT_ASSERT_EQUAL( aMin.GetDate(), aDate.GetDate()); + aDate.AddDays(kMinDays - 10); + CPPUNIT_ASSERT_EQUAL(aMin.GetDate(), aDate.GetDate()); aDate = aBCE; - aDate.AddDays(kMaxDays+10); - CPPUNIT_ASSERT_EQUAL( aMax.GetDate(), aDate.GetDate()); + aDate.AddDays(kMaxDays + 10); + CPPUNIT_ASSERT_EQUAL(aMax.GetDate(), aDate.GetDate()); aDate = aMax; aDate.SetDay(32); aDate.Normalize(); - CPPUNIT_ASSERT_EQUAL( aMax.GetDate(), aDate.GetDate()); + CPPUNIT_ASSERT_EQUAL(aMax.GetDate(), aDate.GetDate()); CPPUNIT_ASSERT(!aDate.IsEmpty()); // 0001-00-x normalized to -0001-12-x @@ -89,7 +88,7 @@ void DateTest::testDate() aDate.SetMonth(0); aDate.SetDay(22); aDate.Normalize(); - CPPUNIT_ASSERT_EQUAL( Date(22,12,-1).GetDate(), aDate.GetDate()); + CPPUNIT_ASSERT_EQUAL(Date(22, 12, -1).GetDate(), aDate.GetDate()); sal_uInt32 nExpected = 11222; CPPUNIT_ASSERT_EQUAL(nExpected, aDate.GetDateUnsigned()); @@ -98,21 +97,21 @@ void DateTest::testDate() aDate.SetMonth(2); aDate.SetDay(32); aDate.Normalize(); - CPPUNIT_ASSERT_EQUAL( Date(4,3,1999).GetDate(), aDate.GetDate()); + CPPUNIT_ASSERT_EQUAL(Date(4, 3, 1999).GetDate(), aDate.GetDate()); // Empty date is not normalized and stays empty date. - aDate = Date( Date::EMPTY ); + aDate = Date(Date::EMPTY); aDate.Normalize(); - CPPUNIT_ASSERT_EQUAL( Date(Date::EMPTY).GetDate(), aDate.GetDate()); - CPPUNIT_ASSERT( !aDate.IsValidDate()); // GetDate() also shall have no normalizing side effect + CPPUNIT_ASSERT_EQUAL(Date(Date::EMPTY).GetDate(), aDate.GetDate()); + CPPUNIT_ASSERT(!aDate.IsValidDate()); // GetDate() also shall have no normalizing side effect // 0000-01-00 normalized to -0001-12-31 // SetYear(0) asserts, use empty date to force. - aDate = Date( Date::EMPTY ); + aDate = Date(Date::EMPTY); aDate.SetMonth(1); aDate.SetDay(0); aDate.Normalize(); - CPPUNIT_ASSERT_EQUAL( Date(31,12,-1).GetDate(), aDate.GetDate()); + CPPUNIT_ASSERT_EQUAL(Date(31, 12, -1).GetDate(), aDate.GetDate()); // 1999-00-00 normalized to 1998-12-31 (not 1998-11-30, or otherwise // also 0001-00-00 should be -0001-11-30 which it should not, should it?) @@ -120,14 +119,14 @@ void DateTest::testDate() aDate.SetMonth(0); aDate.SetDay(0); aDate.Normalize(); - CPPUNIT_ASSERT_EQUAL( Date(31,12,1998).GetDate(), aDate.GetDate()); + CPPUNIT_ASSERT_EQUAL(Date(31, 12, 1998).GetDate(), aDate.GetDate()); // 0001-00-00 normalized to -0001-12-31 aDate.SetYear(1); aDate.SetMonth(0); aDate.SetDay(0); aDate.Normalize(); - CPPUNIT_ASSERT_EQUAL( Date(31,12,-1).GetDate(), aDate.GetDate()); + CPPUNIT_ASSERT_EQUAL(Date(31, 12, -1).GetDate(), aDate.GetDate()); } void DateTest::testLeapYear() @@ -159,32 +158,32 @@ void DateTest::testLeapYear() { // Year -1 is a leap year. - Date aDate (28,2,-1); + Date aDate(28, 2, -1); aDate.AddDays(1); CPPUNIT_ASSERT(aDate.IsLeapYear()); - CPPUNIT_ASSERT_EQUAL( Date(29,2,-1).GetDate(), aDate.GetDate()); + CPPUNIT_ASSERT_EQUAL(Date(29, 2, -1).GetDate(), aDate.GetDate()); } { - Date aDate(1,3,-1); + Date aDate(1, 3, -1); aDate.AddDays(-1); CPPUNIT_ASSERT(aDate.IsLeapYear()); - CPPUNIT_ASSERT_EQUAL( Date(29,2,-1).GetDate(), aDate.GetDate()); + CPPUNIT_ASSERT_EQUAL(Date(29, 2, -1).GetDate(), aDate.GetDate()); } { // Year -5 is a leap year. - Date aDate(28,2,-5); + Date aDate(28, 2, -5); aDate.AddDays(1); CPPUNIT_ASSERT(aDate.IsLeapYear()); - CPPUNIT_ASSERT_EQUAL( Date(29,2,-5).GetDate(), aDate.GetDate()); + CPPUNIT_ASSERT_EQUAL(Date(29, 2, -5).GetDate(), aDate.GetDate()); } { - Date aDate(1,3,-5); + Date aDate(1, 3, -5); aDate.AddDays(-1); CPPUNIT_ASSERT(aDate.IsLeapYear()); - CPPUNIT_ASSERT_EQUAL( Date(29,2,-5).GetDate(), aDate.GetDate()); + CPPUNIT_ASSERT_EQUAL(Date(29, 2, -5).GetDate(), aDate.GetDate()); } } @@ -535,7 +534,6 @@ void DateTest::testIsBetween() } CPPUNIT_TEST_SUITE_REGISTRATION(DateTest); - } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/tools/qa/cppunit/test_pathutils.cxx b/tools/qa/cppunit/test_pathutils.cxx index c0a1ea5078d0..7ad75f1e8db2 100644 --- a/tools/qa/cppunit/test_pathutils.cxx +++ b/tools/qa/cppunit/test_pathutils.cxx @@ -24,25 +24,24 @@ #include <cppunit/extensions/HelperMacros.h> #include <tools/pathutils.hxx> -namespace { - -void buildPath( - wchar_t const * front, wchar_t const * back, wchar_t const * path) +namespace +{ +void buildPath(wchar_t const* front, wchar_t const* back, wchar_t const* path) { #if defined(_WIN32) wchar_t p[MAX_PATH]; - wchar_t * e = tools::buildPath( - p, front, front + std::wcslen(front), back, std::wcslen(back)); - CPPUNIT_ASSERT_EQUAL(static_cast<void *>(p + std::wcslen(path)), static_cast<void *>(e)); + wchar_t* e = tools::buildPath(p, front, front + std::wcslen(front), back, std::wcslen(back)); + CPPUNIT_ASSERT_EQUAL(static_cast<void*>(p + std::wcslen(path)), static_cast<void*>(e)); CPPUNIT_ASSERT_EQUAL(0, std::wcscmp(path, p)); #else - (void) front; - (void) back; - (void) path; + (void)front; + (void)back; + (void)path; #endif } -class Test: public CppUnit::TestFixture { +class Test : public CppUnit::TestFixture +{ public: void testBuildPath(); @@ -51,7 +50,8 @@ public: CPPUNIT_TEST_SUITE_END(); }; -void Test::testBuildPath() { +void Test::testBuildPath() +{ buildPath(L"a:\\b\\", L"..", L"a:\\"); buildPath(L"a:\\b\\", L"..\\", L"a:\\"); buildPath(L"a:\\b\\c\\", L"..\\..\\..\\d", L"a:\\..\\d"); @@ -61,7 +61,6 @@ void Test::testBuildPath() { } CPPUNIT_TEST_SUITE_REGISTRATION(Test); - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/qa/cppunit/test_rectangle.cxx b/tools/qa/cppunit/test_rectangle.cxx index 76ab1827f622..00970e47c792 100644 --- a/tools/qa/cppunit/test_rectangle.cxx +++ b/tools/qa/cppunit/test_rectangle.cxx @@ -14,8 +14,7 @@ namespace { - -class Test: public CppUnit::TestFixture +class Test : public CppUnit::TestFixture { public: void test_rectangle(); @@ -28,7 +27,7 @@ public: void Test::test_rectangle() { { - tools::Rectangle aRect(1,1,1,1); + tools::Rectangle aRect(1, 1, 1, 1); CPPUNIT_ASSERT_EQUAL(tools::Long(1), aRect.GetWidth()); CPPUNIT_ASSERT_EQUAL(tools::Long(1), aRect.GetHeight()); @@ -38,7 +37,7 @@ void Test::test_rectangle() } { - tools::Rectangle aRect(Point(), Size(1,1)); + tools::Rectangle aRect(Point(), Size(1, 1)); CPPUNIT_ASSERT_EQUAL(tools::Long(0), aRect.Left()); CPPUNIT_ASSERT_EQUAL(tools::Long(0), aRect.Top()); @@ -55,9 +54,7 @@ void Test::test_rectangle() } } - CPPUNIT_TEST_SUITE_REGISTRATION(Test); - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |