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

C++ TestList类代码示例

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

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



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

示例1: createDummies

 TestList
 createDummies ()
   {
     TestList list;
     list.push_back (DD<1>());
     list.push_back (DD<3>());
     list.push_back (DD<5>());
     list.push_back (DD<7>());
     return list;
   } //note: copy
开发者ID:Ichthyostega,项目名称:Lumiera,代码行数:10,代码来源:opaque-holder-test.cpp


示例2: createOpaqueValues

 TestList
 createOpaqueValues ()
   {
     TestList list;
     list.push_back (PolyVal::build<Imp<1>>  () );
     list.push_back (PolyVal::build<Imp<11>> () );
     list.push_back (PolyVal::build<Imp<111>>() );
     list.push_back (PolyVal::build<Imp<23>> () );
     list.push_back (PolyVal::build<Imp<5>>  () );
     return list;
   } //note: copy
开发者ID:Ichthyostega,项目名称:Lumiera,代码行数:11,代码来源:polymorphic-value-test.cpp


示例3: errors

ErrorMap TestRunner::errors() const
{
    ErrorMap errors;
    TestList tests = this->tests();
    for (auto it = tests.begin(); it != tests.end(); ++it) {
        if (!(*it)->passed()) {
            errors[(*it)] = (*it)->errors;
        }
    }
    return errors;
}
开发者ID:sourcey,项目名称:libsourcey,代码行数:11,代码来源:test.cpp


示例4: selectStartupTests

UnitTests::TestList UnitTests::selectStartupTests (TestList const& tests) const noexcept
{
    TestList list;
    for (int i = 0; i < tests.size(); ++i)
    {
        UnitTest* const test = tests [i];
        if (test->getWhen () == UnitTest::runStartup)
            list.add (test);
    }
    return list;
}
开发者ID:DaiLiRong,项目名称:rippled,代码行数:11,代码来源:UnitTest.cpp


示例5: operator

 void operator()( TestList& list ) const
 {
     list.sort();
     
     gTestController.CancelFailureCountdown();
     
     for ( TestList::iterator p = list.begin(); p != list.end(); p++ )
         if ( p != list.begin() ) {
             TestList::iterator tmp=p;
             --tmp;
             EH_ASSERT( *p >= *tmp );
         }
 }
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:13,代码来源:test_list.cpp


示例6: selectPackage

UnitTests::TestList UnitTests::selectPackage (
    String const& package, TestList const& tests) const noexcept
{
    TestList list;
    list.ensureStorageAllocated (tests.size ());
    for (int i = 0; i < tests.size(); ++i)
    {
        UnitTest* const test = tests [i];
        if (package.equalsIgnoreCase (test->getPackageName ()) &&
            test->getWhen () != UnitTest::runManual)
            list.add (test);
    }
    return list;
}
开发者ID:DaiLiRong,项目名称:rippled,代码行数:14,代码来源:UnitTest.cpp


示例7: selectTest

UnitTests::TestList UnitTests::selectTest (
    String const& testname, TestList const& tests) const noexcept
{
    TestList list;
    for (int i = 0; i < tests.size(); ++i)
    {
        UnitTest* const test = tests [i];
        if (testname.equalsIgnoreCase (test->getClassName ()))
        {
            list.add (test);
            break;
        }
    }
    return list;
}
开发者ID:DaiLiRong,项目名称:rippled,代码行数:15,代码来源:UnitTest.cpp


示例8: RunAllTests

