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

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

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

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

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

示例1: mme

voidMooseEnumTest::multiTestOne(){  MultiMooseEnum mme("one two three four", "two");  CPPUNIT_ASSERT( mme.contains("one") == false );  CPPUNIT_ASSERT( mme.contains("two") == true );  CPPUNIT_ASSERT( mme.contains("three") == false );  CPPUNIT_ASSERT( mme.contains("four") == false );  mme.push_back("four");  CPPUNIT_ASSERT( mme.contains("one") == false );  CPPUNIT_ASSERT( mme.contains("two") == true );  CPPUNIT_ASSERT( mme.contains("three") == false );  CPPUNIT_ASSERT( mme.contains("four") == true );  // isValid  CPPUNIT_ASSERT ( mme.isValid() == true );  mme.clear();  CPPUNIT_ASSERT ( mme.isValid() == false );  mme.push_back("one three");  CPPUNIT_ASSERT( mme.contains("one") == true );  CPPUNIT_ASSERT( mme.contains("two") == false );  CPPUNIT_ASSERT( mme.contains("three") == true );  CPPUNIT_ASSERT( mme.contains("four") == false );  std::vector<std::string> mvec(2);  mvec[0] = "one";  mvec[1] = "two";  std::set<std::string> mset;  mset.insert("two");  mset.insert("three");  // Assign  mme = mvec;  CPPUNIT_ASSERT( mme.contains("one") == true );  CPPUNIT_ASSERT( mme.contains("two") == true );  CPPUNIT_ASSERT( mme.contains("three") == false );  CPPUNIT_ASSERT( mme.contains("four") == false );  mme = mset;  CPPUNIT_ASSERT( mme.contains("one") == false );  CPPUNIT_ASSERT( mme.contains("two") == true );  CPPUNIT_ASSERT( mme.contains("three") == true );  CPPUNIT_ASSERT( mme.contains("four") == false );  // Insert  mme.push_back(mvec);  CPPUNIT_ASSERT( mme.contains("one") == true );  CPPUNIT_ASSERT( mme.contains("two") == true );  CPPUNIT_ASSERT( mme.contains("three") == true );  CPPUNIT_ASSERT( mme.contains("four") == false );  mme.clear();  mme = "one four";  CPPUNIT_ASSERT( mme.contains("one") == true );  CPPUNIT_ASSERT( mme.contains("two") == false );  CPPUNIT_ASSERT( mme.contains("three") == false );  CPPUNIT_ASSERT( mme.contains("four") == true );  mme.push_back("three four");  CPPUNIT_ASSERT( mme.contains("one") == true );  CPPUNIT_ASSERT( mme.contains("two") == false );  CPPUNIT_ASSERT( mme.contains("three") == true );  CPPUNIT_ASSERT( mme.contains("four") == true );  // Size  CPPUNIT_ASSERT( mme.size() == 4 );  CPPUNIT_ASSERT( mme.unique_items_size() == 3 );  // All but "two" should be in the Enum  std::set<std::string> compare_set, return_set, difference;  for (MooseEnumIterator it = mme.begin(); it != mme.end(); ++it)    return_set.insert(*it);  compare_set.insert("ONE");  compare_set.insert("THREE");  compare_set.insert("FOUR");  std::set_symmetric_difference(return_set.begin(), return_set.end(),                                compare_set.begin(), compare_set.end(),                                std::inserter(difference, difference.end()));  CPPUNIT_ASSERT( difference.size() == 0 );  // Order and indexing  mme.clear();  mme = "one two four";  CPPUNIT_ASSERT( mme.contains("three") == false );  CPPUNIT_ASSERT( mme[0] == "one" );  CPPUNIT_ASSERT( mme[1] == "two" );  CPPUNIT_ASSERT( mme[2] == "four" );}
开发者ID:AhmedAly83,项目名称:moose,代码行数:97,


示例2: callDumpStringForCoverage

 void callDumpStringForCoverage() {     CPPUNIT_ASSERT(m_path->DumpString().find(L"SCXFilePath") != std::wstring::npos);     CPPUNIT_ASSERT(m_path->DumpString().find(m_path->GetDirectory()) != std::wstring::npos);     CPPUNIT_ASSERT(m_path->DumpString().find(m_path->GetFilename()) != std::wstring::npos); }
开发者ID:Microsoft,项目名称:pal,代码行数:6,


示例3: CPPUNIT_ASSERT

void CNLog2RatioEngineTest::defineOptionsTest(){	cout<<endl;	Verbose::out(1, "****CNLog2RatioEngineTest::defineOptionsTest****");	CNLog2RatioEngine m_objCNLog2RatioEngine;	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOptBool("help")==false);	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOptInt("verbose")==1);	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOptBool("version")==false);	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("out-dir")==".");	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("command-line")=="");	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("exec-guid")=="");	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("program-name")=="");	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("program-company")=="");	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("program-version")=="");	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("program-cvs-id")=="");	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("version-to-report")=="");	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("probeset-ids")=="");	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("annotation-file")=="");	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("expr-summary-file")=="");	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("genotype-calls-file")=="");	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("genotype-confidences-file")=="");	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("genotype-report-file")=="");    CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOptInt("xChromosome")==24);	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOptInt("yChromosome")==25);	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("reference-file")=="");	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOptBool("call-copynumber-engine")==true);	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOptBool("log2ratio-hdf5-output")==false);	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOptBool("log2ratio-text-output")==false);	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOptInt("mem-usage")==0);	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("analysis")=="");	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOptInt("gc-correction-bin-count")==25);	CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOptBool("delete-files")==false);    CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOptBool("log2-input")==false);    CPPUNIT_ASSERT(m_objCNLog2RatioEngine.getOpt("gc-content-override-file")=="");}
开发者ID:einon,项目名称:affymetrix-power-tools,代码行数:35,


