mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-06 21:58:57 -04:00
merging rs_gxs-finale to v0.6 branch
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@6953 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
commit
39909b705f
67 changed files with 5686 additions and 488 deletions
|
@ -56,7 +56,9 @@ linux-* {
|
|||
LIBS += ../../../lib/libretroshare.a
|
||||
LIBS += ../../../../../libbitdht/src/lib/libbitdht.a
|
||||
LIBS += ../../../../../openpgpsdk/src/lib/libops.a
|
||||
LIBS += -lssl -lgpgme -lupnp -lixml -lgnome-keyring -lsqlite3 -lbz2
|
||||
LIBS += -lssl -lgpgme -lupnp -lixml -lgnome-keyring -lbz2
|
||||
# We need a explicit path here, to force using the home version of sqlite3 that really encrypts the database.
|
||||
LIBS += /home/crispy/Development/retroshare/sqlcipher/sqlcipher/.libs/libsqlite3.a
|
||||
LIBS *= -rdynamic -frtti
|
||||
DEFINES *= HAVE_XSS # for idle time, libx screensaver extensions
|
||||
DEFINES *= UBUNTU
|
||||
|
|
|
@ -108,7 +108,7 @@ bool GenExchangeTest::pollForMsgAcknowledgement(uint32_t token,
|
|||
now = time(NULL);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
GenExchangeTestService* GenExchangeTest::getTestService()
|
||||
{
|
||||
|
@ -155,12 +155,13 @@ void GenExchangeTest::setUp()
|
|||
// would be useful for genexchange services
|
||||
// to have a protected reset button
|
||||
mTestService->start();
|
||||
}
|
||||
}
|
||||
|
||||
void GenExchangeTest::breakDown()
|
||||
{
|
||||
mTestService->join();
|
||||
clearAllData();
|
||||
mDataService->resetDataStore();
|
||||
mTestService->join();
|
||||
clearAllData();
|
||||
}
|
||||
|
||||
bool msgDataSort(const RsDummyMsg* m1, const RsDummyMsg* m2)
|
||||
|
@ -189,7 +190,7 @@ bool GenExchangeTest::compareMsgDataMaps()
|
|||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool GenExchangeTest::compareMsgIdMaps()
|
||||
|
@ -205,7 +206,7 @@ bool GenExchangeTest::compareMsgIdMaps()
|
|||
ok &= Comparison<std::vector<RsGxsMessageId>, RsGxsMessageId>::comparison(v1, v2);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool GenExchangeTest::compareMsgMetaMaps()
|
||||
|
@ -220,19 +221,19 @@ bool GenExchangeTest::compareMsgMetaMaps()
|
|||
ok &= Comparison<std::vector<RsMsgMetaData>, RsMsgMetaData>::comparison(v1, v2);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool GenExchangeTest::compareMsgRelateIdsMap()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool GenExchangeTest::compareMsgRelatedDataMap()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool grpDataSort(const RsDummyGrp* g1, const RsDummyGrp* g2)
|
||||
{
|
||||
|
@ -247,7 +248,7 @@ bool GenExchangeTest::compareGrpData()
|
|||
bool ok = Comparison<std::vector<RsDummyGrp*>, RsDummyGrp*>::comparison
|
||||
(mGrpDataIn, mGrpDataOut);
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
|
||||
bool operator<(const RsGroupMetaData& l, const RsGroupMetaData& r)
|
||||
{
|
||||
|
@ -263,7 +264,7 @@ bool GenExchangeTest::compareGrpMeta()
|
|||
bool ok = Comparison<std::list<RsGroupMetaData>, RsGroupMetaData>::comparison
|
||||
(mGrpMetaDataIn, mGrpMetaDataOut);
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool GenExchangeTest::compareGrpIds()
|
||||
|
@ -289,7 +290,7 @@ void GenExchangeTest::createGrps(uint32_t nGrps,
|
|||
pollForGrpAcknowledgement(token, grpId);
|
||||
groupId.push_back(grpId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GenExchangeTest::init(RsMsgMetaData& msgMetaData) const
|
||||
{
|
||||
|
@ -334,7 +335,7 @@ void GenExchangeTest::init(RsDummyGrp& grpItem) const
|
|||
{
|
||||
randString(SHORT_STR, grpItem.grpData);
|
||||
init(grpItem.meta);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::init(RsDummyMsg& msgItem) const
|
||||
|
@ -346,72 +347,72 @@ void GenExchangeTest::init(RsDummyMsg& msgItem) const
|
|||
void GenExchangeTest::storeToMsgDataOutMaps(const DummyMsgMap& msgDataOut)
|
||||
{
|
||||
mMsgDataOut.insert(msgDataOut.begin(), msgDataOut.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::storeToMsgIdsOutMaps(const GxsMsgIdResult& msgIdsOut)
|
||||
{
|
||||
mMsgIdsOut.insert(msgIdsOut.begin(), msgIdsOut.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::storeToMsgMetaOutMaps(const GxsMsgMetaMap& msgMetaOut)
|
||||
{
|
||||
mMsgMetaDataOut.insert(msgMetaOut.begin(), msgMetaOut.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::storeToMsgDataInMaps(const DummyMsgMap& msgDataIn)
|
||||
{
|
||||
mMsgDataIn.insert(msgDataIn.begin(), msgDataIn.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::storeToMsgIdsInMaps(const GxsMsgIdResult& msgIdsIn)
|
||||
{
|
||||
mMsgIdsIn.insert(msgIdsIn.begin(), msgIdsIn.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::storeToMsgMetaInMaps(const GxsMsgMetaMap& msgMetaIn)
|
||||
{
|
||||
mMsgMetaDataIn.insert(msgMetaIn.begin(), msgMetaIn.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::storeToGrpIdsOutList(
|
||||
const std::list<RsGxsGroupId>& grpIdOut)
|
||||
{
|
||||
mGrpIdsOut.insert(mGrpIdsOut.end(), grpIdOut.begin(), grpIdOut.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::storeToGrpMetaOutList(
|
||||
const std::list<RsGroupMetaData>& grpMetaOut)
|
||||
{
|
||||
mGrpMetaDataOut.insert(mGrpMetaDataOut.end(), grpMetaOut.begin(), grpMetaOut.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::storeToGrpDataOutList(
|
||||
const std::vector<RsDummyGrp*>& grpDataOut)
|
||||
{
|
||||
mGrpDataOut.insert(mGrpDataOut.end(), grpDataOut.begin(), grpDataOut.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::storeToGrpIdsInList(
|
||||
const std::list<RsGxsGroupId>& grpIdIn)
|
||||
{
|
||||
mGrpIdsIn.insert(mGrpIdsIn.end(), grpIdIn.begin(), grpIdIn.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::storeToGrpMetaInList(
|
||||
const std::list<RsGroupMetaData>& grpMetaIn)
|
||||
{
|
||||
mGrpMetaDataIn.insert(mGrpMetaDataIn.end(), grpMetaIn.begin(), grpMetaIn.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::storeToGrpDataInList(
|
||||
|
@ -437,14 +438,14 @@ void GenExchangeTest::clearAllData()
|
|||
void GenExchangeTest::clearMsgDataInMap()
|
||||
{
|
||||
mMsgDataIn.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::clearMsgDataOutMap()
|
||||
{
|
||||
|
||||
clearMsgDataMap(mMsgDataOut);
|
||||
}
|
||||
}
|
||||
|
||||
void GenExchangeTest::clearMsgDataMap(DummyMsgMap& msgDataMap) const
|
||||
{
|
||||
|
@ -459,31 +460,31 @@ void GenExchangeTest::clearMsgDataMap(DummyMsgMap& msgDataMap) const
|
|||
void GenExchangeTest::clearMsgMetaInMap()
|
||||
{
|
||||
mMsgMetaDataIn.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::clearMsgMetaOutMap()
|
||||
{
|
||||
mMsgMetaDataOut.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::clearMsgIdInMap()
|
||||
{
|
||||
mMsgIdsIn.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::clearMsgIdOutMap()
|
||||
{
|
||||
mMsgIdsOut.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::clearMsgRelatedIdInMap()
|
||||
{
|
||||
mMsgRelatedIdsIn.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::clearGrpDataInList()
|
||||
|
@ -494,38 +495,38 @@ void GenExchangeTest::clearGrpDataInList()
|
|||
void GenExchangeTest::clearGrpDataList(std::vector<RsDummyGrp*>& grpData) const
|
||||
{
|
||||
deleteResVector<RsDummyGrp>(grpData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::clearGrpDataOutList()
|
||||
{
|
||||
clearGrpDataList(mGrpDataOut);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::clearGrpMetaInList()
|
||||
{
|
||||
mGrpMetaDataIn.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::clearGrpMetaOutList()
|
||||
{
|
||||
mGrpMetaDataOut.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::clearGrpIdInList()
|
||||
{
|
||||
mGrpIdsIn.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenExchangeTest::clearGrpIdOutList()
|
||||
{
|
||||
mGrpIdsOut.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool operator ==(const RsMsgMetaData& lMeta, const RsMsgMetaData& rMeta)
|
||||
{
|
||||
|
@ -584,5 +585,5 @@ bool operator ==(const RsDummyMsg& lMsg, const RsDummyMsg& rMsg)
|
|||
bool operator ==(const RsGxsGrpItem& lGrp, const RsGxsGrpItem& rGrp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ private:
|
|||
std::list<RsGroupMetaData> mGrpMetaDataOut, mGrpMetaDataIn;
|
||||
std::list<RsGxsGroupId> mGrpIdsOut, mGrpIdsIn;
|
||||
|
||||
DummyMsgMap mMsgDataOut, mMsgDataIn;
|
||||
std::map<RsGxsGroupId, std::vector<RsDummyMsg*> > mMsgDataOut, mMsgDataIn;
|
||||
GxsMsgMetaMap mMsgMetaDataOut, mMsgMetaDataIn;
|
||||
GxsMsgIdResult mMsgIdsOut, mMsgIdsIn;
|
||||
|
||||
|
|
|
@ -17,6 +17,11 @@ void GenExchangeTestService::publishDummyGrp(uint32_t &token, RsDummyGrp *grp)
|
|||
publishGroup(token, grp);
|
||||
}
|
||||
|
||||
void GenExchangeTestService::updateDummyGrp(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta, RsDummyGrp *group)
|
||||
{
|
||||
updateGroup(token, updateMeta, group);
|
||||
}
|
||||
|
||||
void GenExchangeTestService::publishDummyMsg(uint32_t &token, RsDummyMsg *msg)
|
||||
{
|
||||
publishMsg(token, msg);
|
||||
|
|
|
@ -15,6 +15,7 @@ public:
|
|||
void notifyChanges(std::vector<RsGxsNotify*>& changes);
|
||||
|
||||
void publishDummyGrp(uint32_t& token, RsDummyGrp* grp);
|
||||
void updateDummyGrp(uint32_t &token, RsGxsGroupUpdateMeta& meta, RsDummyGrp *group);
|
||||
void publishDummyMsg(uint32_t& token, RsDummyMsg* msg);
|
||||
|
||||
/*!
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "gxspublishgrouptest.h"
|
||||
#include "util/utest.h"
|
||||
#include "support.h"
|
||||
|
||||
#define POLLING_TIME_OUT 5
|
||||
|
||||
|
@ -169,6 +170,65 @@ bool GxsPublishGroupTest::testGrpIdRetrieval()
|
|||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool GxsPublishGroupTest::testUpdateGroup()
|
||||
{
|
||||
setUp();
|
||||
|
||||
GenExchangeTestService* testService = getTestService();
|
||||
RsTokenService* tokenService = getTokenService();
|
||||
|
||||
// create some random grps to allow msg testing
|
||||
|
||||
RsDummyGrp* dgrp1 = new RsDummyGrp();
|
||||
RsDummyGrp* dgrp2 = new RsDummyGrp();
|
||||
|
||||
RsDummyGrp* dgrp2_copy = new RsDummyGrp();
|
||||
|
||||
init(*dgrp1);
|
||||
init(*dgrp2);
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = 45000;
|
||||
uint32_t token;
|
||||
RsGxsGroupId grpId;
|
||||
|
||||
std::vector<RsDummyGrp*> groupsPublished;
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
|
||||
std::string name = dgrp1->meta.mGroupName;
|
||||
*dgrp2 = *dgrp1;
|
||||
testService->publishDummyGrp(token, dgrp1);
|
||||
bool ok = pollForGrpAcknowledgement(token, grpId);
|
||||
|
||||
grpIds.push_back(grpId);
|
||||
RsGxsGroupUpdateMeta updateMeta(grpId);
|
||||
|
||||
updateMeta.setMetaUpdate(RsGxsGroupUpdateMeta::NAME, name);
|
||||
randString(SHORT_STR, dgrp2->grpData);
|
||||
dgrp2->meta.mGroupId = grpId;
|
||||
*dgrp2_copy = *dgrp2;
|
||||
dgrp2->grpData ="ojfosfjsofjsof";
|
||||
testService->updateDummyGrp(token, updateMeta, dgrp2);
|
||||
ok &= pollForGrpAcknowledgement(token, grpId);
|
||||
|
||||
groupsPublished.push_back(dgrp2_copy);
|
||||
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
tokenService->requestGroupInfo(token, 0, opts, grpIds);
|
||||
|
||||
pollForToken(token, opts, true);
|
||||
|
||||
|
||||
ok &= compareGrpData();
|
||||
|
||||
breakDown();
|
||||
|
||||
return ok;
|
||||
|
||||
}
|
||||
|
||||
bool GxsPublishGroupTest::testGrpMetaRetrieval()
|
||||
{
|
||||
|
||||
|
@ -229,10 +289,11 @@ bool GxsPublishGroupTest::testGrpMetaRetrieval()
|
|||
}
|
||||
void GxsPublishGroupTest::runTests()
|
||||
{
|
||||
CHECK(testGrpSubmissionRetrieval());
|
||||
CHECK(testGrpIdRetrieval());
|
||||
CHECK(testGrpMetaRetrieval());
|
||||
CHECK(testSpecificGrpRetrieval());
|
||||
// CHECK(testGrpSubmissionRetrieval());
|
||||
// CHECK(testGrpIdRetrieval());
|
||||
// CHECK(testGrpMetaRetrieval());
|
||||
// CHECK(testSpecificGrpRetrieval());
|
||||
CHECK(testUpdateGroup());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ private:
|
|||
bool testSpecificGrpRetrieval();
|
||||
bool testGrpIdRetrieval();
|
||||
bool testGrpMetaRetrieval();
|
||||
bool testUpdateGroup();
|
||||
|
||||
|
||||
private:
|
||||
|
|
|
@ -49,10 +49,10 @@ bool GxsPublishMsgTest::testMsgSubmissionRetrieval()
|
|||
msgOut->meta.mMsgId = msgId.second;
|
||||
|
||||
DummyMsgMap msgMap;
|
||||
std::vector<RsDummyMsg*> msgV;
|
||||
msgV.push_back(msgOut);
|
||||
msgMap[msgOut->meta.mGroupId] = msgV;
|
||||
storeToMsgDataOutMaps(msgMap);
|
||||
std::vector<RsDummyMsg*> msgV;
|
||||
msgV.push_back(msgOut);
|
||||
msgMap[msgOut->meta.mGroupId] = msgV;
|
||||
storeToMsgDataOutMaps(msgMap);
|
||||
|
||||
|
||||
RsTokReqOptions opts;
|
||||
|
|
|
@ -30,16 +30,16 @@ INITTEST();
|
|||
int main()
|
||||
{
|
||||
|
||||
RsGeneralDataService* dataStore = new RsDataService("./", "testServiceDb", RS_SERVICE_TYPE_DUMMY, NULL);
|
||||
RsGeneralDataService* dataStore = new RsDataService("./", "testServiceDb", RS_SERVICE_TYPE_DUMMY, NULL, "");
|
||||
|
||||
// we want to use default authentication which is NO authentication :)
|
||||
GenExchangeTestService testService(dataStore, NULL, NULL);
|
||||
|
||||
//GxsPublishGroupTest testGrpPublishing(&testService, dataStore);
|
||||
//testGrpPublishing.runTests();
|
||||
GxsPublishGroupTest testGrpPublishing(&testService, dataStore);
|
||||
testGrpPublishing.runTests();
|
||||
|
||||
GxsPublishMsgTest testMsgPublishing(&testService, dataStore);
|
||||
testMsgPublishing.runTests();
|
||||
//GxsPublishMsgTest testMsgPublishing(&testService, dataStore);
|
||||
//testMsgPublishing.runTests();
|
||||
|
||||
FINALREPORT("RsGenExchangeTest");
|
||||
|
||||
|
|
110
libretroshare/src/tests/serialiser/rsgxsupdateitem_test.cc
Normal file
110
libretroshare/src/tests/serialiser/rsgxsupdateitem_test.cc
Normal file
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* rsgxsupdateitem_test.cc
|
||||
*
|
||||
* Created on: 9 Dec 2013
|
||||
* Author: crispy
|
||||
*/
|
||||
|
||||
#include "support.h"
|
||||
#include "rsgxsupdateitem_test.h"
|
||||
|
||||
INITTEST();
|
||||
|
||||
RsSerialType* init_item(RsGxsGrpUpdateItem& i)
|
||||
{
|
||||
i.clear();
|
||||
i.grpUpdateTS = rand()%2424;
|
||||
randString(SHORT_STR, i.peerId);
|
||||
return new RsGxsUpdateSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
|
||||
}
|
||||
|
||||
RsSerialType* init_item(RsGxsMsgUpdateItem& i)
|
||||
{
|
||||
i.clear();
|
||||
randString(SHORT_STR, i.peerId);
|
||||
int numUpdates = rand()%123;
|
||||
|
||||
std::string peer;
|
||||
for(int j=0; j < numUpdates; j++)
|
||||
{
|
||||
randString(SHORT_STR, peer);
|
||||
i.msgUpdateTS.insert(std::make_pair(peer, rand()%45));
|
||||
}
|
||||
|
||||
return new RsGxsUpdateSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
|
||||
}
|
||||
|
||||
RsSerialType* init_item(RsGxsServerGrpUpdateItem& i)
|
||||
{
|
||||
i.clear();
|
||||
i.grpUpdateTS = rand()%2424;
|
||||
|
||||
return new RsGxsUpdateSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
|
||||
}
|
||||
|
||||
RsSerialType* init_item(RsGxsServerMsgUpdateItem& i)
|
||||
{
|
||||
i.clear();
|
||||
randString(SHORT_STR, i.grpId);
|
||||
i.msgUpdateTS = rand()%4252;
|
||||
return new RsGxsUpdateSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
|
||||
}
|
||||
|
||||
bool operator ==(const RsGxsGrpUpdateItem& l, const RsGxsGrpUpdateItem& r)
|
||||
{
|
||||
bool ok = l.grpUpdateTS == r.grpUpdateTS;
|
||||
ok &= l.peerId == r.peerId;
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool operator ==(const RsGxsMsgUpdateItem& l, const RsGxsMsgUpdateItem& r)
|
||||
{
|
||||
bool ok = l.peerId == r.peerId;
|
||||
|
||||
const std::map<std::string, uint32_t>& lUp = l.msgUpdateTS, rUp = r.msgUpdateTS;
|
||||
|
||||
ok &= lUp.size() == rUp.size();
|
||||
|
||||
std::map<std::string, uint32_t>::const_iterator lit = lUp.begin(), rit;
|
||||
|
||||
for(; lit != lUp.end(); lit++)
|
||||
{
|
||||
std::string key = lit->first;
|
||||
if((rit = rUp.find(key)) != rUp.end())
|
||||
ok &= lit->second == rit->second;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool operator ==(const RsGxsServerGrpUpdateItem& l,
|
||||
const RsGxsServerGrpUpdateItem& r)
|
||||
{
|
||||
return l.grpUpdateTS == r.grpUpdateTS;
|
||||
}
|
||||
|
||||
bool operator ==(const RsGxsServerMsgUpdateItem& l,
|
||||
const RsGxsServerMsgUpdateItem& r)
|
||||
{
|
||||
bool ok = l.grpId == r.grpId;
|
||||
ok &= l.msgUpdateTS == r.msgUpdateTS;
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cerr << "RsGxsUpdateItem Tests" << std::endl;
|
||||
|
||||
test_RsItem<RsGxsGrpUpdateItem>(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM); REPORT("Serialise/Deserialise RsGxsGrpUpdateItem");
|
||||
test_RsItem<RsGxsMsgUpdateItem>(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM); REPORT("Serialise/Deserialise RsGxsMsgUpdateItem");
|
||||
test_RsItem<RsGxsServerGrpUpdateItem>(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM); REPORT("Serialise/Deserialise RsGxsServerGrpUpdateItem");
|
||||
test_RsItem<RsGxsServerMsgUpdateItem>(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM); REPORT("Serialise/Deserialise RsGxsServerMsgUpdateItem");
|
||||
|
||||
FINALREPORT("RsGxsUpdateItem Tests");
|
||||
|
||||
return TESTRESULT();
|
||||
}
|
25
libretroshare/src/tests/serialiser/rsgxsupdateitem_test.h
Normal file
25
libretroshare/src/tests/serialiser/rsgxsupdateitem_test.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* rsgxsupdateitem_test.h
|
||||
*
|
||||
* Created on: 9 Dec 2013
|
||||
* Author: crispy
|
||||
*/
|
||||
|
||||
#ifndef RSGXSUPDATEITEM_TEST_H_
|
||||
#define RSGXSUPDATEITEM_TEST_H_
|
||||
|
||||
#include "serialiser/rsgxsupdateitems.h"
|
||||
#include "support.h"
|
||||
|
||||
|
||||
RsSerialType* init_item(RsGxsGrpUpdateItem& i);
|
||||
RsSerialType* init_item(RsGxsMsgUpdateItem& i);
|
||||
RsSerialType* init_item(RsGxsServerGrpUpdateItem& i);
|
||||
RsSerialType* init_item(RsGxsServerMsgUpdateItem& i);
|
||||
|
||||
bool operator==(const RsGxsGrpUpdateItem& l, const RsGxsGrpUpdateItem& r);
|
||||
bool operator==(const RsGxsMsgUpdateItem& l, const RsGxsMsgUpdateItem& r);
|
||||
bool operator==(const RsGxsServerGrpUpdateItem& l, const RsGxsServerGrpUpdateItem& r);
|
||||
bool operator==(const RsGxsServerMsgUpdateItem& l, const RsGxsServerMsgUpdateItem& r);
|
||||
|
||||
#endif /* RSGXSUPDATEITEM_TEST_H_ */
|
|
@ -39,7 +39,7 @@ RsSerialType* init_item(RsNxsSyncGrp& rsg)
|
|||
{
|
||||
rsg.clear();
|
||||
rsg.flag = RsNxsSyncGrp::FLAG_USE_SYNC_HASH;
|
||||
rsg.syncAge = rand()%2423;
|
||||
rsg.createdSince = rand()%2423;
|
||||
randString(3124,rsg.syncHash);
|
||||
|
||||
return new RsNxsSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
|
||||
|
@ -50,7 +50,7 @@ RsSerialType* init_item(RsNxsSyncMsg& rsgm)
|
|||
rsgm.clear();
|
||||
|
||||
rsgm.flag = RsNxsSyncMsg::FLAG_USE_SYNC_HASH;
|
||||
rsgm.syncAge = rand()%24232;
|
||||
rsgm.createdSince = rand()%24232;
|
||||
rsgm.transactionNumber = rand()%23;
|
||||
randString(SHORT_STR, rsgm.grpId);
|
||||
randString(SHORT_STR, rsgm.syncHash);
|
||||
|
@ -120,7 +120,7 @@ bool operator==(const RsNxsSyncGrp& l, const RsNxsSyncGrp& r)
|
|||
|
||||
if(l.syncHash != r.syncHash) return false;
|
||||
if(l.flag != r.flag) return false;
|
||||
if(l.syncAge != r.syncAge) return false;
|
||||
if(l.createdSince != r.createdSince) return false;
|
||||
if(l.transactionNumber != r.transactionNumber) return false;
|
||||
|
||||
return true;
|
||||
|
@ -130,7 +130,7 @@ bool operator==(const RsNxsSyncMsg& l, const RsNxsSyncMsg& r)
|
|||
{
|
||||
|
||||
if(l.flag != r.flag) return false;
|
||||
if(l.syncAge != r.syncAge) return false;
|
||||
if(l.createdSince != r.createdSince) return false;
|
||||
if(l.syncHash != r.syncHash) return false;
|
||||
if(l.grpId != r.grpId) return false;
|
||||
if(l.transactionNumber != r.transactionNumber) return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue