diff options
Diffstat (limited to 'i18npool/qa/cppunit/test_breakiterator.cxx')
-rw-r--r-- | i18npool/qa/cppunit/test_breakiterator.cxx | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 58b6a98f0978..dd3e85007403 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -87,13 +87,13 @@ void TestBreakIterator::testLineBreaking() { //Here we want the line break to leave text here) on the next line i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest, strlen("(some tex"), aLocale, 0, aHyphOptions, aUserOptions); - CPPUNIT_ASSERT_MESSAGE("Expected a break at the start of the word", aResult.breakIndex == 6); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected a break at the start of the word", static_cast<sal_Int32>(6), aResult.breakIndex); } { //Here we want the line break to leave "here)" on the next line i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest, strlen("(some text here"), aLocale, 0, aHyphOptions, aUserOptions); - CPPUNIT_ASSERT_MESSAGE("Expected a break at the start of the word", aResult.breakIndex == 11); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected a break at the start of the word", static_cast<sal_Int32>(11), aResult.breakIndex); } } @@ -109,7 +109,7 @@ void TestBreakIterator::testLineBreaking() { //Here we want the line break to happen at the whitespace i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest, aTest.getLength()-1, aLocale, 0, aHyphOptions, aUserOptions); - CPPUNIT_ASSERT_MESSAGE("Expected a break at the start of the word", aResult.breakIndex == aWord.getLength()+1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected a break at the start of the word", aWord.getLength()+1, aResult.breakIndex); } } @@ -124,7 +124,7 @@ void TestBreakIterator::testLineBreaking() //Here we want the line break to leave /bar/ba clumped together on the next line i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest, strlen("foo /bar/ba"), aLocale, 0, aHyphOptions, aUserOptions); - CPPUNIT_ASSERT_MESSAGE("Expected a break at the first slash", aResult.breakIndex == 4); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected a break at the first slash", static_cast<sal_Int32>(4), aResult.breakIndex); } } @@ -139,7 +139,7 @@ void TestBreakIterator::testLineBreaking() //Here we want the line break to move the whole lot to the next line i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest, aTest.getLength()-2, aLocale, 0, aHyphOptions, aUserOptions); - CPPUNIT_ASSERT_MESSAGE("Expected a break at the start of the line, not at ]", aResult.breakIndex == 0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected a break at the start of the line, not at ]", static_cast<sal_Int32>(0), aResult.breakIndex); } } @@ -339,7 +339,7 @@ void TestBreakIterator::testWordBoundaries() { CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aDoublePositions)); nPos = m_xBreak->nextWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; - CPPUNIT_ASSERT(nPos == aDoublePositions[i++]); + CPPUNIT_ASSERT_EQUAL(aDoublePositions[i++], nPos); } while (nPos < aTest.getLength()); nPos = aTest.getLength(); @@ -347,7 +347,7 @@ void TestBreakIterator::testWordBoundaries() do { nPos = m_xBreak->previousWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; - CPPUNIT_ASSERT(nPos == aDoublePositions[--i]); + CPPUNIT_ASSERT_EQUAL(aDoublePositions[--i], nPos); } while (nPos > 0); } @@ -362,7 +362,7 @@ void TestBreakIterator::testWordBoundaries() { CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aSinglePositions)); nPos = m_xBreak->nextWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; - CPPUNIT_ASSERT(nPos == aSinglePositions[i++]); + CPPUNIT_ASSERT_EQUAL(aSinglePositions[i++], nPos); } while (nPos < aTest.getLength()); nPos = aTest.getLength(); @@ -370,13 +370,13 @@ void TestBreakIterator::testWordBoundaries() do { nPos = m_xBreak->previousWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; - CPPUNIT_ASSERT(nPos == aSinglePositions[--i]); + CPPUNIT_ASSERT_EQUAL(aSinglePositions[--i], nPos); } while (nPos > 0); } const sal_Int32 aSingleQuotePositions[] = {0, 1, 9, 10}; - CPPUNIT_ASSERT(aTests[0] == '\''); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Unicode>('\''), aTests[0]); { OUString aTest = aBase.replaceAll("xx", OUStringLiteral1(aTests[0])); sal_Int32 nPos = -1; @@ -385,7 +385,7 @@ void TestBreakIterator::testWordBoundaries() { CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aSingleQuotePositions)); nPos = m_xBreak->nextWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; - CPPUNIT_ASSERT(nPos == aSingleQuotePositions[i++]); + CPPUNIT_ASSERT_EQUAL(aSingleQuotePositions[i++], nPos); } while (nPos < aTest.getLength()); nPos = aTest.getLength(); @@ -393,7 +393,7 @@ void TestBreakIterator::testWordBoundaries() do { nPos = m_xBreak->previousWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; - CPPUNIT_ASSERT(nPos == aSingleQuotePositions[--i]); + CPPUNIT_ASSERT_EQUAL(aSingleQuotePositions[--i], nPos); } while (nPos > 0); } @@ -414,10 +414,10 @@ 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(aExpected[i++] == nPos); + CPPUNIT_ASSERT_EQUAL(aExpected[i++], nPos); } while (nPos++ < aTest.getLength()); - CPPUNIT_ASSERT(i == SAL_N_ELEMENTS(aExpected)); + CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(aExpected), i); } //See https://bz.apache.org/ooo/show_bug.cgi?id=85411 @@ -456,10 +456,10 @@ 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(aExpected[i++] == nPos); + CPPUNIT_ASSERT_EQUAL(aExpected[i++], nPos); } while (nPos++ < aTest.getLength()); - CPPUNIT_ASSERT(i == SAL_N_ELEMENTS(aExpected)); + CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(aExpected), i); } //https://bz.apache.org/ooo/show_bug.cgi?id=21290 @@ -497,10 +497,10 @@ 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(aExpected[i++] == nPos); + CPPUNIT_ASSERT_EQUAL(aExpected[i++], nPos); } while (nPos++ < aTest.getLength()); - CPPUNIT_ASSERT(i == SAL_N_ELEMENTS(aExpected)); + CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(aExpected), i); } //See https://bz.apache.org/ooo/show_bug.cgi?id=58513 @@ -520,10 +520,10 @@ 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(aExpected[i++] == nPos); + CPPUNIT_ASSERT_EQUAL(aExpected[i++], nPos); } while (nPos++ < aTest.getLength()); - CPPUNIT_ASSERT(i == SAL_N_ELEMENTS(aExpected)); + CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(aExpected), i); } { @@ -536,12 +536,12 @@ void TestBreakIterator::testWordBoundaries() CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aExpected)); aBounds = m_xBreak->getWordBoundary(aTest, nPos, aLocale, i18n::WordType::DICTIONARY_WORD, true); - CPPUNIT_ASSERT(aExpected[i++] == aBounds.startPos); - CPPUNIT_ASSERT(aExpected[i++] == aBounds.endPos); + CPPUNIT_ASSERT_EQUAL(aExpected[i++], aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(aExpected[i++], aBounds.endPos); nPos = aBounds.endPos; } while (nPos++ < aTest.getLength()); - CPPUNIT_ASSERT(i == SAL_N_ELEMENTS(aExpected)); + CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(aExpected), i); } } @@ -603,10 +603,10 @@ void TestBreakIterator::testGraphemeIteration() sal_Int32 nPos; nPos = m_xBreak->nextCharacters(aTest, 0, aLocale, i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); - CPPUNIT_ASSERT_MESSAGE("Should skip full grapheme", nPos == SAL_N_ELEMENTS(BA_HALANT_LA)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip full grapheme", static_cast<sal_Int32>(SAL_N_ELEMENTS(BA_HALANT_LA)), nPos); nPos = m_xBreak->previousCharacters(aTest, SAL_N_ELEMENTS(BA_HALANT_LA), aLocale, i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); - CPPUNIT_ASSERT_MESSAGE("Should skip full grapheme", nPos == 0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip full grapheme", static_cast<sal_Int32>(0), nPos); } { @@ -617,10 +617,10 @@ void TestBreakIterator::testGraphemeIteration() sal_Int32 nPos; nPos = m_xBreak->nextCharacters(aTest, 0, aLocale, i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); - CPPUNIT_ASSERT_MESSAGE("Should skip full grapheme", nPos == SAL_N_ELEMENTS(HA_HALANT_NA_VOWELSIGNI)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip full grapheme", static_cast<sal_Int32>(SAL_N_ELEMENTS(HA_HALANT_NA_VOWELSIGNI)), nPos); nPos = m_xBreak->previousCharacters(aTest, SAL_N_ELEMENTS(HA_HALANT_NA_VOWELSIGNI), aLocale, i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); - CPPUNIT_ASSERT_MESSAGE("Should skip full grapheme", nPos == 0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip full grapheme", static_cast<sal_Int32>(0), nPos); } { @@ -631,10 +631,10 @@ void TestBreakIterator::testGraphemeIteration() sal_Int32 nPos; nPos = m_xBreak->nextCharacters(aTest, 0, aLocale, i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); - CPPUNIT_ASSERT_MESSAGE("Should skip full grapheme", nPos == SAL_N_ELEMENTS(TA_HALANT_MA_HALANT_YA)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip full grapheme", static_cast<sal_Int32>(SAL_N_ELEMENTS(TA_HALANT_MA_HALANT_YA)), nPos); nPos = m_xBreak->previousCharacters(aTest, SAL_N_ELEMENTS(TA_HALANT_MA_HALANT_YA), aLocale, i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); - CPPUNIT_ASSERT_MESSAGE("Should skip full grapheme", nPos == 0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip full grapheme", static_cast<sal_Int32>(0), nPos); } aLocale.Language = "ta"; @@ -649,10 +649,10 @@ void TestBreakIterator::testGraphemeIteration() nPos = m_xBreak->nextCharacters(aTest, 0, aLocale, i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); - CPPUNIT_ASSERT_MESSAGE("Should skip full grapheme", nPos == SAL_N_ELEMENTS(KA_VIRAMA_SSA)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip full grapheme", static_cast<sal_Int32>(SAL_N_ELEMENTS(KA_VIRAMA_SSA)), nPos); nPos = m_xBreak->previousCharacters(aTest, SAL_N_ELEMENTS(KA_VIRAMA_SSA), aLocale, i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); - CPPUNIT_ASSERT_MESSAGE("Should skip full grapheme", nPos == 0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip full grapheme", static_cast<sal_Int32>(0), nPos); } { @@ -664,10 +664,10 @@ void TestBreakIterator::testGraphemeIteration() nPos = m_xBreak->nextCharacters(aTest, 0, aLocale, i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); - CPPUNIT_ASSERT_MESSAGE("Should skip full grapheme", nPos == SAL_N_ELEMENTS(KA_VOWELSIGNU)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip full grapheme", static_cast<sal_Int32>(SAL_N_ELEMENTS(KA_VOWELSIGNU)), nPos); nPos = m_xBreak->previousCharacters(aTest, SAL_N_ELEMENTS(KA_VOWELSIGNU), aLocale, i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); - CPPUNIT_ASSERT_MESSAGE("Should skip full grapheme", nPos == 0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip full grapheme", static_cast<sal_Int32>(0), nPos); } { @@ -684,7 +684,7 @@ void TestBreakIterator::testGraphemeIteration() sal_Int32 nOldPos = nPos; nPos = m_xBreak->nextCharacters(aTest, nPos, aLocale, i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); - CPPUNIT_ASSERT_MESSAGE("Should skip 2 units", nPos == nOldPos+2); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip 2 units", nOldPos+2, nPos); } for (sal_Int32 i = 0; i < 4; ++i) @@ -692,7 +692,7 @@ void TestBreakIterator::testGraphemeIteration() sal_Int32 nOldPos = nPos; nPos = m_xBreak->previousCharacters(aTest, nPos, aLocale, i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); - CPPUNIT_ASSERT_MESSAGE("Should skip 2 units", nPos == nOldPos-2); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip 2 units", nOldPos-2, nPos); } } @@ -711,7 +711,7 @@ void TestBreakIterator::testGraphemeIteration() ++nGraphemeCount; } - CPPUNIT_ASSERT_MESSAGE("Should be considered 1 grapheme", nGraphemeCount == 1); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be considered 1 grapheme", static_cast<sal_Int32>(1), nGraphemeCount); } aLocale.Language = "hi"; @@ -726,10 +726,10 @@ void TestBreakIterator::testGraphemeIteration() nPos = m_xBreak->nextCharacters(aTest, 0, aLocale, i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); - CPPUNIT_ASSERT_MESSAGE("Should skip full grapheme", nPos == SAL_N_ELEMENTS(SHA_VOWELSIGNII)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip full grapheme", static_cast<sal_Int32>(SAL_N_ELEMENTS(SHA_VOWELSIGNII)), nPos); nPos = m_xBreak->previousCharacters(aTest, SAL_N_ELEMENTS(SHA_VOWELSIGNII), aLocale, i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); - CPPUNIT_ASSERT_MESSAGE("Should skip full grapheme", nPos == 0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip full grapheme", static_cast<sal_Int32>(0), nPos); } } @@ -767,8 +767,8 @@ void TestBreakIterator::testWeak() aMsg.append("Char 0x"); aMsg.append(static_cast<sal_Int32>(aWeaks[i]), 16); aMsg.append(" should have been weak"); - CPPUNIT_ASSERT_MESSAGE(aMsg.getStr(), - nScript == i18n::ScriptType::WEAK); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsg.getStr(), + i18n::ScriptType::WEAK, nScript); } } } @@ -806,8 +806,8 @@ void TestBreakIterator::testAsian() aMsg.append("Char 0x"); aMsg.append(static_cast<sal_Int32>(aAsians[i]), 16); aMsg.append(" should have been asian"); - CPPUNIT_ASSERT_MESSAGE(aMsg.getStr(), - nScript == i18n::ScriptType::ASIAN); + CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsg.getStr(), + i18n::ScriptType::ASIAN, nScript); } } } @@ -882,7 +882,7 @@ void TestBreakIterator::testThai() { CPPUNIT_ASSERT(!aPositions.empty()); nPos = m_xBreak->previousWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; - CPPUNIT_ASSERT(nPos == aPositions.top()); + CPPUNIT_ASSERT_EQUAL(aPositions.top(), nPos); aPositions.pop(); } while (nPos > 0); |