ServerContextImpl::ServerContextImpl(): _state(NOT_INITIALIZED), _beaconAddressList(), _ignoreAddressList(), _autoBeaconAddressList(true), _beaconPeriod(15.0), _broadcastPort(PVA_BROADCAST_PORT), _serverPort(PVA_SERVER_PORT), _receiveBufferSize(MAX_TCP_RECV), _timer(), _beaconEmitter(), _acceptor(), _transportRegistry(), _channelProviderRegistry(), _channelProviderNames(PVACCESS_DEFAULT_PROVIDER), _channelProviders(), _beaconServerStatusProvider(), _startTime() { epicsTimeGetCurrent(&_startTime); // TODO maybe there is a better place for this (when there will be some factory) epicsSignalInstallSigAlarmIgnore (); epicsSignalInstallSigPipeIgnore (); generateGUID(); initializeLogger(); }
int main(int argc, char *argv[]) { int error = EXIT_SUCCESS; pthread_t threads[nb_threads]; unsigned int i; program = argv[0]; initializeLogger(0); DEBUG_VAR(program,"%s"); for(i=0;i<nb_threads;i++) { DEBUG_VAR(i,"%d"); error = pthread_create(&threads[i],NULL,thread,(void*)nb_loop); if (error != 0) { ERROR_MSG("pthread_create %d error %d",i,error); threads[i] = 0; } } for(i=0;i<nb_threads;i++) { if (threads[i] != 0) { void *thread_return = NULL; NOTICE_MSG("waiting for %d ending...",i); error = pthread_join(threads[i],&thread_return); DEBUG_VAR(error,"%d"); } } return error; }
void initializeLoggers (const char *pszLogDir) { if (!FileUtils::directoryExists (pszLogDir)) { if (!FileUtils::createDirectory (pszLogDir)) { return; } } time_t now = time (NULL); struct tm *ptm = localtime (&now); static char timestamp[17]; sprintf (timestamp, "%d%02d%02d-%02d_%02d_%02d", (ptm->tm_year+1900), (ptm->tm_mon+1), ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec); printf ("Running DSPro (Version built on %s).\n", BUILD_TIME); initializeLogger (&pLogger, pszLogDir, "dspro.log", timestamp, false); checkAndLogMsg ("main", Logger::L_Info, "Running DSPro version built on %s.\n", BUILD_TIME); initializeLogger (&pNetLog, pszLogDir, "dspro-matchmaking.log", timestamp, false); initializeLogger (&pTopoLog, pszLogDir, "dspro-topology.log", timestamp, false); initializeLogger (&pCmdProcLog, pszLogDir, "dspro-notifications.log", timestamp, false); }
void *thread(void *params) { #if __LP64__ unsigned long int l = (unsigned long int)params; #else //__LP64__ unsigned int l = (unsigned int)params; #endif //__LP64__ unsigned int i; static unsigned int n = 1; __sync_fetch_and_add(&n,1); initializeLogger(n); for(i=0;i<l;i++) { DEBUG_VAR(i,"%d"); usleep(1000); } return NULL; }
SimSettings OMCFactory::readSimulationParameter(int argc, const char* argv[]) { int opt; int portnum; map<string, OutputPointType> outputPointTypeMap = MAP_LIST_OF "all", OPT_ALL MAP_LIST_SEP "step", OPT_STEP MAP_LIST_SEP "none", OPT_NONE MAP_LIST_END; map<string, OutputFormat> outputFormatMap = MAP_LIST_OF "csv", CSV MAP_LIST_SEP "mat", MAT MAP_LIST_SEP "buffer", BUFFER MAP_LIST_SEP "empty", EMPTY MAP_LIST_END; map<string, EmitResults> emitResultsMap = MAP_LIST_OF "all", EMIT_ALL MAP_LIST_SEP "public", EMIT_PUBLIC MAP_LIST_SEP "none", EMIT_NONE MAP_LIST_END; po::options_description desc("Allowed options"); //program options that can be overwritten by OMEdit must be declared as vector //so that the same value can be set multiple times //(e.g. 'executable -F arg1 -r=arg2' -> 'executable -F arg1 -F=arg2') //the variables of OMEdit are always the first elements of the result vectors, if they are set desc.add_options() ("help", "produce help message") ("nls-continue", po::bool_switch()->default_value(false), "non linear solver will continue if it can not reach the given precision") ("runtime-library,R", po::value<string>(), "path to cpp runtime libraries") ("modelica-system-library,M", po::value<string>(), "path to Modelica library") ("input-path", po::value< string >(), "directory with input files, like init xml (defaults to modelica-system-library)") ("output-path", po::value< string >(), "directory for output files, like results (defaults to modelica-system-library)") ("results-file,F", po::value<vector<string> >(),"name of results file") ("start-time,S", po::value< double >()->default_value(0.0), "simulation start time") ("stop-time,E", po::value< double >()->default_value(1.0), "simulation stop time") ("step-size,H", po::value< double >()->default_value(0.0), "simulation step size") ("solver,I", po::value< string >()->default_value("euler"), "solver method") ("lin-solver,L", po::value< string >()->default_value(_defaultLinSolver), "linear solver method") ("non-lin-solver,N", po::value< string >()->default_value(_defaultNonLinSolver), "non linear solver method") ("number-of-intervals,G", po::value< int >()->default_value(500), "number of intervals in equidistant grid") ("tolerance,T", po::value< double >()->default_value(1e-6), "solver tolerance") ("warn-all,W", po::bool_switch()->default_value(false), "issue all warning messages") ("log-settings,V", po::value< vector<string> >(), "log information: init, nls, ls, solver, output, events, model, other") ("log-format,X", po::value< string >()->default_value("txt"), "log format: txt, xml, xmltcp") ("log-port", po::value< int >()->default_value(0), "tcp port for log messages (default 0 meaning stdout/stderr)") ("alarm,A", po::value<unsigned int >()->default_value(360), "sets timeout in seconds for simulation") ("output-type,O", po::value< string >()->default_value("all"), "the points in time written to result file: all (output steps + events), step (just output points), none") ("output-format,P", po::value< string >()->default_value("mat"), "simulation results output format: csv, mat, buffer, empty") ("emit-results,U", po::value< string >()->default_value("public"), "emit results: all, public, none") ; // a group for all options that should not be visible if '--help' is set po::options_description descHidden("Hidden options"); descHidden.add_options() ("ignored", po::value<vector<string> >(), "ignored options") ("unrecognized", po::value<vector<string> >(), "unsupported options") ("solver-threads", po::value<int>()->default_value(1), "number of threads that can be used by the solver") ; po::options_description descAll("All options"); descAll.add(desc); descAll.add(descHidden); po::variables_map vm; boost::function<pair<string, string> (const string&)> parserFunction(boost::bind(&OMCFactory::parseIngoredAndWrongFormatOption, this, _1)); po::parsed_options parsed = po::command_line_parser(argc, argv) .options(descAll) .style((po::command_line_style::default_style | po::command_line_style::allow_long_disguise) & ~po::command_line_style::allow_guessing) .extra_parser(parserFunction) .allow_unregistered() .run(); po::store(parsed, vm); po::notify(vm); if (vm.count("help")) { cout << desc << endl; throw ModelicaSimulationError(MODEL_FACTORY, "Cannot parse command line arguments correctly, because the help message was requested.", "",true); } LogSettings logSettings = initializeLogger(vm); // warn about unrecognized command line options vector<string> unrecognized = po::collect_unrecognized(parsed.options, po::include_positional); if (vm.count("unrecognized")) { vector<string> opts = vm["unrecognized"].as<vector<string> >(); unrecognized.insert(unrecognized.begin(), opts.begin(), opts.end()); } if (unrecognized.size() > 0) { ostringstream os; os << "Warning: unrecognized command line options "; copy(unrecognized.begin(), unrecognized.end(), ostream_iterator<string>(os, " ")); LOGGER_WRITE(os.str(), LC_OTHER, LL_WARNING); } string runtime_lib_path; string modelica_lib_path; double starttime = vm["start-time"].as<double>(); double stoptime = vm["stop-time"].as<double>(); double stepsize =vm["step-size"].as<double>(); bool nlsContinueOnError = vm["nls-continue"].as<bool>(); int solverThreads = vm["solver-threads"].as<int>(); if (!(stepsize > 0.0)) stepsize = (stoptime - starttime) / vm["number-of-intervals"].as<int>(); double tolerance = vm["tolerance"].as<double>(); string solver = vm["solver"].as<string>(); string nonLinSolver = vm["non-lin-solver"].as<string>(); string linSolver = vm["lin-solver"].as<string>(); unsigned int timeOut = vm["alarm"].as<unsigned int>(); if (vm.count("runtime-library")) { //cout << "runtime library path set to " << vm["runtime-library"].as<string>() << endl; runtime_lib_path = vm["runtime-library"].as<string>(); normalizePath(runtime_lib_path); } else throw ModelicaSimulationError(MODEL_FACTORY,"runtime libraries path is not set"); if (vm.count("modelica-system-library")) { //cout << "Modelica library path set to " << vm["Modelica-system-library"].as<string>() << endl; modelica_lib_path = vm["modelica-system-library"].as<string>(); normalizePath(modelica_lib_path); } else throw ModelicaSimulationError(MODEL_FACTORY,"Modelica library path is not set"); string inputPath, outputPath; if (vm.count("input-path")) { inputPath = vm["input-path"].as<string>(); normalizePath(inputPath); } else inputPath = modelica_lib_path; if (vm.count("output-path")) { outputPath = vm["output-path"].as<string>(); normalizePath(outputPath); } else outputPath = modelica_lib_path; string resultsfilename; if (vm.count("results-file")) { //cout << "results file: " << vm["results-file"].as<string>() << endl; resultsfilename = vm["results-file"].as<vector<string> >().front(); } else throw ModelicaSimulationError(MODEL_FACTORY,"results-filename is not set"); OutputPointType outputPointType; if (vm.count("output-type")) { string outputType_str = vm["output-type"].as<string>(); if (outputPointTypeMap.find(outputType_str) != outputPointTypeMap.end()) outputPointType = outputPointTypeMap[outputType_str]; else throw ModelicaSimulationError(MODEL_FACTORY, "Unknown output-type " + outputType_str); } else throw ModelicaSimulationError(MODEL_FACTORY, "output-type is not set"); OutputFormat outputFormat; if (vm.count("output-format")) { string outputFormat_str = vm["output-format"].as<string>(); if (outputFormatMap.find(outputFormat_str) != outputFormatMap.end()) outputFormat = outputFormatMap[outputFormat_str]; else throw ModelicaSimulationError(MODEL_FACTORY, "Unknown output-format " + outputFormat_str); } else throw ModelicaSimulationError(MODEL_FACTORY, "output-format is not set"); EmitResults emitResults = EMIT_PUBLIC; // emit public per default for OMC use if (vm.count("emit-results")) { string emitResults_str = vm["emit-results"].as<string>(); if (emitResultsMap.find(emitResults_str) != emitResultsMap.end()) emitResults = emitResultsMap[emitResults_str]; else throw ModelicaSimulationError(MODEL_FACTORY, "Unknown emit-results " + emitResults_str); } fs::path libraries_path = fs::path( runtime_lib_path) ; fs::path modelica_path = fs::path( modelica_lib_path) ; libraries_path.make_preferred(); modelica_path.make_preferred(); SimSettings settings = {solver, linSolver, nonLinSolver, starttime, stoptime, stepsize, 1e-24, 0.01, tolerance, resultsfilename, timeOut, outputPointType, logSettings, nlsContinueOnError, solverThreads, outputFormat, emitResults, inputPath, outputPath}; _library_path = libraries_path.string(); _modelicasystem_path = modelica_path.string(); return settings; }
void GameCore::startOgre() { reader=new ConfigReader(gameConfigFile); if(reader->readFile()) { writer=new ConfigWriter(gameConfigFile); writer->importConfigReader(reader); reader->pushConfigFile("GameSettings"); std::string pluginsConfig = reader->getFieldValueAsString("ConfigFiles", "plugins-configfile"); std::string resourcesConfig = reader->getFieldValueAsString("ConfigFiles", "resources-configfile"); std::string ogreConfig = reader->getFieldValueAsString("ConfigFiles", "ogre-config"); std::string ogreLogFile = reader->getFieldValueAsString("LogFiles", "ogre-logfile"); std::string gameLogFile = reader->getFieldValueAsString("LogFiles", "game-logfile"); serverTcpPort= reader->getFieldValueAsInteger("NetworkSettings", "tcp-port"); ttftpPort = reader->getFieldValueAsInteger("NetworkSettings", "ttftp-client-port"); nickname=reader->getFieldValueAsString("MultiplayerSettings","nickname"); wallHeight = reader->getFieldValueAsDouble("MapSettings", "wall-height"); mapPath = reader->getFieldValueAsString("MapSettings", "map-lookup-directory"); shadowsEnabled = reader->getFieldValueAsBool("GraphicsSettings", "shadows"); menuBackgroundMusic = reader->getFieldValueAsString("GameSounds", "menu-background"); gameBackgroundMusic = reader->getFieldValueAsString("GameSounds", "game-background"); lmgFireSound = reader->getFieldValueAsString("GameSounds", "lmg-fire"); bgSoundVolume=reader->getFieldValueAsDouble("GameSounds","bg-sound-volume"); bgSoundVolume=(bgSoundVolume<-1?.1:bgSoundVolume); (reader->getFieldValueAsString("MultiplayerSettings","player-color")=="blue"?color=0:color=1); maxDecals=reader->getFieldValueAsInteger("GraphicsSettings","max-decals"); if(maxDecals==-1) maxDecals=30; sensivity=((reader->getFieldValueAsDouble("MultiplayerSettings","mouse-sensivity")<=0?5:reader->getFieldValueAsDouble("MultiplayerSettings","mouse-sensivity"))); moveAnimationSpeed = reader->getFieldValueAsDouble("AnimationSpeeds", "move-speed"); fireAnimationSpeed = reader->getFieldValueAsDouble("AnimationSpeeds", "fire-speed"); moveSpeed=125; buildMap = true; singlePlayerMode = reader->getFieldValueAsBool("Debug", "singleplayer"); if (buildMap) mapFileName = reader->getFieldValueAsString("MapSettings", "map-file-name"); if (mapPath == "NULL") mapPath = "Map/"; else mapPath = mapPath.find("/") == std::string::npos ? mapPath.substr(mapPath.find("/")) : mapPath; gameStarted = teamDM = gameLoaded=false; initializeLogger(gameLogFile); logger->addLine("game config file " + gameConfigFile + " loaded to memory & logger initialized"); LogManager* logManager=new LogManager(); logManager->createLog(ogreLogFile,true,false,false); root = OGRE_NEW Root(pluginsConfig,ogreConfig, ""); ConfigFile configFile; configFile.load(resourcesConfig); //[start]taken from ogre framework Ogre::ConfigFile::SectionIterator seci = configFile.getSectionIterator(); Ogre::String secName, typeName, archName; while (seci.hasMoreElements()) { secName = seci.peekNextKey(); Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext(); Ogre::ConfigFile::SettingsMultiMap::iterator i; for (i = settings->begin(); i != settings->end(); ++i) { typeName = i->first; archName = i->second; Ogre::ResourceGroupManager::getSingleton().addResourceLocation( archName, typeName, secName); } } //[END] logger->addLine("ogre configuration has been read"); root->showConfigDialog(); renderWindow=root->initialise(true,"Team-Two"); logger->addLine("window created"); sceneManager=root->createSceneManager(ST_EXTERIOR_FAR,"core"); localPlayer=NULL; mapMode=false; mainCamera=sceneManager->createCamera("MainCam"); mainCamera->setNearClipDistance(1);mainCamera->setLodBias(2); mainCamera->setFarClipDistance(100000000); mainCamera->setAspectRatio(renderWindow->getWidth()/(float)renderWindow->getHeight()); menuSceneManager=root->createSceneManager(ST_GENERIC,"menu"); menuCamera=menuSceneManager->createCamera("MenuCam"); menuCamera->setNearClipDistance(1); menuMode=true; viewPort=renderWindow->addViewport(mainCamera); dynamics=NULL; if(shadowsEnabled) sceneManager->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE); else sceneManager->setShadowTechnique(Ogre::SHADOWTYPE_NONE); ResourceGroupManager::getSingletonPtr()->initialiseAllResourceGroups(); logger->addLine("GameCore: scanning map files"); lookupMapFiles(mapPath); logger->addLine("GameCore: --ok"); logger->addLine("GameCore: initializing event listeners"); initializeEventListeners(); logger->addLine("GameCore: --ok"); logger->addLine("GameCore: initializing CEGUI"); initializeCEGUI(); logger->addLine("GameCore: --ok"); logger->addLine("GameCore: initializing menu"); initializeMenu(); menuController->showLoading(); root->renderOneFrame(); #if WINDOWS_PLATFORM //Sleep(5000); #else sleep(5); #endif logger->addLine("GameCore: --ok"); logger->addLine("GameCore: initializing ingamemenu"); initializeInGameGUI(); logger->addLine("GameCore: --ok"); logger->addLine("GameCore: initializing networking"); initializeNetworking(); logger->addLine("GameCore: --ok"); //=================================================DEBUG if (singlePlayerMode) { initializePhysics(); logger->addLine("Physics initialized"); initializeScene(); logger->addLine("Scene initialized"); if (buildMap) initializeMap(mapPath + mapFileName); logger->addLine("Map initialized"); _initializeSinglePlayer(); initializeItems(); initializeTeleporters(); } //================================================= logger->addLine("GameCore: initializing sounds"); initializeSounds(); logger->addLine("GameCore: --ok"); root->addFrameListener(this); logger->addLine("GameLoop starting..."); menuController->hideLoading(); gameLoop(); } else std::cout<<"configuration file not found!...\n"; }
void HookThread::Setup() { initializeLogger(); logInfo("APMAlert2 starting up..."); }
/** * Main method (Duh ;) ) Runs the whole simulation. Main loop runs in this method * * @param argc number of command line arguments * @param argsv[] command line parameters. Several Config file parameters can be overriden by setting them here. "--visualize" is especially cool, as it shows an OpenGL live view * * @return 0 if successful */ int main(int argc, char* argsv[]) { if (argc > 1 && (!strcmp(argsv[1], "-?") || !strcmp(argsv[1], "help") || !strcmp(argsv[1], "--help"))) { std::cout << "This is the NUKULAR Simulator" << std::endl; std::cout << "Authors: " << std::endl; std::cout << "\tLeonhard Rannabauer" << std::endl; std::cout << "\tJakob Weiss" << std::endl; std::cout << "\tAlexander Winkler" << std::endl; std::cout << std::endl; std::cout << "By default, configuration will be loaded from a configuration file." << std::endl; std::cout << "The CWD will be searched for \"config.cfg\". Override this by specifying the" << std::endl; std::cout << "\t-configFile command line parameter with the path to your own configuration" << std::endl; std::cout << "\t(either .xml or .cfg format)" << std::endl; std::cout << std::endl; std::cout << "EXAMPLE: ./MolSim -configFile simulationConfig.xml -outputFilePrefix MD_sim -endTime 10" << std::endl; std::cout << std::endl; std::cout << "\t will load Settings from simulationConfig.xml, simulate the world for 10 seconds" << std::endl; std::cout << "\t and output the files with a prefix of \"MD_sim\", which will lead to files like" << std::endl; std::cout << "\t\"MD_sim_0010.vtu\"" << std::endl; return 0; } std::cout << "Initializing the logger..." << std::endl << std::flush; //Initialize the logging stuff initializeLogger(); Settings::initSettings(argc, argsv); LOG4CXX_TRACE(rootLogger, "Settings initialized!"); #ifdef _OPENMP if(Settings::numThreads > 0) { LOG4CXX_INFO(rootLogger, "Setting OpenMP Threads to " << Settings::numThreads); omp_set_num_threads(Settings::numThreads); } else { LOG4CXX_INFO(rootLogger, "Running on " << omp_get_max_threads() << " threads"); Settings::numThreads = omp_get_max_threads(); } #else Settings::numThreads = 1; LOG4CXX_INFO(rootLogger, "Running serial version!"); #endif #ifdef PAPI_BENCH for(int i=0; i < Settings::numThreads; i++) { char fileName[200]; sprintf(fileName, "CalcF #%i.txt", i); papiCalcFCounters[i] = new PapiEnv(fileName); sprintf(fileName, "CalcX #%i.txt", i); papiCalcXCounters[i] = new PapiEnv(fileName); } #endif //Check if we should be executing some unit tests if(!Settings::testCase.empty()) { return executeTests(); } LOG4CXX_TRACE(rootLogger, "Creating Simulator instance..."); Simulator *sim = new Simulator(); #ifndef NOGLVISUALIZER outputWriter::theSimulator = sim; #endif //Check if we should initialize with old state file if(Settings::inputFile.size() !=0){ std::cout << "state found"<<std::endl; } double current_time = Settings::startTime; int iteration = 0; int benchmarkStartTime = getMilliCount(); double timeForOneIteration = 0; // for this loop, we assume: current x, current f and current v are known int maxIterations = (Settings::endTime - Settings::startTime) / Settings::deltaT; int nextProgressBarDraw = 1; int iterationsPerPercent = (maxIterations/100) + 1; LOG4CXX_INFO(rootLogger, "Will calculate " << maxIterations << " iterations and output " << maxIterations/Settings::outputFrequency << " frames "); while (current_time < Settings::endTime) { if (iteration % Settings::outputFrequency == 0) { sim->plotParticles(iteration + Settings::outputFileIterationOffset); } sim->nextTimeStep(); iteration++; if(iteration == nextProgressBarDraw) { nextProgressBarDraw+=iterationsPerPercent; printProgressBar(100*iteration/maxIterations, -(benchmarkStartTime - getMilliCount())); } LOG4CXX_TRACE(rootLogger, "Iteration " << iteration << " finished."); current_time += Settings::deltaT; timeForOneIteration = ((double)(benchmarkStartTime - getMilliCount()))/iteration; #ifndef NOGLVISUALIZER while(outputWriter::renderingPaused) usleep(2000); #endif #ifdef PAPI_BENCH for(int i=0; i < Settings::numThreads; i++) { papiCalcFCounters[i]->printResults(); papiCalcXCounters[i]->printResults(); papiCalcFCounters[i]->reset(); papiCalcXCounters[i]->reset(); } #endif } int benchmarkEndTime = getMilliCount(); if(Settings::saveLastState) sim->exportPhaseSpace(); if(Settings::printStatistics) sim->exportStatistics(); LOG4CXX_INFO(rootLogger, "Simulation finished. Took " << (benchmarkEndTime - benchmarkStartTime)/1000.0 << " seconds"); delete sim; LOG4CXX_DEBUG(rootLogger, "Created " << Particle::createdInstances << " Particle instances (" << Particle::createdByCopy << " by copy)"); LOG4CXX_DEBUG(rootLogger, "Destroyed " << Particle::destroyedInstances << " Particle instances"); #ifdef PAPI_BENCH for(int i=0; i < Settings::numThreads; i++) { std::cout << "Writing PAPI output for thread " << i << std::endl; papiCalcFCounters[i]->createResultFile(); papiCalcXCounters[i]->createResultFile(); delete papiCalcFCounters[i]; delete papiCalcXCounters[i]; } #endif //10 is arbitrarily chosen. there will always be some stray particles because of //static instances that will be destroyed at program exit #ifndef NOGLVISUALIZER if(Particle::createdInstances - Particle::destroyedInstances - outputWriter::render3dParticles.size() > 10) { #else if(Particle::createdInstances - Particle::destroyedInstances > 10) { #endif LOG4CXX_WARN(rootLogger, "Significant mismatch between created and destroyed particle instances. This can be a memory leak! " << (Particle::createdInstances - Particle::destroyedInstances)); } LOG4CXX_DEBUG(rootLogger, "output written. Terminating..."); return 0; } int executeTests() { std::cout << "Running tests..." << std::endl; CppUnit::TextUi::TestRunner runner; bool all = !Settings::testCase.compare("all"); if(all || !Settings::testCase.compare("ParticleContainer")) runner.addTest(ParticleContainerTests::suite()); if(all || !Settings::testCase.compare("ParticleGenerator")) runner.addTest(ParticleGeneratorTests::suite()); // if(all || !Settings::testCase.compare("Settings")) // runner.addTest(SettingsXsdTest::suite()); if(all || !Settings::testCase.compare("Matrix")) runner.addTest(MatrixTests::suite()); runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(), std::cerr ) ); // Run the tests. bool wasSuccessful = runner.run(); // Return error code 1 if the one of test failed. if(wasSuccessful) { std::cout << "Tests ok!" << std::endl; } else { std::cout << "Some tests failed!" << std::endl; } return wasSuccessful ? 0 : 1; }