int RunAllTests(TestReporter& reporter, TestList const& list, int const maxTestTimeInMs )
{
    TestResults result(&reporter);

    Timer overallTimer;
    overallTimer.Start();

    Test const* curTest = list.GetHead();
    while (curTest != 0)
    {
        Timer testTimer;
        testTimer.Start();
        result.OnTestStart(curTest->m_testName);

        curTest->Run(result);

        int const testTimeInMs = testTimer.GetTimeInMs();
        if (maxTestTimeInMs > 0 && testTimeInMs > maxTestTimeInMs)
        {
            MemoryOutStream stream;
            stream << "Global time constraint failed. Expected under " << maxTestTimeInMs <<
                      "ms but took " << testTimeInMs << "ms.";
            result.OnTestFailure(curTest->m_filename, curTest->m_lineNumber,
                                 curTest->m_testName, stream.GetText());
        }
        result.OnTestFinish(curTest->m_testName, testTimeInMs/1000.0f);

        curTest = curTest->next;
    }

    float const secondsElapsed = overallTimer.GetTimeInMs() / 1000.0f;
    reporter.ReportSummary(result.GetTestCount(), result.GetFailureCount(), secondsElapsed);

    return result.GetFailureCount();
}
开发者ID:mentaldease,项目名称:bastionlandscape,代码行数:35,代码来源:TestRunner.cpp


示例9: defined

ListAdder::ListAdder(TestList& list, Test* test, ...)
{
    char * arg;
    va_list argList;
    va_start(argList, test);
    for(arg = va_arg(argList, char*); arg != nullptr; arg = va_arg(argList, char*))
    {
        char * key = arg;
        arg = va_arg(argList, char*);
        if(arg != nullptr)
        {
            char *value = arg;
            test->m_properties.Add(key, value);
        }
    }
    va_end(argList);

    // If on windows we could be either desktop or winrt. Make a requires property for the correct version.
    // Only a desktop runner environment can execute a desktop test case and vice versa on winrt.
    // This starts with visual studio versions after VS 2012.
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
#ifdef __cplusplus_winrt
    test->m_properties.Add("Requires", "winrt");
#else
    test->m_properties.Add("Requires", "desktop");
#endif
#endif

    list.Add(test);
}
开发者ID:tapvanvn,项目名称:odatacpp-client,代码行数:30,代码来源:TestList.cpp


示例10: selectTests

UnitTests::TestList UnitTests::selectTests (
    String const& match, TestList const& tests) const noexcept
{
    TestList list;
    list.ensureStorageAllocated (tests.size ());

    int const indexOfDot = match.indexOfChar ('.');
    String const package = (indexOfDot == -1) ? match : match.substring (0, indexOfDot);
    String const testname = (indexOfDot == -1) ? ""
        : match.substring (indexOfDot + 1, match.length () + 1);

    if (package != String::empty)
    {
        if (testname != String::empty)
        {
            // "package.testname" : First test which matches
            for (int i = 0; i < tests.size(); ++i)
            {
                UnitTest* const test = tests [i];
                if (package.equalsIgnoreCase (test->getPackageName ()) &&
                    testname.equalsIgnoreCase (test->getClassName ()))
                {
                    list.add (test);
                    break;
                }
            }
        }
        else
        {
            // Get all tests in the package
            list = selectPackage (package, tests);

            // If no trailing slash on package, try tests
            if (list.size () == 0 && indexOfDot == -1)
            {
                // Try "package" as a testname
                list = selectTest (package, tests);
            }
        }
    }
    else if (testname != String::empty)
    {
        list = selectTest (testname, tests);
    }
    else
    {
        // All non manual tests
        for (int i = 0; i < tests.size(); ++i)
        {
            UnitTest* const test = tests [i];
            if (test->getWhen () != UnitTest::runManual)
                list.add (test);
        }
    }

    return list;
}
开发者ID:DaiLiRong,项目名称:rippled,代码行数:57,代码来源:UnitTest.cpp


示例11: run

void TestRunner::run()
{
    cout << "===============================================================" << endl;
    // cout << "running all tests" << endl;

    uint64_t start = time::hrtime();
    double duration = 0;
    TestList tests = this->tests();
    for (auto it = tests.begin(); it != tests.end(); ++it) {
        {
            std::lock_guard<std::mutex> guard(_mutex);
            _current = *it;
        }
        cout
            << "---------------------------------------------------------------" << endl;
        cout << _current->name << " starting" << endl;
        uint64_t test_start = time::hrtime();
        try {
            _current->run();
        } catch (std::exception& exc) {
            _current->errors.push_back(exc.what());
            cout << "exception thrown: " << exc.what() << endl;
        }
        _current->duration = (time::hrtime() - test_start) / 1e9;
        cout << _current->name << " ended after " << _current->duration << " seconds" << endl;
    }

    duration = (time::hrtime() - start) / 1e9;

    cout << "---------------------------------------------------------------" << endl;
    cout << "all tests completed after " << duration << " seconds" << endl;
    // cout << "summary: " << endl;

    for (auto it = tests.begin(); it != tests.end(); ++it) {
        if ((*it)->passed()) {
            cout << (*it)->name << " passed" << endl;
        } else {
            cout << (*it)->name << " failed" << endl;
        }
    }
}
开发者ID:sourcey,项目名称:libsourcey,代码行数:41,代码来源:test.cpp


示例12: runTests

void UnitTests::runTests (TestList const& tests)
{
    m_results = new Results;
    for (int i = 0; i < tests.size (); ++i)
    {
        if (shouldAbortTests())
            break;
        runTest (*tests [i]);
    }
    m_results->secondsElapsed = RelativeTime (
        Time::getCurrentTime () - m_results->whenStarted).inSeconds ();
}
开发者ID:AUSTRALIANBITCOINS,项目名称:rippled,代码行数:12,代码来源:beast_UnitTest.cpp


示例13: runTests

void UnitTests::runTests (TestList const& tests, int64 randomSeed)
{
    if (randomSeed == 0)
        randomSeed = Random().nextInt (0x7fffffff);
    m_random = Random (randomSeed);

    m_results = new Results;
    for (int i = 0; i < tests.size (); ++i)
    {
        if (shouldAbortTests())
            break;
        runTest (*tests [i]);
    }
    m_results->secondsElapsed = RelativeTime (
        Time::getCurrentTime () - m_results->whenStarted).inSeconds ();
}
开发者ID:DaiLiRong,项目名称:rippled,代码行数:16,代码来源:UnitTest.cpp


示例14: RunAllTests

int RunAllTests(TestReporter& reporter, TestList const& list, char const* suiteName, int const maxTestTimeInMs )
{
    TestResults result(&reporter);

    Timer overallTimer;
    overallTimer.Start();

    Test const* curTest = list.GetHead();
    while (curTest != 0)
    {
        if (suiteName == 0 || !std::strcmp(curTest->m_details.suiteName, suiteName))
        {
            Timer testTimer;
            testTimer.Start();
            result.OnTestStart(curTest->m_details);

            curTest->Run(result);

            int const testTimeInMs = testTimer.GetTimeInMs();
            if (maxTestTimeInMs > 0 && testTimeInMs > maxTestTimeInMs && !curTest->m_timeConstraintExempt)
            {
                MemoryOutStream stream;
                stream << "Global time constraint failed. Expected under " << maxTestTimeInMs <<
                       "ms but took " << testTimeInMs << "ms.";
                result.OnTestFailure(curTest->m_details, stream.GetText());
            }
            result.OnTestFinish(curTest->m_details, (float)testTimeInMs);
        }

        curTest = curTest->next;
    }

    float const secondsElapsed = overallTimer.GetTimeInMs() / 1000.0f;
    reporter.ReportSummary(result.GetTotalTestCount(), result.GetFailedTestCount(), result.GetFailureCount(), secondsElapsed);

    return result.GetFailureCount();
}
开发者ID:fatman2021,项目名称:sharm,代码行数:37,代码来源:TestRunner.cpp


示例15: TEST

