/* * libretroshare/src/serialiser: rsturtleitems_test.cc * * RetroShare Serialiser. * * Copyright 2007-2008 by Cyril Soler * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License Version 2 as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA. * * Please report all bugs and problems to "retroshare@lunamutt.com". * */ /****************************************************************** */ #include #include #include #include "turtle/rsturtleitem.h" #include "ft/ftturtlefiletransferitem.h" #include "support.h" #include "rstlvutil.h" RsSerialType* init_item(CompressedChunkMap& map) { map._map.clear() ; for(uint32_t i=0;i<15;++i) map._map.push_back(rand()) ; return new RsTurtleSerialiser(); } bool operator==(const CompressedChunkMap& m1,const CompressedChunkMap& m2) { if(m1._map.size() != m2._map.size()) return false ; for(uint32_t i=0;i::const_iterator i1(it1.result.begin()) ; std::list::const_iterator i2(it2.result.begin()) ; for(;i1!=it1.result.end() && i2!=it2.result.end();++i1,++i2) if( !(*i1 == *i2)) return false ; return true ; } TEST(libretroshare_serialiser, RsTurtleItem) { for(uint32_t i=0;i<20;++i) { //test_RsItem(); //test_RsItem(); //test_RsItem(); //test_RsItem(); test_RsItem(); test_RsItem(); test_RsItem(); test_RsItem(); test_RsItem(); } }