mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-15 16:49:20 -05:00
fixed unit tests
This commit is contained in:
parent
1b8b9d4e56
commit
ebf54d1340
11 changed files with 47 additions and 36 deletions
|
|
@ -176,21 +176,21 @@ RsSerialType* init_item(RsNxsMsg& nxm)
|
|||
return new RsNxsSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
|
||||
}
|
||||
|
||||
RsSerialType* init_item(RsNxsSyncGrp& rsg)
|
||||
RsSerialType* init_item(RsNxsSyncGrpReqItem& rsg)
|
||||
{
|
||||
rsg.clear();
|
||||
rsg.flag = RsNxsSyncGrp::FLAG_USE_SYNC_HASH;
|
||||
rsg.flag = RsNxsSyncGrpItem::FLAG_USE_SYNC_HASH;
|
||||
rsg.createdSince = rand()%2423;
|
||||
randString(3124,rsg.syncHash);
|
||||
|
||||
return new RsNxsSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
|
||||
}
|
||||
|
||||
RsSerialType* init_item(RsNxsSyncMsg& rsgm)
|
||||
RsSerialType* init_item(RsNxsSyncMsgReqItem& rsgm)
|
||||
{
|
||||
rsgm.clear();
|
||||
|
||||
rsgm.flag = RsNxsSyncMsg::FLAG_USE_SYNC_HASH;
|
||||
rsgm.flag = RsNxsSyncMsgItem::FLAG_USE_SYNC_HASH;
|
||||
rsgm.createdSince = rand()%24232;
|
||||
rsgm.transactionNumber = rand()%23;
|
||||
init_random(rsgm.grpId) ;
|
||||
|
|
@ -223,7 +223,7 @@ RsSerialType* init_item(RsNxsSyncMsgItem& rsgml)
|
|||
return new RsNxsSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
|
||||
}
|
||||
|
||||
RsSerialType* init_item(RsNxsTransac& rstx){
|
||||
RsSerialType* init_item(RsNxsTransacItem &rstx){
|
||||
|
||||
rstx.clear();
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ RsSerialType* init_item(RsNxsTransac& rstx){
|
|||
}
|
||||
|
||||
|
||||
bool operator==(const RsNxsSyncGrp& l, const RsNxsSyncGrp& r)
|
||||
bool operator==(const RsNxsSyncGrpReqItem& l, const RsNxsSyncGrpReqItem& r)
|
||||
{
|
||||
|
||||
if(l.syncHash != r.syncHash) return false;
|
||||
|
|
@ -247,7 +247,7 @@ bool operator==(const RsNxsSyncGrp& l, const RsNxsSyncGrp& r)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool operator==(const RsNxsSyncMsg& l, const RsNxsSyncMsg& r)
|
||||
bool operator==(const RsNxsSyncMsgReqItem& l, const RsNxsSyncMsgReqItem& r)
|
||||
{
|
||||
|
||||
if(l.flag != r.flag) return false;
|
||||
|
|
@ -279,7 +279,7 @@ bool operator==(const RsNxsSyncMsgItem& l, const RsNxsSyncMsgItem& r)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool operator==(const RsNxsTransac& l, const RsNxsTransac& r){
|
||||
bool operator==(const RsNxsTransacItem& l, const RsNxsTransacItem& r){
|
||||
|
||||
if(l.transactFlag != r.transactFlag) return false;
|
||||
if(l.transactionNumber != r.transactionNumber) return false;
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ bool operator==(const RsNxsGrp&, const RsNxsGrp&);
|
|||
bool operator==(const RsNxsMsg&, const RsNxsMsg&);
|
||||
bool operator==(const RsGxsGrpMetaData& l, const RsGxsGrpMetaData& r);
|
||||
bool operator==(const RsGxsMsgMetaData& l, const RsGxsMsgMetaData& r);
|
||||
bool operator==(const RsNxsSyncGrp& l, const RsNxsSyncGrp& r);
|
||||
bool operator==(const RsNxsSyncMsg& l, const RsNxsSyncMsg& r);
|
||||
bool operator==(const RsNxsSyncGrpItem& l, const RsNxsSyncGrpItem& r);
|
||||
bool operator==(const RsNxsSyncMsgItem& l, const RsNxsSyncMsgItem& r);
|
||||
bool operator==(const RsNxsTransac& l, const RsNxsTransac& r);
|
||||
bool operator==(const RsNxsSyncGrpItem& l, const RsNxsSyncGrpItem& r);
|
||||
bool operator==(const RsNxsSyncMsgItem& l, const RsNxsSyncMsgItem& r);
|
||||
bool operator==(const RsNxsTransacItem& l, const RsNxsTransacItem& r);
|
||||
|
||||
//void init_item(RsNxsGrp& nxg);
|
||||
//void init_item(RsNxsMsg& nxm);
|
||||
|
|
@ -23,11 +23,11 @@ void init_item(RsGxsMsgMetaData* metaMsg);
|
|||
|
||||
RsSerialType* init_item(RsNxsGrp& nxg);
|
||||
RsSerialType* init_item(RsNxsMsg& nxm);
|
||||
RsSerialType* init_item(RsNxsSyncGrp& rsg);
|
||||
RsSerialType* init_item(RsNxsSyncMsg& rsgm);
|
||||
RsSerialType* init_item(RsNxsSyncGrpReqItem &rsg);
|
||||
RsSerialType* init_item(RsNxsSyncMsgReqItem &rsgm);
|
||||
RsSerialType* init_item(RsNxsSyncGrpItem& rsgl);
|
||||
RsSerialType* init_item(RsNxsSyncMsgItem& rsgml);
|
||||
RsSerialType* init_item(RsNxsTransac& rstx);
|
||||
RsSerialType* init_item(RsNxsTransacItem& rstx);
|
||||
|
||||
template<typename T>
|
||||
void copy_all_but(T& ex, const std::list<T>& s, std::list<T>& d)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ bool rs_nxs_test::RsNxsSimpleDummyCircles::loadCircle(
|
|||
}
|
||||
|
||||
int rs_nxs_test::RsNxsSimpleDummyCircles::canSend(const RsGxsCircleId& circleId,
|
||||
const RsPgpId& id) {
|
||||
const RsPgpId& id, bool &should_encrypt) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -33,11 +33,20 @@ int rs_nxs_test::RsNxsSimpleDummyCircles::canReceive(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool rs_nxs_test::RsNxsSimpleDummyCircles::isRecipient(const RsGxsCircleId &circleId, const RsGxsId& id)
|
||||
{
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool rs_nxs_test::RsNxsSimpleDummyCircles::recipients(
|
||||
const RsGxsCircleId& circleId, std::list<RsPgpId>& friendlist) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rs_nxs_test::RsNxsSimpleDummyCircles::recipients(
|
||||
const RsGxsCircleId& circleId, std::list<RsGxsId>& friendlist) {
|
||||
return true;
|
||||
}
|
||||
rs_nxs_test::RsNxsSimpleDummyReputation::RsNxsSimpleDummyReputation(
|
||||
RepMap& repMap, bool cached) {
|
||||
}
|
||||
|
|
@ -76,8 +85,7 @@ bool rs_nxs_test::RsNxsDelayedDummyCircles::loadCircle(
|
|||
return allowed(circleId);
|
||||
}
|
||||
|
||||
int rs_nxs_test::RsNxsDelayedDummyCircles::canSend(
|
||||
const RsGxsCircleId& circleId, const RsPgpId& id) {
|
||||
int rs_nxs_test::RsNxsDelayedDummyCircles::canSend(const RsGxsCircleId& circleId, const RsPgpId& id, bool &should_encrypt) {
|
||||
return allowed(circleId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,10 +39,13 @@ namespace rs_nxs_test
|
|||
bool isLoaded(const RsGxsCircleId &circleId);
|
||||
bool loadCircle(const RsGxsCircleId &circleId);
|
||||
|
||||
int canSend(const RsGxsCircleId &circleId, const RsPgpId &id);
|
||||
int canSend(const RsGxsCircleId &circleId, const RsPgpId &id,bool& should_encrypt);
|
||||
int canReceive(const RsGxsCircleId &circleId, const RsPgpId &id);
|
||||
bool recipients(const RsGxsCircleId &circleId, std::list<RsPgpId> &friendlist);
|
||||
|
||||
virtual bool recipients(const RsGxsCircleId &circleId, std::list<RsGxsId>& idlist) ;
|
||||
virtual bool isRecipient(const RsGxsCircleId &circleId, const RsGxsId& id) ;
|
||||
virtual bool getLocalCircleServerUpdateTS(const RsGxsCircleId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) { return true ; }
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
@ -66,10 +69,13 @@ namespace rs_nxs_test
|
|||
bool isLoaded(const RsGxsCircleId &circleId);
|
||||
bool loadCircle(const RsGxsCircleId &circleId);
|
||||
|
||||
int canSend(const RsGxsCircleId &circleId, const RsPgpId &id);
|
||||
int canSend(const RsGxsCircleId &circleId, const RsPgpId &id,bool& should_encrypt);
|
||||
int canReceive(const RsGxsCircleId &circleId, const RsPgpId &id);
|
||||
bool recipients(const RsGxsCircleId &circleId, std::list<RsPgpId> &friendlist);
|
||||
|
||||
virtual bool recipients(const RsGxsCircleId &circleId, std::list<RsGxsId>& idlist) { return true ;}
|
||||
virtual bool isRecipient(const RsGxsCircleId &circleId, const RsGxsId& id) { return allowed(circleId) ; }
|
||||
virtual bool getLocalCircleServerUpdateTS(const RsGxsCircleId& gid,time_t& grp_server_update_TS,time_t& msg_server_update_TS) { return true ; }
|
||||
private:
|
||||
|
||||
bool allowed(const RsGxsCircleId& circleId);
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ rs_nxs_test::NxsTestHub::NxsTestHub(NxsTestScenario::pointer testScenario)
|
|||
mTestScenario->getServiceInfo(),
|
||||
mTestScenario->getDummyReputations(*cit),
|
||||
mTestScenario->getDummyCircles(*cit),
|
||||
NULL,
|
||||
mTestScenario->getDummyPgpUtils(),
|
||||
true
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue