diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-02-22 21:28:52 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-02-23 07:04:09 +0000 |
commit | dc96de7c62e1e6f37ec485f3f0f564a00f3d01f4 (patch) | |
tree | 2f22076b18079daa2f79021463818de6facd71e4 | |
parent | 6d404f9ccad3ac6a7ffb83876ae7a656bc2d4547 (diff) |
Extend loplugin:cppunitassertequals to more argument types
Change-Id: Ic2990ebc2e4a9a36dcd3f90c5f634ca7dd225d52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147491
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | basic/qa/cppunit/test_global_array.cxx | 4 | ||||
-rw-r--r-- | basic/qa/cppunit/test_global_as_new.cxx | 4 | ||||
-rw-r--r-- | chart2/qa/extras/chart2export2.cxx | 4 | ||||
-rw-r--r-- | chart2/qa/extras/chart2import2.cxx | 8 | ||||
-rw-r--r-- | compilerplugins/clang/cppunitassertequals.cxx | 15 | ||||
-rw-r--r-- | compilerplugins/clang/test/cppunitassertequals.cxx | 11 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_export_test.cxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_filters_test.cxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 28 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_copypaste.cxx | 14 | ||||
-rw-r--r-- | sc/qa/unit/ucalc_sort.cxx | 20 | ||||
-rw-r--r-- | sccomp/qa/unit/solver.cxx | 2 | ||||
-rw-r--r-- | svl/qa/unit/svl.cxx | 20 | ||||
-rw-r--r-- | test/source/table/xtablerows.cxx | 4 | ||||
-rw-r--r-- | vcl/qa/cppunit/outdev.cxx | 20 | ||||
-rw-r--r-- | writerperfect/qa/unit/WPXSvStreamTest.cxx | 2 |
16 files changed, 93 insertions, 71 deletions
diff --git a/basic/qa/cppunit/test_global_array.cxx b/basic/qa/cppunit/test_global_array.cxx index 5317e8701858..d2dafcfbda00 100644 --- a/basic/qa/cppunit/test_global_array.cxx +++ b/basic/qa/cppunit/test_global_array.cxx @@ -51,8 +51,8 @@ End Function )BAS"); CPPUNIT_ASSERT(mod->Compile()); - CPPUNIT_ASSERT_EQUAL(StarBASIC::GetErrBasic(), ERRCODE_NONE); - CPPUNIT_ASSERT_EQUAL(SbxBase::GetError(), ERRCODE_NONE); + CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, StarBASIC::GetErrBasic()); + CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, SbxBase::GetError()); CPPUNIT_ASSERT(mod->IsCompiled()); return mod; } diff --git a/basic/qa/cppunit/test_global_as_new.cxx b/basic/qa/cppunit/test_global_as_new.cxx index ea5b6fcc527c..868f62d3ec15 100644 --- a/basic/qa/cppunit/test_global_as_new.cxx +++ b/basic/qa/cppunit/test_global_as_new.cxx @@ -45,8 +45,8 @@ End Function )BAS"); CPPUNIT_ASSERT(mod->Compile()); - CPPUNIT_ASSERT_EQUAL(StarBASIC::GetErrBasic(), ERRCODE_NONE); - CPPUNIT_ASSERT_EQUAL(SbxBase::GetError(), ERRCODE_NONE); + CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, StarBASIC::GetErrBasic()); + CPPUNIT_ASSERT_EQUAL(ERRCODE_NONE, SbxBase::GetError()); CPPUNIT_ASSERT(mod->IsCompiled()); return mod; } diff --git a/chart2/qa/extras/chart2export2.cxx b/chart2/qa/extras/chart2export2.cxx index 4a95f40ab515..f56a0782feca 100644 --- a/chart2/qa/extras/chart2export2.cxx +++ b/chart2/qa/extras/chart2export2.cxx @@ -569,8 +569,8 @@ void Chart2ExportTest2::testCustomPositionofDataLabel() chart2::RelativePosition aCustomLabelPosition; CPPUNIT_ASSERT(xPropertySet->getPropertyValue("CustomLabelPosition") >>= aCustomLabelPosition); - CPPUNIT_ASSERT_DOUBLES_EQUAL(aCustomLabelPosition.Primary, -0.0961935120945059, 1e-5); - CPPUNIT_ASSERT_DOUBLES_EQUAL(aCustomLabelPosition.Secondary, 0.209578842093566, 1e-5); + CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.0961935120945059, aCustomLabelPosition.Primary, 1e-5); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.209578842093566, aCustomLabelPosition.Secondary, 1e-5); } } diff --git a/chart2/qa/extras/chart2import2.cxx b/chart2/qa/extras/chart2import2.cxx index 69658f9bc88b..17d85a5f1268 100644 --- a/chart2/qa/extras/chart2import2.cxx +++ b/chart2/qa/extras/chart2import2.cxx @@ -500,8 +500,8 @@ void Chart2ImportTest2::testDataPointLabelCustomPos() chart2::RelativePosition aCustomLabelPosition; xPropertySet->getPropertyValue("CustomLabelPosition") >>= aCustomLabelPosition; - CPPUNIT_ASSERT_DOUBLES_EQUAL(aCustomLabelPosition.Primary, -0.14621409921671025, 1e-7); - CPPUNIT_ASSERT_DOUBLES_EQUAL(aCustomLabelPosition.Secondary, -5.2887961029923464E-2, 1e-7); + CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.14621409921671025, aCustomLabelPosition.Primary, 1e-7); + CPPUNIT_ASSERT_DOUBLES_EQUAL(-5.2887961029923464E-2, aCustomLabelPosition.Secondary, 1e-7); sal_Int32 aPlacement; xPropertySet->getPropertyValue("LabelPlacement") >>= aPlacement; @@ -523,8 +523,8 @@ void Chart2ImportTest2::testTdf130032() chart2::RelativePosition aCustomLabelPosition; xPropertySet->getPropertyValue("CustomLabelPosition") >>= aCustomLabelPosition; - CPPUNIT_ASSERT_DOUBLES_EQUAL(aCustomLabelPosition.Primary, -0.0438333333333334, 1e-7); - CPPUNIT_ASSERT_DOUBLES_EQUAL(aCustomLabelPosition.Secondary, 0.086794050743657, 1e-7); + CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.0438333333333334, aCustomLabelPosition.Primary, 1e-7); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.086794050743657, aCustomLabelPosition.Secondary, 1e-7); sal_Int32 aPlacement; xPropertySet->getPropertyValue("LabelPlacement") >>= aPlacement; diff --git a/compilerplugins/clang/cppunitassertequals.cxx b/compilerplugins/clang/cppunitassertequals.cxx index 56f13b822163..26879fae9f95 100644 --- a/compilerplugins/clang/cppunitassertequals.cxx +++ b/compilerplugins/clang/cppunitassertequals.cxx @@ -132,6 +132,19 @@ bool CppunitAssertEquals::VisitCallExpr(const CallExpr* callExpr) callExpr->getExprLoc()) << callExpr->getSourceRange(); } + if (loplugin::DeclCheck(decl).Function("assertDoubleEquals"). + Namespace("CppUnit").GlobalNamespace()) + { + // can happen in template test code that both params are compile time constants + if (isCompileTimeConstant(callExpr->getArg(0))) + return true; + if (isCompileTimeConstant(callExpr->getArg(1))) + report( + DiagnosticsEngine::Warning, + "CPPUNIT_ASSERT_DOUBLES_EQUALS parameters look switched, expected value should be first param", + callExpr->getExprLoc()) + << callExpr->getSourceRange(); + } return true; } @@ -167,7 +180,7 @@ Expr const * stripConstructor(Expr const * expr) { bool CppunitAssertEquals::isCompileTimeConstant(Expr const * expr) { - if (expr->isIntegerConstantExpr(compiler.getASTContext())) + if (expr->isCXX11ConstantExpr(compiler.getASTContext())) return true; // is string literal ? expr = expr->IgnoreParenImpCasts(); diff --git a/compilerplugins/clang/test/cppunitassertequals.cxx b/compilerplugins/clang/test/cppunitassertequals.cxx index 05d814c855c2..3de01eb2b6eb 100644 --- a/compilerplugins/clang/test/cppunitassertequals.cxx +++ b/compilerplugins/clang/test/cppunitassertequals.cxx @@ -20,7 +20,8 @@ #define TEST2(x) x void test( - bool b1, bool b2, OUString const & s1, OUString const & s2, T t, void * p, std::nullptr_t n) + bool b1, bool b2, OUString const & s1, OUString const & s2, T t, void * p, std::nullptr_t n, + double d) { CppUnit::Asserter::failIf(b1,""); CPPUNIT_ASSERT(b1 && b2); // expected-error {{rather split into two CPPUNIT_ASSERT [loplugin:cppunitassertequals]}} @@ -70,6 +71,14 @@ void test( CPPUNIT_ASSERT_EQUAL_MESSAGE("foo", s1, OUString("xxx")); // expected-error {{CPPUNIT_ASSERT_EQUALS parameters look switched, expected value should be first param [loplugin:cppunitassertequals]}} CPPUNIT_ASSERT_EQUAL(OUString("xxx"), s1); CPPUNIT_ASSERT_EQUAL_MESSAGE("foo", OUString("xxx"), s1); + + CPPUNIT_ASSERT_EQUAL(d, 1.0); // expected-error {{CPPUNIT_ASSERT_EQUALS parameters look switched, expected value should be first param [loplugin:cppunitassertequals]}} + CPPUNIT_ASSERT_EQUAL(1.0, d); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(d, 1.0, 0.1); // expected-error {{CPPUNIT_ASSERT_DOUBLES_EQUALS parameters look switched, expected value should be first param [loplugin:cppunitassertequals]}} + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("foo", d, 1.0, 0.1); // expected-error {{CPPUNIT_ASSERT_DOUBLES_EQUALS parameters look switched, expected value should be first param [loplugin:cppunitassertequals]}} + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, d, 0.1); + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("foo", 1.0, d, 0.1); } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index aefd1a8eda48..d5bade09b9fa 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -318,7 +318,7 @@ void ScExportTest::test() pDoc = getScDoc(); double aVal = pDoc->GetValue(0, 0, 0); - ASSERT_DOUBLES_EQUAL(aVal, 1.0); + ASSERT_DOUBLES_EQUAL(1.0, aVal); } void ScExportTest::testDefaultFontHeight() @@ -488,7 +488,7 @@ void ScExportTest::testPasswordExport() pDoc = getScDoc(); double aVal = pDoc->GetValue(0, 0, 0); - ASSERT_DOUBLES_EQUAL(aVal, 1.0); + ASSERT_DOUBLES_EQUAL(1.0, aVal); } } diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx index 6af0460170be..52b0a1bf527e 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -3112,10 +3112,10 @@ void ScFiltersTest::testFormulaDependency() // check if formula in A1 changes value double nVal = pDoc->GetValue(0, 0, 0); - CPPUNIT_ASSERT_DOUBLES_EQUAL(nVal, 1.0, 1e-10); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, nVal, 1e-10); pDoc->SetValue(0, 1, 0, 0.0); nVal = pDoc->GetValue(0, 0, 0); - CPPUNIT_ASSERT_DOUBLES_EQUAL(nVal, 2.0, 1e-10); + CPPUNIT_ASSERT_DOUBLES_EQUAL(2.0, nVal, 1e-10); // check that the number format is implicitly inherited // CPPUNIT_ASSERT_EQUAL(pDoc->GetString(0,4,0), rDoc.GetString(0,5,0)); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index b94ccf7526c2..8b78c55ae005 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4207,42 +4207,42 @@ void Test::testUpdateReference() double aValue; aValue = m_pDoc->GetValue(2,0,2); - ASSERT_DOUBLES_EQUAL_MESSAGE("formula does not return correct result", aValue, 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("formula does not return correct result", 3, aValue); aValue = m_pDoc->GetValue(2,1,2); - ASSERT_DOUBLES_EQUAL_MESSAGE("formula does not return correct result", aValue, 5); + ASSERT_DOUBLES_EQUAL_MESSAGE("formula does not return correct result", 5, aValue); //test deleting both sheets: one is not directly before the sheet, the other one is m_pDoc->DeleteTab(0); aValue = m_pDoc->GetValue(2,0,1); - ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting first sheet formula does not return correct result", aValue, 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting first sheet formula does not return correct result", 3, aValue); aValue = m_pDoc->GetValue(2,1,1); - ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting first sheet formula does not return correct result", aValue, 5); + ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting first sheet formula does not return correct result", 5, aValue); m_pDoc->DeleteTab(0); aValue = m_pDoc->GetValue(2,0,0); - ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting second sheet formula does not return correct result", aValue, 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting second sheet formula does not return correct result", 3, aValue); aValue = m_pDoc->GetValue(2,1,0); - ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting second sheet formula does not return correct result", aValue, 5); + ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting second sheet formula does not return correct result", 5, aValue); //test adding two sheets m_pDoc->InsertTab(0, "Sheet2"); aValue = m_pDoc->GetValue(2,0,1); - ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting first sheet formula does not return correct result", aValue, 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting first sheet formula does not return correct result", 3, aValue); aValue = m_pDoc->GetValue(2,1,1); - ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting first sheet formula does not return correct result", aValue, 5); + ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting first sheet formula does not return correct result", 5, aValue); m_pDoc->InsertTab(0, "Sheet1"); aValue = m_pDoc->GetValue(2,0,2); - ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting second sheet formula does not return correct result", aValue, 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting second sheet formula does not return correct result", 3, aValue); aValue = m_pDoc->GetValue(2,1,2); - ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting second sheet formula does not return correct result", aValue, 5); + ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting second sheet formula does not return correct result", 5, aValue); //test new DeleteTabs/InsertTabs methods m_pDoc->DeleteTabs(0, 2); aValue = m_pDoc->GetValue(2, 0, 0); - ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting sheets formula does not return correct result", aValue, 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting sheets formula does not return correct result", 3, aValue); aValue = m_pDoc->GetValue(2, 1, 0); - ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting sheets formula does not return correct result", aValue, 5); + ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting sheets formula does not return correct result", 5, aValue); std::vector<OUString> aSheets; aSheets.emplace_back("Sheet1"); @@ -4250,9 +4250,9 @@ void Test::testUpdateReference() m_pDoc->InsertTabs(0, aSheets, true); aValue = m_pDoc->GetValue(2, 0, 2); - ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting sheets formula does not return correct result", aValue, 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting sheets formula does not return correct result", 3, aValue); aValue = m_pDoc->GetValue(2, 1, 2); - ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting sheets formula does not return correct result", aValue, 5); + ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting sheets formula does not return correct result", 5, aValue); m_pDoc->DeleteTab(3); m_pDoc->DeleteTab(2); diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index b6062cb04c72..5db90a4daa21 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -482,7 +482,7 @@ void TestCopyPaste::testCopyPaste() m_pDoc->SetString(1, 0, 0, aFormulaString); double fValue = m_pDoc->GetValue(ScAddress(1, 0, 0)); - ASSERT_DOUBLES_EQUAL_MESSAGE("formula should return 11", fValue, 11); + ASSERT_DOUBLES_EQUAL_MESSAGE("formula should return 11", 11, fValue); // add notes to A1:C1 setNote(0, 0, 0, "Hello world in A1"); // empty cell content @@ -568,7 +568,7 @@ void TestCopyPaste::testCopyPaste() //check undo and redo pUndo->Undo(); fValue = m_pDoc->GetValue(ScAddress(1, 1, 1)); - ASSERT_DOUBLES_EQUAL_MESSAGE("after undo formula should return nothing", fValue, 0); + ASSERT_DOUBLES_EQUAL_MESSAGE("after undo formula should return nothing", 0, fValue); aString = m_pDoc->GetString(2, 1, 1); CPPUNIT_ASSERT_MESSAGE("after undo, string should be removed", aString.isEmpty()); CPPUNIT_ASSERT_MESSAGE("after undo, note on A2 should be removed", !m_pDoc->HasNote(0, 1, 1)); @@ -9961,7 +9961,7 @@ void TestCopyPaste::testMoveBlock() CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell C1 should contain an updated formula", OUString("=B1+1"), aString); double fValue = m_pDoc->GetValue(aAddrB1); - ASSERT_DOUBLES_EQUAL_MESSAGE("Cell B1 should contain 1", fValue, 1); + ASSERT_DOUBLES_EQUAL_MESSAGE("Cell B1 should contain 1", 1, fValue); // cell notes has been moved 1 cell right (event when overlapping) CPPUNIT_ASSERT_MESSAGE("There should be NO note on A1", !m_pDoc->HasNote(aAddrA1)); @@ -10219,16 +10219,16 @@ void TestCopyPaste::testCopyPasteFormulas() m_pDoc->SetString(0, 4, 0, "=$Sheet2.A$1"); // to prevent ScEditableTester in ScDocFunc::MoveBlock - ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(0, 0, 0), 1.0); - ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(0, 1, 0), 1.0); + ASSERT_DOUBLES_EQUAL(1.0, m_pDoc->GetValue(0, 0, 0)); + ASSERT_DOUBLES_EQUAL(1.0, m_pDoc->GetValue(0, 1, 0)); ScDocFunc& rDocFunc = m_xDocShell->GetDocFunc(); bool bMoveDone = rDocFunc.MoveBlock(ScRange(0, 0, 0, 0, 4, 0), ScAddress(10, 10, 0), false, false, false, true); // check that moving was successful, mainly for editable tester CPPUNIT_ASSERT(bMoveDone); - ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(10, 10, 0), 1.0); - ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(10, 11, 0), 1.0); + ASSERT_DOUBLES_EQUAL(1.0, m_pDoc->GetValue(10, 10, 0)); + ASSERT_DOUBLES_EQUAL(1.0, m_pDoc->GetValue(10, 11, 0)); CPPUNIT_ASSERT_EQUAL(OUString("=COLUMN($A$1)"), m_pDoc->GetFormula(10, 10, 0)); CPPUNIT_ASSERT_EQUAL(OUString("=$A$1+L12"), m_pDoc->GetFormula(10, 11, 0)); CPPUNIT_ASSERT_EQUAL(OUString("=$Sheet2.K11"), m_pDoc->GetFormula(10, 12, 0)); diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx index f71e0d663a59..2a046adb668f 100644 --- a/sc/qa/unit/ucalc_sort.cxx +++ b/sc/qa/unit/ucalc_sort.cxx @@ -121,7 +121,7 @@ void TestSort::testSort() m_pDoc->Sort(0, aSortData, false, true, nullptr, nullptr); double nVal = m_pDoc->GetValue(1,0,0); - ASSERT_DOUBLES_EQUAL(nVal, 1.0); + ASSERT_DOUBLES_EQUAL(1.0, nVal); // check that note is also moved after sorting pNote = m_pDoc->GetNote(1, 0, 0); @@ -1683,24 +1683,24 @@ void TestSort::testSortBroadcaster() // Enter new value and check that it is broadcasted. First in empty cell. m_pDoc->SetString(1,5,0, "16"); double nVal = m_pDoc->GetValue(1,7,0); - ASSERT_DOUBLES_EQUAL(nVal, 16.0); + ASSERT_DOUBLES_EQUAL(16.0, nVal); nVal = m_pDoc->GetValue(1,8,0); - ASSERT_DOUBLES_EQUAL(nVal, 16.0); + ASSERT_DOUBLES_EQUAL(16.0, nVal); nVal = m_pDoc->GetValue(1,9,0); - ASSERT_DOUBLES_EQUAL(nVal, 17.0); + ASSERT_DOUBLES_EQUAL(17.0, nVal); nVal = m_pDoc->GetValue(1,10,0); - ASSERT_DOUBLES_EQUAL(nVal, 17.0); + ASSERT_DOUBLES_EQUAL(17.0, nVal); // Enter new value and check that it is broadcasted. Now overwriting data. m_pDoc->SetString(0,5,0, "32"); nVal = m_pDoc->GetValue(0,7,0); - ASSERT_DOUBLES_EQUAL(nVal, 32.0); + ASSERT_DOUBLES_EQUAL(32.0, nVal); nVal = m_pDoc->GetValue(0,8,0); - ASSERT_DOUBLES_EQUAL(nVal, 32.0); + ASSERT_DOUBLES_EQUAL(32.0, nVal); nVal = m_pDoc->GetValue(0,9,0); - ASSERT_DOUBLES_EQUAL(nVal, 34.0); + ASSERT_DOUBLES_EQUAL(34.0, nVal); nVal = m_pDoc->GetValue(0,10,0); - ASSERT_DOUBLES_EQUAL(nVal, 34.0); + ASSERT_DOUBLES_EQUAL(34.0, nVal); } m_pDoc->DeleteTab(0); @@ -1973,7 +1973,7 @@ void TestSort::testSortImages() m_pDoc->Sort(0, aSortData, false, true, nullptr, nullptr); double nVal = m_pDoc->GetValue(0,0,0); - ASSERT_DOUBLES_EQUAL(nVal, 1.0); + ASSERT_DOUBLES_EQUAL(1.0, nVal); // check that note is also moved after sorting aCellPos = ScAddress(1, 0, 0); diff --git a/sccomp/qa/unit/solver.cxx b/sccomp/qa/unit/solver.cxx index c4df7b644643..a339eab4db6f 100644 --- a/sccomp/qa/unit/solver.cxx +++ b/sccomp/qa/unit/solver.cxx @@ -108,7 +108,7 @@ void LpSolverTest::testSolver(OUString const & rName) CPPUNIT_ASSERT(xSolver->getSuccess()); uno::Sequence<double> aSolution = xSolver->getSolution(); CPPUNIT_ASSERT_EQUAL(aSolution.getLength(), aVariables.getLength()); - CPPUNIT_ASSERT_EQUAL(aSolution[0], 5.0); + CPPUNIT_ASSERT_EQUAL(5.0, aSolution[0]); uno::Reference<sheet::XSolverDescription> xDesc(xSolver, uno::UNO_QUERY_THROW); const OString sMessage("Empty description for " + OUStringToOString(rName, RTL_TEXTENCODING_UTF8)); diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index 29bbde9b999d..a64abd5fa89f 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -1859,16 +1859,16 @@ void Test::testStandardColorIntegrity() CPPUNIT_ASSERT_EQUAL( size_t(NF_KEY_LASTCOLOR) - size_t(NF_KEY_FIRSTCOLOR) + 1, nMaxDefaultColors ); CPPUNIT_ASSERT_EQUAL( nMaxDefaultColors, rStandardColors.size() ); // Colors must follow same order as in sEnglishKeyword - CPPUNIT_ASSERT_EQUAL( rStandardColors[0], COL_BLACK ); - CPPUNIT_ASSERT_EQUAL( rStandardColors[1], COL_LIGHTBLUE ); - CPPUNIT_ASSERT_EQUAL( rStandardColors[2], COL_LIGHTGREEN ); - CPPUNIT_ASSERT_EQUAL( rStandardColors[3], COL_LIGHTCYAN ); - CPPUNIT_ASSERT_EQUAL( rStandardColors[4], COL_LIGHTRED ); - CPPUNIT_ASSERT_EQUAL( rStandardColors[5], COL_LIGHTMAGENTA ); - CPPUNIT_ASSERT_EQUAL( rStandardColors[6], COL_BROWN ); - CPPUNIT_ASSERT_EQUAL( rStandardColors[7], COL_GRAY ); - CPPUNIT_ASSERT_EQUAL( rStandardColors[8], COL_YELLOW ); - CPPUNIT_ASSERT_EQUAL( rStandardColors[9], COL_WHITE ); + CPPUNIT_ASSERT_EQUAL( COL_BLACK, rStandardColors[0] ); + CPPUNIT_ASSERT_EQUAL( COL_LIGHTBLUE, rStandardColors[1] ); + CPPUNIT_ASSERT_EQUAL( COL_LIGHTGREEN, rStandardColors[2] ); + CPPUNIT_ASSERT_EQUAL( COL_LIGHTCYAN, rStandardColors[3] ); + CPPUNIT_ASSERT_EQUAL( COL_LIGHTRED, rStandardColors[4] ); + CPPUNIT_ASSERT_EQUAL( COL_LIGHTMAGENTA, rStandardColors[5] ); + CPPUNIT_ASSERT_EQUAL( COL_BROWN, rStandardColors[6] ); + CPPUNIT_ASSERT_EQUAL( COL_GRAY, rStandardColors[7] ); + CPPUNIT_ASSERT_EQUAL( COL_YELLOW, rStandardColors[8] ); + CPPUNIT_ASSERT_EQUAL( COL_WHITE, rStandardColors[9] ); } void Test::testColorNamesConversion() diff --git a/test/source/table/xtablerows.cxx b/test/source/table/xtablerows.cxx index c241b2bb88f6..f44a6fcbce46 100644 --- a/test/source/table/xtablerows.cxx +++ b/test/source/table/xtablerows.cxx @@ -32,7 +32,7 @@ void XTableRows::testInsertByIndex() xTableRows->removeByIndex(0, 1); xTableRows->insertByIndex(0, 1); - CPPUNIT_ASSERT_DOUBLES_EQUAL(xCellRange->getCellByPosition(0, 1)->getValue(), 15.0, 0.1); + CPPUNIT_ASSERT_DOUBLES_EQUAL(15.0, xCellRange->getCellByPosition(0, 1)->getValue(), 0.1); CPPUNIT_ASSERT_THROW(xTableRows->insertByIndex(-1, 1), uno::RuntimeException); } @@ -45,7 +45,7 @@ void XTableRows::testRemoveByIndex() uno::Reference<table::XTableRows> xTableRows(init(), uno::UNO_QUERY_THROW); xTableRows->removeByIndex(0, 1); - CPPUNIT_ASSERT_DOUBLES_EQUAL(xCellRange->getCellByPosition(0, 0)->getValue(), 15.0, 0.1); + CPPUNIT_ASSERT_DOUBLES_EQUAL(15.0, xCellRange->getCellByPosition(0, 0)->getValue(), 0.1); CPPUNIT_ASSERT_THROW(xTableRows->removeByIndex(-1, 1), uno::RuntimeException); } diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx index b3468aa7c4ee..99fb0b9be7d9 100644 --- a/vcl/qa/cppunit/outdev.cxx +++ b/vcl/qa/cppunit/outdev.cxx @@ -162,31 +162,31 @@ public: void VclOutdevTest::testGetReadableFontColorPrinter() { ScopedVclPtrInstance<Printer> pPrinter; - CPPUNIT_ASSERT_EQUAL(pPrinter->GetReadableFontColor(COL_WHITE, COL_WHITE), COL_BLACK); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, pPrinter->GetReadableFontColor(COL_WHITE, COL_WHITE)); } void VclOutdevTest::testGetReadableFontColorWindow() { ScopedVclPtrInstance<vcl::Window> pWindow(nullptr, WB_APP | WB_STDWORK); - CPPUNIT_ASSERT_EQUAL(pWindow->GetOutDev()->GetReadableFontColor(COL_WHITE, COL_BLACK), - COL_WHITE); - CPPUNIT_ASSERT_EQUAL(pWindow->GetOutDev()->GetReadableFontColor(COL_WHITE, COL_WHITE), - COL_BLACK); - CPPUNIT_ASSERT_EQUAL(pWindow->GetOutDev()->GetReadableFontColor(COL_BLACK, COL_BLACK), - COL_WHITE); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, + pWindow->GetOutDev()->GetReadableFontColor(COL_WHITE, COL_BLACK)); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, + pWindow->GetOutDev()->GetReadableFontColor(COL_WHITE, COL_WHITE)); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, + pWindow->GetOutDev()->GetReadableFontColor(COL_BLACK, COL_BLACK)); } void VclOutdevTest::testPrinterBackgroundColor() { ScopedVclPtrInstance<Printer> pPrinter; - CPPUNIT_ASSERT_EQUAL(pPrinter->GetBackgroundColor(), COL_WHITE); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, pPrinter->GetBackgroundColor()); } void VclOutdevTest::testWindowBackgroundColor() { ScopedVclPtrInstance<vcl::Window> pWindow(nullptr, WB_APP | WB_STDWORK); pWindow->SetBackground(Wallpaper(COL_WHITE)); - CPPUNIT_ASSERT_EQUAL(pWindow->GetBackgroundColor(), COL_WHITE); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, pWindow->GetBackgroundColor()); } void VclOutdevTest::testVirtualDevice() @@ -197,7 +197,7 @@ void VclOutdevTest::testVirtualDevice() pVDev->SetOutputSizePixel(Size(32, 32)); pVDev->SetBackground(Wallpaper(COL_WHITE)); - CPPUNIT_ASSERT_EQUAL(pVDev->GetBackgroundColor(), COL_WHITE); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, pVDev->GetBackgroundColor()); pVDev->Erase(); pVDev->DrawPixel(Point(1, 2), COL_BLUE); diff --git a/writerperfect/qa/unit/WPXSvStreamTest.cxx b/writerperfect/qa/unit/WPXSvStreamTest.cxx index 0bd7b7b159fa..7936664f2569 100644 --- a/writerperfect/qa/unit/WPXSvStreamTest.cxx +++ b/writerperfect/qa/unit/WPXSvStreamTest.cxx @@ -175,7 +175,7 @@ void WPXSvStreamTest::testRead() pData = pInput->read(0UL, nReadBytes); CPPUNIT_ASSERT_EQUAL(0UL, nReadBytes); CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); - CPPUNIT_ASSERT_EQUAL(pData, static_cast<const unsigned char*>(nullptr)); + CPPUNIT_ASSERT_EQUAL(static_cast<const unsigned char*>(nullptr), pData); CPPUNIT_ASSERT(!pInput->isEnd()); } |