[Libreoffice-commits] core.git: sccomp/qa

2022-05-03 Thread Stephan Bergmann (via logerrit)
 sccomp/qa/unit/SwarmSolverTest.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e4f1a6ba19f14f39dc45fff20b2f15adf2db04ee
Author: Stephan Bergmann 
AuthorDate: Tue May 3 23:24:38 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Wed May 4 08:36:09 2022 +0200

Just use Any ctor instead of makeAny in sccomp

Change-Id: I4872a74604b97ba68a7db10c2980fc32605bc492
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133787
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sccomp/qa/unit/SwarmSolverTest.cxx 
b/sccomp/qa/unit/SwarmSolverTest.cxx
index 966f9c673fc5..2503090514a9 100644
--- a/sccomp/qa/unit/SwarmSolverTest.cxx
+++ b/sccomp/qa/unit/SwarmSolverTest.cxx
@@ -275,7 +275,7 @@ void SwarmSolverTest::testMultipleVariables()
 uno::UNO_QUERY_THROW);
 
 uno::Reference xPropSet(xSolver, 
uno::UNO_QUERY_THROW);
-xPropSet->setPropertyValue("Integer", uno::makeAny(true));
+xPropSet->setPropertyValue("Integer", uno::Any(true));
 
 table::CellAddress aObjective(0, 5, 7);
 


[Libreoffice-commits] core.git: sccomp/qa

2021-06-09 Thread Julien Nabet (via logerrit)
 sccomp/qa/unit/SwarmSolverTest.cxx |   21 +++--
 sccomp/qa/unit/solver.cxx  |3 +--
 2 files changed, 8 insertions(+), 16 deletions(-)

New commits:
commit 5897a97bb53bcbf2283161cc22f43d87f575f3d6
Author: Julien Nabet 
AuthorDate: Wed Jun 9 18:14:41 2021 +0200
Commit: Julien Nabet 
CommitDate: Wed Jun 9 19:57:11 2021 +0200

Simplify Sequences initializations (sccomp)

Change-Id: I6316e1318ae1ee68e5d4e4529731bca0d1860b58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116932
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/sccomp/qa/unit/SwarmSolverTest.cxx 
b/sccomp/qa/unit/SwarmSolverTest.cxx
index b7d3becc475c..78cfccaaa376 100644
--- a/sccomp/qa/unit/SwarmSolverTest.cxx
+++ b/sccomp/qa/unit/SwarmSolverTest.cxx
@@ -75,8 +75,7 @@ void SwarmSolverTest::testUnconstrained()
 table::CellAddress aObjective(0, 1, 1);
 
 // "changing cells" - unknown variables
-uno::Sequence aVariables(1);
-aVariables[0] = table::CellAddress(0, 1, 0);
+uno::Sequence aVariables{ { 0, 1, 0 } };
 
 // constraints
 uno::Sequence aConstraints;
@@ -125,8 +124,7 @@ void SwarmSolverTest::testVariableBounded()
 table::CellAddress aObjective(0, 1, 1);
 
 // "changing cells" - unknown variables
-uno::Sequence aVariables(1);
-aVariables[0] = table::CellAddress(0, 1, 0);
+uno::Sequence aVariables{ { 0, 1, 0 } };
 
 // constraints
 uno::Sequence aConstraints(2);
@@ -177,8 +175,7 @@ void SwarmSolverTest::testVariableConstrained()
 table::CellAddress aObjective(0, 1, 1);
 
 // "changing cells" - unknown variables
-uno::Sequence aVariables(1);
-aVariables[0] = table::CellAddress(0, 1, 0);
+uno::Sequence aVariables{ { 0, 1, 0 } };
 
 // constraints
 uno::Sequence aConstraints(3);
@@ -233,9 +230,7 @@ void SwarmSolverTest::testTwoVariables()
 table::CellAddress aObjective(0, 1, 5);
 
 // "changing cells" - unknown variables
-uno::Sequence aVariables(2);
-aVariables[0] = table::CellAddress(0, 1, 2);
-aVariables[1] = table::CellAddress(0, 1, 3);
+uno::Sequence aVariables{ { 0, 1, 2 }, { 0, 1, 3 } };
 
 // constraints
 uno::Sequence aConstraints(4);
@@ -299,11 +294,9 @@ void SwarmSolverTest::testMultipleVariables()
 table::CellAddress aObjective(0, 5, 7);
 
 // "changing cells" - unknown variables
-uno::Sequence aVariables(4);
-aVariables[0] = table::CellAddress(0, 6, 1);
-aVariables[1] = table::CellAddress(0, 6, 2);
-aVariables[2] = table::CellAddress(0, 6, 3);
-aVariables[3] = table::CellAddress(0, 6, 4);
+uno::Sequence aVariables{
+{ 0, 6, 1 }, { 0, 6, 2 }, { 0, 6, 3 }, { 0, 6, 4 }
+};
 
 // constraints
 uno::Sequence aConstraints(12);
diff --git a/sccomp/qa/unit/solver.cxx b/sccomp/qa/unit/solver.cxx
index 4405279e26cb..eedbce69f274 100644
--- a/sccomp/qa/unit/solver.cxx
+++ b/sccomp/qa/unit/solver.cxx
@@ -87,8 +87,7 @@ void LpSolverTest::testSolver(OUString const & rName)
 table::CellAddress aObjective(0, 0, 0);
 
 // "changing cells" - unknown variables
-uno::Sequence aVariables(1);
-aVariables[0] = table::CellAddress(0, 0, 0);
+uno::Sequence aVariables { {0, 0, 0 } };
 
 // constraints
 uno::Sequence aConstraints(1);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sccomp/qa

2021-06-04 Thread Noel Grandin (via logerrit)
 sccomp/qa/unit/solver.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit fe66c4e2ac43ca0bef04ede7250848dd37c35a45
Author: Noel Grandin 
AuthorDate: Fri Jun 4 15:44:58 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Jun 4 22:08:41 2021 +0200

fix leak in solver test

