Index: unittests/tst_utilities.cpp =================================================================== diff -u -r8c69137f18382bdc55a5678e6ed44a7683fe4dea -r805119c460b4a266d6401c8705f4427e7fbe270f --- unittests/tst_utilities.cpp (.../tst_utilities.cpp) (revision 8c69137f18382bdc55a5678e6ed44a7683fe4dea) +++ unittests/tst_utilities.cpp (.../tst_utilities.cpp) (revision 805119c460b4a266d6401c8705f4427e7fbe270f) @@ -26,32 +26,49 @@ */ tst_utilities::tst_utilities(QObject *parent) : QObject(parent) { } -// void tst_utilities::initTestCase_data() -// { -// } +void tst_utilities::tst_floatCompare_noMatch() +{ + QVERIFY( ! Types::floatCompare(1.002,1.003)); +} -//void tst_utilities::initTestCase() -//{ -//} +void tst_utilities::tst_floatCompare_isMatch() +{ + QVERIFY( Types::floatCompare(1.354,1.354)); +} -// void tst_utilities::init() -// { -// } +void tst_utilities::tst_getbits_NoError() +{ + QByteArray ba = QByteArray::fromHex("a5"); + Types::Flags flg; + int i = 0; + QVERIFY( Types::getBits(ba,i,flg,8)); +} -//void tst_utilities::cleanup() -//{ -//} +void tst_utilities::tst_getbits_IsError() +{ + QByteArray ba = QByteArray::fromHex("a5"); + Types::Flags flg; + int i = 0; + QVERIFY( ! Types::getBits(ba,i,flg,9)); +} -//void tst_utilities::cleanupTestCase() -//{ -//} +void tst_utilities::tst_fromvariant_NoString() +{ + QCOMPARE(Format::fromVariant(64), "@"); +} -void tst_utilities::getValue_len() +void tst_utilities::tst_fromvariant_IsString() { + QCOMPARE(Format::fromVariant("@"), "@"); +} + +void tst_utilities::tst_getValue_len() +{ Types::S32 vFlowSetPoint; int index = 0; QByteArray data; data += 0xFF; QVERIFY( ! Types::getValue<>( data, index, vFlowSetPoint ) ); } +