本文整理汇总了C++中CPPUNIT_FAIL函数的典型用法代码示例。如果您正苦于以下问题:C++ CPPUNIT_FAIL函数的具体用法?C++ CPPUNIT_FAIL怎么用?C++ CPPUNIT_FAIL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CPPUNIT_FAIL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: testReadFile
void testReadFile()
{
//Read STL-Image from file
mitk::STLFileReader::Pointer reader = mitk::STLFileReader::New();
if (!reader->CanReadFile(m_SurfacePath, "", "")) {CPPUNIT_FAIL("Cannot read test data STL file.");}
reader->SetFileName(m_SurfacePath);
reader->Update();
mitk::Surface::Pointer surface = reader->GetOutput();
//check some basic stuff
CPPUNIT_ASSERT_MESSAGE("Reader output not NULL",surface.IsNotNull());
CPPUNIT_ASSERT_MESSAGE("IsInitialized()",surface->IsInitialized());
CPPUNIT_ASSERT_MESSAGE("mitk::Surface::SetVtkPolyData()",(surface->GetVtkPolyData()!=NULL));
CPPUNIT_ASSERT_MESSAGE("Availability of geometry",(surface->GetGeometry()!=NULL));
//use vtk stl reader for reference
vtkSmartPointer<vtkSTLReader> myVtkSTLReader = vtkSmartPointer<vtkSTLReader>::New();
myVtkSTLReader->SetFileName( m_SurfacePath.c_str() );
myVtkSTLReader->Update();
vtkSmartPointer<vtkPolyData> myVtkPolyData = myVtkSTLReader->GetOutput();
//vtkPolyData from vtkSTLReader directly
int n = myVtkPolyData->GetNumberOfPoints();
//vtkPolyData from mitkSTLFileReader
int m = surface->GetVtkPolyData()->GetNumberOfPoints();
CPPUNIT_ASSERT_MESSAGE("Number of Points in VtkPolyData",(n == m));
}
开发者ID:GHfangxin,项目名称:MITK,代码行数:27,代码来源:mitkSTLFileReaderTest.cpp
示例2: catch
void DefaultNetworkPublishingComponentTests::setUp()
{
try
{
dtCore::SetDataFilePathList(dtCore::GetDeltaDataPathList());
mLogger = &dtUtil::Log::GetInstance("defaultnetworkpublishingcomponenttests.cpp");
mGameManager = new dtGame::GameManager(*GetGlobalApplication().GetScene());
mGameManager->SetApplication(GetGlobalApplication());
mNetPubComp = new DefaultNetworkPublishingComponent;
mDefMsgProc = new DefaultMessageProcessor;
mTestComp = new TestComponent;
mGameManager->AddComponent(*mDefMsgProc, GameManager::ComponentPriority::HIGHEST);
mGameManager->AddComponent(*mNetPubComp, GameManager::ComponentPriority::NORMAL);
mGameManager->AddComponent(*mTestComp, GameManager::ComponentPriority::NORMAL);
mGameManager->CreateActor(*dtActors::EngineActorRegistry::GAME_MESH_ACTOR_TYPE, mGameActorProxy);
dtCore::System::GetInstance().SetShutdownOnWindowClose(false);
dtCore::System::GetInstance().Start();
mTestComp->reset();
//Publish the actor.
mGameManager->AddActor(*mGameActorProxy, false, false);
dtCore::System::GetInstance().Step();
}
catch (const dtUtil::Exception& ex)
{
CPPUNIT_FAIL((std::string("Error: ") + ex.ToString()).c_str());
}
}
开发者ID:VRAC-WATCH,项目名称:deltajug,代码行数:34,代码来源:defaultnetworkpublishingcomponenttests.cpp
示例3: testWriteAll
void testWriteAll()
{
uint16_t addr;
getReady();
// Enable write
writeOpAddr(EWEN_OPCODE, EWEN_OPCODE_BITS, 0, EWEN_ADDR_BITS);
standby();
// Fill all memory
writeOpAddr(WRAL_OPCODE, WRAL_OPCODE_BITS, 0, WRAL_ADDR_BITS);
writeData(0xABBA);
standby();
if (waitForCompletion()) {
stop();
getReady();
// Write successful -- verify all memory
for ( addr=0; addr < EEPROM93C46::SIZE; addr++ ) {
CPPUNIT_ASSERT_EQUAL((uint16_t)0xABBA, readAt(addr));
}
}
else {
CPPUNIT_FAIL("EEPROM write was not completed");
}
stop();
}
开发者ID:LastRitter,项目名称:vbox-haiku,代码行数:26,代码来源:tstDevEEPROM.cpp
示例4: GenerateData_3DImage_CompareToReference
void GenerateData_3DImage_CompareToReference()
{
int upperThr = 255;
int lowerThr = 60;
int outsideVal = 0;
int insideVal = 100;
us::ServiceReference<OclResourceService> ref = GetModuleContext()->GetServiceReference<OclResourceService>();
OclResourceService* resources = GetModuleContext()->GetService<OclResourceService>(ref);
resources->GetContext(); //todo why do i need to call this before GetMaximumImageSize()?
if(resources->GetMaximumImageSize(2, CL_MEM_OBJECT_IMAGE3D) == 0)
{
//GPU device does not support 3D images. Skip this test.
MITK_INFO << "Skipping test.";
return;
}
try{
m_oclBinaryFilter->SetInput( m_Random3DImage );
m_oclBinaryFilter->SetUpperThreshold( upperThr );
m_oclBinaryFilter->SetLowerThreshold( lowerThr );
m_oclBinaryFilter->SetOutsideValue( outsideVal );
m_oclBinaryFilter->SetInsideValue( insideVal );
m_oclBinaryFilter->Update();
mitk::Image::Pointer outputImage = mitk::Image::New();
outputImage = m_oclBinaryFilter->GetOutput();
// reference computation
//This is not optimal here, but since we use a random image
//we cannot know the reference image at this point.
typedef itk::Image< unsigned char, 3> ImageType;
typedef itk::BinaryThresholdImageFilter< ImageType, ImageType > ThresholdFilterType;
ImageType::Pointer itkInputImage = ImageType::New();
CastToItkImage( m_Random3DImage, itkInputImage );
ThresholdFilterType::Pointer refThrFilter = ThresholdFilterType::New();
refThrFilter->SetInput( itkInputImage );
refThrFilter->SetLowerThreshold( lowerThr );
refThrFilter->SetUpperThreshold( upperThr );
refThrFilter->SetOutsideValue( outsideVal );
refThrFilter->SetInsideValue( insideVal );
refThrFilter->Update();
mitk::Image::Pointer referenceImage = mitk::Image::New();
mitk::CastToMitkImage(refThrFilter->GetOutput(), referenceImage);
MITK_ASSERT_EQUAL( referenceImage, outputImage,
"OclBinaryThresholdFilter should be equal to regular itkBinaryThresholdImageFilter.");
}
catch(mitk::Exception &e)
{
std::string errorMessage = "Caught unexpected exception ";
errorMessage.append(e.what());
CPPUNIT_FAIL(errorMessage.c_str());
}
}
开发者ID:151706061,项目名称:MITK,代码行数:60,代码来源:mitkOclBinaryThresholdImageFilterTest.cpp
示例5: CPPUNIT_ASSERT_MESSAGE
void ConnectTests::connect ()
{
rdbi_context_def *rdbi_context;
int id;
try
{
CPPUNIT_ASSERT_MESSAGE ("rdbi_initialize failed", RDBI_SUCCESS == do_rdbi_init (&rdbi_context));
try
{
CPPUNIT_ASSERT_MESSAGE ("rdbi_connect failed", RDBI_SUCCESS == do_rdbi_connect (rdbi_context, id));
CPPUNIT_ASSERT_MESSAGE ("rdbi_disconnect failed", RDBI_SUCCESS == rdbi_disconnect (rdbi_context));
}
catch (CppUnit::Exception exception)
{
rdbi_term (&rdbi_context);
throw exception;
}
CPPUNIT_ASSERT_MESSAGE ("rdbi_term failed", RDBI_SUCCESS == rdbi_term (&rdbi_context));
}
catch (CppUnit::Exception exception)
{
throw exception;
}
catch (...)
{
CPPUNIT_FAIL ("unexpected exception encountered");
}
}
开发者ID:johanvdw,项目名称:fdo-git-mirror,代码行数:29,代码来源:ConnectTests.cpp
示例6: CPPUNIT_FAIL
void HTMLChatViewTest::checkResultBody(QString validOutput) {
QString out = view->dumpContent();
delete view;
delete form;
int a = out.indexOf("<body>"),
b = out.lastIndexOf("</body>");
if (a < 0 || b < 0) {
CPPUNIT_FAIL("no <body> element");
}
out.chop(out.size() - b);
out = out.right(out.size() - a - 6).replace('\n', "");
validOutput.replace('\n', "");
for (int i = 0; i < validOutput.size(); ++i) {
if (validOutput[i] != out[i]) {
qDebug() << i << out.left(i);
break;
}
}
CPPUNIT_ASSERT_EQUAL(validOutput.toStdString(), out.toStdString());
}
开发者ID:senu,项目名称:psi,代码行数:27,代码来源:htmlchatviewtest.cpp
示例7: SpectrumDataSetStokes
void FilterBankAdapterTest::test_readFile()
{
try {
{ // Use Case:
// read in a file with a header
// requesty to read a single block
// Expect:
// header and block to be read in and DataBlob filled
// TestConfig config("StreamDataSet.xml", "lib");
// create the DataBlob
SpectrumDataSetStokes* blob = new SpectrumDataSetStokes();
QString xml = "";
pelican::test::AdapterTester tester("FilterBankAdapter", xml);
tester.setDataFile(pelican::test::TestConfig::findTestFile("testData.dat","lib"));
tester.execute(blob);
CPPUNIT_ASSERT_EQUAL( (unsigned int)1 , blob->nPolarisations() );
CPPUNIT_ASSERT_EQUAL( (unsigned int)496 , blob->nChannels() );
delete blob;
}
}
catch( QString& e ) {
CPPUNIT_FAIL( e.toStdString() );
}
}
开发者ID:chrisjwilliams,项目名称:pelican-katburst,代码行数:26,代码来源:FilterBankAdapterTest.cpp
示例8: storeNode
void EdgeIterationTest::testGetOutEdges()
{
_engine->evaluate(QString::fromStdString("var it = g.getOutEdges(n1); storeNode(n1);"));
if(_engine->hasUncaughtException())
CPPUNIT_FAIL(qPrintable(_engine->uncaughtException().toString()));
tlp::Graph *testGraph = _graph->asGraph();
tlp::Iterator<tlp::edge> *it = testGraph->getOutEdges(_testNode->asNode());
int itCount = 0;
while (it->hasNext()) {
_engine->evaluate(QString::fromStdString("storeEdge(it.next());"));
if(_engine->hasUncaughtException())
CPPUNIT_FAIL(qPrintable(_engine->uncaughtException().toString()));
CPPUNIT_ASSERT(_testEdge->asEdge() == it->next());
itCount++;
}
CPPUNIT_ASSERT(itCount == 1); // only n1->n2 (edge coming from n1)
}
开发者ID:jujis008,项目名称:Tulip-Plugins,代码行数:17,代码来源:EdgeIterationTest.cpp
示例9: test_unpack_pack
void test_unpack_pack(){
datapack_t handle = datapack_open("tests/data2.pak");
if ( !handle ){
CPPUNIT_FAIL(std::string("unpack_open(..) failed: ") + strerror(errno));
}
char* tmp;
int ret = unpack_filename(handle, "data3.txt", &tmp);
if ( ret != 0 ){
CPPUNIT_FAIL(std::string("unpack_filename(..) failed: ") + strerror(ret));
}
CPPUNIT_ASSERT_EQUAL(std::string(tmp), std::string("test data\n"));
free(tmp);
datapack_close(handle);
}
开发者ID:ext,项目名称:datapack,代码行数:17,代码来源:test.cpp
示例10: exs
/**
* test d'SERDataSource
*/
void CppUnitMessages::test3ExceptionReport() {
std::vector<ServiceException*> exs ( 1, new ServiceException ( locator,code,message,"wmts" ) ) ;
exs.push_back ( new ServiceException ( locator,OWS_NOAPPLICABLE_CODE,"Autre message!!","wmts" ) ) ;
SERDataSource *serDSC= new SERDataSource ( &exs ) ;
if ( serDSC==NULL ) CPPUNIT_FAIL ( "Impossible de créer l'objet SERDataSource !" ) ;
std::string exTxt= serDSC->getMessage() ;
if ( exTxt.length() <=0 ) CPPUNIT_FAIL ( "Message de longueur nulle pour le rapport d'exception !" ) ;
CPPUNIT_ASSERT_MESSAGE ( "attribut code absent du message :\n"+exTxt,exTxt.find ( " exceptionCode=\""+ServiceException::getCodeAsString ( OWS_NOAPPLICABLE_CODE ) +"\"",0 ) !=std::string::npos ) ;
CPPUNIT_ASSERT_MESSAGE ( "Exception absent du message :\n"+exTxt,exTxt.find ( "<Exception ",0 ) !=std::string::npos ) ;
CPPUNIT_ASSERT_MESSAGE ( "ExceptionReport absent du message :\n"+exTxt,exTxt.find ( "<ExceptionReport ",0 ) !=std::string::npos ) ;
CPPUNIT_ASSERT_MESSAGE ( "attribut xmlns absent du message ou incorrect (xmlns=\"http://opengis.net/ows/1.1\" attendu) :\n"+exTxt,exTxt.find ( "xmlns=\"http://www.opengis.net/ows/1.1\"",0 ) !=std::string::npos ) ;
// TODO : validation du XML
delete serDSC ;
exs.clear() ;
} // test3ExceptionReport
开发者ID:tcoupin,项目名称:rok4,代码行数:20,代码来源:CppUnitMessages.cpp
示例11: tearDown
void CInfiniteMediatorTest::testFilterReturnsNULL()
{
tearDown();
// Set up the mediator
std::string proto("file://");
std::string infname("./run-0000-00.evt");
std::string outfname("./copy2-run-0000-00.evt");
// std::ifstream ifile (infname.c_str());
// std::ofstream ofile (outfname.c_str());
// m_source = new CIStreamDataSource(ifile);
// m_sink = new COStreamDataSink(ofile);
try {
URL uri(proto+infname);
m_source = new CFileDataSource(uri, std::vector<uint16_t>());
m_sink = new CFileDataSink(outfname);
m_filter = new CNullFilter;
m_mediator = new CInfiniteMediator(0,0,0);
m_mediator->setDataSource(m_source);
m_mediator->setDataSink(m_sink);
m_mediator->setFilter(m_filter);
m_mediator->mainLoop();
// kill all of the sinks and sources
tearDown();
// set up defaults so that we don't segfault at tearDown
setUp();
} catch (CException& exc) {
std::stringstream errmsg; errmsg << "Caught exception:" << exc.ReasonText();
CPPUNIT_FAIL(errmsg.str().c_str());
} catch (int errcode) {
std::stringstream errmsg; errmsg << "Caught integer " << errcode;
CPPUNIT_FAIL(errmsg.str().c_str());
} catch (std::string errmsg) {
CPPUNIT_FAIL(errmsg.c_str());
}
struct stat st;
stat(outfname.c_str(), &st);
CPPUNIT_ASSERT_EQUAL( 0, int(st.st_size) );
remove(outfname.c_str());
}
开发者ID:jrtomps,项目名称:nscldaq,代码行数:46,代码来源:filterhandlertests.cpp
示例12: set_service_class_thread
void set_service_class_thread(boost::thread *thrd)
{
if (nullptr == service_class_thread) {
service_class_thread = thrd;
} else {
CPPUNIT_FAIL("Unexpected service class thread received.");
}
}
开发者ID:FlyingRhenquest,项目名称:socket_server_2,代码行数:8,代码来源:test_client_server.cpp
示例13: ASSERT_VALUE
void ASSERT_VALUE(int32_t value, const MetricSnapshot & snapshot, const char *name)
{
const Metric* _metricValue_((snapshot).getMetrics().getMetric(name));
if (_metricValue_ == 0) {
CPPUNIT_FAIL("Metric value '" + std::string(name) + "' not found in snapshot");
}
CPPUNIT_ASSERT_EQUAL(value, int32_t(_metricValue_->getLongValue("value")));
}
开发者ID:songhtdo,项目名称:vespa,代码行数:8,代码来源:snapshottest.cpp
示例14: sprintf
void UnitTestUtil::CheckOutput( const char* masterFileName, const char* outFileName )
{
if ( CompareFiles( masterFileName, outFileName ) != 0 ) {
char buffer[5000];
sprintf( buffer, "Output file %s differs from expected output file %s", outFileName, masterFileName );
CPPUNIT_FAIL (buffer);
}
}
开发者ID:johanvdw,项目名称:fdo-git-mirror,代码行数:8,代码来源:UnitTestUtil.cpp
示例15: compareWith
void compareWith() {
Index i, j;
NPerm p, q;
for (i = 0; i < nIdx; ++i) {
p = NPerm::atIndex(idx[i]);
if (p.compareWith(p) != 0) {
std::ostringstream msg;
msg << "Routine compareWith() does not conclude that "
<< p.str() << " == " << p.str() << ".";
CPPUNIT_FAIL(msg.str());
}
if (! looksEqual(p, p)) {
std::ostringstream msg;
msg << "Permutation " << p.str()
<< " does not appear to be equal to itself.";
CPPUNIT_FAIL(msg.str());
}
}
for (i = 0; i < nIdx; ++i) {
p = NPerm::atIndex(idx[i]);
for (j = i + 1; j < nIdx; ++j) {
q = NPerm::atIndex(idx[j]);
if (p.compareWith(q) != -1) {
std::ostringstream msg;
msg << "Routine compareWith() does not conclude that "
<< p.str() << " < " << q.str() << ".";
CPPUNIT_FAIL(msg.str());
}
if (q.compareWith(p) != 1) {
std::ostringstream msg;
msg << "Routine compareWith() does not conclude that "
<< q.str() << " > " << p.str() << ".";
CPPUNIT_FAIL(msg.str());
}
if (! looksDistinct(p, q)) {
std::ostringstream msg;
msg << "Permutations " << q.str() << " and "
<< p.str() << " do not appear to be distinct.";
CPPUNIT_FAIL(msg.str());
}
}
}
}
开发者ID:WPettersson,项目名称:regina,代码行数:46,代码来源:nperm.cpp
示例16: pj_transform
void GridGeometryTest::testGetGeometryHirlam10()
{
std::ostringstream exp;
double x0 = 5.75 * DEG_TO_RAD;
double y0 = -13.25 * DEG_TO_RAD;
double x1 = (5.75+(247*0.1)) * DEG_TO_RAD;
double y1 = -13.25 * DEG_TO_RAD;
double x2 = (5.75+(247*0.1)) * DEG_TO_RAD;
double y2 = (-13.25+(399*0.1)) * DEG_TO_RAD;
double x3 = 5.75 * DEG_TO_RAD;
double y3 = (-13.25+(399*0.1)) * DEG_TO_RAD;
int error = pj_transform( hirlam10Proj, targetProj, 1, 0, &x0, &y0, NULL );
if ( error ) {
std::ostringstream msg;
msg << "Error during reprojection: " << pj_strerrno(error) << ".";
CPPUNIT_FAIL( msg.str() );
}
error = pj_transform( hirlam10Proj, targetProj, 1, 0, &x1, &y1, NULL );
if ( error ) {
std::ostringstream msg;
msg << "Error during reprojection: " << pj_strerrno(error) << ".";
CPPUNIT_FAIL( msg.str() );
}
error = pj_transform( hirlam10Proj, targetProj, 1, 0, &x2, &y2, NULL );
if ( error ) {
std::ostringstream msg;
msg << "Error during reprojection: " << pj_strerrno(error) << ".";
CPPUNIT_FAIL( msg.str() );
}
error = pj_transform( hirlam10Proj, targetProj, 1, 0, &x3, &y3, NULL );
if ( error ) {
std::ostringstream msg;
msg << "Error during reprojection: " << pj_strerrno(error) << ".";
CPPUNIT_FAIL( msg.str() );
}
exp << "POLYGON((";
exp << wdb::round(x0 * RAD_TO_DEG, 4) << " " << wdb::round (y0 * RAD_TO_DEG, 4) << ",";
exp << wdb::round(x1 * RAD_TO_DEG, 4) << " " << wdb::round (y1 * RAD_TO_DEG, 4) << ",";
exp << wdb::round(x2 * RAD_TO_DEG, 4) << " " << wdb::round (y2 * RAD_TO_DEG, 4) << ",";
exp << wdb::round(x3 * RAD_TO_DEG, 4) << " " << wdb::round (y3 * RAD_TO_DEG, 4) << ",";
exp << wdb::round(x0 * RAD_TO_DEG, 4) << " " << wdb::round (y0 * RAD_TO_DEG, 4) << "))";
const std::string expected = exp.str();
std::string geometry = grid->wktRepresentation();
CPPUNIT_ASSERT_EQUAL( expected, geometry);
}
开发者ID:helenk,项目名称:wdb,代码行数:45,代码来源:GridGeometryTest.cpp
示例17: test_get_loaded_modules
/*!
* @brief tests for get_loaded_modules()
*
*
*
*/
void test_get_loaded_modules()
{
::RTM::ManagerServant *pman = new ::RTM::ManagerServant();
::RTC::ReturnCode_t ret;
try
{
ret = pman->load_module(".libs/DummyModule1.so","DummyModule1Init");
CPPUNIT_ASSERT_EQUAL(::RTC::RTC_OK, ret);
CPPUNIT_ASSERT(isFound(pman->get_loaded_modules(),
".//.libs/DummyModule1.so"));
}
catch(...)
{
CPPUNIT_FAIL("Exception thrown.");
}
try
{
ret = pman->load_module(".libs/DummyModule2.so","DummyModule2Init");
CPPUNIT_ASSERT_EQUAL(::RTC::RTC_OK, ret);
CPPUNIT_ASSERT(isFound(pman->get_loaded_modules(),
".//.libs/DummyModule2.so"));
}
catch(...)
{
CPPUNIT_FAIL("Exception thrown.");
}
//Execute the function
::RTM::ModuleProfileList* list;
list = pman->get_loaded_modules();
::RTM::ModuleProfileList modlist(*list);
delete list;
//Check returns(ModuleProfileList).
CPPUNIT_ASSERT_EQUAL((::CORBA::ULong)2, modlist.length());
CPPUNIT_ASSERT_EQUAL(::std::string("file_path"),
::std::string(modlist[0].properties[0].name));
const char* ch;
if( modlist[0].properties[0].value >>= ch )
{
CPPUNIT_ASSERT_EQUAL(::std::string(".//.libs/DummyModule1.so"),
::std::string(ch));
}
else
{
开发者ID:pansas,项目名称:OpenRTM-aist-portable,代码行数:51,代码来源:ManagerServantTests.cpp
示例18: config
void ConfigTest::testConfigCharThrowInvalidArgument(void)
{
try {
Config config('\"');
CPPUNIT_FAIL("std::invalid_argument must be throw.");
} catch (std::invalid_argument&) {
CPPUNIT_ASSERT(true);
}
}
开发者ID:rhorii,项目名称:cslcsv,代码行数:9,代码来源:ConfigTest.cpp
示例19: CPPUNIT_FAIL
void CSomeTests::test2()
{
int var1 = 99;
int var2 = 99;
if (var1 == var2) {
CPPUNIT_FAIL("var1 and var2 matched - should not be equal in this case!!");
}
}
开发者ID:pdrezet,项目名称:brix,代码行数:9,代码来源:SomeTests.cpp
示例20: failTestMissingException
/*
* Test should fail because an exception was expected, but none occurred. The failure message
* will also include the action that was underway (and should have caused an exception).
*/
void failTestMissingException(const char *expectedException, const char* action)
{
char buffer[4096];
sprintf(buffer,
"(missingException) Expected an exception (%s) while %s",
expectedException,
action);
CPPUNIT_FAIL(buffer);
}
开发者ID:openlvc,项目名称:portico,代码行数:13,代码来源:common.cpp
注:本文中的CPPUNIT_FAIL函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论