diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-10-06 16:39:43 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-10-06 16:39:43 +0100 |
commit | 7543399f7278d573f157a48016f407bde3088e15 (patch) | |
tree | 79ca25e685260c66e229866cc12bd379157b38a1 /i18npool | |
parent | 8e61b0150b9d62d8ffd40089f69f49055187c998 (diff) |
coverity#1373441 Side effect in assertion
Change-Id: I10a8298e5379fa93a5d3616202a7802c0eda1cbb
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/qa/cppunit/test_breakiterator.cxx | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 1bd2b3dda737..c00c716efac2 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -364,7 +364,8 @@ void TestBreakIterator::testWordBoundaries() { CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aSinglePositions)); nPos = m_xBreak->nextWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; - CPPUNIT_ASSERT_EQUAL(aSinglePositions[i++], nPos); + CPPUNIT_ASSERT_EQUAL(aSinglePositions[i], nPos); + ++i; } while (nPos < aTest.getLength()); nPos = aTest.getLength(); @@ -372,7 +373,8 @@ void TestBreakIterator::testWordBoundaries() do { nPos = m_xBreak->previousWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; - CPPUNIT_ASSERT_EQUAL(aSinglePositions[--i], nPos); + --i; + CPPUNIT_ASSERT_EQUAL(aSinglePositions[i], nPos); } while (nPos > 0); } @@ -387,7 +389,8 @@ void TestBreakIterator::testWordBoundaries() { CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aSingleQuotePositions)); nPos = m_xBreak->nextWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; - CPPUNIT_ASSERT_EQUAL(aSingleQuotePositions[i++], nPos); + CPPUNIT_ASSERT_EQUAL(aSingleQuotePositions[i], nPos); + ++i; } while (nPos < aTest.getLength()); nPos = aTest.getLength(); @@ -395,7 +398,8 @@ void TestBreakIterator::testWordBoundaries() do { nPos = m_xBreak->previousWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; - CPPUNIT_ASSERT_EQUAL(aSingleQuotePositions[--i], nPos); + --i; + CPPUNIT_ASSERT_EQUAL(aSingleQuotePositions[i], nPos); } while (nPos > 0); } @@ -416,7 +420,8 @@ void TestBreakIterator::testWordBoundaries() CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aExpected)); nPos = m_xBreak->getWordBoundary(aTest, nPos, aLocale, i18n::WordType::DICTIONARY_WORD, true).endPos; - CPPUNIT_ASSERT_EQUAL(aExpected[i++], nPos); + CPPUNIT_ASSERT_EQUAL(aExpected[i], nPos); + ++i; } while (nPos++ < aTest.getLength()); CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(aExpected), i); @@ -458,7 +463,8 @@ void TestBreakIterator::testWordBoundaries() CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aExpected)); nPos = m_xBreak->getWordBoundary(aTest, nPos, aLocale, i18n::WordType::DICTIONARY_WORD, true).endPos; - CPPUNIT_ASSERT_EQUAL(aExpected[i++], nPos); + CPPUNIT_ASSERT_EQUAL(aExpected[i], nPos); + ++i; } while (nPos++ < aTest.getLength()); CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(aExpected), i); @@ -499,7 +505,8 @@ void TestBreakIterator::testWordBoundaries() CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aExpected)); nPos = m_xBreak->getWordBoundary(aTest, nPos, aLocale, i18n::WordType::DICTIONARY_WORD, true).endPos; - CPPUNIT_ASSERT_EQUAL(aExpected[i++], nPos); + CPPUNIT_ASSERT_EQUAL(aExpected[i], nPos); + ++i; } while (nPos++ < aTest.getLength()); CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(aExpected), i); @@ -522,7 +529,8 @@ void TestBreakIterator::testWordBoundaries() CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aExpected)); nPos = m_xBreak->getWordBoundary(aTest, nPos, aLocale, i18n::WordType::WORD_COUNT, true).endPos; - CPPUNIT_ASSERT_EQUAL(aExpected[i++], nPos); + CPPUNIT_ASSERT_EQUAL(aExpected[i], nPos); + ++i; } while (nPos++ < aTest.getLength()); CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(aExpected), i); @@ -538,8 +546,10 @@ void TestBreakIterator::testWordBoundaries() CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aExpected)); aBounds = m_xBreak->getWordBoundary(aTest, nPos, aLocale, i18n::WordType::DICTIONARY_WORD, true); - CPPUNIT_ASSERT_EQUAL(aExpected[i++], aBounds.startPos); - CPPUNIT_ASSERT_EQUAL(aExpected[i++], aBounds.endPos); + CPPUNIT_ASSERT_EQUAL(aExpected[i], aBounds.startPos); + ++i; + CPPUNIT_ASSERT_EQUAL(aExpected[i], aBounds.endPos); + ++i; nPos = aBounds.endPos; } while (nPos++ < aTest.getLength()); |