Added unit test for Hasta protocol
This commit is contained in:
parent
b56823a6e7
commit
b00cbdb37c
3 changed files with 69 additions and 0 deletions
42
telldus-core/tests/service/ProtocolHastaTest.cpp
Normal file
42
telldus-core/tests/service/ProtocolHastaTest.cpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
#include "ProtocolHastaTest.h"
|
||||
#include "service/ProtocolHasta.h"
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION (ProtocolHastaTest);
|
||||
|
||||
class ProtocolHastaTest::PrivateData {
|
||||
public:
|
||||
ProtocolHasta *protocol;
|
||||
};
|
||||
|
||||
void ProtocolHastaTest :: setUp (void) {
|
||||
d = new PrivateData;
|
||||
d->protocol = new ProtocolHasta();
|
||||
}
|
||||
|
||||
void ProtocolHastaTest :: tearDown (void) {
|
||||
delete d->protocol;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void ProtocolHastaTest :: decodeDataTest (void) {
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE(
|
||||
"Hasta Version 1 26380 1 DOWN",
|
||||
std::string("class:command;protocol:hasta;model:selflearning;house:26380;unit:1;method:down;"),
|
||||
d->protocol->decodeData(ControllerMessage("protocol:hasta;model:selflearning;data:0xC671100;"))
|
||||
);
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE(
|
||||
"Hasta Version 1 26380 1 UP",
|
||||
std::string("class:command;protocol:hasta;model:selflearning;house:26380;unit:1;method:up;"),
|
||||
d->protocol->decodeData(ControllerMessage("protocol:arctech;model:selflearning;data:0xC670100;"))
|
||||
);
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE(
|
||||
"Hasta Version 2 19337 15 DOWN",
|
||||
std::string("class:command;protocol:hasta;model:selflearningv2;house:19337;unit:15;method:down;"),
|
||||
d->protocol->decodeData(ControllerMessage("protocol:hasta;model:selflearningv2;data:0x4B891F01;"))
|
||||
);
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE(
|
||||
"Hasta Version 2 19337 15 UP",
|
||||
std::string("class:command;protocol:hasta;model:selflearningv2;house:19337;unit:15;method:up;"),
|
||||
d->protocol->decodeData(ControllerMessage("protocol:hasta;model:selflearningv2;data:0x4B89CF01;"))
|
||||
);
|
||||
}
|
25
telldus-core/tests/service/ProtocolHastaTest.h
Normal file
25
telldus-core/tests/service/ProtocolHastaTest.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
#ifndef PROTOCOLHASTATEST_H
|
||||
#define PROTOCOLHASTATEST_H
|
||||
|
||||
#include <cppunit/TestFixture.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
class ProtocolHastaTest : public CPPUNIT_NS :: TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE (ProtocolHastaTest);
|
||||
CPPUNIT_TEST (decodeDataTest);
|
||||
CPPUNIT_TEST_SUITE_END ();
|
||||
|
||||
public:
|
||||
void setUp (void);
|
||||
void tearDown (void);
|
||||
|
||||
protected:
|
||||
void decodeDataTest(void);
|
||||
|
||||
private:
|
||||
class PrivateData;
|
||||
PrivateData *d;
|
||||
};
|
||||
|
||||
#endif //PROTOCOLHASTATEST_H
|
|
@ -2,6 +2,7 @@
|
|||
#define SERVICETESTS_H
|
||||
|
||||
#include "ProtocolEverflourishTest.h"
|
||||
#include "ProtocolHastaTest.h"
|
||||
#include "ProtocolNexaTest.h"
|
||||
#include "ProtocolOregonTest.h"
|
||||
#include "ProtocolSartanoTest.h"
|
||||
|
@ -10,6 +11,7 @@
|
|||
namespace ServiceTests {
|
||||
inline void setup() {
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION (ProtocolEverflourishTest);
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION (ProtocolHastaTest);
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION (ProtocolNexaTest);
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION (ProtocolOregonTest);
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION (ProtocolSartanoTest);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue