当前位置: 首页>>代码示例>>C++>>正文


C++ CPPUNIT_ASSERT函数代码示例

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


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


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