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


C++ printPassFail函数代码示例

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


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

示例1: printTestMessage

bool Test::test_mazeReader01()
{
	bool isPassed = false;
	

	m_testNum++;


	printTestMessage(m_testNum, "MazeReader throws MazeCreationException if file doesn't exist");

	try
	{
		MazeReader mr("");
	}
	catch(MazeCreationException& mce)
	{
		isPassed = true;
	}
	catch(...)
	{
		std::cerr << "ERROR: Exception thrown was not MazeCreationException" << std::endl;
	}

	printPassFail(isPassed);

	return(isPassed);
}
开发者ID:chengyeh,项目名称:EECS268,代码行数:27,代码来源:Test.cpp

示例2: printTestMessage

bool Test::test2()
{
	bool isPassed = true;
	const int SIZE = 1000;
	const int LOW = -100;
	const int HIGH = 100;
	int* arr = Sorts<int>::createTestArray(SIZE, LOW, HIGH);

	printTestMessage(2, "createTestArray creates an array with values in the provided range");
	
	//check each value to ensure it's in range
	for(int i=0; i<SIZE && isPassed; i++)
	{
		if(arr[i] < LOW || arr[i] > HIGH)
		{
			isPassed = false;
			std::cerr << "ERROR! Excepted value from " << LOW << " to " << HIGH << ". Got " << arr[i];
			std::cerr << std::endl;
		}
	}
	
	delete[] arr;
	arr = nullptr;
	printPassFail(isPassed);
	return (isPassed);
}
开发者ID:KueiHsienChu,项目名称:EECS_268,代码行数:26,代码来源:Test.cpp

示例3: printTestMessage

bool Test::test_order03()
{
	bool isPassed = false;
	BSTI<int>* bst = new BinarySearchTree<int>();
	std::vector<int> input = {50, 25, 75, 10, 30, 65, 100}; 
	std::vector<int> correct = {10, 30, 25, 65, 100, 75, 50};
	std::vector<int> output;

	m_testNum++;

	printTestMessage(m_testNum, "vector returned by treeToVector(IN_ORDER) returns vector: {10, 30, 25, 65, 100, 75, 50}");

	loadVectorIntoTree(input, bst);
	output = bst->treeToVector(POST_ORDER);

	if(output == correct)
	{
		isPassed = true;
	}
	else
	{
		isPassed = false;
		std::cerr << "ERROR: expected ";
		printVector(correct);
		std::cerr << " got ";
		printVector(output);
		std::cerr << std::endl;	
	}	

	printPassFail(isPassed);

	delete bst;
	return(isPassed);
}
开发者ID:willashley23,项目名称:Binary-Search-Tree,代码行数:34,代码来源:Test.cpp

示例4: printTestMessage

bool Test_LinkedList::test16()
{
	LinkedList<int> list;
	bool isPassed = false;
	int trackedSize = 0;

	printTestMessage("size preserved by removeBack on populated list");

	//Remove front on every 3rd iteration, add otherwise.
	for(int i=0; i<TEST_SIZE; i++)
	{
		if( i>0 && i%3 == 0)
		{

			list.removeBack();
			trackedSize--;
		}
		else
		{

			list.addBack(i);
			trackedSize++;
		}
	}

	isPassed = trackedSize == list.size();
	printPassFail(isPassed);
	return (isPassed); 
}
开发者ID:bgivens,项目名称:eecs448-lab02,代码行数:29,代码来源:Test_LinkedList.cpp

示例5: printTestMessage

bool Test::test_sort26()
{
        bool isPassed = false;
        const int LOW = 0;
        const int HIGH = 5000;
        int* arr = Sorts<int>::createTestArray(TEST_SIZE, LOW, HIGH);
        double time = 0.0;

        m_testNum++;
        printTestMessage(m_testNum, "quickSortWithMedian sort completes in reasonable amount of time (0-2secs platform dependent) " + std::to_string(TEST_SIZE));

        time = Sorts<int>::sortTimer(Sorts<int>::quickSortWithMedian, arr, TEST_SIZE);

        std::cerr << "\nTime for quickSortWithMedian sort on " + std::to_string(TEST_SIZE) + " elements: " << time << " ";

        if(time<0 || time>2)
        {
                isPassed = false;
        }
        else
        {
                isPassed = true;
        }

        delete[] arr;
        arr = nullptr;

        printPassFail(isPassed);
        return (isPassed);
}
开发者ID:austinBailey5624,项目名称:oldCPlusPlusProjects,代码行数:30,代码来源:Test.cpp


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