本文整理汇总了C++中Test::Name方法的典型用法代码示例。如果您正苦于以下问题:C++ Test::Name方法的具体用法?C++ Test::Name怎么用?C++ Test::Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test
的用法示例。
在下文中一共展示了Test::Name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DisplayHelp
void ShellCommandRun::DisplayHelp(IWriter& aResponse)
{
aResponse.Write(Brn("Run a unit test. Options are:\n"));
TestMap::iterator it = iTests.begin();
while (it != iTests.end()) {
Test* test = it->second;
aResponse.Write(Brn(" "));
aResponse.Write(Brn(test->Name()));
if (test->HelpAvailable()) {
aResponse.Write(Brn(" (--help for arguments)"));
}
aResponse.Write(Brn("\n"));
it++;
}
}
示例2: DrawResults
//.........这里部分代码省略.........
auto DrawRowLeft = [ &painter, &free_rect ]( QFont font, QColor color1, QString label, double spase = 1 )
{
painter.save();
QFontMetrics metrix( font );
QRect place;
AllocatePlace( place, metrix.height()*spase, free_rect );
QPoint start_point( place.left() , place.center().y()+metrix.height()/2 );
painter.setFont( font );
painter.setPen( color1 );
painter.drawText( start_point, label );
painter.restore();
};
auto DrawRowLeft3 = [ &painter, &free_rect ]( QFont const& font,
QColor const& color1,
QString const& label,
QColor const& color2 = Qt::black,
QString const& value = "",
QColor const& color3 = Qt::black,
QString const& value2 = "",
double spase = 1)
{
painter.save();
QFontMetrics metrix( font );
QRect place;
AllocatePlace( place, metrix.height()*spase, free_rect );
QPoint start_point( place.left() , place.center().y()+metrix.height()/2 );
QPoint start_point2( start_point.x() + metrix.width(label), place.center().y() +metrix.height()/2);
QPoint start_point3( start_point2.x() + metrix.width(value), place.center().y() +metrix.height()/2);
painter.setFont( font );
painter.setPen( color1 );
painter.drawText( start_point, label );
painter.setPen( color2 );
painter.drawText( start_point2, value );
painter.setPen( color3 );
painter.drawText( start_point3, value2 );
painter.restore();
};
DrawRowCenter( title_font, Qt::black, "", 7 );
DrawRowCenter( title_font, Qt::black, "Результаты испытаний", 1 );
DrawRowCenter2( title_font, Qt::black, "дискретного аппарата ", Qt::red, mGsType, 2 );
QString header = "<html>"
"<head>"
"<meta charset='utf-8'>"
"<style type='text/css'>"
"td { text-align: center;}"
"th { font-weight: normal; padding: 2px;}"
"table {border-collapse: collapse; border-style: solid; vertical-align:middle;}"
"</style>"
"</head>"
"<body>"
"<table width='100%' border='1.5' cellspacing='-0.5' cellpadding='-0.5'>"
"<tr>"
"<th> Номер </th>"
"<th></th>"
"<th> Работоспособность </th>"
"</tr>";
QString footer = "</table>"
"</body>"
"</html>";
bool sucsess = true;
QString row;
for ( auto it = mTestCase.begin(), end = mTestCase.end(); it != end; ++it )
{
Test* ptr = *it;
row += "<tr>"
"<td>"+test::ToString( ptr->Number() )+"</td>"
"<td>"+ QString(ptr->Name()).replace("\n","<br>") +"</td>"
"<td style='font-size:28pt; color: \"red\"; font-weight:bold;'>"+ (ptr->Success() ? QString("+"):QString("-")) +"</td>"
"</tr>";
sucsess &= ptr->Success();
}
QTextDocument doc;
doc.setUndoRedoEnabled( false );
doc.setTextWidth( free_rect.width() );
doc.setUseDesignMetrics( true );
doc.setDefaultTextOption ( QTextOption (Qt::AlignHCenter ) );
doc.setHtml( header + row + footer );
auto h = doc.documentLayout()->documentSize().height();
QRect place;
AllocatePlace( place, h ,free_rect );
QRectF r( 0, 0, place.width(), place.height() );
painter.save();
painter.translate( place.topLeft() );
doc.drawContents( &painter, r);
painter.restore();
DrawRowLeft( text_font, Qt::black, "ИТОГ:", 3 );
DrawRowLeft3( text_font, Qt::black, "Гидроаппарат ",
Qt::red, mGsType + (sucsess? " годен": " не годен"),
Qt::black, " к эксплуатации", 1 );
return true;
}
示例3: main
int main(int argc, char const *argv[])
{
for( int i = 1; i < argc; i++ )
{
if( strncmp( argv[i], "--vutpp:", 8 ) == 0 )
{
std::string strVutppParam = argv[i] + 8;
const size_t seperator = strVutppParam.find( ',' );
if( seperator == std::string::npos )
return -1;
HANDLE readPipe, writePipe;
sscanf( strVutppParam.substr( 0, seperator ).c_str(), "%d", &readPipe );
sscanf( strVutppParam.substr( seperator+1 ).c_str(), "%d", &writePipe );
char readBuffer[1024], writeBuffer[1024];
DWORD dwSize = 0;
strcpy( writeBuffer, "connect" );
if( WriteFile( writePipe, writeBuffer, 1024, &dwSize, NULL ) == false || dwSize != 1024 )
return -1;
while( true )
{
if( ReadFile( readPipe, readBuffer, 1024, &dwSize, NULL ) == false || dwSize != 1024 )
return -1;
if( strncmp( readBuffer, "__VUTPP_FINISH__", 16 ) == 0 )
break;
const char* pSeperator = strchr( readBuffer, ',' );
std::string suiteName( readBuffer, pSeperator - readBuffer ), testName( pSeperator+1 );
testName += "Test";
bool bRun = false;
for( int testIndex = 0; testIndex < TestRegistry::Instance().TestCount(); testIndex++ )
{
Test* pTest = TestRegistry::Instance().Tests()[testIndex];
if( strcmp( pTest->Name(), testName.c_str() ) == 0 )
{
VUTPP_Result testResult( writePipe );
pTest->Run(testResult);
strcpy( writeBuffer, "-1," );
bRun = true;
if( WriteFile( writePipe, writeBuffer, 1024, &dwSize, NULL ) == false || dwSize != 1024 )
return -1;
}
}
if( bRun == false )
{
sprintf( writeBuffer, "%d,,%s", -2, "can't find test" );
if( WriteFile( writePipe, writeBuffer, 1024, &dwSize, NULL ) == false || dwSize != 1024 )
return -1;
}
}
return 0;
}
}
VUTPP_Result testResult( 0 );
TestResultStdErr result;
TestRegistry::Instance().Run(testResult);
return (result.FailureCount());
}