static bool run(TestRunner& tr) { if(tr.isTestEnabled("fixme")) { // load and start node Node* node = Tester::loadNode(tr, "test-services-customcatalog"); assertNoException( node->start()); Config cfg = tr.getApp()->getConfig(); sTestDataDir = cfg["test"]["dataPath"]->getString(); //config["node"]["modulePath"] = append BPE_MODULES_DIRECTORY; //config["bitmunk.catalog.CustomCatalog"]["uploadListings"] = false; // run tests customCatalogTests(*node, tr); // stop and unload node node->stop(); Tester::unloadNode(tr); } if(tr.isTestEnabled("fixme")) { // load and start node Node* node = Tester::loadNode(tr, "test-services-customcatalog"); assertNoException( node->start()); Config cfg = tr.getApp()->getConfig(); sTestDataDir = cfg["test"]["dataPath"]->getString(); //config["node"]["modulePath"] = BPE_MODULES_DIRECTORY; //config["bitmunk.catalog.CustomCatalog"]["uploadListings"] = true; // run tests interactiveCustomCatalogTests(*node, tr); // stop and unload node node->stop(); Tester::unloadNode(tr); } return true; };
static bool run(TestRunner& tr) { if(tr.isTestEnabled("pong")) { runPingTest(tr); } return true; }
static bool run(TestRunner& tr) { if(tr.isTestEnabled("ws-server")) { runWebServerTest(tr); } return true; }
static bool run(TestRunner& tr) { if(tr.isDefaultEnabled()) { runNodeMonitorTest(tr); } return true; }
static bool run(TestRunner& tr) { if(tr.isDefaultEnabled()) { runConfigManagerTest(tr); } return true; }
static bool run(TestRunner& tr) { if(tr.isTestEnabled("fiber-yield")) { runFiberYieldTest(tr); } return true; }
static bool run(TestRunner& tr) { if(tr.isDefaultEnabled()) { runHttpHeaderTest(tr); runHttpNormalizePath(tr); runCookieTest(tr); } if(tr.isTestEnabled("http-server")) { runHttpServerTest(tr); } if(tr.isTestEnabled("http-pong")) { runHttpPongTest(tr); } if(tr.isTestEnabled("http-client-get")) { runHttpClientGetTest(tr); } if(tr.isTestEnabled("http-client-redirect-loop")) { runHttpClientRedirectLoopTest(tr); } if(tr.isTestEnabled("http-client-post")) { runHttpClientPostTest(tr); } if(tr.isTestEnabled("ping")) { runPingTest(tr); } return true; }
int main (int argc , char** argv) { std::ofstream xml("./cppUnit_output.xml",ios::app); CppUnit::TestResult controller; CppUnit::TestResultCollector result; controller.addListener( &result ); TestRunner runner; runner.addTest(Manipulation_test::suite()); runner.run(controller); CppUnit::XmlOutputter outputter( &result, xml ); CppUnit::TextOutputter outputter2( &result, std::cerr ); outputter.write(); outputter2.write(); return result.wasSuccessful() ? 0 : 1 ; }
int main( int, char *argv[] ) { using namespace Aeryn; int result = -1; try { TestRunner testRunner; CommandLineParser commandLineParser( argv ); result = testRunner.Run( commandLineParser ); } catch( const Exception& e ) { std::cout << e.what() << std::endl; } return result; }
virtual void run() { TestResultCollector collector; // create a test result and add the listeners TestResult result; result.addListener(&collector); // create a test runner TestRunner runner; MyTest test1; MyTest2 test2; runner.addTest(&test1); runner.addTest(&test2); runner.run(result); //RTF_TEST_REPORT(Asserter::format("count: %d", collector.failedCount())); RTF_TEST_CHECK(collector.testCount() == 2, "Checking tests count"); RTF_TEST_CHECK(collector.passedCount() == 1, "Checking passed count"); RTF_TEST_CHECK(collector.failedCount() == 1, "Checking failed count"); }
/* * Run the test suite, return 0 on success, 1 on error. */ int main(void) { TestResult controller; TestResultCollector result; controller.addListener(&result); BriefTestProgressListener progress; controller.addListener(&progress); TestRunner runner; runner.addTest( TestFactoryRegistry::getRegistry().makeTest() ); runner.run(controller); CompilerOutputter outputter(&result, std::cerr); outputter.write(); return result.wasSuccessful() ? 0 : 1; }
/*! Runs the named test case. * * \param testName Name of the test case to run. If an empty is given, then * all added tests are run. The name can be the name of any * test in the hierarchy. * \param doWait if \c true then the user must press the RETURN key * before the run() method exit. * \param doPrintResult if \c true (default) then the test result are printed * on the standard output. * \param doPrintProgress if \c true (default) then TextTestProgressListener is * used to show the progress. * \return \c true is the test was successful, \c false if the test * failed or was not found. */ bool TextTestRunner::run( std::string testName, bool doWait, bool doPrintResult, bool doPrintProgress ) { TextTestProgressListener progress; if ( doPrintProgress ) m_eventManager->addListener( &progress ); TestRunner *pThis = this; pThis->run( *m_eventManager, testName ); if ( doPrintProgress ) m_eventManager->removeListener( &progress ); printResult( doPrintResult ); wait( doWait ); return m_result->wasSuccessful(); }
static void contributorGetTest(Node& node, TestRunner& tr) { tr.group("contributors"); Messenger* messenger = node.getMessenger(); tr.test("id"); { Url url("/api/3.0/contributors/1"); // get contributor DynamicObject contributor; assertNoException( messenger->getFromBitmunk(&url, contributor)); printf("\nContributor:\n"); dumpDynamicObject(contributor, false); } tr.passIfNoException(); tr.test("owner"); { Url url("/api/3.0/contributors/?owner=900"); // get contributor DynamicObject contributors; assertNoException( messenger->getFromBitmunk(&url, contributors)); printf("\nContributors:\n"); dumpDynamicObject(contributors, false); } tr.passIfNoException(); tr.test("media"); { Url url("/api/3.0/contributors/?media=1"); // get contributor DynamicObject contributors; assertNoException( messenger->getFromBitmunk(&url, contributors)); printf("\nContributors:\n"); dumpDynamicObject(contributors, false); } tr.passIfNoException(); tr.ungroup(); }
static void encodeFound(TestState& state) { if (verbose()) { if (state.fPixelWorst.count()) { SkTDArray<SortByPixel*> worst; for (int index = 0; index < state.fPixelWorst.count(); ++index) { *worst.append() = &state.fPixelWorst[index]; } SkTQSort<SortByPixel>(worst.begin(), worst.end() - 1); for (int index = 0; index < state.fPixelWorst.count(); ++index) { const TestResult& result = *worst[index]; SkDebugf("%d %s pixelError=%d\n", result.fDirNo, result.fFilename, result.fPixelError); } } if (state.fSlowest.count()) { SkTDArray<SortByTime*> slowest; for (int index = 0; index < state.fSlowest.count(); ++index) { *slowest.append() = &state.fSlowest[index]; } if (slowest.count() > 0) { SkTQSort<SortByTime>(slowest.begin(), slowest.end() - 1); for (int index = 0; index < slowest.count(); ++index) { const TestResult& result = *slowest[index]; SkDebugf("%d %s time=%d\n", result.fDirNo, result.fFilename, result.fTime); } } } } TestRunner testRunner; for (int index = 0; index < state.fPixelWorst.count(); ++index) { const TestResult& result = state.fPixelWorst[index]; SkString filename(result.fFilename); if (!filename.endsWith(".skp")) { filename.append(".skp"); } *testRunner.fRunnables.append() = new TestRunnableEncode(&testSkpClipEncode, result.fDirNo, filename.c_str(), &testRunner); } testRunner.render(); }
int main(int argc,char** argv) { Globals::instance().setDebugMode(true); Globals::instance().initLog("ktutester.log"); TestRunner tr; tr.addTest(new UPnPParseDescriptionTest()); tr.addTest(new UPnPParseResponseTest()); tr.addTest(new DHTMsgParseTest()); tr.addTest(new BigIntTest()); tr.addTest(new RC4Test()); tr.addTest(new DiffleHellmanTest()); tr.doAllTests(); Globals::cleanup(); return 0; }
void addtexttest(TestRunner& runner) { runner.add("text/setup", {"func"}, &setup_test); runner.add("text/learning", {"func"}, &learning_test); runner.add("text/predicting", {"func"}, &predicting_test); runner.add("text/genpred", {"func"}, &genpred_test); runner.add("text/genpredeval", {"func"}, &genpredeval_test); runner.add("text/code", {"func"}, &code_test); }
int main() { ConnectionType type; QString address = "127.0.0.1::5025"; #ifdef Q_OS_WIN type = ConnectionType::VisaTcpSocketConnection; #else type = ConnectionType::TcpSocketConnection; #endif TestRunner testRunner; // testRunner.addTest(new UnitsTest); testRunner.addTest(new VnaChannelTest (type, address)); // testRunner.addTest(new VnaArbitraryFrequencyTest(type, address)); // testRunner.addTest(new VnaIntermodTest (type, address)); // testRunner.addTest(new VnaSweepTest (type, address)); // testRunner.addTest(new VnaCalibrateTest (type, address)); // testRunner.addTest(new VnaPauseSweepsTest (type, address)); // testRunner.addTest(new VnaTraceTest (type, address)); qDebug() << "Global result: " << (testRunner.runTests() ? "PASS" : "FAIL"); return 0; }
static void permissionGetTest(Node& node, TestRunner& tr) { tr.group("permissions"); Messenger* messenger = node.getMessenger(); tr.test("group get"); { // create url for obtaining permission group information Url url("/api/3.0/permissions/100"); // get permission group PermissionGroup group; assertNoException( messenger->getFromBitmunk(&url, group)); printf("\nGroup:\n"); dumpDynamicObject(group, false); } tr.passIfNoException(); tr.ungroup(); }
int main(int argc, char** argv) { TestResult testresult; TestResultCollector collectedresults; BriefTestProgressListener progress; testresult.addListener(&collectedresults); testresult.addListener(&progress); TestRunner testrunner; testrunner.addTest (TestFactoryRegistry::getRegistry().makeTest()); testrunner.run(testresult); CompilerOutputter compileroutputter(&collectedresults, std::cerr); compileroutputter.write(); // Output XML for Jenkins CPPunit plugin /*ofstream xmlFileOut("cppTestBasicMathResults.xml"); XmlOutputter xmlOut(&collectedresults, xmlFileOut); xmlOut.write();*/ return collectedresults.wasSuccessful() ? 0 : 1; }
int main(int argc, char **argv) { TestResult controller; TestResultCollector result; controller.addListener(&result); BriefTestProgressListener progress; controller.addListener(&progress); TestRunner runner; runner.addTest(TestFactoryRegistry::getRegistry().makeTest()); runner.run(controller); // compiler output CompilerOutputter coutputter(&result, stdCOut()); coutputter.write(); // output test result for jenkins std::ofstream ofs("test_result.xml"); CPPUNIT_NS::XmlOutputter outputter(&result, ofs,"UTF-8"); outputter.write(); return result.wasSuccessful() ? 0 : 1; }
static void runDynoIterTest(TestRunner& tr) { tr.group("DynamicObject iter perf"); bool all = false; Config cfg = tr.getApp()->getConfig(); if(cfg->hasMember("all")) { all = cfg["all"]->getBoolean(); } if(all) { //runDynoIterTest1(tr, "array s:10M i:1 ", 10000000, 1); runDynoIterTest1(tr, "array s:1M i:1 ", 1000000, 1); runDynoIterTest1(tr, "array s:1M i:2 ", 1000000, 2); runDynoIterTest1(tr, "array s:1M i:5 ", 1000000, 5); runDynoIterTest1(tr, "array s:1M i:10 ", 1000000, 10); } runDynoIterTest1(tr, "array s:100K i:100 ", 100000, 100); runDynoIterTest1(tr, "array s:10K i:1K ", 10000, 1000); runDynoIterTest1(tr, "array s:1K i:10K ", 1000, 10000); runDynoIterTest1(tr, "array s:100 i:100K ", 100, 100000); runDynoIterTest1(tr, "array s:10 i:1M ", 10, 1000000); if(all) { runDynoIterTest1(tr, "array s:5 i:1M ", 5, 1000000); runDynoIterTest1(tr, "array s:2 i:1M ", 2, 1000000); runDynoIterTest1(tr, "array s:1 i:1M ", 1, 1000000); runDynoIterTest1(tr, "array s:0 i:1M ", 0, 1000000); //runDynoIterTest1(tr, "array s:5 i:2M ", 5, 2000000); //runDynoIterTest1(tr, "array s:2 i:5M ", 2, 5000000); //runDynoIterTest1(tr, "array s:1 i:10M ", 1, 10000000); } tr.ungroup(); }
static void acquireLicenseTest(Node& node, TestRunner& tr) { tr.group("media license"); Messenger* messenger = node.getMessenger(); tr.test("acquire signed media"); { // create url for obtaining media license Url url("/api/3.0/sva/contracts/media/2"); // get signed media Media media; assertNoException( messenger->postSecureToBitmunk( &url, NULL, &media, node.getDefaultUserId())); printf("\nSigned Media:\n"); dumpDynamicObject(media, false); } tr.passIfNoException(); tr.ungroup(); }
std::wstring ArgumentBuilder::BuildPublicArgs(TestRunner& runner, int logLevel, unsigned options) { std::wostringstream args; args << L"--log_level=" << GetLogLevelArg(logLevel); if (options & ExeRunner::Randomize) args << L" --random=1"; if (options & ExeRunner::Repeat) options &= ~ExeRunner::WaitForDebugger; // Cannot enable disabled test cases: GetEnableArg2 getArg; runner.TraverseTestTree(getArg); args << L" --run_test=" << getArg.GetArg(); return args.str(); }
void addoptdigitstest(TestRunner& runner) { runner.add("optdigits/byexps", {"real"}, &byexps_test); runner.add("optdigits/big", {"real"}, &big_test); runner.add("optdigits/measure", {"func"}, &measure_test); runner.add("optdigits/visuals", {"func"}, &visuals_test); runner.add("optdigits/predict", {"func"}, &predict_test); runner.add("optdigits/detailedpredict", {"func"}, &detailedpredict_test); runner.add("optdigits/learning", {"func"}, &learning_test); runner.add("optdigits/setup", {"func"}, &setup_test); // big_test(ok); /* measure_test(ok); visuals_test(ok); predict_test(ok); learning_test(ok); setup_test(ok);*/ }
void runTests() { TestRunner runner; // Bayesian Node Tests runner.runTest("Can Sample Node", canSample); runner.runTest("Can Average Node Value", canAverage); runner.runTest("Can Marginalize Node", canMarginalizeNode); runner.runTest("Can obtain Markov Blanket of Node", canMarkovBlanket); // Bayesian Network Tests runner.runTest("Can Sample Network", canSampleNetwork); runner.runTest("Can Marginalize Network", canMarginalizeNetwork); ostringstream oss; for (int i = 100; i < 1000; i += 100) { oss << "Marginalization of Bayesian Network of Size (" << i << ")"; for (int j = 8; j <= 64; j *= 2) runner.runTest(oss.str(), bind(run, i, j)); oss.str(""); } runner.runTests(); }
static bool run(TestRunner& tr) { if(tr.isTestEnabled("login-required")) { // load bitmunk node Node* node = Tester::loadNode(tr); assertNoException( node->start()); // run config test runConfigTest(*node, tr); // unload bitmunk node node->stop(); Tester::unloadNode(tr); assertNoExceptionSet(); } return true; }
static void accountGetTest(Node& node, TestRunner& tr) { tr.group("accounts"); Messenger* messenger = node.getMessenger(); tr.test("get"); { Url url("/api/3.0/accounts/?owner=900"); // get all accounts User user; messenger->getSecureFromBitmunk(&url, user, node.getDefaultUserId()); printf("\nAccounts:\n"); dumpDynamicObject(user); } tr.passIfNoException(); tr.ungroup(); tr.group("account"); tr.test("get"); { // create url for obtaining users Url url("/api/3.0/accounts/9000"); // get account Account account; assertNoException( messenger->getSecureFromBitmunk( &url, account, node.getDefaultUserId())); printf("\nAccount:\n"); dumpDynamicObject(account, false); } tr.passIfNoException(); tr.ungroup(); }
int main(int argc, char** argv) { TestRunner r; // Load up all our test suites r.addTest("judo", judo::GlobalsTest::getTestSuite()); r.addTest("judo::CDATA", judo::CDATATest::getTestSuite()); r.addTest("judo::Element", judo::ElementTest::getTestSuite()); r.addTest("judo::ElementStream", judo::ElementStreamTest::getTestSuite()); // Start processing r.run(argc, argv); return 0; }
void TestGeneticScheduleGenerator::preTest(bool isPass) { TestRunner* instance; // Test the ProfInfo class here instance = new TestProfInfo(); isPass ? instance->runPassTests() : instance->runFailTests(); delete instance; // Test the ScoreCalculator classes here instance = new TestScoreCalculators(); isPass ? instance->runPassTests() : instance->runFailTests(); delete instance; // Test the ScheduleCalculator class here instance = new TestScheduleCalculator(); isPass ? instance->runPassTests() : instance->runFailTests(); delete instance; }
static void pingPerfTest(Node& node, TestRunner& tr) { tr.group("ping perf"); Messenger* messenger = node.getMessenger(); // number of loops for each test Config cfg = tr.getApp()->getConfig(); //node.getConfigManager()->getConfig( // tester->getApp()->getMetaConfig()["groups"]["main"]->getString()); int n = cfg->hasMember("loops") ? cfg["loops"]->getInt32() : 50; tr.test("insecure get"); { Url url("/api/3.0/system/test/ping"); DynamicObject dummy; uint64_t startTime = Timer::startTiming(); for(int i = 0; i < n; ++i) { messenger->getFromBitmunk(&url, dummy); } double dt = Timer::getSeconds(startTime); printf("t=%g ms, r=%g ms, r/s=%g", dt * 1000.0, dt/n * 1000.0, n/dt); } tr.passIfNoException(); tr.test("secure get"); { Url url("/api/3.0/system/test/ping"); DynamicObject dummy; uint64_t startTime = Timer::startTiming(); for(int i = 0; i < n; ++i) { messenger->getSecureFromBitmunk(&url, dummy, node.getDefaultUserId()); } double dt = Timer::getSeconds(startTime); printf("t=%g ms, r=%g ms, r/s=%g", dt * 1000.0, dt/n * 1000.0, n/dt); } tr.passIfNoException(); tr.ungroup(); }