• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CPPUNIT_ASSERT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: mme

void
MooseEnumTest::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,代码来源:MooseEnumTest.C


示例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,代码来源:scxfilepath_test.cpp


示例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,代码来源:CNLog2RatioEngineTest.cpp


示例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,代码来源:Vector4.cpp


示例5: handleEventTest

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


示例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,代码来源:QuatGenTest.cpp


示例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,代码来源:medOpMML3ParameterViewTest.cpp


示例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,代码来源:DHTests.cpp


示例9: CPPUNIT_ASSERT

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


示例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 protected]")
                                ,UtlString("boston"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("boston"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("boston"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("boston"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("boston"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("boston"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("boston"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("boston"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("boston"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         // permutation for the 'seattle' location
         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("seattle"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
//.........这里部分代码省略.........
开发者ID:mranga,项目名称:sipxecs,代码行数:101,代码来源:FallbackRulesUrlMappingTest.cpp


示例11: testAllLongDistancePermutations

      void testAllLongDistancePermutations()
      {
         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 protected]")
                                ,UtlString("boston"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 2 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("<sip:[email protected]>;q=0.9",actual);
         getResult( registrations, 1, "contact", actual);
         ASSERT_STR_EQUAL("<sip:[email protected]>;q=0.8",actual);
         registrations.destroyAll();
         
         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("boston"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 2 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("<sip:[email protected]>;q=0.9",actual);
         getResult( registrations, 1, "contact", actual);
         ASSERT_STR_EQUAL("<sip:[email protected]>;q=0.8",actual);
         registrations.destroyAll();
         
         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:2335[email protected]")
                                ,UtlString("boston"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 2 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("<sip:[email protected]>;q=0.9",actual);
         getResult( registrations, 1, "contact", actual);
         ASSERT_STR_EQUAL("<sip:[email protected]>;q=0.8",actual);
         registrations.destroyAll();

         // permutations for the 'seattle' location
         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("seattle"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 2 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("<sip:[email protected]>;q=0.9",actual);
         getResult( registrations, 1, "contact", actual);
         ASSERT_STR_EQUAL("<sip:[email protected]>;q=0.7",actual);
         registrations.destroyAll();
         
         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("seattle"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 2 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("<sip:[email protected]>;q=0.9",actual);
         getResult( registrations, 1, "contact", actual);
         ASSERT_STR_EQUAL("<sip:[email protected]>;q=0.7",actual);
         registrations.destroyAll();
         
         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("seattle"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 2 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("<sip:[email protected]>;q=0.9",actual);
         getResult( registrations, 1, "contact", actual);
         ASSERT_STR_EQUAL("<sip:[email protected]>;q=0.7",actual);
         registrations.destroyAll();

         // permutations for the other locations
         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("walla-walla"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();
         
         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString(""),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();
         
         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("ogden"),
//.........这里部分代码省略.........
开发者ID:mranga,项目名称:sipxecs,代码行数:101,代码来源:FallbackRulesUrlMappingTest.cpp


示例12: testAll800Permutations

      void testAll800Permutations()
      {
         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 );

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("boston"),
                                registrations
                                ) == OS_SUCCESS );

         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("regina"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString(""),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();
         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("new-york"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();
         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("DC"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("Philly"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString(""),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("miami"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         CPPUNIT_ASSERT( urlmap->getContactList( Url("sip:[email protected]")
                                ,UtlString("orlando"),
                                registrations
                                ) == OS_SUCCESS );
         CPPUNIT_ASSERT_EQUAL( 1 ,  registrations.getSize() );
         getResult( registrations, 0, "contact", actual);
         ASSERT_STR_EQUAL("sip:[email protected]",actual);
         registrations.destroyAll();

         delete urlmap;
      }
开发者ID:mranga,项目名称:sipxecs,代码行数:93,代码来源:FallbackRulesUrlMappingTest.cpp


示例13: CPPUNIT_ASSERT

void TestSpinNetwork::test_propose_step()
{
  // Create a random number generator
  Mocasinns::Random::Boost_MT19937 rng;
  
  // Define boolean variables indicating whether an index was tried to flip
  bool dynamic_index_0_found = false; bool static_index_0_found = false;
  bool dynamic_index_1_found = false; bool static_index_1_found = false;
  bool dynamic_index_2_found = false; bool static_index_2_found = false;

  // Suggest a lot of steps and test them
  for (unsigned int i = 0; i < 1000; ++i)
  {
    // Propose the two steps
    SpinNetworkStep<IsingSpin, std::vector<IsingSpin*> > step_dynamic
      = testnetwork_dynamic->propose_step(&rng);
    SpinNetworkStep<IsingSpin, std::array<IsingSpin*, 2> > step_static
      = testnetwork_static->propose_step(&rng);

    // Check the old and the new spins
    CPPUNIT_ASSERT(step_dynamic.get_old_spin() == IsingSpin(1));
    CPPUNIT_ASSERT(step_dynamic.get_new_spin() == IsingSpin(-1));
    CPPUNIT_ASSERT(step_static.get_old_spin() == IsingSpin(1));
    CPPUNIT_ASSERT(step_static.get_new_spin() == IsingSpin(-1));

    // Check the range of the indizes
    CPPUNIT_ASSERT(step_dynamic.get_flip_index() <= 2);
    CPPUNIT_ASSERT(step_static.get_flip_index() <= 2);

    // Check the indizes
    if (step_dynamic.get_flip_index() == 0) dynamic_index_0_found = true;
    if (step_dynamic.get_flip_index() == 1) dynamic_index_1_found = true;
    if (step_dynamic.get_flip_index() == 2) dynamic_index_2_found = true;
    if (step_static.get_flip_index() == 0) static_index_0_found = true;
    if (step_static.get_flip_index() == 1) static_index_1_found = true;
    if (step_static.get_flip_index() == 2) static_index_2_found = true;
  }

  CPPUNIT_ASSERT(dynamic_index_0_found);
  CPPUNIT_ASSERT(dynamic_index_1_found);
  CPPUNIT_ASSERT(dynamic_index_2_found);
  CPPUNIT_ASSERT(static_index_0_found);
  CPPUNIT_ASSERT(static_index_1_found);
  CPPUNIT_ASSERT(static_index_2_found);
}
开发者ID:SpeckFleck,项目名称:mocasinns,代码行数:45,代码来源:test_spin_network.cpp


示例14: iters

   void QuatGenMetricTest::testGenTimingSetRot()
   {
      double bokd = 1;
      float bokf = 1;
      gmtl::Quat<double> q1;
      const long iters(25000);
      CPPUNIT_METRIC_START_TIMING();

      for (long iter = 0; iter < iters; ++iter)
      {
         gmtl::set( q1, gmtl::makeNormal( gmtl::AxisAngled( bokd, bokd, bokd, bokd ) ) );
         bokd += q1[2];
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE( "QuatGenTest/setRot(quatd,axisangled)", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      gmtl::Quat<float> q2; bokf = 1.0f;
      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         gmtl::set( q2, gmtl::makeNormal( gmtl::AxisAnglef( bokf, bokf, bokf, bokf ) ) );
         bokf -= q2[3];
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE( "QuatGenTest/setRot(quatf,axisanglef)", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%


      gmtl::Quat<double> q3; bokd = 1.0f;
      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         gmtl::set( q3, gmtl::makeNormal( gmtl::AxisAngled( bokd, gmtl::Vec<double, 3>( bokd, bokd, bokd ) ) ) );
         bokd *= q3[1] + 1.2;
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE( "QuatGenTest/setRot(quatd,axisangled(r,vec))", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      gmtl::Quat<float> q4; bokf = 1.0f;
      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         gmtl::set( q4, gmtl::makeNormal( gmtl::AxisAnglef( bokf, gmtl::Vec<float, 3>( bokf, bokf, bokf ) ) ) );
         bokf += q4[1] + 1.2f;
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE( "QuatGenTest/setRot(quatf,axisanglef(r,vec))", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%


      gmtl::Quat<double> q5;
      gmtl::Vec<double, 3> v4(1,2,3), v5(1,2,3);
      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         gmtl::setRot( q5, gmtl::makeNormal( v4 ), gmtl::makeNormal( v5 ) );
         v4[2] += q5[1] + 1.2;
         v5[0] -= q5[2] + 1.2;
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE( "QuatGenTest/setRot(quatd,vec3d,vec3d)", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      gmtl::Quat<float> q6;
      gmtl::Vec<float, 3> v6(1,2,3), v7(1,2,3);
      CPPUNIT_METRIC_START_TIMING();
      for (long iter = 0; iter < iters; ++iter)
      {
         gmtl::setRot( q6, gmtl::makeNormal( v6 ), gmtl::makeNormal( v7 ) );
         v6[2] += q6[1] + 1.2f;
         v7[0] -= q6[2] + 1.2f;
      }
      CPPUNIT_METRIC_STOP_TIMING();
      CPPUNIT_ASSERT_METRIC_TIMING_LE( "QuatGenTest/setRot(quatf,vec3f,vec3f)", iters, 0.075f, 0.1f);  // warn at 7.5%, error at 10%

      // force intelligent compilers to do all the iterations (ie. to not optimize them out),
      // by using the variables computed...
      CPPUNIT_ASSERT( bokf != 0.998f );
      CPPUNIT_ASSERT( bokd != 0.0998 );
      CPPUNIT_ASSERT( q1[0] != 10000.0f );
      CPPUNIT_ASSERT( q2[1] != 10000.0f );
      CPPUNIT_ASSERT( q3[2] != 10000.0f );
      CPPUNIT_ASSERT( q4[3] != 10000.0f );
      CPPUNIT_ASSERT( q5[0] != 10000.0f );
      CPPUNIT_ASSERT( q6[1] != 10000.0f );
   }
开发者ID:CosmicPirate,项目名称:RayTracingRenderer,代码行数:83,代码来源:QuatGenTest.cpp


示例15: operator

	void operator()(const CoOrd next) {
		int dx = std::abs(next.first - last.first);
		int dy = std::abs(next.second - last.second);
		CPPUNIT_ASSERT(dx < 2 && dy < 2 && (dx || dy));
		last = next;
	}
开发者ID:MoLAoS,项目名称:Mandate,代码行数:6,代码来源:line_test.cpp


示例16: CPPUNIT_ASSERT

void NavigationSeriesTest::navigationTest()
{
    CPPUNIT_ASSERT(m_series);
    ::fwMedData::NavigationSeries::ContainerType positions =
    {
        {0., {-514.1606513019431, -94.68116795798758, 979.3785055174628}}
    };

    ::fwMedData::NavigationSeries::ContainerType move =
    {
        {0., {0.897820633950464, 0.13607544320686907, -1.2769419285130967}},
        {1421.375, {2.322431935080602, 0.33708203932328956, -3.734284956660633}},
        {2114.208, {2.43713135678714, -0.049220088700801926, -3.266794030753196}},
        {3377.9159999999997, {0., 0., 0.}},
        {4027.6536502546687, {-3.964310130780936, 0.08006285575503613, 5.313864037415808}},
        {6237.149579831932, {0., 0., 0.}},
        {6500.074702886248, {-0.8058588959846187, 1.6088833889257592, -2.2406369414514837}},
        {7616.651952461799, {0.15881288125106394, 0.9634983958585909, -3.792280054764281}},
        {9291.517826825127, {15.00876504273313, 1.948698699541007, 9.621351972786318}},
        {10328.339558573854, {8.746762102220163, -1.3252231011236748, 0.40990799919194243}},
        {11344.944, {3.107379091978582, 0.24758149132857085, -1.7704233405817775}},
        {13717.94906621392, {-14.868514648384936, -0.06864726970614742, -1.8512522029189045}},
        {14874.404074702887, {-2.1505985395333633, 0.0025699595738454374, -0.5800507110513734}},
        {15472.570458404074, {0.5463244285267206, -0.009449336194383946, -4.067785389892101}},
        {18862.179966044143, {0., 0., 0.}},
        {20576.923599320886, {-1.4763543428185393, 0.6215147468157091, 4.983670944496179}},
        {23208.855687606112, {0., 0., 0.}}
    };

    ::fwMedData::NavigationSeries::ContainerType lookAt =
    {
        {0., {216.48659596562175, -109.43725495319805, 0.}},
        {4027.6536502546687, {206.6271751068543, -90.3143606602177, -7.6435594203111314}},
        {6500.074702886248, {206.6271751068543, -90.3143606602177, -7.6435594203111314}}
    };

    // Test add API
    for(const auto& elt : positions)
    {
        m_series->addPosition(elt.first, elt.second);
    }
    for(const auto& elt : move)
    {
        m_series->addMove(elt.first, elt.second);
    }
    for(const auto& elt : lookAt)
    {
        m_series->addLookAt(elt.first, elt.second);
    }
    CPPUNIT_ASSERT_EQUAL(positions.size(), m_series->getPositionMap().size());
    CPPUNIT_ASSERT_EQUAL(move.size(), m_series->getMoveMap().size());
    CPPUNIT_ASSERT_EQUAL(lookAt.size(), m_series->getLookAtMap().size());

    CPPUNIT_ASSERT(positions == m_series->getPositionMap());
    CPPUNIT_ASSERT(move == m_series->getMoveMap());
    CPPUNIT_ASSERT(lookAt == m_series->getLookAtMap());

    // Create Path
    const ::boost::filesystem::path path = ::fwTools::System::getTemporaryFolder() / "navigationtest";
    ::boost::filesystem::create_directories(path);

    const std::string jsonzFile = "NavigationSeriesTest.jsonz";
    ::fwAtoms::Object::sptr atom1 = ::fwAtomConversion::convert(m_series);
    writeNavigation((path/jsonzFile), atom1);

    ::fwAtoms::Object::sptr atom2 = readNavigation(path/jsonzFile);

    ::fwData::Object::sptr object;
    ::fwMedData::NavigationSeries::sptr navigationSeries;

    object           = ::fwAtomConversion::convert(atom2, ::fwAtomConversion::AtomVisitor::ChangePolicy());
    navigationSeries = ::fwMedData::NavigationSeries::dynamicCast(object);

    // Test get API
    CPPUNIT_ASSERT(navigationSeries);
    CPPUNIT_ASSERT_EQUAL(positions.size(), navigationSeries->getPositionMap().size());
    CPPUNIT_ASSERT_EQUAL(mov 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CPPUNIT_ASSERT_EQUAL函数代码示例发布时间:2022-05-30
下一篇:
C++ CPPA_REQUIRE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap