当前位置: 首页>>代码示例>>C++>>正文


C++ runner函数代码示例

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


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


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