• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ runner函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中runner函数的典型用法代码示例。如果您正苦于以下问题:C++ runner函数的具体用法?C++ runner怎么用?C++ runner使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了runner函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: memLeakWarn

int CommandLineTestRunner::RunAllTests(int ac, const char** av)
{
	int result = 0;
	ConsoleTestOutput output;

#ifndef DISABLE_MEMORYLEAK_PLUGIN
	MemoryLeakWarningPlugin memLeakWarn(DEF_PLUGIN_MEM_LEAK);
	//memLeakWarn.disable();
	TestRegistry::getCurrentRegistry()->installPlugin(&memLeakWarn);
#endif
	{
		CommandLineTestRunner runner(ac, av, &output);
		result = runner.runAllTestsMain();
	}

#ifndef DISABLE_MEMORYLEAK_PLUGIN
	if (result == 0) {
		output << memLeakWarn.FinalReport(0);
	}
#endif
	return result;
}
开发者ID:c444b774,项目名称:MediaTest,代码行数:22,代码来源:CommandLineTestRunner.cpp


示例2: test_container_mt_stop

void test_container_mt_stop() {
    test_mt_handler th;
    proton::container c(th);
    c.auto_stop(false);
    container_runner runner(c);
    auto t = std::thread(runner);
    // Must ensure that thread is joined or detached
    try {
        test_listen_handler lh;
        c.listen("//:0", lh);       //  Also opens a connection
        ASSERT_EQUAL("start", th.wait());
        ASSERT_EQUAL("open", th.wait());
        c.stop();
        t.join();
    } catch (...) {
        // We don't join as we don't know if we'll be stuck waiting
        if (t.joinable()) {
            t.detach();
        }
        throw;
    }
}
开发者ID:engineer-legion,项目名称:qpid-proton,代码行数:22,代码来源:container_test.cpp


示例3: socketServer

void socketServer(int ac, char **av)
{
    if(ac <= 1) {
        std::cout<<"server ipv4:127.0.0.1:5000"<<std::endl;
        return ;
    }

    bool can_continue(true);
    EventLoop::EpollRunner runner(EventLoop::SignalSet(SIGINT),
            [&can_continue](int sig)
            {
                if(sig == SIGINT) can_continue = false;
            });

    Thread::Server server(runner);
    server.NewListeningSocket(boost::lexical_cast<EventLoop::SocketAddress>(av[1]));

    runner.run([&can_continue]() { return can_continue;});

    std::cout<<"done"<<std::endl;
    return;
}
开发者ID:jixuquan,项目名称:source,代码行数:22,代码来源:main.cpp


示例4: main

// run all tests
int main(int argc, char **argv) {
	// change if you want to run only one test
	bool runAll = true;
	const char* suiteToRun = "Parser53TestClass";
	std::vector<const char*> testCasesToRun;
	//testCasesToRun.push_back("ScanFileShouldNotifyClassObserver");
	int ret = 0;
	if (runAll) {
		ret = UnitTest::RunAllTests();
	}
	else {
		UnitTest::TestReporterStdout reporter;
		UnitTest::TestRunner runner(reporter);
		SingleTestsPredicateClass pred(testCasesToRun);
		ret = runner.RunTestsIf(UnitTest::Test::GetTestList(), suiteToRun, pred, 0);
	}
	
	// calling cleanup here so that we can run this binary through a memory leak detector 
	// ICU will cache many things and that will cause the detector to output "possible leaks"
	u_cleanup();
	return ret;
}
开发者ID:robertop,项目名称:pelet,代码行数:23,代码来源:main.cpp


示例5: run

        virtual bool run(const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
            string coll = cmdObj[ "captrunc" ].valuestrsafe();
            uassert( 13416, "captrunc must specify a collection", !coll.empty() );
            NamespaceString nss( dbname, coll );
            int n = cmdObj.getIntField( "n" );
            bool inc = cmdObj.getBoolField( "inc" ); // inclusive range?

            Client::WriteContext ctx( nss.ns() );
            Collection* collection = ctx.ctx().db()->getCollection( nss.ns() );
            massert( 13417, "captrunc collection not found or empty", collection);

            boost::scoped_ptr<Runner> runner(InternalPlanner::collectionScan(nss.ns(),
                                                                             InternalPlanner::BACKWARD));
            DiskLoc end;
            // We remove 'n' elements so the start is one past that
            for( int i = 0; i < n + 1; ++i ) {
                Runner::RunnerState state = runner->getNext(NULL, &end);
                massert( 13418, "captrunc invalid n", Runner::RUNNER_ADVANCED == state);
            }
            collection->temp_cappedTruncateAfter( end, inc );
            return true;
        }
开发者ID:LearyLX,项目名称:mongo,代码行数:22,代码来源:test_commands.cpp


示例6: run

        void run() {
            Client::WriteContext ctx(&_txn, ns());
            
            Database* db = ctx.ctx().db();
            Collection* coll = db->getCollection(&_txn, ns());
            if (!coll) {
                coll = db->createCollection(&_txn, ns());
            }

            WorkingSet* ws = new WorkingSet();
            MockStage* ms = new MockStage(ws);

            for (int i = 0; i < numObj(); ++i) {
                WorkingSetMember member;
                member.state = WorkingSetMember::OWNED_OBJ;

                member.obj = fromjson("{a: [1,2,3], b:[1,2,3], c:[1,2,3], d:[1,2,3,4]}");
                ms->pushBack(member);

                member.obj = fromjson("{a:1, b:1, c:1}");
                ms->pushBack(member);
            }

            SortStageParams params;
            params.collection = coll;
            params.pattern = BSON("b" << -1 << "c" << 1 << "a" << 1);
            params.limit = 0;

            // We don't get results back since we're sorting some parallel arrays.
            PlanExecutor runner(ws,
                                new FetchStage(&_txn,
                                               ws,
                                               new SortStage(&_txn, params, ws, ms), NULL, coll),
                                coll);
            PlanExecutor::ExecState runnerState = runner.getNext(NULL, NULL);
            ASSERT_EQUALS(PlanExecutor::EXEC_ERROR, runnerState);
            ctx.commit();
        }
开发者ID:leonidbl91,项目名称:mongo,代码行数:38,代码来源:query_stage_sort.cpp


示例7: sortAndCheck

        /**
         * A template used by many tests below.
         * Fill out numObj objects, sort them in the order provided by 'direction'.
         * If extAllowed is true, sorting will use use external sorting if available.
         * If limit is not zero, we limit the output of the sort stage to 'limit' results.
         */
        void sortAndCheck(int direction, Collection* coll) {
            WorkingSet* ws = new WorkingSet();
            MockStage* ms = new MockStage(ws);

            // Insert a mix of the various types of data.
            insertVarietyOfObjects(ms, coll);

            SortStageParams params;
            params.collection = coll;
            params.pattern = BSON("foo" << direction);
            params.limit = limit();

            // Must fetch so we can look at the doc as a BSONObj.
            PlanExecutor runner(ws,
                                new FetchStage(&_txn, ws,
                                               new SortStage(&_txn, params, ws, ms), NULL, coll),
                                coll);

            // Look at pairs of objects to make sure that the sort order is pairwise (and therefore
            // totally) correct.
            BSONObj last;
            ASSERT_EQUALS(PlanExecutor::ADVANCED, runner.getNext(&last, NULL));

            // Count 'last'.
            int count = 1;

            BSONObj current;
            while (PlanExecutor::ADVANCED == runner.getNext(&current, NULL)) {
                int cmp = sgn(current.woSortOrder(last, params.pattern));
                // The next object should be equal to the previous or oriented according to the sort
                // pattern.
                ASSERT(cmp == 0 || cmp == 1);
                ++count;
                last = current;
            }

            checkCount(count);
        }
开发者ID:leonidbl91,项目名称:mongo,代码行数:44,代码来源:query_stage_sort.cpp


示例8: run

        void run() {
            Client::ReadContext ctx(&_txn, ns());

            // Configure the scan.
            CollectionScanParams params;
            params.collection = ctx.ctx().db()->getCollection( &_txn, ns() );
            params.direction = CollectionScanParams::FORWARD;
            params.tailable = false;

            // Make a scan and have the runner own it.
            WorkingSet* ws = new WorkingSet();
            PlanStage* ps = new CollectionScan(&_txn, params, ws, NULL);
            PlanExecutor runner(ws, ps, params.collection);

            int count = 0;
            for (BSONObj obj; PlanExecutor::ADVANCED == runner.getNext(&obj, NULL); ) {
                // Make sure we get the objects in the order we want
                ASSERT_EQUALS(count, obj["foo"].numberInt());
                ++count;
            }

            ASSERT_EQUALS(numObj(), count);
        }
开发者ID:LKTInc,项目名称:mongo,代码行数:23,代码来源:query_stage_collscan.cpp


示例9: main

int main()
{
	return UnitTest::RunAllTests();
	
	try
    {
        UnitTest::TestReporterStdout reporter;
		UnitTest::TestRunner runner(reporter);
	
	
		return runner.RunTestsIf(
			UnitTest::Test::GetTestList(),
			"ParamTests",
			UnitTest::True(),
			0);
    }
    catch(std::exception const& e)
    {
         printf("%s", e.what());
         // If you are feeling mad (not in main) you could rethrow! 
    }
	
}
开发者ID:mbedded-ninja,项目名称:ClarkTransform-Cpp,代码行数:23,代码来源:main.cpp


示例10: ctx

    vector<BSONObj> Helpers::findAll( const string& ns , const BSONObj& query ) {
        Lock::assertAtLeastReadLocked(ns);
        Client::Context ctx(ns);

        CanonicalQuery* cq;
        uassert(17236, "Could not canonicalize " + query.toString(),
                CanonicalQuery::canonicalize(ns, query, &cq).isOK());

        Runner* rawRunner;
        uassert(17237, "Could not get runner for query " + query.toString(),
                getRunner(ctx.db()->getCollection( ns ), cq, &rawRunner).isOK());

        vector<BSONObj> all;

        auto_ptr<Runner> runner(rawRunner);
        Runner::RunnerState state;
        BSONObj obj;
        while (Runner::RUNNER_ADVANCED == (state = runner->getNext(&obj, NULL))) {
            all.push_back(obj);
        }

        return all;
    }
开发者ID:AshishThakur,项目名称:mongo,代码行数:23,代码来源:dbhelpers.cpp


示例11: DiskLoc

    /* fetch a single object from collection ns that matches query
       set your db SavedContext first
    */
    DiskLoc Helpers::findOne(Collection* collection, const BSONObj &query, bool requireIndex) {
        if ( !collection )
            return DiskLoc();

        CanonicalQuery* cq;
        const WhereCallbackReal whereCallback(collection->ns().db());

        massert(17244, "Could not canonicalize " + query.toString(),
            CanonicalQuery::canonicalize(collection->ns(), query, &cq, whereCallback).isOK());

        Runner* rawRunner;
        size_t options = requireIndex ? QueryPlannerParams::NO_TABLE_SCAN : QueryPlannerParams::DEFAULT;
        massert(17245, "Could not get runner for query " + query.toString(),
                getRunner(collection, cq, &rawRunner, options).isOK());

        auto_ptr<Runner> runner(rawRunner);
        Runner::RunnerState state;
        DiskLoc loc;
        if (Runner::RUNNER_ADVANCED == (state = runner->getNext(NULL, &loc))) {
            return loc;
        }
        return DiskLoc();
    }
开发者ID:vigneshncc,项目名称:mongo,代码行数:26,代码来源:dbhelpers.cpp


示例12: cmdLine

void WinTestRunner::run()
{
	// Note: The following code is some evil hack to
	// add batch capability to the MFC based WinTestRunner.
	
	std::string cmdLine(AfxGetApp()->m_lpCmdLine);
	if (cmdLine.size() >= 2 && cmdLine[0] == '/' && (cmdLine[1] == 'b' || cmdLine[1] == 'B'))
	{
		// We're running in batch mode.
		std::string outPath;
		if (cmdLine.size() > 4 && cmdLine[2] == ':')
			outPath = cmdLine.substr(3);
		else
			outPath = "CON";
		std::ofstream ostr(outPath.c_str());
		if (ostr.good())
		{
			TestRunner runner(ostr);
			for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it)
				runner.addTest((*it)->toString(), *it);
			_tests.clear();
			std::vector<std::string> args;
			args.push_back("WinTestRunner");
			args.push_back("-all");
			bool success = runner.run(args);
			ExitProcess(success ? 0 : 1);
		}
		else ExitProcess(2);
	}
	else
	{
		// We're running in interactive mode.
		TestRunnerDlg dlg;
		dlg.setTests(_tests);
		dlg.DoModal();
	}
}
开发者ID:119,项目名称:vdc,代码行数:37,代码来源:WinTestRunner.cpp


