mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-03 20:04:20 -04:00
Merging branches/v0.6-initdev into trunk.
These split at 6672 -> 7075, so quite a bit merge. libretroshare compiles - but untested. retroshare-gui needs GenCertDialog.ui and IdEditDialog.ui to be properly merged. (compile errors). some plugins will be broken. retroshare-nogui is untested. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7078 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
commit
c0738eec7f
407 changed files with 23716 additions and 50779 deletions
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