test/source/sheet/xfunctiondescriptions.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
New commits: commit 09fcdbd5e0ae35fb7db8c8784329035edd82573b Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Feb 14 22:36:01 2018 +0100 Fix random range for XFunctionDescriptions::testGetById ...regression introduced with eff70347190a6642fd62a9e0b20e4366c39fbc7a "tdf#45904 Move _XFunctionDescriptions Java test to C++" (where java.util.Random.nextInt(n) returned a value 0 <= x < n), apparently causing sporadic failures of CppunitTest_sc_functionlistobj like <https:// ci.libreoffice.org/job/lo_gerrit/27696/Config=linux_clang_dbgutil_64/console> > ##Failure Location unknown## : Error > Test name: sc_apitest::ScFunctionListObj::testGetById > An uncaught exception of type com.sun.star.lang.IndexOutOfBoundsException Also verify that nCount is not negative, so that the requirements of the std::uniform_int_distribution ctor are guaranteed to be satisfied. Change-Id: I90a5dc234fdd07f52fea69ae1d406f0818efb007 diff --git a/test/source/sheet/xfunctiondescriptions.cxx b/test/source/sheet/xfunctiondescriptions.cxx index 12da126cb8d3..5a71f532a4be 100644 --- a/test/source/sheet/xfunctiondescriptions.cxx +++ b/test/source/sheet/xfunctiondescriptions.cxx @@ -30,12 +30,12 @@ void XFunctionDescriptions::testGetById() uno::Reference<sheet::XFunctionDescriptions> xFD(init(), UNO_QUERY_THROW); const sal_Int32 nCount = xFD->getCount(); - CPPUNIT_ASSERT_MESSAGE("No FunctionDescriptions available", 0 != nCount); + CPPUNIT_ASSERT_MESSAGE("No FunctionDescriptions available", 0 < nCount); // first grab a random function descriptions std::random_device rd; std::mt19937 gen(rd()); - std::uniform_int_distribution<> distr(1, nCount); + std::uniform_int_distribution<> distr(0, nCount - 1); int nNumber = distr(gen); sal_Int32 aId1 = 0; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits