#include <iostream> #include <string.h> #include <string>
#include "../TransmissionGateway/Sensor.h"
using namespace std;
#define BOOST_TEST_MODULE sensor #include <boost/test/included/unit_test.hpp>
//==================================================================== //============================ 单元测试 - Sensor.h =================== //==================================================================== BOOST_AUTO_TEST_SUITE (sensor) // name of the test suite is sensor
// ! CLastRecv 类测试 BOOST_AUTO_TEST_CASE (clastrecv) { //cout <<"------------------- begin CLastRecv test---------"<< endl; string str("hello"); CLastRecv lastRecv(str); time_t recvTime; string strRecv;
BOOST_CHECK(lastRecv.GetRecvTime(recvTime) == TRUE);//TRUE
lastRecv.GetRecvMessage(strRecv);
BOOST_CHECK(0 == strRecv.compare("hello"));
BOOST_CHECK(-1 == strRecv.compare("world"));
//cout << ctime(&recvTime) << endl;
//cout <<"------------------- end CLastRecv test---------"<< endl; } |