示例13: getOplogStartHack

    Status getOplogStartHack(CanonicalQuery* cq, Runner** runnerOut) {
        // Make an oplog start finding stage.
        WorkingSet* oplogws = new WorkingSet();
        OplogStart* stage = new OplogStart(cq->ns(), cq->root(), oplogws);

        // Takes ownership of ws and stage.
        auto_ptr<InternalRunner> runner(new InternalRunner(cq->ns(), stage, oplogws));
        runner->setYieldPolicy(Runner::YIELD_AUTO);

        // The stage returns a DiskLoc of where to start.
        DiskLoc startLoc;
        Runner::RunnerState state = runner->getNext(NULL, &startLoc);

        // This is normal.  The start of the oplog is the beginning of the collection.
        if (Runner::RUNNER_EOF == state) { return getRunner(cq, runnerOut); }

        // This is not normal.  An error was encountered.
        if (Runner::RUNNER_ADVANCED != state) {
            return Status(ErrorCodes::InternalError,
                          "quick oplog start location had error...?");
        }

        // cout << "diskloc is " << startLoc.toString() << endl;

        // Build our collection scan...
        CollectionScanParams params;
        params.ns = cq->ns();
        params.start = startLoc;
        params.direction = CollectionScanParams::FORWARD;
        params.tailable = cq->getParsed().hasOption(QueryOption_CursorTailable);

        WorkingSet* ws = new WorkingSet();
        CollectionScan* cs = new CollectionScan(params, ws, cq->root());
        // Takes ownership of cq, cs, ws.
        *runnerOut = new SingleSolutionRunner(cq, NULL, cs, ws);
        return Status::OK();
    }
开发者ID:carlzhangxuan,项目名称:mongo,代码行数:37,代码来源:new_find.cpp


示例14: main

int
main(int argc, char *argv[])
{
    if (argc < 2)
    {
        CopyRight(stderr, argv[0]);
        GMX_ERROR(gmx::eeInvalidInput,
                  "Not enough command-line arguments");
    }

    std::auto_ptr<gmx::TrajectoryAnalysisModule>
    mod(gmx::createTrajectoryAnalysisModule(argv[1]));
    if (mod.get() == NULL)
    {
        CopyRight(stderr, argv[0]);
        GMX_ERROR(gmx::eeInvalidInput,
                  "Unknown analysis module given as the first command-line argument");
    }
    --argc;
    ++argv;

    gmx::TrajectoryAnalysisCommandLineRunner runner(mod.get());
    return runner.run(argc, argv);
}
开发者ID:aeszter,项目名称:gromacs,代码行数:24,代码来源:g_ana.cpp


示例15: main

int main(int argc, char* argv[]) {

	// 根据命令行参数加载配置文件等处理过程
	Utils::loadCommandLine(argc, argv);

	// 工作模式配置为 执行轨迹跟踪
	if (CFG_sModeExecute == "track") {
		TrackRunner runner(CFG_iImageLoadBegin, CFG_iImageLoadEnd);

		runner.initFirstFrame();
		int cnt = 0;
		while (runner.hasNext()) {

			int idxImgCur = runner.runKeyStep();
			
			cnt++;
		}
		runner.lm();
		cv::waitKey();

	}
	// 工作模式配置为 并行批量特征预处理
	else if (CFG_sModeExecute == "feature") {
#pragma omp parallel for
		for (int idx = CFG_iImageLoadBegin; idx <= CFG_iImageLoadEnd; idx++) {
			
			FeatureState fs(idx);
			fs.detect(CFG_iMaxFeatures);
			printf("FeatureDetect[%d]-\n",idx);
		}
	
	}

	getchar();
	return 0;
}
开发者ID:SenYu,项目名称:SLAMTracker,代码行数:36,代码来源:MainProgram.cpp


示例16: main

int main(int ac, const char** av)
{
#ifdef INCLUDE_GTEST_TESTS
    GTestConvertor convertor;
    convertor.addAllGTestToTestRegistry();
#endif

    MemoryReporterPlugin plugin;
    MockSupportPlugin mockPlugin;
    TestRegistry::getCurrentRegistry()->installPlugin(&plugin);
    TestRegistry::getCurrentRegistry()->installPlugin(&mockPlugin);

#ifndef GMOCK_RENAME_MAIN
    return CommandLineTestRunner::RunAllTests(ac, av);
#else
    /* Don't have any memory leak detector when running the Google Test tests */

    testing::GMOCK_FLAG(verbose) = testing::internal::kWarningVerbosity;

    ConsoleTestOutput output;
    CommandLineTestRunner runner(ac, av, &output, TestRegistry::getCurrentRegistry());
    return runner.runAllTestsMain();
#endif
}
开发者ID:hajmf,项目名称:cpputest,代码行数:24,代码来源:AllTests.cpp


示例17: main