TEST(ListTests, TestAll) 
{
	static TestStruct sValues[] = 
	{
		{ 1, 1.1 },
		{ 2, 2.2 },
		{ 3, 3.3 },
		{ 4, 4.4 },
	};

	// test empty
	TestList list;
	TestCurrentListState(list, 0, NULL);

	// test Clear() when empty
	ASSERT_EQ(list.Clear(), XN_STATUS_OK);
	TestCurrentListState(list, 0, NULL);

	// make sure AddBefore and AddAfter fail when receiving End()
	ASSERT_EQ(list.AddBefore(list.End(), sValues[0]), XN_STATUS_ILLEGAL_POSITION);
	ASSERT_EQ(list.AddAfter(list.End(), sValues[0]), XN_STATUS_ILLEGAL_POSITION);

	// test AddLast when empty
	ASSERT_EQ(list.AddLast(sValues[0]), XN_STATUS_OK);
	TestCurrentListState(list, 1, sValues);

	// test Clear when only one
	ASSERT_EQ(list.Clear(), XN_STATUS_OK);
	TestCurrentListState(list, 0, NULL);

	// test AddFirst when empty
	ASSERT_EQ(list.AddFirst(sValues[2]), XN_STATUS_OK);
	TestCurrentListState(list, 1, sValues + 2);

	// test AddFirst when having one
	ASSERT_EQ(list.AddFirst(sValues[1]), XN_STATUS_OK);
	TestCurrentListState(list, 2, sValues + 1);

	// test AddBefore in the beginning
	ASSERT_EQ(list.AddBefore(list.Begin(), sValues[0]), XN_STATUS_OK);
	TestCurrentListState(list, 3, sValues);

	// test Remove by value
	ASSERT_EQ(list.Remove(sValues[1]), XN_STATUS_OK);
	TestStruct aTemp[] = 
	{
		sValues[0],
		sValues[2]
	};
	TestCurrentListState(list, 2, aTemp);

	// and Remove by iterator
	ASSERT_EQ(list.Remove(++list.Begin()), XN_STATUS_OK);
	TestCurrentListState(list, 1, sValues);

	// test AddLast when having one
	ASSERT_EQ(list.AddLast(sValues[1]), XN_STATUS_OK);
	TestCurrentListState(list, 2, sValues);

	// test AddAfter in the end
	ASSERT_EQ(list.AddAfter(list.ReverseBegin(), sValues[2]), XN_STATUS_OK);
	TestCurrentListState(list, 3, sValues);

	// test AddBefore in the middle
	ASSERT_EQ(list.AddBefore(++list.Begin(), sValues[3]), XN_STATUS_OK);
	TestStruct aTemp2[] = 
	{
		sValues[0],
		sValues[3],
		sValues[1],
		sValues[2]
	};
	TestCurrentListState(list, 4, aTemp2);

	// remove one (needed for next test)
	ASSERT_EQ(list.Remove(++list.Begin()), XN_STATUS_OK);
	TestStruct aTemp3[] = 
	{
		sValues[0],
		sValues[1],
		sValues[2]
	};
	TestCurrentListState(list, 3, aTemp3);

	// test AddAfter in the middle
	ASSERT_EQ(list.AddAfter(--list.ReverseBegin(), sValues[3]), XN_STATUS_OK);
	TestStruct aTemp4[] = 
	{
		sValues[0],
		sValues[1],
		sValues[3],
		sValues[2]
	};
	TestCurrentListState(list, 4, aTemp4);

	// test const Find()
	const TestList& constList = list;
	TestList::ConstIterator constIt = constList.Find(sValues[3]);
	ASSERT_NE(constIt, constList.End());
	ASSERT_EQ(constIt, --constList.ReverseBegin());
//.........这里部分代码省略.........
开发者ID:Wessi,项目名称:OpenNI,代码行数:101,代码来源:ListTests.cpp


示例16: main

int main(int,char**)
{
    TestList<TestUpdaterOptions> tests;
    tests.addTest(&TestUpdaterOptions::testOldFormatArgs);
    return TestUtils::runTest(tests);
}
开发者ID:GlPortal,项目名称:Update-Installer,代码行数:6,代码来源:TestUpdaterOptions.cpp


示例17:

ListAdder::ListAdder(TestList& list, Test* test) {
  list.Add(test);
}
开发者ID:Aksej,项目名称:ia,代码行数:3,代码来源:TestList.cpp


示例18: main

void main()
{
    TestList testlist;
	testlist.RunAllTests();
}
开发者ID:GFrenette-Lareault,项目名称:TP3_MasterMind,代码行数:5,代码来源:Main.cpp


示例19: loop

void loop() {
    delay(1000);
    l.RunTest();
}
开发者ID:andysworkshop,项目名称:avr-stl,代码行数:4,代码来源:test_list.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ TestMap类代码示例发布时间:2022-05-31
下一篇:
C++ TestIntfPrx类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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