Change-Id: I676b22a59f057a18d44a561f632803283cbe9b6f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116720
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sccomp/qa/unit/solver.cxx b/sccomp/qa/unit/solver.cxx
index 9355733c36d2..4405279e26cb 100644
--- a/sccomp/qa/unit/solver.cxx
+++ b/sccomp/qa/unit/solver.cxx
@@ -60,6 +60,7 @@ void LpSolverTest::setUp()
 void LpSolverTest::tearDown()
 {
 uno::Reference(m_xDocument, 
uno::UNO_QUERY_THROW)->dispose();
+m_xDocument.clear();
 test::BootstrapFixture::tearDown();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sccomp/qa

2020-06-04 Thread Stephan Bergmann (via logerrit)
 sccomp/qa/unit/SwarmSolverTest.cxx |   20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 5bc4d69007cfb715ea16e616c2fc5b90adc2f289
Author: Stephan Bergmann 
AuthorDate: Thu Jun 4 21:23:11 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jun 5 08:16:58 2020 +0200

Upcoming loplugin:elidestringvar: sccomp

Change-Id: I324c04f94ec5532e0a49d6f25a82121ad8baa439
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95538
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sccomp/qa/unit/SwarmSolverTest.cxx 
b/sccomp/qa/unit/SwarmSolverTest.cxx
index a92eb0b65d49..7b424cabbd56 100644
--- a/sccomp/qa/unit/SwarmSolverTest.cxx
+++ b/sccomp/qa/unit/SwarmSolverTest.cxx
@@ -67,9 +67,9 @@ void SwarmSolverTest::testUnconstrained()
 uno::Reference xSheet(xIndex->getByIndex(0), 
uno::UNO_QUERY_THROW);
 
 uno::Reference xSolver;
-const OUString sSolverName("com.sun.star.comp.Calc.SwarmSolver");
 
-
xSolver.set(m_xContext->getServiceManager()->createInstanceWithContext(sSolverName,
 m_xContext),
+xSolver.set(m_xContext->getServiceManager()->createInstanceWithContext(
+"com.sun.star.comp.Calc.SwarmSolver", m_xContext),
 uno::UNO_QUERY_THROW);
 
 table::CellAddress aObjective(0, 1, 1);
@@ -117,9 +117,9 @@ void SwarmSolverTest::testVariableBounded()
 uno::Reference xSheet(xIndex->getByIndex(0), 
uno::UNO_QUERY_THROW);
 
 uno::Reference xSolver;
-const OUString sSolverName("com.sun.star.comp.Calc.SwarmSolver");
 
-
xSolver.set(m_xContext->getServiceManager()->createInstanceWithContext(sSolverName,
 m_xContext),
+xSolver.set(m_xContext->getServiceManager()->createInstanceWithContext(
+"com.sun.star.comp.Calc.SwarmSolver", m_xContext),
 uno::UNO_QUERY_THROW);
 
 table::CellAddress aObjective(0, 1, 1);
@@ -169,9 +169,9 @@ void SwarmSolverTest::testVariableConstrained()
 uno::Reference xSheet(xIndex->getByIndex(0), 
uno::UNO_QUERY_THROW);
 
 uno::Reference xSolver;
-const OUString sSolverName("com.sun.star.comp.Calc.SwarmSolver");
 
-
xSolver.set(m_xContext->getServiceManager()->createInstanceWithContext(sSolverName,
 m_xContext),
+xSolver.set(m_xContext->getServiceManager()->createInstanceWithContext(
+"com.sun.star.comp.Calc.SwarmSolver", m_xContext),
 uno::UNO_QUERY_THROW);
 
 table::CellAddress aObjective(0, 1, 1);
@@ -225,9 +225,9 @@ void SwarmSolverTest::testTwoVariables()
 uno::Reference xSheet(xIndex->getByIndex(0), 
uno::UNO_QUERY_THROW);
 
 uno::Reference xSolver;
-const OUString sSolverName("com.sun.star.comp.Calc.SwarmSolver");
 
-
xSolver.set(m_xContext->getServiceManager()->createInstanceWithContext(sSolverName,
 m_xContext),
+xSolver.set(m_xContext->getServiceManager()->createInstanceWithContext(
+"com.sun.star.comp.Calc.SwarmSolver", m_xContext),
 uno::UNO_QUERY_THROW);
 
 table::CellAddress aObjective(0, 1, 5);
@@ -288,9 +288,9 @@ void SwarmSolverTest::testMultipleVariables()
 uno::Reference xSheet(xIndex->getByIndex(0), 
uno::UNO_QUERY_THROW);
 
 uno::Reference xSolver;
-const OUString sSolverName("com.sun.star.comp.Calc.SwarmSolver");
 
-
xSolver.set(m_xContext->getServiceManager()->createInstanceWithContext(sSolverName,
 m_xContext),
+xSolver.set(m_xContext->getServiceManager()->createInstanceWithContext(
+"com.sun.star.comp.Calc.SwarmSolver", m_xContext),
 uno::UNO_QUERY_THROW);
 
 uno::Reference xPropSet(xSolver, 
uno::UNO_QUERY_THROW);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sccomp/qa

2019-01-24 Thread Libreoffice Gerrit user
 sccomp/qa/unit/SwarmSolverTest.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 938012a9f42761836d5240ab8efacbeeaf3385b2
Author: Stephan Bergmann 
AuthorDate: Thu Jan 24 14:05:32 2019 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Jan 24 21:23:24 2019 +0100

Fix order of CPPUNIT_ASSERT_EQUAL expected vs. actual arguments

Change-Id: I36ea52e6ef7142566d4155c5279f791d4cf509a1
Reviewed-on: https://gerrit.libreoffice.org/66867
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sccomp/qa/unit/SwarmSolverTest.cxx 
b/sccomp/qa/unit/SwarmSolverTest.cxx
index 2f0e6d48104b..b7bd3025373e 100644
--- a/sccomp/qa/unit/SwarmSolverTest.cxx
+++ b/sccomp/qa/unit/SwarmSolverTest.cxx
@@ -102,7 +102,7 @@ void SwarmSolverTest::testUnconstrained()
 CPPUNIT_ASSERT(xSolver->getSuccess());
 uno::Sequence aSolution = xSolver->getSolution();
 
-CPPUNIT_ASSERT_EQUAL(aSolution.getLength(), aVariables.getLength());
+CPPUNIT_ASSERT_EQUAL(aVariables.getLength(), aSolution.getLength());
 // It happens that the unconstrained test does not find a solution in the
 // timeframe or number of generations it has available as the search space 
is
 // too big and the values might not converge to solution. So for now just 
run
@@ -161,7 +161,7 @@ void SwarmSolverTest::testVariableBounded()
 CPPUNIT_ASSERT(xSolver->getSuccess());
 uno::Sequence aSolution = xSolver->getSolution();
 
-CPPUNIT_ASSERT_EQUAL(aSolution.getLength(), aVariables.getLength());
+CPPUNIT_ASSERT_EQUAL(aVariables.getLength(), aSolution.getLength());
 CPPUNIT_ASSERT_DOUBLES_EQUAL(3.0, aSolution[0], 1E-5);
 }
 
@@ -219,7 +219,7 @@ void SwarmSolverTest::testVariableConstrained()
 CPPUNIT_ASSERT(xSolver->getSuccess());
 uno::Sequence aSolution = xSolver->getSolution();
 
-CPPUNIT_ASSERT_EQUAL(aSolution.getLength(), aVariables.getLength());
+CPPUNIT_ASSERT_EQUAL(aVariables.getLength(), aSolution.getLength());
 CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.741657, aSolution[0], 1E-5);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sccomp/qa

2018-02-28 Thread Tomaž Vajngerl
 sccomp/qa/unit/SwarmSolverTest.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 0d26570365e81ee65701b89e1d4121c04fbb813f
Author: Tomaž Vajngerl 
Date:   Wed Feb 28 18:53:17 2018 +0900

swarm: don't assert the result in testUnconstrained

It can happen the algorithm doesn't converge the values towards
the solution in the timeframe and number of generations it has
available (slow execution, high cpu load, bad luck) so for now
don't assert the expected value in the test, but still run it
so we know the algorithm does end eventually and doesn't cause
any seg. faults.

Change-Id: Ic889ad1618bf057ac7b281c15bce735f8ec5e13c
Reviewed-on: https://gerrit.libreoffice.org/50500
Reviewed-by: Stephan Bergmann 
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sccomp/qa/unit/SwarmSolverTest.cxx 
b/sccomp/qa/unit/SwarmSolverTest.cxx
index d0652e0fc0a9..6403de068a91 100644
--- a/sccomp/qa/unit/SwarmSolverTest.cxx
+++ b/sccomp/qa/unit/SwarmSolverTest.cxx
@@ -103,7 +103,12 @@ void SwarmSolverTest::testUnconstrained()
 uno::Sequence aSolution = xSolver->getSolution();
 
 CPPUNIT_ASSERT_EQUAL(aSolution.getLength(), aVariables.getLength());
-CPPUNIT_ASSERT_DOUBLES_EQUAL(3.0, aSolution[0], .9);
+// It happens that the unconstrained test does not find a solution in the
+// timeframe or number of generations it has available as the search space 
is
+// too big and the values might not converge to solution. So for now just 
run
+// the test so we know for sure the algorithm is guaranteed to finish
+// and doesn't cause any seg faults.
+//CPPUNIT_ASSERT_DOUBLES_EQUAL(3.0, aSolution[0], .9);
 }
 
 void SwarmSolverTest::testVariableBounded()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sccomp/qa

2017-11-24 Thread Stephan Bergmann
 sccomp/qa/unit/SwarmSolverTest.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1fa761af825641da5c87f80c2a17135f92418960
Author: Stephan Bergmann 
Date:   Fri Nov 24 15:30:48 2017 +0100

Ridiculously large delta for SwarmSolverTest::testUnconstrained for now

At least the Jenkins lo_ubsan build sporadically keeps failing
CppunitTest_sccomp_swarmsolvertest due to rather widely off values here
(3.00064356398118 in  
and
2.8639022684852 in ), 
so
suggestion by Tomaž Vajngerl was: "Let's adapt the delta for now. Generally
anything close to 3 should be acceptable as the algorithm greatly depends on
random values."

Change-Id: Id8f8657e521381decb1c719a1cffdf959ae74ef4
Reviewed-on: https://gerrit.libreoffice.org/45231
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sccomp/qa/unit/SwarmSolverTest.cxx 
b/sccomp/qa/unit/SwarmSolverTest.cxx
index 918cd9103021..0be632dfb174 100644
--- a/sccomp/qa/unit/SwarmSolverTest.cxx
+++ b/sccomp/qa/unit/SwarmSolverTest.cxx
@@ -103,7 +103,7 @@ void SwarmSolverTest::testUnconstrained()
 uno::Sequence aSolution = xSolver->getSolution();
 
 CPPUNIT_ASSERT_EQUAL(aSolution.getLength(), aVariables.getLength());
-CPPUNIT_ASSERT_DOUBLES_EQUAL(3.0, aSolution[0], 1E-5);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(3.0, aSolution[0], .2);
 }
 
 void SwarmSolverTest::testVariableBounded()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sccomp/qa

2017-11-20 Thread Stephan Bergmann
 sccomp/qa/unit/SwarmSolverTest.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 495d25bf653f3e0752982a889443b02fc374b0ed
Author: Stephan Bergmann 
Date:   Mon Nov 20 17:22:41 2017 +0100

CppunitTest_swarm_solver_test also consistently fails for UBSan build

...at least for my local one, with

> 
/data/sbergman/lo-san/core/sccomp/qa/unit/SwarmSolverTest.cxx:387:(anonymous 
namespace)::SwarmSolverTest::testMultipleVariables
> double equality assertion failed
> - Expected: 0
> - Actual  : 1
> - Delta   : 1e-05

so disable that part unconditionally for now.

Change-Id: Id8c091781baf4381696e2a8f0501df1f3f83724f
Reviewed-on: https://gerrit.libreoffice.org/44977
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sccomp/qa/unit/SwarmSolverTest.cxx 
b/sccomp/qa/unit/SwarmSolverTest.cxx
index 18553471ba19..fd1bac2d0090 100644
--- a/sccomp/qa/unit/SwarmSolverTest.cxx
+++ b/sccomp/qa/unit/SwarmSolverTest.cxx
@@ -382,8 +382,8 @@ void SwarmSolverTest::testMultipleVariables()
 uno::Sequence aSolution = xSolver->getSolution();
 
 CPPUNIT_ASSERT_EQUAL(aVariables.getLength(), aSolution.getLength());
-#ifndef _WIN32
-// Disable on windows for now, needs algorithm stability improvements
+#if 0
+// Disable for now, needs algorithm stability improvements
 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, aSolution[0], 1E-5);
 CPPUNIT_ASSERT_DOUBLES_EQUAL(3.0, aSolution[1], 1E-5);
 CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, aSolution[2], 1E-5);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sccomp/qa

