本文整理汇总了C++中cppunit::TestSuite::run方法的典型用法代码示例。如果您正苦于以下问题:C++ TestSuite::run方法的具体用法?C++ TestSuite::run怎么用?C++ TestSuite::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cppunit::TestSuite
的用法示例。
在下文中一共展示了TestSuite::run方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
CppUnit::TestSuite suite;
ExpTest expt("ExpTest");
ProgTest progt("ProgTest");
ProcTest proct("ProcTest");
RtlTest rtlt("RtlTest");
ParserTest parsert("ParserTest");
TypeTest typet("TypeTest");
expt.registerTests(&suite);
progt.registerTests(&suite);
proct.registerTests(&suite);
rtlt.registerTests(&suite);
parsert.registerTests(&suite);
typet.registerTests(&suite);
CppUnit::TextTestResult res;
suite.run( &res );
std::cout << res << std::endl;
return 0;
}
示例2: main
int main()
{
// Using TestCase
ComplexNumberTest cnt("Super test");
cnt.runTest();
// Using TestFixture
CppUnit::TestCaller<ComplexNumberFixture> testForEquality("testEquality", &ComplexNumberFixture::testEquality);
CppUnit::TestResult resultOfEquality;
testForEquality.run(&resultOfEquality);
CppUnit::TestCaller<ComplexNumberFixture> testForAddition("testAddition", &ComplexNumberFixture::testAddition);
CppUnit::TestResult resultOfAddition;
testForAddition.run(&resultOfAddition);
// Using TestSuite
/* // Math Suite
CppUnit::TestSuite math_suite;
math_suite.addTest(new CppUnit::TestCaller<ComplexNumberFixture> ("testAddition", &ComplexNumberFixture::testAddition));
*/
CppUnit::TestSuite suite;
CppUnit::TestResult suite_result;
suite.addTest(new CppUnit::TestCaller<ComplexNumberFixture> ("testEquality", &ComplexNumberFixture::testEquality));
suite.addTest(new CppUnit::TestCaller<ComplexNumberFixture> ("testAddition", &ComplexNumberFixture::testAddition));
suite.addTest(ComplexNumberSuite::suite());
suite.run(&suite_result);
// Using suite method
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest(registry.makeTest());
bool wasSuccessful = runner.run();
if (wasSuccessful)
cout << "Was successful" << endl;
else
cout << "Was unsuccessful" << endl;
Complex c(7);
cout << c << endl;
}
示例3: main
int main(int argc, char** argv)
{
CppUnit::TestSuite suite;
LoaderTest lt("ExpTest");
lt.registerTests(&suite);
CppUnit::TextTestResult res;
suite.run( &res );
std::cout << res << std::endl;
return 0;
}
示例4: main
int main(int argc, char** argv)
{
CppUnit::TestSuite suite;
// FrontSparcTest fst("FrontSparcTest");
// FrontendTest fet("FrontendTest");
// FrontPentTest fpt("FrontPentTest");
FrontPentTest fSt("FrontPentTest");
// fst.registerTests(&suite);
// fpt.registerTests(&suite);
fSt.registerTests(&suite);
CppUnit::TextTestResult res;
prog.readLibParams(); // Read library signatures (once!)
suite.run( &res );
std::cout << res << std::endl;
return 0;
}
示例5: if
_EXPORT
int
BTestShell::Run(int argc, char *argv[]) {
// Make note of which directory we started in
UpdateTestDir(argv);
// Parse the command line args
if (!ProcessArguments(argc, argv))
return 0;
// Load any dynamically loadable tests we can find
LoadDynamicSuites();
// See if the user requested a list of tests. If so,
// print and bail.
if (fListTestsAndExit) {
PrintInstalledTests();
return 0;
}
// Add the proper tests to our suite (or exit if there
// are no tests installed).
CppUnit::TestSuite suite;
if (fTests.empty()) {
// No installed tests whatsoever, so bail
cout << "ERROR: No installed tests to run!" << endl;
return 0;
} else if (fSuitesToRun.empty() && fTestsToRun.empty()) {
// None specified, so run them all
TestMap::iterator i;
for (i = fTests.begin(); i != fTests.end(); ++i)
suite.addTest( i->second );
} else {
set<string>::const_iterator i;
set<string> suitesToRemove;
// Add all the tests from any specified suites to the list of
// tests to run (since we use a set, this eliminates the concern
// of having duplicate entries).
for (i = fTestsToRun.begin(); i != fTestsToRun.end(); ++i) {
// See if it's a suite (since it may just be a single test)
if (fSuites.find(*i) != fSuites.end()) {
// Note the suite name for later removal unless the
// name is also the name of an available individual test
if (fTests.find(*i) == fTests.end()) {
suitesToRemove.insert(*i);
}
const TestMap &tests = fSuites[*i]->getTests();
TestMap::const_iterator j;
for (j = tests.begin(); j != tests.end(); j++) {
fTestsToRun.insert( j->first );
}
}
}
// Remove the names of all of the suites we discovered from the
// list of tests to run (unless there's also an installed individual
// test of the same name).
for (i = suitesToRemove.begin(); i != suitesToRemove.end(); i++) {
fTestsToRun.erase(*i);
}
// Everything still in fTestsToRun must then be an explicit test
for (i = fTestsToRun.begin(); i != fTestsToRun.end(); ++i) {
// Make sure it's a valid test
if (fTests.find(*i) != fTests.end()) {
suite.addTest( fTests[*i] );
} else {
cout << endl << "ERROR: Invalid argument \"" << *i << "\"" << endl;
PrintHelp();
return 0;
}
}
}
// Run all the tests
InitOutput();
InstallPatches();
suite.run(&fTestResults);
UninstallPatches();
PrintResults();
return 0;
}