[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/nepomuk/test
From: Sebastian Trueg <sebastian () trueg ! de>
Date: 2010-08-25 17:34:29
Message-ID: 20100825173429.E894DAC871 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1167924 by trueg:
Fixed the test for Term::fromProperty.
M +36 -33 querytest.cpp
M +1 -0 querytest.h
--- trunk/KDE/kdelibs/nepomuk/test/querytest.cpp #1167923:1167924
@@ -499,16 +499,47 @@
// test logical or
QCOMPARE( ct1 || ct2 || lt1, Term(OrTerm( ct1, ct2, lt1 )) );
+}
- // test variant handling
- QCOMPARE( Soprano::Vocabulary::NAO::hasTag() == Nepomuk::Variant( \
QString::fromLatin1("Hello World") ), +
+void QueryTest::testComparison_data()
+{
+ QTest::addColumn<Nepomuk::Query::Query>( "q1" );
+ QTest::addColumn<Nepomuk::Query::Query>( "q2" );
+
+ // invalid queries should always be similar - trivial but worth checking anyway
+ Query q1, q2;
+ QTest::newRow("invalid") << q1 << q2;
+
+ // file queries with differently sorted folder lists
+ FileQuery fq1, fq2;
+ fq1.addIncludeFolder( KUrl("/tmp") );
+ fq1.addIncludeFolder( KUrl("/wurst") );
+ fq2.addIncludeFolder( KUrl("/wurst") );
+ fq2.addIncludeFolder( KUrl("/tmp") );
+ QTest::newRow("file query include sorting") << Query(fq1) << Query(fq2);
+}
+
+
+void QueryTest::testComparison()
+{
+ QFETCH( Nepomuk::Query::Query, q1 );
+ QFETCH( Nepomuk::Query::Query, q2 );
+
+ QCOMPARE( q1, q2 );
+}
+
+
+void QueryTest::testTermFromProperty()
+{
+ QCOMPARE( Term::fromProperty(Soprano::Vocabulary::NAO::hasTag(), \
Nepomuk::Variant( QString::fromLatin1("Hello World") )), Term(
ComparisonTerm( Soprano::Vocabulary::NAO::hasTag(),
LiteralTerm( QLatin1String("Hello World") ),
ComparisonTerm::Equal ) )
);
- QCOMPARE( Soprano::Vocabulary::NAO::hasTag() == Nepomuk::Variant( 42 ),
+ QCOMPARE( Term::fromProperty(Soprano::Vocabulary::NAO::hasTag(), \
Nepomuk::Variant( 42 )), Term(
ComparisonTerm( Soprano::Vocabulary::NAO::hasTag(),
LiteralTerm( 42 ),
@@ -516,7 +547,7 @@
);
Nepomuk::Resource res( QUrl("nepomuk:/res/foobar") );
- QCOMPARE( Soprano::Vocabulary::NAO::hasTag() == Nepomuk::Variant( res ),
+ QCOMPARE( Term::fromProperty(Soprano::Vocabulary::NAO::hasTag(), \
Nepomuk::Variant( res )), Term(
ComparisonTerm( Soprano::Vocabulary::NAO::hasTag(),
ResourceTerm( res ),
@@ -524,7 +555,7 @@
);
Nepomuk::Resource res2( QUrl("nepomuk:/res/foobar2") );
- QCOMPARE( Soprano::Vocabulary::NAO::hasTag() == Nepomuk::Variant( \
QList<Nepomuk::Resource>() << res << res2 ), + QCOMPARE( \
Term::fromProperty(Soprano::Vocabulary::NAO::hasTag(), Nepomuk::Variant( \
QList<Nepomuk::Resource>() << res << res2 )), Term(
AndTerm(
ComparisonTerm( Soprano::Vocabulary::NAO::hasTag(),
@@ -536,34 +567,6 @@
);
}
-
-void QueryTest::testComparison_data()
-{
- QTest::addColumn<Nepomuk::Query::Query>( "q1" );
- QTest::addColumn<Nepomuk::Query::Query>( "q2" );
-
- // invalid queries should always be similar - trivial but worth checking anyway
- Query q1, q2;
- QTest::newRow("invalid") << q1 << q2;
-
- // file queries with differently sorted folder lists
- FileQuery fq1, fq2;
- fq1.addIncludeFolder( KUrl("/tmp") );
- fq1.addIncludeFolder( KUrl("/wurst") );
- fq2.addIncludeFolder( KUrl("/wurst") );
- fq2.addIncludeFolder( KUrl("/tmp") );
- QTest::newRow("file query include sorting") << Query(fq1) << Query(fq2);
-}
-
-
-void QueryTest::testComparison()
-{
- QFETCH( Nepomuk::Query::Query, q1 );
- QFETCH( Nepomuk::Query::Query, q2 );
-
- QCOMPARE( q1, q2 );
-}
-
QTEST_KDEMAIN_CORE( QueryTest )
#include "querytest.moc"
--- trunk/KDE/kdelibs/nepomuk/test/querytest.h #1167923:1167924
@@ -37,6 +37,7 @@
void testLogicalOperators();
void testComparison_data();
void testComparison();
+ void testTermFromProperty();
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic