Merge pull request #421 from PhenomRetroShare/Fix_UnitTestCompilation

Fix UnitTest Compilation
This commit is contained in:
Cyril Soler 2016-06-18 17:43:50 -04:00 committed by GitHub
commit bc04f3c94b
5 changed files with 18 additions and 18 deletions

View File

@ -155,7 +155,7 @@ public:
* @return a pointer to a valid profile if successful, otherwise NULL
*
*/
bool getKey(const RsGxsId &id, RsTlvPrublicRSAKey& key){ return false; }
bool getKey(const RsGxsId &id, RsTlvPublicRSAKey& key){ return false; }
bool getPrivateKey(const RsGxsId &id, RsTlvPrivateRSAKey& key){ return false; } // For signing outgoing messages.
private:

View File

@ -35,8 +35,8 @@
TEST(libretroshare_gxs, GxsSecurity)
{
RsTlvSecurityKey_deprecated pub_key ;
RsTlvSecurityKey_deprecated priv_key ;
RsTlvPublicRSAKey pub_key ;
RsTlvPrivateRSAKey priv_key ;
EXPECT_TRUE(GxsSecurity::generateKeyPair(pub_key,priv_key)) ;
@ -45,7 +45,7 @@ TEST(libretroshare_gxs, GxsSecurity)
EXPECT_TRUE( pub_key.keyId == priv_key.keyId );
EXPECT_TRUE( pub_key.startTS == priv_key.startTS );
RsTlvSecurityKey_deprecated pub_key2 ;
RsTlvPublicRSAKey pub_key2 ;
EXPECT_TRUE(GxsSecurity::extractPublicKey(priv_key,pub_key2)) ;
EXPECT_TRUE( pub_key.keyId == pub_key2.keyId );

View File

@ -67,10 +67,10 @@ void init_item(RsTlvSecurityKeySet& ks)
randString(SHORT_STR, ks.groupId);
for(int i=1; i<n; i++)
{
RsGxsId a_str;
a_str = RsGxsId::random();
RsGxsId a_str;
a_str = RsGxsId::random();
RsTlvSecurityKey_deprecated& a_key = ks.keys[a_str];
RsTlvPublicRSAKey& a_key = ks.public_keys[a_str];
init_item(a_key);
a_key.keyId = a_str;
}
@ -81,10 +81,10 @@ bool operator==(const RsTlvSecurityKeySet& l, const RsTlvSecurityKeySet& r)
if(l.groupId != r.groupId) return false;
std::map<RsGxsId, RsTlvSecurityKey_deprecated>::const_iterator l_cit = l.keys.begin(),
r_cit = r.keys.begin();
std::map<RsGxsId, RsTlvPublicRSAKey>::const_iterator l_cit = l.public_keys.begin(),
r_cit = r.public_keys.begin();
for(; l_cit != l.keys.end(); l_cit++, r_cit++){
for(; l_cit != l.public_keys.end(); l_cit++, r_cit++){
if(l_cit->first != r_cit->first) return false;
if(!(l_cit->second == r_cit->second)) return false;
}
@ -94,7 +94,7 @@ bool operator==(const RsTlvSecurityKeySet& l, const RsTlvSecurityKeySet& r)
bool operator==(const RsTlvSecurityKey_deprecated& sk1, const RsTlvSecurityKey_deprecated& sk2)
bool operator==(const RsTlvPublicRSAKey& sk1, const RsTlvPublicRSAKey& sk2)
{
if(sk1.startTS != sk2.startTS) return false;
@ -183,14 +183,14 @@ bool operator==(const RsTlvBinaryData& bd1, const RsTlvBinaryData& bd2)
}
void init_item(RsTlvSecurityKey_deprecated& sk)
void init_item(RsTlvPublicRSAKey& sk)
{
int randnum = rand()%313131;
sk.endTS = randnum;
sk.keyFlags = randnum;
sk.startTS = randnum;
sk.keyId = RsGxsId::random();
sk.keyId = RsGxsId::random();
std::string randomStr;
randString(LARGE_STR, randomStr);

View File

@ -58,7 +58,7 @@ void randString(const uint32_t, std::wstring&);
/* for testing compound tlv items */
void init_item(RsTlvSecurityKey_deprecated&);
void init_item(RsTlvPublicRSAKey&);
void init_item(RsTlvSecurityKeySet&);
void init_item(RsTlvKeySignature&);
void init_item(RsTlvKeySignatureSet&);
@ -70,7 +70,7 @@ void init_item(RsTlvPeerIdSet&);
void init_item(RsTlvImage&);
void init_item(RsTlvPeerIdSet&);
bool operator==(const RsTlvSecurityKey_deprecated&, const RsTlvSecurityKey_deprecated& );
bool operator==(const RsTlvPublicRSAKey&, const RsTlvPublicRSAKey& );
bool operator==(const RsTlvSecurityKeySet&, const RsTlvSecurityKeySet& );
bool operator==(const RsTlvKeySignature&, const RsTlvKeySignature& );
bool operator==(const RsTlvBinaryData&, const RsTlvBinaryData&);

View File

@ -65,10 +65,10 @@ bool test_SetTlvItem(RsTlvItem *item, uint16_t type, void *data, uint32_t size,
int test_TlvRandom(void *data, uint32_t len, uint32_t offset)
{
uint32_t tmpoffset = 0;
//uint32_t tmpoffset = 0;
/* List of all the TLV types it could be! */
RsTlvSecurityKey_deprecated skey;
RsTlvPublicRSAKey skey;
RsTlvSecurityKeySet skeyset;
RsTlvKeySignature keysign;
@ -114,7 +114,7 @@ int test_TlvRandom(void *data, uint32_t len, uint32_t offset)
EXPECT_TRUE(test_SetTlvItem(&kv, TLV_TYPE_KEYVALUE, data, len, offset));
EXPECT_TRUE(test_SetTlvItem(&kvset, TLV_TYPE_KEYVALUESET, data, len, offset));
std::cerr << "test_TlvRandom:: Testing Keys (TYPESET)" << std::endl;
EXPECT_TRUE(test_SetTlvItem(&skey, TLV_TYPE_SECURITYKEY_deprecated, data, len, offset));
EXPECT_TRUE(test_SetTlvItem(&skey, TLV_TYPE_SECURITY_KEY, data, len, offset));
EXPECT_TRUE(test_SetTlvItem(&skeyset, TLV_TYPE_SECURITYKEYSET, data, len, offset));
EXPECT_TRUE(test_SetTlvItem(&keysign, TLV_TYPE_KEYSIGNATURE, data, len, offset));