您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CPPUNIT_FAIL函数代码示例

51自学网 2021-06-01 20:05:01
  C++
这篇教程C++ CPPUNIT_FAIL函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CPPUNIT_FAIL函数的典型用法代码示例。如果您正苦于以下问题:C++ CPPUNIT_FAIL函数的具体用法?C++ CPPUNIT_FAIL怎么用?C++ CPPUNIT_FAIL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CPPUNIT_FAIL函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例21: fopen

FdoInt32 UnitTestUtil::CompareFiles( const char* file1Name, const char* file2Name ){	char buffer[500];	char buffer1[5000];	char buffer2[5000];	FdoInt32 retcode = -1;	FILE* fp1 = fopen( file1Name, "r" );	FILE* fp2 = fopen( file2Name, "r" );		if ( fp1 == NULL ) {		sprintf( buffer, "UnitTestUtil::CompareFiles: failed to open file %s", file1Name );        CPPUNIT_FAIL (buffer);	}	if ( fp2 == NULL ) {    	fclose(fp1);		sprintf( buffer, "UnitTestUtil::CompareFiles: failed to open file %s", file2Name );        CPPUNIT_FAIL (buffer);	}	while ( fgets( buffer1, sizeof(buffer1-1), fp1 ) != NULL ) {		if ( !fgets( buffer2, sizeof(buffer2-1), fp2  ) ) 			// different: file2 has fewer lines.			goto the_exit;		if ( strcmp( buffer1, buffer2 ) )			// different: a line is different			goto the_exit;	}	if ( fgets( buffer2, sizeof(buffer2-1), fp2 ) ) 		// different: file2 has more lines.		goto the_exit;	retcode = 0;the_exit:	fclose(fp1);	fclose(fp2);	return( retcode );}
开发者ID:johanvdw,项目名称:fdo-git-mirror,代码行数:44,


示例22: CleanUpClass

/* Test insert/update/select (but not setting/getting any lock info) on a table that supports locking. */void BasicUpdateTests::update_on_lock_enabled_table (){    if (CreateSchemaOnly())  return;    try    {        mConnection = ArcSDETests::GetConnection ();        mConnection->SetConnectionString (ArcSDETestConfig::ConnStringMetadcov());        mConnection->Open ();		// Clean up previous tests:        CleanUpClass(mConnection, ArcSDETestConfig::ClassSchemaSample(), ArcSDETestConfig::ClassNameSample(), true);                FdoPtr<FdoIInsert> insert = (FdoIInsert*)mConnection->CreateCommand (FdoCommandType_Insert);        insert->SetFeatureClassName (ArcSDETestConfig::QClassNameSample());        FdoPtr<FdoPropertyValueCollection> values = insert->GetPropertyValues ();        FdoPtr<FdoStringValue> expression = FdoStringValue::Create (L"Zozo");        FdoPtr<FdoPropertyValue> value = FdoPropertyValue::Create (AdjustRdbmsName(L"LockProperty"), expression);        values->Add (value);        FdoPtr<FdoIFeatureReader> reader = insert->Execute ();        FdoInt32 newId = 0;        if (reader->ReadNext())            newId = reader->GetInt32(AdjustRdbmsName(L"Id"));        FdoPtr<FdoIUpdate> update = (FdoIUpdate*)mConnection->CreateCommand (FdoCommandType_Update);        update->SetFeatureClassName (ArcSDETestConfig::QClassNameSample());        wchar_t filter[1024];        FdoCommonOSUtil::swprintf(filter, ELEMENTS(filter), L"%ls = %d", AdjustRdbmsName(L"Id"), newId);        update->SetFilter (FdoPtr<FdoFilter>(FdoFilter::Parse (filter)));	    values = update->GetPropertyValues ();	    value = FdoPropertyValue::Create ();        value->SetName (AdjustRdbmsName(L"LockProperty"));		value->SetValue (L"'All mimsy were the borogoves'");        values->Add (value);        if (1 != update->Execute ())            CPPUNIT_FAIL ("update execute failed");        // check by doing a select        FdoPtr<FdoISelect> select = (FdoISelect*)mConnection->CreateCommand (FdoCommandType_Select);        select->SetFeatureClassName (ArcSDETestConfig::QClassNameSample());        reader = select->Execute ();        while (reader->ReadNext ())        {            CPPUNIT_ASSERT_MESSAGE ("incorrect value", 0 == wcscmp (L"All mimsy were the borogoves", reader->GetString (AdjustRdbmsName(L"LockProperty"))));        }        reader->Close();		// Clean up after test:		CleanUpClass(mConnection, ArcSDETestConfig::ClassSchemaTestClassSimple(), ArcSDETestConfig::ClassNameSample(), true);        mConnection->Close();    }    catch (FdoException* ge)     {        fail (ge);    }}
开发者ID:johanvdw,项目名称:fdo-git-mirror,代码行数:57,


示例23: requestPing

    void requestPing(const std::wstring& /*message*/)    {        switch(mMode)        {        case CMultiPingPongTest::DoubleResponse:            responsePong(L"Hi");            responsePong(L"Hi");            break;        case CMultiPingPongTest::DoubleResponseError:            sendError(PingPongTest::UPD_ID_responsePong);            sendError(PingPongTest::UPD_ID_responsePong);            break;        case CMultiPingPongTest::DoubleRequestError:            sendError(PingPongTest::UPD_ID_requestPing);            sendError(PingPongTest::UPD_ID_requestPing);            break;        case CMultiPingPongTest::ResponseAndResponseError:            responsePong(L"Hi");            sendError(PingPongTest::UPD_ID_responsePong);            break;        case CMultiPingPongTest::ResponseErrorAndResponse:            sendError(PingPongTest::UPD_ID_responsePong);            responsePong(L"Hi");            break;        case CMultiPingPongTest::ResponseAndRequestError:            responsePong(L"Hi");            sendError(PingPongTest::UPD_ID_requestPing);            break;        case CMultiPingPongTest::RequestErrorAndResponse:            sendError(PingPongTest::UPD_ID_requestPing);            responsePong(L"Hi");            break;        case CMultiPingPongTest::ResponseErrorAndRequestError:            sendError(PingPongTest::UPD_ID_responsePong);            sendError(PingPongTest::UPD_ID_requestPing);            break;        case CMultiPingPongTest::RequestErrorAndResponseError:            sendError(PingPongTest::UPD_ID_requestPing);            sendError(PingPongTest::UPD_ID_responsePong);            break;        default:            CPPUNIT_FAIL("Unknown mode");            break;        }        engine()->remove(*this);    }
开发者ID:ptka,项目名称:DSI,代码行数:56,


示例24: TestThreadExceptionHaveCorrectThreadID

 void TestThreadExceptionHaveCorrectThreadID() {     SCXCoreLib::SCXHandle<SCXCoreLib::SCXThread> thread = GivenARunningThread();     try {         thread->Start(SCXThreadTest::SimpleThreadBodyTerminate);         CPPUNIT_FAIL("Expected exception not thrown: SCXThreadStartException");     } catch (SCXCoreLib::SCXThreadStartException& e) {         CPPUNIT_ASSERT_EQUAL(SCXCoreLib::SCXThread::GetCurrentThreadID(), e.GetThreadID());     } }
开发者ID:Microsoft,项目名称:pal,代码行数:10,


示例25: sprintf

void TestMoXie::CompareFrameElement(const Vector3& expected, const Vector3& actual, const char* message, Int32 frame, Int32 dimension, double precision){	if (fabs(actual[dimension]-expected[dimension]) > precision)	{		char failmessage[256];		sprintf(failmessage, "%s frame %u dimension %u: expected %lf got %lf (precision required %lf)",			message, frame, dimension, expected[dimension], actual[dimension], precision);		CPPUNIT_FAIL(failmessage);	}}
开发者ID:Alzathar,项目名称:Open3DMotion,代码行数:10,


示例26: Stat

        virtual void Stat(            const SCXCoreLib::SCXFilePath            & path,            SCXCoreLib::SCXFileSystem::SCXStatStruct * pStat)        {            // warnings as errors, so deal with the unused params            (void) path;            (void) pStat;            CPPUNIT_FAIL("The SCXLVMUtils external dependency Stat is not implemented for this test.");        }
开发者ID:vrdmr,项目名称:pal,代码行数:10,


示例27: open

/** * Create a new instance of ServoControllerDummy and  * set it to the private variable */void dashee::test::ServoUART::setUp(){    this->fd = open("/dev/ttyAMA0", O_RDWR | O_NOCTTY);    if (this->fd == -1)        CPPUNIT_FAIL("Cannot open file!");        struct termios options;    tcgetattr(this->fd, &options);    cfsetispeed(&options, B230400);    cfsetospeed(&options, B230400);    options.c_cflag &= ~PARENB;    options.c_cflag &= ~CSTOPB;    options.c_cflag &= ~CSIZE;    options.c_cflag |= CS8;    // no flow control    options.c_cflag &= ~CRTSCTS;    options.c_cflag |= CREAD | CLOCAL;  // turn on READ & ignore ctrl lines    options.c_iflag &= ~(IXON | IXOFF | IXANY); // turn off s/w flow ctrl    options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); // make raw    options.c_oflag &= ~OPOST; // make raw    // see: http://unixwiz.net/techtips/termios-vmin-vtime.html    options.c_cc[VMIN]  = 0;    options.c_cc[VTIME] = 10;    if (tcsetattr(this->fd, TCSANOW, &options) < 0)        CPPUNIT_FAIL("Initilizing UART failed");        // Reset the GPIO pin    dashee::GPIO gpio(18, dashee::GPIO::OUT);    gpio.low();    gpio.high();    // Important     dashee::sleep(10000);    this->servo = new dashee::ServoUART(&this->fd, 2);}
开发者ID:Sumeet002,项目名称:dashee,代码行数:47,



注:本文中的CPPUNIT_FAIL函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CPPUNIT_METRIC_START_TIMING函数代码示例
C++ CPPUNIT_ASSERT_NO_THROW函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。