2017-11-20 Thread Caolán McNamara
 sccomp/qa/unit/solver.cxx |   20 
 1 file changed, 16 insertions(+), 4 deletions(-)

New commits:
commit fda2ee3d87600ce7ecbec5528ea80b8e9758f584
Author: Caolán McNamara 
Date:   Mon Nov 20 08:55:31 2017 +

WaE: -Werror=unused-function

Change-Id: I773224bd332669c86648578a47612fa6d639c9c5
Reviewed-on: https://gerrit.libreoffice.org/44945
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sccomp/qa/unit/solver.cxx b/sccomp/qa/unit/solver.cxx
index 2ecc3282b17f..76d94fee88c3 100644
--- a/sccomp/qa/unit/solver.cxx
+++ b/sccomp/qa/unit/solver.cxx
@@ -26,18 +26,28 @@ class LpSolverTest: public test::BootstrapFixture
 {
 uno::Reference m_xDocument;
 
+#ifdef ENABLE_LPSOLVE
 void testLpSolver();
+#endif
+#ifdef ENABLE_COINMP
 void testCoinMPSolver();
+#endif
 
+#if defined(ENABLE_LPSOLVE) || defined(ENABLE_COINMP)
 void testSolver(OUString const & rName);
+#endif
 
 public:
 virtual void setUp() override;
 virtual void tearDown() override;
 
 CPPUNIT_TEST_SUITE(LpSolverTest);
+#ifdef ENABLE_LPSOLVE
 CPPUNIT_TEST(testLpSolver);
+#endif
+#ifdef ENABLE_COINMP
 CPPUNIT_TEST(testCoinMPSolver);
+#endif
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -57,20 +67,21 @@ void LpSolverTest::tearDown()
 test::BootstrapFixture::tearDown();
 }
 
+#ifdef ENABLE_LPSOLVE
 void LpSolverTest::testLpSolver()
 {
-#ifdef ENABLE_LPSOLVE
 testSolver("com.sun.star.comp.Calc.LpsolveSolver");
-#endif
 }
+#endif
 
+#ifdef ENABLE_COINMP
 void LpSolverTest::testCoinMPSolver()
 {
-#ifdef ENABLE_COINMP
 testSolver("com.sun.star.comp.Calc.CoinMPSolver");
-#endif
 }
+#endif
 
+#if defined(ENABLE_LPSOLVE) || defined(ENABLE_COINMP)
 void LpSolverTest::testSolver(OUString const & rName)
 {
 uno::Reference xSolver(m_xContext->getServiceManager()->
@@ -106,6 +117,7 @@ void LpSolverTest::testSolver(OUString const & rName)
 const OString sMessage("Empty description for " + OUStringToOString(rName, 
RTL_TEXTENCODING_UTF8));
 CPPUNIT_ASSERT_MESSAGE(sMessage.getStr(), 
!xDesc->getComponentDescription().isEmpty());
 }
+#endif
 
 CPPUNIT_TEST_SUITE_REGISTRATION(LpSolverTest);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sccomp/qa

2017-03-02 Thread Tomaž Vajngerl
 sccomp/qa/unit/lpsolver.cxx |   58 +---
 1 file changed, 23 insertions(+), 35 deletions(-)

New commits:
commit b5fb5951c1068446c1546ea0d441484c066c6124
Author: Tomaž Vajngerl 
Date:   Thu Mar 2 13:04:21 2017 +0100

change the solver test to explicitly test the available solvers

This changes the lpsolver test to explicitly test the available
linear solvers we have - either CoinMP, LpSolver or both. This
prevents that a newly added solver will be automatically tested
as it can have a different behaviour for the tested input values.

Change-Id: I0c4d2f9c561d1e834ca51196b7b5ecf7d89ba550
Reviewed-on: https://gerrit.libreoffice.org/34813
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sccomp/qa/unit/lpsolver.cxx b/sccomp/qa/unit/lpsolver.cxx
index 079d7fc..2754c03 100644
--- a/sccomp/qa/unit/lpsolver.cxx
+++ b/sccomp/qa/unit/lpsolver.cxx
@@ -26,15 +26,18 @@ class LpSolverTest: public test::BootstrapFixture
 {
 uno::Reference m_xDocument;
 
-void test();
-void testSolver(const uno::Reference& xSolver);
+void testLpSolver();
+void testCoinMPSolver();
+
+void testSolver(OUString const & rName);
 
 public:
 virtual void setUp() override;
 virtual void tearDown() override;
 
 CPPUNIT_TEST_SUITE(LpSolverTest);
-CPPUNIT_TEST(test);
+CPPUNIT_TEST(testLpSolver);
+CPPUNIT_TEST(testCoinMPSolver);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -54,44 +57,25 @@ void LpSolverTest::tearDown()
 test::BootstrapFixture::tearDown();
 }
 
-void LpSolverTest::test()
+void LpSolverTest::testLpSolver()
 {
-uno::Reference xEnAc(
-m_xContext->getServiceManager(), uno::UNO_QUERY_THROW);
-uno::Reference xEnum = xEnAc->
-createContentEnumeration( "com.sun.star.sheet.Solver" );
-CPPUNIT_ASSERT(xEnum.is());
-
-sal_Int32 nCount = 0;
-while (xEnum->hasMoreElements())
-{
-uno::Reference xIntFac;
-xEnum->nextElement() >>= xIntFac;
-CPPUNIT_ASSERT(xIntFac.is());
-uno::Reference xInfo(xIntFac, 
uno::UNO_QUERY_THROW);
-const OUString sName(xInfo->getImplementationName());
-uno::Reference 
xSolver(m_xContext->getServiceManager()->
-createInstanceWithContext(sName, m_xContext), 
uno::UNO_QUERY_THROW);
-testSolver(xSolver);
-
-uno::Reference xDesc(xSolver, 
uno::UNO_QUERY_THROW);
-const OString sMessage("Empty description for " +
-OUStringToOString(sName, RTL_TEXTENCODING_UTF8));
-CPPUNIT_ASSERT_MESSAGE(sMessage.getStr(), 
!xDesc->getComponentDescription().isEmpty());
-++nCount;
-}
-sal_Int32 nExpected = 0;
-#ifdef ENABLE_COINMP
-++nExpected;
-#endif
 #ifdef ENABLE_LPSOLVE
-++nExpected;
+testSolver("com.sun.star.comp.Calc.LpsolveSolver");
+#endif
+}
+
+void LpSolverTest::testCoinMPSolver()
+{
+#ifdef ENABLE_COINMP
+testSolver("com.sun.star.comp.Calc.CoinMPSolver");
 #endif
-CPPUNIT_ASSERT_EQUAL(nExpected, nCount);
 }
 
-void LpSolverTest::testSolver(const uno::Reference& xSolver)
+void LpSolverTest::testSolver(OUString const & rName)
 {
+uno::Reference xSolver(m_xContext->getServiceManager()->
+createInstanceWithContext(rName, m_xContext), 
uno::UNO_QUERY_THROW);
+
 table::CellAddress aObjective(0, 0, 0);
 
 // "changing cells" - unknown variables
@@ -117,6 +101,10 @@ void LpSolverTest::testSolver(const 
uno::Reference& xSolver)
 uno::Sequence aSolution = xSolver->getSolution();
 CPPUNIT_ASSERT_EQUAL(aSolution.getLength(), aVariables.getLength());
 CPPUNIT_ASSERT_EQUAL(aSolution[0], (double)5.0);
+
+uno::Reference xDesc(xSolver, 
uno::UNO_QUERY_THROW);
+const OString sMessage("Empty description for " + OUStringToOString(rName, 
RTL_TEXTENCODING_UTF8));
+CPPUNIT_ASSERT_MESSAGE(sMessage.getStr(), 
!xDesc->getComponentDescription().isEmpty());
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(LpSolverTest);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits