⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 failure.h

📁 计算机软件的测试驱动程序cppunit精简版。
💻 H
字号:


#ifndef FAILURE_H
#define FAILURE_H

// Failure records the circumstances surrounding a test failure.  Using C++
// macros were are able to record the name of the file where the failure 
// occurred, the line number, and the text of the condition which provoked
// the failure.

 
#include <string>

class Failure
{
public:
	Failure (std::string theCondition, std::string theTestName, std::string theFileName, long theLineNumber) 
		: condition (theCondition), testName (theTestName), fileName (theFileName), lineNumber (theLineNumber)
	{
	}

	std::string condition;
	std::string testName;
	std::string fileName;
	long lineNumber;
};


inline std::ostream& operator<< (std::ostream& stream, Failure& failure)
{
	stream 
		<< "Failure: \"" << failure.condition.c_str () << "\" " 
		<< "line " << failure.lineNumber << " in "
		<< failure.fileName.c_str ()
		<< std::endl;

	return stream;
}

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -