/*! * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, * IN PART OR IN WHOLE, * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * file tst_utilities.cpp * date 01/08/2020 * author Behrouz NematiPour * */ #include "tst_utilities.h" // Qt // Project #include "types.h" /*! * \brief tst_utilities::tst_utilities * \details Constructor * \param parent - QObject parent owner object. * Qt handles the children destruction by their parent objects life-cycle. */ tst_utilities::tst_utilities(QObject *parent) : QObject(parent) { } void tst_utilities::tst_floatCompare_noMatch() { QVERIFY( ! Types::floatCompare(1.002,1.003)); } void tst_utilities::tst_floatCompare_isMatch() { QVERIFY( Types::floatCompare(1.354,1.354)); } 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::tst_getbits_IsError() { QByteArray ba = QByteArray::fromHex("a5"); Types::Flags flg; int i = 0; QVERIFY( ! Types::getBits(ba,i,flg,9)); } void tst_utilities::tst_fromvariant_NoString() { QCOMPARE(Format::fromVariant(64), "@"); } 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 ) ); }