mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-03 03:36:58 -04:00
updated tests and also fixed a few bugs in using random initialisation routines
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-NewGRouterModel@7839 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e8f5f44318
commit
ac4f51623b
17 changed files with 95 additions and 91 deletions
|
@ -31,7 +31,7 @@ static FileIndex *createBasicFileIndex(time_t age);
|
||||||
TEST(libretroshare_dbase, SaveTest)
|
TEST(libretroshare_dbase, SaveTest)
|
||||||
{
|
{
|
||||||
RsPeerId peerId;
|
RsPeerId peerId;
|
||||||
peerId.random();
|
peerId = RsPeerId::random();
|
||||||
FileIndex *fi1 = createBasicFileIndex(100);
|
FileIndex *fi1 = createBasicFileIndex(100);
|
||||||
FileIndex *fi2 = new FileIndex(peerId);
|
FileIndex *fi2 = new FileIndex(peerId);
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ TEST(libretroshare_dbase, SaveTest)
|
||||||
FileIndex *createBasicFileIndex(time_t age)
|
FileIndex *createBasicFileIndex(time_t age)
|
||||||
{
|
{
|
||||||
RsPeerId peerId;
|
RsPeerId peerId;
|
||||||
peerId.random();
|
peerId = RsPeerId::random();
|
||||||
FileIndex *fi = new FileIndex(peerId);
|
FileIndex *fi = new FileIndex(peerId);
|
||||||
|
|
||||||
FileEntry fe;
|
FileEntry fe;
|
||||||
|
|
|
@ -156,7 +156,7 @@ int test2(FileIndex *fi)
|
||||||
FileIndex *createBasicFileIndex(time_t age)
|
FileIndex *createBasicFileIndex(time_t age)
|
||||||
{
|
{
|
||||||
RsPeerId peerId;
|
RsPeerId peerId;
|
||||||
peerId.random();
|
peerId = RsPeerId::random();
|
||||||
FileIndex *fi = new FileIndex(peerId);
|
FileIndex *fi = new FileIndex(peerId);
|
||||||
|
|
||||||
FileEntry fe;
|
FileEntry fe;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
TEST(libretroshare_dbase, SearchTest)
|
TEST(libretroshare_dbase, SearchTest)
|
||||||
{
|
{
|
||||||
RsPeerId peerId;
|
RsPeerId peerId;
|
||||||
peerId.random();
|
peerId = RsPeerId::random();
|
||||||
|
|
||||||
std::cout << std::string::npos << std::endl;
|
std::cout << std::string::npos << std::endl;
|
||||||
std::string testfile = "searchtest.index";
|
std::string testfile = "searchtest.index";
|
||||||
|
|
|
@ -107,7 +107,7 @@ void init_item(RsGxsGrpMetaData* metaGrp)
|
||||||
|
|
||||||
metaGrp->mSubscribeFlags = rand()%2251;
|
metaGrp->mSubscribeFlags = rand()%2251;
|
||||||
metaGrp->mPop = rand()%5262;
|
metaGrp->mPop = rand()%5262;
|
||||||
metaGrp->mMsgCount = rand()%2421;
|
metaGrp->mVisibleMsgCount = rand()%2421;
|
||||||
metaGrp->mLastPost = rand()%2211;
|
metaGrp->mLastPost = rand()%2211;
|
||||||
metaGrp->mReputationCutOff = rand()%5262;
|
metaGrp->mReputationCutOff = rand()%5262;
|
||||||
|
|
||||||
|
|
|
@ -139,8 +139,8 @@ void test_messageStoresAndRetrieve()
|
||||||
// first create a grpId
|
// first create a grpId
|
||||||
RsGxsGroupId grpId0, grpId1;
|
RsGxsGroupId grpId0, grpId1;
|
||||||
|
|
||||||
grpId0.random();
|
grpId0 = RsGxsGroupId::random();
|
||||||
grpId1.random();
|
grpId1 = RsGxsGroupId::random();
|
||||||
std::vector<RsGxsGroupId> grpV; // stores grpIds of all msgs stored and retrieved
|
std::vector<RsGxsGroupId> grpV; // stores grpIds of all msgs stored and retrieved
|
||||||
grpV.push_back(grpId0);
|
grpV.push_back(grpId0);
|
||||||
grpV.push_back(grpId1);
|
grpV.push_back(grpId1);
|
||||||
|
|
|
@ -310,10 +310,10 @@ void GenExchangeTest::init(RsMsgMetaData& msgMetaData) const
|
||||||
//randString(SHORT_STR, msgMeta.mAuthorId);
|
//randString(SHORT_STR, msgMeta.mAuthorId);
|
||||||
randString(SHORT_STR, msgMetaData.mMsgName);
|
randString(SHORT_STR, msgMetaData.mMsgName);
|
||||||
randString(SHORT_STR, msgMetaData.mServiceString);
|
randString(SHORT_STR, msgMetaData.mServiceString);
|
||||||
msgMetaData.mOrigMsgId.random();
|
msgMetaData.mOrigMsgId = RsGxsMessageId::random();
|
||||||
msgMetaData.mParentId.random();
|
msgMetaData.mParentId = RsGxsMessageId::random();
|
||||||
msgMetaData.mThreadId.random();
|
msgMetaData.mThreadId = RsGxsMessageId::random();
|
||||||
msgMetaData.mGroupId.random();
|
msgMetaData.mGroupId = RsGxsGroupId::random();
|
||||||
|
|
||||||
msgMetaData.mChildTs = randNum();
|
msgMetaData.mChildTs = randNum();
|
||||||
msgMetaData.mMsgStatus = randNum();
|
msgMetaData.mMsgStatus = randNum();
|
||||||
|
@ -328,7 +328,7 @@ uint32_t GenExchangeTest::randNum() const
|
||||||
|
|
||||||
void GenExchangeTest::init(RsGroupMetaData& grpMetaData) const
|
void GenExchangeTest::init(RsGroupMetaData& grpMetaData) const
|
||||||
{
|
{
|
||||||
grpMetaData.mGroupId.random();
|
grpMetaData.mGroupId = RsGxsGroupId::random();
|
||||||
//randString(SHORT_STR, grpMetaData.mAuthorId);
|
//randString(SHORT_STR, grpMetaData.mAuthorId);
|
||||||
randString(SHORT_STR, grpMetaData.mGroupName);
|
randString(SHORT_STR, grpMetaData.mGroupName);
|
||||||
randString(SHORT_STR, grpMetaData.mServiceString);
|
randString(SHORT_STR, grpMetaData.mServiceString);
|
||||||
|
@ -337,7 +337,7 @@ void GenExchangeTest::init(RsGroupMetaData& grpMetaData) const
|
||||||
grpMetaData.mGroupFlags = randNum();
|
grpMetaData.mGroupFlags = randNum();
|
||||||
grpMetaData.mLastPost = randNum();
|
grpMetaData.mLastPost = randNum();
|
||||||
grpMetaData.mGroupStatus = randNum();
|
grpMetaData.mGroupStatus = randNum();
|
||||||
grpMetaData.mMsgCount = randNum();
|
grpMetaData.mVisibleMsgCount = randNum();
|
||||||
grpMetaData.mPop = randNum();
|
grpMetaData.mPop = randNum();
|
||||||
grpMetaData.mSignFlags = randNum();
|
grpMetaData.mSignFlags = randNum();
|
||||||
grpMetaData.mPublishTs = randNum();
|
grpMetaData.mPublishTs = randNum();
|
||||||
|
@ -568,7 +568,7 @@ bool operator ==(const RsGroupMetaData& lMeta, const RsGroupMetaData& rMeta)
|
||||||
if(lMeta.mGroupName != rMeta.mGroupName) return false;
|
if(lMeta.mGroupName != rMeta.mGroupName) return false;
|
||||||
if(lMeta.mGroupStatus != rMeta.mGroupStatus) return false;
|
if(lMeta.mGroupStatus != rMeta.mGroupStatus) return false;
|
||||||
if(lMeta.mLastPost != rMeta.mLastPost) return false;
|
if(lMeta.mLastPost != rMeta.mLastPost) return false;
|
||||||
if(lMeta.mMsgCount != rMeta.mMsgCount) return false;
|
if(lMeta.mVisibleMsgCount != rMeta.mVisibleMsgCount) return false;
|
||||||
if(lMeta.mPop != rMeta.mPop) return false;
|
if(lMeta.mPop != rMeta.mPop) return false;
|
||||||
// if(lMeta.mPublishTs != rMeta.mPublishTs) return false; set in gxs
|
// if(lMeta.mPublishTs != rMeta.mPublishTs) return false; set in gxs
|
||||||
if(lMeta.mServiceString != rMeta.mServiceString) return false;
|
if(lMeta.mServiceString != rMeta.mServiceString) return false;
|
||||||
|
|
|
@ -155,8 +155,8 @@ public:
|
||||||
* @return a pointer to a valid profile if successful, otherwise NULL
|
* @return a pointer to a valid profile if successful, otherwise NULL
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int getKey(const RsGxsId &id, RsTlvSecurityKey &key){ return false; }
|
bool getKey(const RsGxsId &id, RsTlvSecurityKey &key){ return false; }
|
||||||
int getPrivateKey(const RsGxsId &id, RsTlvSecurityKey &key){ return false; } // For signing outgoing messages.
|
bool getPrivateKey(const RsGxsId &id, RsTlvSecurityKey &key){ return false; } // For signing outgoing messages.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ NxsGrpSync::NxsGrpSync(RsGcxs* circle, RsGixsReputation* reputation)
|
||||||
if(circle)
|
if(circle)
|
||||||
{
|
{
|
||||||
meta->mCircleType = GXS_CIRCLE_TYPE_EXTERNAL;
|
meta->mCircleType = GXS_CIRCLE_TYPE_EXTERNAL;
|
||||||
meta->mCircleId.random();
|
meta->mCircleId = RsGxsCircleId::random();
|
||||||
}
|
}
|
||||||
|
|
||||||
RsGxsGroupId grpId = grp->grpId;
|
RsGxsGroupId grpId = grp->grpId;
|
||||||
|
|
|
@ -121,10 +121,10 @@ void rs_nxs_test::NxsTestHub::StartTest()
|
||||||
PeerNxsMap::iterator mit = mPeerNxsMap.begin();
|
PeerNxsMap::iterator mit = mPeerNxsMap.begin();
|
||||||
for(; mit != mPeerNxsMap.end(); mit++)
|
for(; mit != mPeerNxsMap.end(); mit++)
|
||||||
{
|
{
|
||||||
createThread(*(mit->second));
|
(mit->second)->start() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
createThread(*this);
|
start() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,44 +23,39 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "util/rsrandom.h"
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
#include "grouter/grouteritems.h"
|
#include "grouter/grouteritems.h"
|
||||||
#include "serialiser/rstlvutil.h"
|
|
||||||
#include "support.h"
|
#include "support.h"
|
||||||
|
#include "rstlvutil.h"
|
||||||
|
|
||||||
RsSerialType* init_item(RsGRouterGenericDataItem& cmi)
|
RsSerialType* init_item(RsGRouterGenericDataItem& cmi)
|
||||||
{
|
{
|
||||||
|
cmi.routing_id = RSRandom::random_u32() ;
|
||||||
|
cmi.destination_key = GRouterKeyId::random() ;
|
||||||
cmi.data_size = lrand48()%1000 + 1000 ;
|
cmi.data_size = lrand48()%1000 + 1000 ;
|
||||||
cmi.data_bytes = (uint8_t*)malloc(cmi.data_size) ;
|
cmi.data_bytes = (uint8_t*)malloc(cmi.data_size) ;
|
||||||
RSRandom::random_bytes(cmi.data_bytes,cmi.data_size) ;
|
RSRandom::random_bytes(cmi.data_bytes,cmi.data_size) ;
|
||||||
cmi.routing_id = RSRandom::random_u32() ;
|
|
||||||
|
|
||||||
Sha1CheckSum cs ;
|
init_item(cmi.signature) ;
|
||||||
for(int i=0;i<5;++i) cs.fourbytes[i] = RSRandom::random_u32() ;
|
|
||||||
cmi.destination_key = cs ;
|
cmi.randomized_distance = RSRandom::random_u32() ;
|
||||||
|
cmi.flags = RSRandom::random_u32() ;
|
||||||
|
|
||||||
return new RsGRouterSerialiser();
|
return new RsGRouterSerialiser();
|
||||||
}
|
}
|
||||||
RsSerialType* init_item(RsGRouterACKItem& cmi)
|
RsSerialType* init_item(RsGRouterReceiptItem& cmi)
|
||||||
{
|
{
|
||||||
cmi.mid = RSRandom::random_u32() ;
|
cmi.mid = RSRandom::random_u64() ;
|
||||||
cmi.state = RSRandom::random_u32() ;
|
cmi.state = RSRandom::random_u32() ;
|
||||||
|
cmi.destination_key = GRouterKeyId::random() ;
|
||||||
|
|
||||||
return new RsGRouterSerialiser();
|
init_item(cmi.signature) ;
|
||||||
}
|
|
||||||
RsSerialType* init_item(RsGRouterPublishKeyItem& cmi)
|
|
||||||
{
|
|
||||||
cmi.diffusion_id = RSRandom::random_u32() ;
|
|
||||||
cmi.service_id = RSRandom::random_u32() ;
|
|
||||||
cmi.randomized_distance = RSRandom::random_f32() ;
|
|
||||||
|
|
||||||
Sha1CheckSum cs ;
|
|
||||||
for(int i=0;i<5;++i) cs.fourbytes[i] = RSRandom::random_u32() ;
|
|
||||||
cmi.published_key = cs ;
|
|
||||||
cmi.description_string = "test key" ;
|
|
||||||
|
|
||||||
return new RsGRouterSerialiser();
|
return new RsGRouterSerialiser();
|
||||||
}
|
}
|
||||||
|
@ -68,10 +63,13 @@ RsSerialType* init_item(RsGRouterRoutingInfoItem& cmi)
|
||||||
{
|
{
|
||||||
cmi.origin = SSLIdType::random() ;
|
cmi.origin = SSLIdType::random() ;
|
||||||
cmi.received_time = RSRandom::random_u64() ;
|
cmi.received_time = RSRandom::random_u64() ;
|
||||||
|
cmi.last_sent = RSRandom::random_u64() ;
|
||||||
cmi.status_flags = RSRandom::random_u32() ;
|
cmi.status_flags = RSRandom::random_u32() ;
|
||||||
|
|
||||||
cmi.data_item = new RsGRouterGenericDataItem ;
|
cmi.data_item = new RsGRouterGenericDataItem ;
|
||||||
|
|
||||||
|
init_item(*cmi.data_item) ;
|
||||||
|
|
||||||
uint32_t n = 10+(RSRandom::random_u32()%30) ;
|
uint32_t n = 10+(RSRandom::random_u32()%30) ;
|
||||||
|
|
||||||
for(uint32_t i=0;i<n;++i)
|
for(uint32_t i=0;i<n;++i)
|
||||||
|
@ -79,11 +77,15 @@ RsSerialType* init_item(RsGRouterRoutingInfoItem& cmi)
|
||||||
FriendTrialRecord ftr ;
|
FriendTrialRecord ftr ;
|
||||||
ftr.friend_id = SSLIdType::random() ;
|
ftr.friend_id = SSLIdType::random() ;
|
||||||
ftr.time_stamp = RSRandom::random_u64() ;
|
ftr.time_stamp = RSRandom::random_u64() ;
|
||||||
|
ftr.probability = RSRandom::random_f32() ;
|
||||||
|
ftr.nb_friends = 1+RSRandom::random_u32()%10 ;
|
||||||
|
|
||||||
cmi.tried_friends.push_back(ftr) ;
|
cmi.tried_friends.push_back(ftr) ;
|
||||||
}
|
}
|
||||||
|
cmi.destination_key = cmi.data_item->destination_key ;
|
||||||
|
cmi.client_id = RSRandom::random_u32() ;
|
||||||
|
|
||||||
return init_item(*cmi.data_item) ;
|
return new RsGRouterSerialiser();
|
||||||
}
|
}
|
||||||
RsSerialType* init_item(RsGRouterMatrixFriendListItem& cmi)
|
RsSerialType* init_item(RsGRouterMatrixFriendListItem& cmi)
|
||||||
{
|
{
|
||||||
|
@ -97,7 +99,7 @@ RsSerialType* init_item(RsGRouterMatrixFriendListItem& cmi)
|
||||||
}
|
}
|
||||||
RsSerialType* init_item(RsGRouterMatrixCluesItem& cmi)
|
RsSerialType* init_item(RsGRouterMatrixCluesItem& cmi)
|
||||||
{
|
{
|
||||||
cmi.destination_key = Sha1CheckSum::random() ;
|
cmi.destination_key = GRouterKeyId::random() ;
|
||||||
|
|
||||||
uint32_t n = 10+(RSRandom::random_u32()%30) ;
|
uint32_t n = 10+(RSRandom::random_u32()%30) ;
|
||||||
|
|
||||||
|
@ -116,27 +118,24 @@ RsSerialType* init_item(RsGRouterMatrixCluesItem& cmi)
|
||||||
bool operator ==(const RsGRouterGenericDataItem& cmiLeft,const RsGRouterGenericDataItem& cmiRight)
|
bool operator ==(const RsGRouterGenericDataItem& cmiLeft,const RsGRouterGenericDataItem& cmiRight)
|
||||||
{
|
{
|
||||||
if(cmiLeft.routing_id != cmiRight.routing_id) return false;
|
if(cmiLeft.routing_id != cmiRight.routing_id) return false;
|
||||||
if(cmiLeft.data_size != cmiRight.data_size) return false;
|
|
||||||
if(!(cmiLeft.destination_key == cmiRight.destination_key)) return false;
|
if(!(cmiLeft.destination_key == cmiRight.destination_key)) return false;
|
||||||
|
if(cmiLeft.data_size != cmiRight.data_size) return false;
|
||||||
if(memcmp(cmiLeft.data_bytes,cmiRight.data_bytes,cmiLeft.data_size)) return false;
|
if(memcmp(cmiLeft.data_bytes,cmiRight.data_bytes,cmiLeft.data_size)) return false;
|
||||||
|
|
||||||
return true ;
|
if(!(cmiLeft.signature == cmiRight.signature)) return false ;
|
||||||
}
|
if(cmiLeft.randomized_distance != cmiRight.randomized_distance ) return false ;
|
||||||
bool operator ==(const RsGRouterPublishKeyItem& cmiLeft,const RsGRouterPublishKeyItem& cmiRight)
|
if(cmiLeft.flags != cmiRight.flags ) return false ;
|
||||||
{
|
|
||||||
if(cmiLeft.diffusion_id != cmiRight.diffusion_id) return false;
|
|
||||||
if(!(cmiLeft.published_key == cmiRight.published_key)) return false;
|
|
||||||
if(cmiLeft.service_id != cmiRight.service_id) return false;
|
|
||||||
if(fabs(cmiLeft.randomized_distance - cmiRight.randomized_distance) > 0.001) return false;
|
|
||||||
if(cmiLeft.description_string != cmiRight.description_string) return false;
|
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
bool operator ==(const RsGRouterACKItem& cmiLeft,const RsGRouterACKItem& cmiRight)
|
bool operator ==(const RsGRouterReceiptItem& cmiLeft,const RsGRouterReceiptItem& cmiRight)
|
||||||
{
|
{
|
||||||
if(cmiLeft.mid != cmiRight.mid) return false;
|
if(cmiLeft.mid != cmiRight.mid) return false;
|
||||||
if(cmiLeft.state != cmiRight.state) return false;
|
if(cmiLeft.state != cmiRight.state) return false;
|
||||||
|
if(cmiLeft.destination_key != cmiRight.destination_key) return false;
|
||||||
|
|
||||||
|
if(!(cmiLeft.signature == cmiRight.signature)) return false ;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool operator ==(const RsGRouterMatrixCluesItem& cmiLeft,const RsGRouterMatrixCluesItem& cmiRight)
|
bool operator ==(const RsGRouterMatrixCluesItem& cmiLeft,const RsGRouterMatrixCluesItem& cmiRight)
|
||||||
|
@ -173,19 +172,24 @@ bool operator ==(const RsGRouterRoutingInfoItem& cmiLeft,const RsGRouterRoutingI
|
||||||
if(cmiLeft.status_flags != cmiRight.status_flags) return false ;
|
if(cmiLeft.status_flags != cmiRight.status_flags) return false ;
|
||||||
if(cmiLeft.origin != cmiRight.origin) return false ;
|
if(cmiLeft.origin != cmiRight.origin) return false ;
|
||||||
if(cmiLeft.received_time != cmiRight.received_time) return false ;
|
if(cmiLeft.received_time != cmiRight.received_time) return false ;
|
||||||
|
if(cmiLeft.last_sent != cmiRight.last_sent) return false ;
|
||||||
if(cmiLeft.tried_friends.size() != cmiRight.tried_friends.size()) return false ;
|
if(cmiLeft.tried_friends.size() != cmiRight.tried_friends.size()) return false ;
|
||||||
|
|
||||||
std::list<FriendTrialRecord>::const_iterator itl(cmiLeft.tried_friends.begin()) ;
|
std::list<FriendTrialRecord>::const_iterator itl(cmiLeft.tried_friends.begin()) ;
|
||||||
std::list<FriendTrialRecord>::const_iterator itr(cmiRight.tried_friends.begin()) ;
|
std::list<FriendTrialRecord>::const_iterator itr(cmiRight.tried_friends.begin()) ;
|
||||||
|
|
||||||
while(itl != cmiLeft.tried_friends.end())
|
// while(itl != cmiLeft.tried_friends.end())
|
||||||
{
|
// {
|
||||||
if( (*itl).friend_id != (*itr).friend_id) return false ;
|
// if( (*itl).friend_id != (*itr).friend_id) return false ;
|
||||||
if( (*itl).time_stamp != (*itr).time_stamp) return false ;
|
// if( (*itl).time_stamp != (*itr).time_stamp) return false ;
|
||||||
|
// if( fabs((*itl).probability - (*itr).probability)<0.001) return false ;
|
||||||
++itl ;
|
// if( (*itl).nb_friends != (*itr).nb_friends) return false ;
|
||||||
++itr ;
|
//
|
||||||
}
|
// ++itl ;
|
||||||
|
// ++itr ;
|
||||||
|
// }
|
||||||
|
if(cmiLeft.destination_key != cmiRight.destination_key) return false ;
|
||||||
|
if(cmiLeft.client_id != cmiRight.client_id) return false ;
|
||||||
|
|
||||||
if(!(*cmiLeft.data_item == *cmiRight.data_item)) return false ;
|
if(!(*cmiLeft.data_item == *cmiRight.data_item)) return false ;
|
||||||
|
|
||||||
|
@ -196,8 +200,7 @@ bool operator ==(const RsGRouterRoutingInfoItem& cmiLeft,const RsGRouterRoutingI
|
||||||
TEST(libretroshare_serialiser, RsGRouterItem)
|
TEST(libretroshare_serialiser, RsGRouterItem)
|
||||||
{
|
{
|
||||||
test_RsItem<RsGRouterGenericDataItem >();
|
test_RsItem<RsGRouterGenericDataItem >();
|
||||||
test_RsItem<RsGRouterACKItem >();
|
test_RsItem<RsGRouterReceiptItem >();
|
||||||
test_RsItem<RsGRouterPublishKeyItem >();
|
|
||||||
test_RsItem<RsGRouterRoutingInfoItem >();
|
test_RsItem<RsGRouterRoutingInfoItem >();
|
||||||
test_RsItem<RsGRouterMatrixFriendListItem >();
|
test_RsItem<RsGRouterMatrixFriendListItem >();
|
||||||
test_RsItem<RsGRouterMatrixCluesItem >();
|
test_RsItem<RsGRouterMatrixCluesItem >();
|
||||||
|
|
|
@ -15,18 +15,18 @@ RsSerialType* init_item(RsGxsGrpUpdateItem& i)
|
||||||
{
|
{
|
||||||
i.clear();
|
i.clear();
|
||||||
i.grpUpdateTS = rand()%2424;
|
i.grpUpdateTS = rand()%2424;
|
||||||
i.peerId.random();
|
i.peerId = RsPeerId::random();
|
||||||
return new RsGxsUpdateSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
|
return new RsGxsUpdateSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
RsSerialType* init_item(RsGxsMsgUpdateItem& i)
|
RsSerialType* init_item(RsGxsMsgUpdateItem& i)
|
||||||
{
|
{
|
||||||
i.clear();
|
i.clear();
|
||||||
i.peerId.random();
|
i.peerId = RsPeerId::random();
|
||||||
int numUpdates = rand()%123;
|
int numUpdates = rand()%123;
|
||||||
|
|
||||||
RsPeerId peer;
|
RsPeerId peer;
|
||||||
peer.random();
|
peer = RsPeerId::random();
|
||||||
for(int j=0; j < numUpdates; j++)
|
for(int j=0; j < numUpdates; j++)
|
||||||
{
|
{
|
||||||
i.msgUpdateTS.insert(std::make_pair(peer, rand()%45));
|
i.msgUpdateTS.insert(std::make_pair(peer, rand()%45));
|
||||||
|
@ -46,7 +46,7 @@ RsSerialType* init_item(RsGxsServerGrpUpdateItem& i)
|
||||||
RsSerialType* init_item(RsGxsServerMsgUpdateItem& i)
|
RsSerialType* init_item(RsGxsServerMsgUpdateItem& i)
|
||||||
{
|
{
|
||||||
i.clear();
|
i.clear();
|
||||||
i.grpId.random();
|
i.grpId = RsGxsGroupId::random();
|
||||||
i.msgUpdateTS = rand()%4252;
|
i.msgUpdateTS = rand()%4252;
|
||||||
return new RsGxsUpdateSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
|
return new RsGxsUpdateSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ RsSerialType* init_item(RsChatLobbyInviteItem& cmi)
|
||||||
|
|
||||||
RsSerialType* init_item(RsPrivateChatMsgConfigItem& pcmi)
|
RsSerialType* init_item(RsPrivateChatMsgConfigItem& pcmi)
|
||||||
{
|
{
|
||||||
pcmi.configPeerId.random();
|
pcmi.configPeerId = RsPeerId::random();
|
||||||
pcmi.chatFlags = rand()%34;
|
pcmi.chatFlags = rand()%34;
|
||||||
pcmi.configFlags = rand()%21;
|
pcmi.configFlags = rand()%21;
|
||||||
pcmi.sendTime = rand()%422224;
|
pcmi.sendTime = rand()%422224;
|
||||||
|
@ -174,7 +174,7 @@ RsSerialType* init_item(RsMsgTags& mt)
|
||||||
RsSerialType* init_item(RsMsgSrcId& ms)
|
RsSerialType* init_item(RsMsgSrcId& ms)
|
||||||
{
|
{
|
||||||
ms.msgId = rand()%434;
|
ms.msgId = rand()%434;
|
||||||
ms.srcId.random();
|
ms.srcId = RsPeerId::random();
|
||||||
|
|
||||||
return new RsMsgSerialiser();
|
return new RsMsgSerialiser();
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ void init_item(RsTlvSecurityKeySet& ks)
|
||||||
for(int i=1; i<n; i++)
|
for(int i=1; i<n; i++)
|
||||||
{
|
{
|
||||||
RsGxsId a_str;
|
RsGxsId a_str;
|
||||||
a_str.random();
|
a_str = RsGxsId::random();
|
||||||
|
|
||||||
RsTlvSecurityKey& a_key = ks.keys[a_str];
|
RsTlvSecurityKey& a_key = ks.keys[a_str];
|
||||||
init_item(a_key);
|
init_item(a_key);
|
||||||
|
@ -190,7 +190,7 @@ void init_item(RsTlvSecurityKey& sk)
|
||||||
sk.endTS = randnum;
|
sk.endTS = randnum;
|
||||||
sk.keyFlags = randnum;
|
sk.keyFlags = randnum;
|
||||||
sk.startTS = randnum;
|
sk.startTS = randnum;
|
||||||
sk.keyId.random();
|
sk.keyId = RsGxsId::random();
|
||||||
|
|
||||||
std::string randomStr;
|
std::string randomStr;
|
||||||
randString(LARGE_STR, randomStr);
|
randString(LARGE_STR, randomStr);
|
||||||
|
@ -202,7 +202,7 @@ void init_item(RsTlvSecurityKey& sk)
|
||||||
|
|
||||||
void init_item(RsTlvKeySignature& ks)
|
void init_item(RsTlvKeySignature& ks)
|
||||||
{
|
{
|
||||||
ks.keyId.random();
|
ks.keyId = RsGxsId::random();
|
||||||
|
|
||||||
std::string signData;
|
std::string signData;
|
||||||
randString(LARGE_STR, signData);
|
randString(LARGE_STR, signData);
|
||||||
|
|
|
@ -176,7 +176,7 @@ TEST(libretroshare_serialiser, test_RsTlvPeerIdSet)
|
||||||
|
|
||||||
for(int i = 0; i < 15 ; i++)
|
for(int i = 0; i < 15 ; i++)
|
||||||
{
|
{
|
||||||
testId.random();
|
testId = RsPeerId::random();
|
||||||
i1.ids.push_back(testId);
|
i1.ids.push_back(testId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ TEST(libretroshare_serialiser, test_RsTlvHashSet)
|
||||||
for(int i = 0; i < numRandStrings ; i++)
|
for(int i = 0; i < numRandStrings ; i++)
|
||||||
{
|
{
|
||||||
RsPeerId randId;
|
RsPeerId randId;
|
||||||
randId.random();
|
randId = RsPeerId::random();
|
||||||
i1.ids.push_back(randId);
|
i1.ids.push_back(randId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,8 @@ GxsIsolatedServiceTester::GxsIsolatedServiceTester(const RsPeerId &ownId, const
|
||||||
node->AddService(mTestNs);
|
node->AddService(mTestNs);
|
||||||
|
|
||||||
//mConfigMgr->addConfiguration("posted.cfg", posted_ns);
|
//mConfigMgr->addConfiguration("posted.cfg", posted_ns);
|
||||||
createThread(*mTestService);
|
mTestService->start();
|
||||||
createThread(*mTestNs);
|
mTestNs->start();
|
||||||
|
|
||||||
//node->AddPqiServiceMonitor(status);
|
//node->AddPqiServiceMonitor(status);
|
||||||
addSerialType(new RsNxsSerialiser(RS_SERVICE_GXS_TYPE_TEST));
|
addSerialType(new RsNxsSerialiser(RS_SERVICE_GXS_TYPE_TEST));
|
||||||
|
|
|
@ -122,14 +122,14 @@ GxsPeerNode::GxsPeerNode(const RsPeerId &ownId, const std::list<RsPeerId> &frien
|
||||||
//mConfigMgr->addConfiguration("gxsid.cfg", mGxsIdNs);
|
//mConfigMgr->addConfiguration("gxsid.cfg", mGxsIdNs);
|
||||||
//mConfigMgr->addConfiguration("gxscircles.cfg", mGxsCircleNs);
|
//mConfigMgr->addConfiguration("gxscircles.cfg", mGxsCircleNs);
|
||||||
|
|
||||||
createThread(*mGxsIdService);
|
mGxsIdService->start();
|
||||||
createThread(*mGxsIdNs);
|
mGxsIdNs->start();
|
||||||
createThread(*mGxsCircles);
|
mGxsCircles->start();
|
||||||
createThread(*mGxsCirclesNs);
|
mGxsCirclesNs->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
createThread(*mTestService);
|
mTestService->start();
|
||||||
createThread(*mTestNs);
|
mTestNs->start();
|
||||||
|
|
||||||
//node->AddPqiServiceMonitor(status);
|
//node->AddPqiServiceMonitor(status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,6 +262,7 @@ SOURCES += libretroshare/serialiser/rsturtleitem_test.cc \
|
||||||
libretroshare/serialiser/tlvbase_test.cc \
|
libretroshare/serialiser/tlvbase_test.cc \
|
||||||
libretroshare/serialiser/tlvstack_test.cc \
|
libretroshare/serialiser/tlvstack_test.cc \
|
||||||
libretroshare/serialiser/tlvitems_test.cc \
|
libretroshare/serialiser/tlvitems_test.cc \
|
||||||
|
libretroshare/serialiser/rsgrouteritem_test.cc \
|
||||||
libretroshare/serialiser/tlvtypes_test.cc \
|
libretroshare/serialiser/tlvtypes_test.cc \
|
||||||
libretroshare/serialiser/tlvkey_test.cc \
|
libretroshare/serialiser/tlvkey_test.cc \
|
||||||
libretroshare/serialiser/support.cc \
|
libretroshare/serialiser/support.cc \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue