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


C++ Test::IsTearDown方法代码示例

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


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

示例1: run

void TestRegistry::run (TestResult& result, TCHAR *GroupNameArray[], int Number) 
{
	result.testsStarted ();
	
	//if( setup )
	//{
	//	setup->run(result);//guyu extension
	//	result.addTestCount();//guyu extension
	//}
	//Test *setup[] = new Test*[Number];
	//Test *teardown[] = new Test*[Number];
	//scan all test, and constructor the execution list
	
	for(int i = 0; i < Number; i++)
	{
		Test *setup = NULL;
		Test *teardown = NULL;
		Test *normal = NULL;
		Test *finallist = NULL;

		//collect all test for this group, store them in setup, teardown & normal
		for (Test *test = tests; test != 0; test = test->getNext ())
		{
			if(!_tcscmp( test->GetGroupName(), GroupNameArray[i] ))
			{
				if(test->IsSetup())
				{
					if(setup)
						assert(0 && TEXT("Only 1 setup is allowed in each test group"));
					else
						setup = test;
				}else if(test->IsTearDown())
				{
					if(teardown)
						assert(0 && TEXT("Only 1 teardown is allowed in each test group"));
					else
						teardown = test;
				}else
				{
					normal = test->linkRunNext(normal);
				}
			}
		}

		//construct the final running list
		if(setup)
			finallist = setup;
		if(normal)
		{
			if(finallist)
				finallist->setRunNext(normal);
			else
				finallist = normal;
		}
		if(teardown)
		{
			if(!finallist)
				finallist = teardown;
			else
			{
				Test* p = finallist;
				while(p)
				{
					if(!p->getRunNext())
						break;
					p = p->getRunNext();
				}
				p->setRunNext(teardown);
			}
		}

		if(finallist != NULL)
			LogToDebugW(TEXT("  Test group:%s"), finallist->GetGroupName());
		//run all tests
		for(Test* t = finallist; t; t=t->getRunNext())
		{			
			t->run(result);
			result.addTestCount();
		}
	}

	//for (Test *test = tests; test != 0; test = test->getNext ())
	//{
	//	bool bRunTest = true;
	//	if( Number != 0 )
	//	{
	//		int i;
	//		for( i = 0; i < Number; i++ )
	//		{
	//			if( !_tcscmp( test->GetGroupName(), GroupNameArray[i] ) )
	//				break;					
	//		}
	//		if( i >= Number )
	//			bRunTest = false;
	//	}
	//	
	//	if( bRunTest )
	//	{
	//		test->run (result);
	//		result.addTestCount();//guyu extension
//.........这里部分代码省略.........
开发者ID:ccanan,项目名称:BladeMaster,代码行数:101,代码来源:TestRegistry.cpp


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