Skip to content

Commit

Permalink
Add test cases for the new operators
Browse files Browse the repository at this point in the history
  • Loading branch information
02JanDal committed Oct 28, 2013
1 parent ea0496b commit ec43325
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions tests/selecttest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@ private Q_SLOTS:
<< "SELECT tblPerson.id FROM tblPerson WHERE tblPerson.HireRights = :0"
<< (QVector<QVariant>() << true);

QTest::newRow( "single condition, less than" )
<< select( Person.id ).from( Person ).where( Person.Hired < QDateTime( QDate( 2013, 10, 28 ) )).queryBuilder()
<< "SELECT tblPerson.id FROM tblPerson WHERE tblPerson.Hired < :0"
<< (QVector<QVariant>() << QDateTime( QDate( 2013, 10, 28 ) ));

QTest::newRow( "single condition, less than or equal" )
<< select( Person.id ).from( Person ).where( Person.Hired <= QDateTime( QDate( 2013, 10, 28 ) )).queryBuilder()
<< "SELECT tblPerson.id FROM tblPerson WHERE tblPerson.Hired <= :0"
<< (QVector<QVariant>() << QDateTime( QDate( 2013, 10, 28 ) ));

QTest::newRow( "single condition, greater than" )
<< select( Person.id ).from( Person ).where( Person.Hired > QDateTime( QDate( 2013, 10, 28 ) )).queryBuilder()
<< "SELECT tblPerson.id FROM tblPerson WHERE tblPerson.Hired > :0"
<< (QVector<QVariant>() << QDateTime( QDate( 2013, 10, 28 ) ));

QTest::newRow( "single condition, greater than or equal" )
<< select( Person.id ).from( Person ).where( Person.Hired >= QDateTime( QDate( 2013, 10, 28 ) )).queryBuilder()
<< "SELECT tblPerson.id FROM tblPerson WHERE tblPerson.Hired >= :0"
<< (QVector<QVariant>() << QDateTime( QDate( 2013, 10, 28 ) ));

#ifdef _BullseyeCoverage
#pragma BullseyeCoverage off
#endif
Expand Down
3 changes: 2 additions & 1 deletion tests/testschema.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ TABLE( Person, TEST_EXPORT ) {
COLUMN( HireRights, bool, Null );
COLUMN( PersonActive, bool, Null );
COLUMN( UserName, QString, Unique, 255 );
typedef boost::mpl::vector<idType, fk_lutPrefix_idType, PersonForenameType, PersonSurnameType, PersonSuffixType, PersonGradeType, PersonActiveType, HireRightsType, UserNameType> columns;
COLUMN( Hired, QDateTime, Null );
typedef boost::mpl::vector<idType, fk_lutPrefix_idType, PersonForenameType, PersonSurnameType, PersonSuffixType, PersonGradeType, PersonActiveType, HireRightsType, UserNameType, HiredType> columns;
};


Expand Down

0 comments on commit ec43325

Please sign in to comment.