int main()
{
	sce::Sled::Assert::setAssertHandler(FailTestOnAssertHandler);
	sce::Sled::Logging::setLogHandler(FailTestOnLogErrorHandler);

	sce::Sled::ScopedNetwork sn;
	if (!sn.IsValid())
		UnitTest::ReportAssert("Networking failed!", __FILE__, __LINE__);

#ifdef UNITTEST_XML_NAME
#define UNITTEST_DIRECT_TO_STRING(arg) #arg
#define UNITTEST_INDIRECT_TO_STRING(arg) UNITTEST_DIRECT_TO_STRING(arg)

	UnitTest::TestReporterStdout stdoutReporter;

	UnitTest::CompositeTestReporter reporter;
    reporter.AddReporter(&stdoutReporter);

	UnitTest::TestRunner runner(reporter);
	return runner.RunTestsIf(UnitTest::Test::GetTestList(), NULL, UnitTest::True(), 0);
#else
    #error "UNITTEST_XML_NAME must be defined and set to the basename of the executable."
#endif
}
开发者ID:arsaccol,项目名称:SLED,代码行数:24,代码来源:main.cpp


示例18: main

int main(int argc, const char* argv[])
{
	Game g;

	ifstream cfgfile("monopoly.cfg");

	g.load(cfgfile);

	cfgfile.close();

	cout << "Game is loaded and ready to start!!!" << endl;

	cin.ignore();

	GameRunner runner(g, 20);					// run for 10 rolls!

	runner.runGame();
	
	cout << "Game is finished!!!" << endl;

	cin.ignore();

	return 0;
}
开发者ID:lasttruffulaseed,项目名称:general-cs-fun,代码行数:24,代码来源:MonopolySimulator.cpp


示例19: BMessageRunner

/*
	BMessageRunner(BMessenger target, const BMessage *message,
				   bigtime_t interval, int32 count, BMessenger replyTo)
	@case 5			target is valid, message is valid,
					interval == LONGLONG_MAX, count > 0
	@results		InitCheck() should return B_OK.
					GetInfo() should return B_OK.
					No message should be delivered.
 */
void TBMessageRunnerTester::BMessageRunnerB5()
{
// R5: doesn't behave very well. In worst case registrar time loop gets
// locked up and system wide message runners don't get messages anymore.
#ifndef TEST_R5
	MessageRunnerTestApp app(kTesterSignature);
	MessageRunnerTestLooper *looper = app.TestLooper();
	BMessenger target(looper);
	BMessage message(MSG_RUNNER_MESSAGE);
	bigtime_t interval = LONGLONG_MAX;
	int32 count = 5;
	MessageRunnerTestHandler *handler = app.TestHandler();
	BMessenger replyTo(handler);
	BMessageRunner runner(target, &message, interval, count, replyTo);
	bigtime_t startTime = system_time();
	CHK(runner.InitCheck() == B_OK);
	interval = max(interval, kMinTimeInterval);
	check_message_runner_info(runner, B_OK, interval, count);
	snooze(10000);
	CHK(looper->CheckMessages(startTime, interval, 0));
	CHK(app.CountReplies() == 0);
	CHK(handler->CountReplies() == 0);
#endif
}
开发者ID:mariuz,项目名称:haiku,代码行数:33,代码来源:BMessageRunnerTester.cpp


示例20: GetAppList

/*
	void GetAppList(const char *signature, BList *teamIDList) const
	@case 1			signature or teamIDList are NULL
	@results		Should do nothing/should not modify teamIDList.
*/
void GetAppListTester::GetAppListTestB1()
{
// R5: crashes when passing a NULL signature/BList
#ifndef TEST_R5
	const char *signature = "application/x-vnd.obos-app-run-testapp1";
	// create a list with some dummy entries
	BList emptyList;
	BList list;
	list.AddItem((void*)-7);
	list.AddItem((void*)-42);
	// NULL signature and list
	BRoster roster;
	roster.GetAppList(NULL, NULL);
	// NULL signature
	BList list1(list);
	roster.GetAppList(NULL, &list1);
	check_list(list1, list, list, emptyList);
	// NULL list
	AppRunner runner(true);
	CHK(runner.Run("AppRunTestApp1") == B_OK);
	roster.GetAppList(signature, NULL);
	runner.WaitFor(true);
#endif
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:29,代码来源:GetAppListTester.cpp



注:本文中的runner函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ running函数代码示例发布时间:2022-05-30
下一篇:
C++ runloop_msg_queue_push函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap