mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-27 07:47:03 -05:00
temporary changes (lrand48 - rand(), s/random - s/rand() to turtle tunnel, and tlv random tests to allow windows
compatability. added some explicit headers to distrib items test again for compatability. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3349 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7b4364035e
commit
cf75bee791
@ -48,7 +48,7 @@ tlvrandom_test : tlvrandom_test.o
|
||||
$(CC) $(CFLAGS) -o tlvrandom_test tlvrandom_test.o $(OBJ) $(LIBS)
|
||||
|
||||
rsturtleitem_test : rsturtleitem_test.o support.o
|
||||
$(CC) $(CFLAGS) -o rsturtleitem_test rsturtleitem_test.o $(OBJ) $(LIBS)
|
||||
$(CC) $(CFLAGS) -o rsturtleitem_test rsturtleitem_test.o support.o $(OBJ) $(LIBS)
|
||||
|
||||
rstunnelitem_test : rstunnelitem_test.o support.o
|
||||
$(CC) $(CFLAGS) -o rstunnelitem_test rstunnelitem_test.o support.o $(OBJ) $(LIBS)
|
||||
|
@ -1,3 +1,4 @@
|
||||
<<<<<<< .mine
|
||||
/*
|
||||
* libretroshare/src/serialiser: distribitem_test.cc
|
||||
*
|
||||
@ -24,12 +25,12 @@
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <time.h>
|
||||
#include "serialiser/rsdistribitems.h"
|
||||
#include "serialiser/rschannelitems.h"
|
||||
#include "serialiser/rsforumitems.h"
|
||||
#include "serialiser/rsblogitems.h"
|
||||
#include "retroshare/rsdistrib.h"
|
||||
#include "rsiface/rsdistrib.h"
|
||||
#include "serialiser/rstlvutil.h"
|
||||
#include "util/utest.h"
|
||||
#include "support.h"
|
||||
@ -317,4 +318,3 @@ int main(){
|
||||
return TESTRESULT();
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
/******************************************************************
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <serialiser/rstunnelitems.h>
|
||||
@ -38,11 +39,11 @@
|
||||
|
||||
RsTunnelSerialiser* init_item(RsTunnelDataItem& item)
|
||||
{
|
||||
uint32_t S = lrand48()%20000 ;
|
||||
uint32_t S = rand()%20000 ;
|
||||
item.encoded_data = malloc(S) ;
|
||||
item.encoded_data_len = S ;
|
||||
for(uint32_t i=0;i<S;++i)
|
||||
((unsigned char *)item.encoded_data)[i] = lrand48()%256 ;
|
||||
((unsigned char *)item.encoded_data)[i] = rand()%256 ;
|
||||
item.sourcePeerId = "67641e38df0e75432033d222eae93fff" ;
|
||||
item.relayPeerId = "6013bfc2cea7ab823af7a79fb3ca0df1" ;
|
||||
item.destPeerId = "1d5768db7cd4720d0eb75cc1917da332" ;
|
||||
@ -69,10 +70,10 @@ RsTunnelSerialiser* init_item(RsTunnelHandshakeItem& item)
|
||||
item.destPeerId = "1d5768db7cd4720d0eb75cc1917da332" ;
|
||||
|
||||
item.sslCertPEM = "" ;
|
||||
uint32_t s=lrand48()%20 ;
|
||||
uint32_t s=rand()%20 ;
|
||||
for(uint32_t i=0;i<s;++i)
|
||||
item.sslCertPEM += "6013bfc2cea7ab823af7a79fb3ca0df1" ;
|
||||
item.connection_accepted = lrand48() ;
|
||||
item.connection_accepted = rand() ;
|
||||
|
||||
return new RsTunnelSerialiser();
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ INITTEST();
|
||||
RsSerialType* init_item(CompressedChunkMap& map)
|
||||
{
|
||||
map._map.clear() ;
|
||||
for(uint i=0;i<15;++i)
|
||||
map._map.push_back(lrand48()) ;
|
||||
for(uint32_t i=0;i<15;++i)
|
||||
map._map.push_back(rand()) ;
|
||||
|
||||
return new RsTurtleSerialiser();
|
||||
}
|
||||
@ -90,7 +90,7 @@ RsSerialType* init_item(RsTurtleFileDataItem& item)
|
||||
item.chunk_size = S ;
|
||||
item.chunk_data = new unsigned char[S] ;
|
||||
for(uint32_t i=0;i<S;++i)
|
||||
((unsigned char *)item.chunk_data)[i] = lrand48()%256 ;
|
||||
((unsigned char *)item.chunk_data)[i] = rand()%256 ;
|
||||
return new RsTurtleSerialiser();
|
||||
}
|
||||
bool operator==(const RsTurtleFileDataItem& i1,const RsTurtleFileDataItem& i2)
|
||||
@ -105,9 +105,9 @@ bool operator==(const RsTurtleFileDataItem& i1,const RsTurtleFileDataItem& i2)
|
||||
}
|
||||
RsSerialType* init_item(RsTurtleFileRequestItem& item)
|
||||
{
|
||||
item.tunnel_id = lrand48() ;
|
||||
item.tunnel_id = rand() ;
|
||||
item.chunk_offset = 0x25ea228437894379ull ;
|
||||
item.chunk_size = lrand48() ;
|
||||
item.chunk_size = rand() ;
|
||||
return new RsTurtleSerialiser();
|
||||
}
|
||||
bool operator==(const RsTurtleFileRequestItem& it1,const RsTurtleFileRequestItem& it2)
|
||||
@ -120,8 +120,8 @@ bool operator==(const RsTurtleFileRequestItem& it1,const RsTurtleFileRequestItem
|
||||
}
|
||||
RsSerialType* init_item(RsTurtleTunnelOkItem& item)
|
||||
{
|
||||
item.tunnel_id = lrand48() ;
|
||||
item.request_id = lrand48() ;
|
||||
item.tunnel_id = rand() ;
|
||||
item.request_id = rand() ;
|
||||
return new RsTurtleSerialiser();
|
||||
}
|
||||
bool operator==(const RsTurtleTunnelOkItem& it1,const RsTurtleTunnelOkItem& it2)
|
||||
@ -132,9 +132,9 @@ bool operator==(const RsTurtleTunnelOkItem& it1,const RsTurtleTunnelOkItem& it2)
|
||||
}
|
||||
RsSerialType* init_item(RsTurtleOpenTunnelItem& item)
|
||||
{
|
||||
item.depth = lrand48() ;
|
||||
item.request_id = lrand48() ;
|
||||
item.partial_tunnel_id = lrand48() ;
|
||||
item.depth = rand() ;
|
||||
item.request_id = rand() ;
|
||||
item.partial_tunnel_id = rand() ;
|
||||
item.file_hash = std::string("c0edcfecc0844ef175d61dd589ab288d262b6bc8") ;
|
||||
return new RsTurtleSerialiser();
|
||||
}
|
||||
@ -148,14 +148,14 @@ bool operator==(const RsTurtleOpenTunnelItem& it1,const RsTurtleOpenTunnelItem&
|
||||
}
|
||||
RsSerialType* init_item(RsTurtleRegExpSearchRequestItem& item)
|
||||
{
|
||||
item.request_id = lrand48() ;
|
||||
item.depth = lrand48() ;
|
||||
item.request_id = rand() ;
|
||||
item.depth = rand() ;
|
||||
item.expr._tokens.clear() ;
|
||||
item.expr._ints.clear() ;
|
||||
item.expr._strings.clear() ;
|
||||
|
||||
for(uint32_t i=0;i<10u;++i) item.expr._tokens.push_back(lrand48()%8) ;
|
||||
for(uint32_t i=0;i<6u;++i) item.expr._ints.push_back(lrand48()) ;
|
||||
for(uint32_t i=0;i<10u;++i) item.expr._tokens.push_back(rand()%8) ;
|
||||
for(uint32_t i=0;i<6u;++i) item.expr._ints.push_back(rand()) ;
|
||||
for(uint32_t i=0;i<8u;++i) item.expr._strings.push_back("test string") ;
|
||||
return new RsTurtleSerialiser();
|
||||
}
|
||||
@ -173,8 +173,8 @@ bool operator==(const RsTurtleRegExpSearchRequestItem& it1,const RsTurtleRegExpS
|
||||
}
|
||||
RsSerialType* init_item(RsTurtleStringSearchRequestItem& item)
|
||||
{
|
||||
item.request_id = lrand48() ;
|
||||
item.depth = lrand48() ;
|
||||
item.request_id = rand() ;
|
||||
item.depth = rand() ;
|
||||
item.match_string = std::string("432hkjfdsjkhjk43r3fw") ;
|
||||
return new RsTurtleSerialiser();
|
||||
}
|
||||
@ -202,8 +202,8 @@ bool operator==(const TurtleFileInfo& it1,const TurtleFileInfo& it2)
|
||||
}
|
||||
RsSerialType* init_item(RsTurtleSearchResultItem& item)
|
||||
{
|
||||
item.depth = lrand48() ;
|
||||
item.request_id = lrand48() ;
|
||||
item.depth = rand() ;
|
||||
item.request_id = rand() ;
|
||||
item.result.clear() ;
|
||||
static const uint32_t S = 10 ;
|
||||
for(uint32_t i=0;i<S;++i)
|
||||
|
@ -38,6 +38,7 @@
|
||||
* many deserialisation as possible.
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
#include "serialiser/rstlvbase.h"
|
||||
@ -73,10 +74,10 @@ int main()
|
||||
time_t startTs = time(NULL);
|
||||
time_t endTs = startTs + TEST_LENGTH;
|
||||
|
||||
srandom(startTs);
|
||||
srand(startTs);
|
||||
for(i = 0; i < dsize; i++)
|
||||
{
|
||||
data[i] = random() % 256;
|
||||
data[i] = rand() % 256;
|
||||
}
|
||||
|
||||
std::cerr << "TlvRandom Tests: setup data." << std::endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user