RetroShare/libretroshare/src/tests/network_simulator/main.cpp
csoler bc65dd40c2 - Restored compilation of most tests (The part using previously named p3ConnectMgr is still to be done).
- moved ftSearchDummy and ftDataSendPair in tests/ft since it is only used there.




git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6009 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-12-17 23:05:25 +00:00

58 lines
1.1 KiB
C++

#include <fenv.h>
#include "Network.h"
#include "NetworkSimulatorGUI.h"
#include "MonitoredRsPeers.h"
#include <QApplication>
#include <common/argstream.h>
int main(int argc, char *argv[])
{
feenableexcept(FE_INVALID) ;
feenableexcept(FE_DIVBYZERO) ;
#ifndef DEBUG
try
{
#endif
argstream as(argc,argv) ;
bool show_gui = false;
int nb_nodes = 20 ;
float connexion_probability = 0.2 ;
as >> option('i',"gui",show_gui,"show gui (vs. do the pipeline automatically)")
>> parameter('n',"nodes",nb_nodes,"number of nodes in the network")
>> parameter('p',"connexion probability",connexion_probability,"probability that two nodes are connected (exponential law)")
>> help() ;
as.defaultErrorHandling() ;
// 2 - call the full pipeline
Network network ;
network.initRandom(nb_nodes,connexion_probability) ;
rsPeers = new MonitoredRsPeers(network) ;
if(show_gui)
{
QApplication app(argc,argv) ;
NetworkSimulatorGUI pgui(network);
pgui.show() ;
return app.exec() ;
}
return 0 ;
#ifndef DEBUG
}
catch(std::exception& e)
{
std::cerr << "Unhandled exception: " << e.what() << std::endl;
return 1 ;
}
#endif
}