示例4: result

    void Vector4Test::testComparisonOperatorGreaterThan() {        const Vector4f result( 0.0f, 0.0f, 0.0f, 0.0f );        const Vector4f expected( 1.0f, 1.0f, 1.0f, 1.0f );		        CPPUNIT_ASSERT( expected > result );    }
开发者ID:Omegaice,项目名称:Math,代码行数:6,


示例5: handleEventTest

	void handleEventTest() {		Event *e = new EventAA();		manager.postEvent(e);		CPPUNIT_ASSERT(handled);	}
开发者ID:CESNET,项目名称:glite-lb,代码行数:5,


示例6: expected_result1

   void QuatGenTest::testQuatMakeRot()   {      const float eps = 0.0001f;      gmtl::Quat<float> q1, q2;      q1 = gmtl::make<gmtl::Quat<float> >( gmtl::AxisAnglef( gmtl::Math::deg2Rad( 90.0f ), 1.0f, 0.0f, 0.0f ) );      q2 = gmtl::make<gmtl::Quat<float> >( gmtl::AxisAnglef( gmtl::Math::deg2Rad( 32.0f ), 0.0f, 1.0f, 0.0f ) );      gmtl::Quat<float> expected_result1( 0.707107f, 0, 0, 0.707107f );      gmtl::Quat<float> expected_result2( 0, 0.275637f, 0, 0.961262f );      CPPUNIT_ASSERT( gmtl::isEqual( expected_result1, q1, eps ) );      CPPUNIT_ASSERT( gmtl::isEqual( expected_result2, q2, eps ) );      CPPUNIT_ASSERT( gmtl::isNormalized( q1, eps ) );      CPPUNIT_ASSERT( gmtl::isNormalized( q2, eps ) );      // values from VR Juggler math lib...      std::vector< gmtl::Quat<float> > quats;      quats.push_back( gmtl::Quat<float>( 0, 0, 0, -1       ) );      quats.push_back( gmtl::Quat<float>( -0, -0.173648f, -0, -0.984808f) );      quats.push_back( gmtl::Quat<float>( -0, -0.34202f, -0, -0.939693f ) );      quats.push_back( gmtl::Quat<float>( -0, -0.5f, -0, -0.866025f     ) );      quats.push_back( gmtl::Quat<float>( -0, -0.642788f, -0, -0.766044f) );      quats.push_back( gmtl::Quat<float>( -0, -0.766044f, -0, -0.642788f) );      quats.push_back( gmtl::Quat<float>( -0, -0.866025f, -0, -0.5f     ) );      quats.push_back( gmtl::Quat<float>( -0, -0.939693f, -0, -0.34202f ) );      quats.push_back( gmtl::Quat<float>( -0, -0.984808f, -0, -0.173648f) );      quats.push_back( gmtl::Quat<float>( -0, -1, -0, 0    ) );      quats.push_back( gmtl::Quat<float>( -0, -0.984808f, -0, 0.173648f ) );      quats.push_back( gmtl::Quat<float>( -0, -0.939693f, -0, 0.34202f  ) );      quats.push_back( gmtl::Quat<float>( -0, -0.866025f, -0, 0.5f      ) );      quats.push_back( gmtl::Quat<float>( -0, -0.766044f, -0, 0.642788f ) );      quats.push_back( gmtl::Quat<float>( -0, -0.642788f, -0, 0.766044f ) );      quats.push_back( gmtl::Quat<float>( -0, -0.5f, -0, 0.866025f      ) );      quats.push_back( gmtl::Quat<float>( -0, -0.34202f, -0, 0.939693f  ) );      quats.push_back( gmtl::Quat<float>( -0, -0.173648f, -0, 0.984808f ) );      quats.push_back( gmtl::Quat<float>( 0, 0, 0, 1                  ) );      quats.push_back( gmtl::Quat<float>( 0, 0.173648f, 0, 0.984808f    ) );      quats.push_back( gmtl::Quat<float>( 0, 0.34202f, 0, 0.939693f     ) );      quats.push_back( gmtl::Quat<float>( 0, 0.5f, 0, 0.866025f         ) );      quats.push_back( gmtl::Quat<float>( 0, 0.642788f, 0, 0.766044f    ) );      quats.push_back( gmtl::Quat<float>( 0, 0.766044f, 0, 0.642788f    ) );      quats.push_back( gmtl::Quat<float>( 0, 0.866025f, 0, 0.5f         ) );      quats.push_back( gmtl::Quat<float>( 0, 0.939693f, 0, 0.34202f     ) );      quats.push_back( gmtl::Quat<float>( 0, 0.984808f, 0, 0.173648f    ) );      quats.push_back( gmtl::Quat<float>( 0, 1, 0, 0       ) );      quats.push_back( gmtl::Quat<float>( 0, 0.984808f, 0, -0.173648f   ) );      quats.push_back( gmtl::Quat<float>( 0, 0.939693f, 0, -0.34202f    ) );      quats.push_back( gmtl::Quat<float>( 0, 0.866025f, 0, -0.5f        ) );      quats.push_back( gmtl::Quat<float>( 0, 0.766044f, 0, -0.642788f   ) );      quats.push_back( gmtl::Quat<float>( 0, 0.642788f, 0, -0.766044f   ) );      quats.push_back( gmtl::Quat<float>( 0, 0.5f, 0, -0.866025f        ) );      quats.push_back( gmtl::Quat<float>( 0, 0.34202f, 0, -0.939693f    ) );      quats.push_back( gmtl::Quat<float>( 0, 0.173648f, 0, -0.984808f   ) );      quats.push_back( gmtl::Quat<float>( -0, 0, -0, -1    ) );      /// @todo check this against another math lib other than VR Juggler...      int count = 0;      for (int x = -360; x <= 360; x += 20)      {         gmtl::Quat<float> q3;         CPPUNIT_ASSERT( count >= 0 );         gmtl::set( q2, gmtl::AxisAnglef( gmtl::Math::deg2Rad( float(x) ), 0.0f, 1.0f, 0.0f ) );         gmtl::set( q3, gmtl::AxisAnglef( gmtl::Math::deg2Rad( float(x) ), gmtl::Vec3f( 0.0f, 1.0f, 0.0f ) ) );         CPPUNIT_ASSERT( gmtl::isEqual( quats[count], q2, eps ) );         CPPUNIT_ASSERT( gmtl::isEqual( q3, q2, eps ) );         // make sure that makeRot and setRot do the same thing...         CPPUNIT_ASSERT( gmtl::make<gmtl::Quat<float> >( gmtl::AxisAnglef( gmtl::Math::deg2Rad( float(x) ), 0.0f, 1.0f, 0.0f ) ) == q2 );         CPPUNIT_ASSERT( gmtl::make<gmtl::Quat<float> >( gmtl::AxisAnglef( gmtl::Math::deg2Rad( float(x) ), gmtl::Vec3f( 0.0f, 1.0f, 0.0f ) ) ) == q3 );         count++;      }   }
开发者ID:CosmicPirate,项目名称:RayTracingRenderer,代码行数:72,


示例7: name

//.........这里部分代码省略.........  mafString controlOriginFile=MED_DATA_ROOT;  //controlOriginFile << "/Test_OpMML3ParameterView/";  controlOriginFile << "/";  controlOriginFile << name.c_str();  controlOriginFile << "_";  controlOriginFile << "image";  controlOriginFile << test_name.GetCStr();  controlOriginFile << ".jpg";  fstream controlStream;  controlStream.open(controlOriginFile.GetCStr());   // visualization control  m_RenderWindow->OffScreenRenderingOn();  vtkWindowToImageFilter *w2i;  vtkNEW(w2i);  w2i->SetInput(m_RenderWindow);  //w2i->SetMagnification(magnification);  w2i->Update();  m_RenderWindow->OffScreenRenderingOff();  //write comparing image  vtkJPEGWriter *w;  vtkNEW(w);  w->SetInput(w2i->GetOutput());  mafString imageFile=MED_DATA_ROOT;  if(!controlStream)  {    imageFile << "/";    imageFile << name.c_str();    imageFile << "_";    imageFile << "image";  }  else  {    imageFile << "/";    imageFile << name.c_str();    imageFile << "_";    imageFile << "comp";  }  imageFile << test_name.GetCStr();  imageFile << ".jpg";  w->SetFileName(imageFile.GetCStr());  w->Write();  if(!controlStream)  {    controlStream.close();    vtkDEL(w);    vtkDEL(w2i);    return;  }  controlStream.close();  //read original Image  vtkJPEGReader *rO;  vtkNEW(rO);  mafString imageFileOrig=MED_DATA_ROOT;  imageFileOrig << "/";  imageFileOrig << name.c_str();  imageFileOrig << "_";  imageFileOrig << "image";  imageFileOrig << test_name.GetCStr();  imageFileOrig << ".jpg";  rO->SetFileName(imageFileOrig.GetCStr());  rO->Update();  vtkImageData *imDataOrig = rO->GetOutput();  //read compared image  vtkJPEGReader *rC;  vtkNEW(rC);  rC->SetFileName(imageFile.GetCStr());  rC->Update();  vtkImageData *imDataComp = rC->GetOutput();  vtkImageMathematics *imageMath = vtkImageMathematics::New();  imageMath->SetInput1(imDataOrig);  imageMath->SetInput2(imDataComp);  imageMath->SetOperationToSubtract();  imageMath->Update();  double srR[2] = {-1,1};  imageMath->GetOutput()->GetPointData()->GetScalars()->GetRange(srR);  CPPUNIT_ASSERT(srR[0] == 0.0 && srR[1] == 0.0);  // end visualization control  vtkDEL(imageMath);  vtkDEL(rC);  vtkDEL(rO);  vtkDEL(w);  vtkDEL(w2i);}
开发者ID:besoft,项目名称:MAF2Medical,代码行数:101,


示例8: CPPUNIT_ASSERT

void DHTests::testSerialisation(){	// Generate 1024-bit parameters for testing	DHParameters* p;	AsymmetricParameters** ap = (AsymmetricParameters**) &p;	//CPPUNIT_ASSERT(dh->generateParameters(ap, (void*) 1024));	// changed for 512-bit for speed...#ifndef WITH_BOTAN	CPPUNIT_ASSERT(dh->generateParameters(ap, (void*) 1024));#else	CPPUNIT_ASSERT(dh->generateParameters(ap, (void*) 512));#endif	// Set a fixed private value length	p->setXBitLength(128);	// Serialise the parameters	ByteString serialisedParams = p->serialise();	// Deserialise the parameters	AsymmetricParameters* dP;	CPPUNIT_ASSERT(dh->reconstructParameters(&dP, serialisedParams));	CPPUNIT_ASSERT(dP->areOfType(DHParameters::type));	DHParameters* ddP = (DHParameters*) dP;	CPPUNIT_ASSERT(p->getP() == ddP->getP());	CPPUNIT_ASSERT(p->getG() == ddP->getG());	CPPUNIT_ASSERT(p->getXBitLength() == ddP->getXBitLength());	// Generate a key-pair	AsymmetricKeyPair* kp;	CPPUNIT_ASSERT(dh->generateKeyPair(&kp, dP));	// Serialise the key-pair	ByteString serialisedKP = kp->serialise();	// Deserialise the key-pair	AsymmetricKeyPair* dKP;	CPPUNIT_ASSERT(dh->reconstructKeyPair(&dKP, serialisedKP));	// Check the deserialised key-pair	DHPrivateKey* privKey = (DHPrivateKey*) kp->getPrivateKey();	DHPublicKey* pubKey = (DHPublicKey*) kp->getPublicKey();	DHPrivateKey* dPrivKey = (DHPrivateKey*) dKP->getPrivateKey();	DHPublicKey* dPubKey = (DHPublicKey*) dKP->getPublicKey();	CPPUNIT_ASSERT(privKey->getP() == dPrivKey->getP());	CPPUNIT_ASSERT(privKey->getG() == dPrivKey->getG());	CPPUNIT_ASSERT(privKey->getX() == dPrivKey->getX());	CPPUNIT_ASSERT(pubKey->getP() == dPubKey->getP());	CPPUNIT_ASSERT(pubKey->getG() == dPubKey->getG());	CPPUNIT_ASSERT(pubKey->getY() == dPubKey->getY());	dh->recycleParameters(p);	dh->recycleParameters(dP);	dh->recycleKeyPair(kp);	dh->recycleKeyPair(dKP);}
开发者ID:GarysRefererence2014,项目名称:SoftHSMv2,代码行数:66,


示例9: CPPUNIT_ASSERT

void WoWBrainTest::testGetAIPlane() {    CPPUNIT_ASSERT(ai->getAIPlane()->getId() == 1);}
开发者ID:THeK3nger,项目名称:Wings-of-War,代码行数:3,


示例10: testAllEmergencyPermutations

      void testAllEmergencyPermutations()      {         FallbackRulesUrlMapping* urlmap;         ResultSet registrations;         UtlString actual;         CPPUNIT_ASSERT( urlmap = new FallbackRulesUrlMapping() );         UtlString simpleXml;         mFileTestContext->inputFilePath("fallbackrules.xml", simpleXml);         CPPUNIT_ASSERT( urlmap->loadMappings(simpleXml.data() ) == OS_SUCCESS );         // permutations for the 'boston' location         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email
C++ CPPUNIT_ASSERT_EQUAL函数代码示例
C++ CPPA_REQUIRE函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。