test.cpp

来自「Password Safe Password Safe is a passwor」· C++ 代码 · 共 48 行

CPP
48
字号
// test.cpp#include "test.h"#include <iostream>#include <typeinfo>     // Visual Studio requires /GR""#ifdef _MSC_VER// Allow return-less mains:#pragma warning(disable: 4541)#endifusing namespace std;void Test::do_test(bool cond, const std::string& lbl,                   const char* fname, long lineno){    if (!cond)        do_fail(lbl, fname, lineno);    else        _succeed();}void Test::do_fail(const std::string& lbl,                   const char* fname, long lineno){    ++m_nFail;    if (m_osptr)    {        *m_osptr << typeid(*this).name()                             << " failure: (" << lbl << ") , "                                 << fname                 << " (line " << lineno << ")\n";    }}long Test::report() const{    if (m_osptr)        {            *m_osptr << "Test \""                          << typeid(*this).name() << "\":\n"                     << "\tPassed: " << m_nPass                     << "\tFailed: " << m_nFail                     << endl;        }    return m_nFail;}

⌨️ 快捷键说明

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