diff --git a/autotests/unit/engine/termgeneratortest.cpp b/autotests/unit/engine/termgeneratortest.cpp --- a/autotests/unit/engine/termgeneratortest.cpp +++ b/autotests/unit/engine/termgeneratortest.cpp @@ -41,6 +41,7 @@ void testUnicodeLowering(); void testEmails(); void testWordPositions(); + void testNumbers(); QList allWords(const Document& doc) { @@ -185,6 +186,26 @@ QCOMPARE(posInfo3, QVector() << 3); } +void TermGeneratorTest::testNumbers() +{ + QString str = QString::fromLatin1("1 5 10 -3 -12, 5.6, -13.4 -7e3"); + + Document doc; + TermGenerator termGen(doc); + termGen.indexText(str); + + QList words = allWords(doc); + + QList expectedWords; + // TODO: Signs are dropped by the TermGenerator + expectedWords = { "1", "10", "12", "13.4", "3", "5", "5.6", "7e3"}; + QCOMPARE(words, expectedWords); + + expectedWords = { "1", "10", "12", "-13.4", "-3", "5", "5.6", "-7e3"}; + QEXPECT_FAIL("", "signs not handled correctly", Continue); + QCOMPARE(words, expectedWords); +} + QTEST_MAIN(TermGeneratorTest) #include "termgeneratortest.moc"