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


C++ CPPUNIT_ASSERT_NO_THROW函数代码示例

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


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

示例1: matrix

 void MatrixWrapperTest::testAt()
 {
     MatrixImpl matrix(3, 2, Matrix::INT_32);
     
     CPPUNIT_ASSERT_NO_THROW(matrix.at<int32_t>(0, 1) = 42);
     CPPUNIT_ASSERT_EQUAL((int32_t)(42), const_cast<const MatrixImpl &>(matrix).at<int32_t>(0,1));
 }
开发者ID:joccccc,项目名称:stromx,代码行数:7,代码来源:MatrixWrapperTest.cpp

示例2: CPPUNIT_ASSERT_NO_THROW

void newtestclass::testAplusb_out_of_range_NO_THROW_03() {
    int a = 100;
    int b = 1;
    APlusB aPlusB;

    CPPUNIT_ASSERT_NO_THROW(aPlusB.aplusb(a, b));
}
开发者ID:8Observer8,项目名称:exampleOfException_APlusB,代码行数:7,代码来源:newtestclass.cpp

示例3: CPPUNIT_ASSERT_NO_THROW

    void
    StamperTest::stamp()
    {
	// test if stamping works
	StamperTestCommand stamp;
	stamp.magic.postPaid = false;
	stamper->setStamp(stamp);
	wns::ldk::CompoundPtr compound;
	CPPUNIT_ASSERT_NO_THROW(compound = sendCompound(newFakeCompound()));
	CPPUNIT_ASSERT_EQUAL((unsigned int)1, compoundsSent());
	StamperTestCommand* command = stamper->getCommand(compound->getCommandPool());
	CPPUNIT_ASSERT(!command->magic.postPaid);

	// test if Stamper uses its own instance to stamp
	stamp.magic.postPaid = true;
	compound = sendCompound(newFakeCompound());
	CPPUNIT_ASSERT_EQUAL((unsigned int)2, compoundsSent());
	command = stamper->getCommand(compound->getCommandPool());
	CPPUNIT_ASSERT(!command->magic.postPaid);

	// test if updating the stamp works
	stamper->setStamp(stamp);
	compound = sendCompound(newFakeCompound());
	CPPUNIT_ASSERT_EQUAL((unsigned int)3, compoundsSent());
	command = stamper->getCommand(compound->getCommandPool());
	CPPUNIT_ASSERT(command->magic.postPaid);
    }
开发者ID:lshmenor,项目名称:IMTAphy,代码行数:27,代码来源:StamperTest.cpp

示例4: BCESfindNearTest

void xRinexEphemerisStore :: BCESfindNearTest (void)
{
	ofstream DumpData;
	DumpData.open ("Logs/findNearTest.txt");

	gpstk::Rinex3EphemerisStore Store;
        int nr;
	nr = Store.loadFile("TestRinex06.031");

        std::list<gpstk::Rinex3NavData> R3NList;
        gpstk::GPSEphemerisStore GStore;
        list<gpstk::Rinex3NavData>::const_iterator it;
        Store.addToList(R3NList);
        for (it = R3NList.begin(); it != R3NList.end(); ++it)
          GStore.addEphemeris(gpstk::EngEphemeris(*it));

	gpstk::CivilTime Time(2006,1,31,13,0,1,2);
        const gpstk::CommonTime ComTime = (gpstk::CommonTime)Time;

	short PRN0 = 0;
	short PRN1 = 1;
	short PRN15 = 15;
	short PRN32 = 32;
	short PRN33 = 33;
   gpstk::SatID sid0(PRN0,gpstk::SatID::systemGPS);
   gpstk::SatID sid1(PRN1,gpstk::SatID::systemGPS);
   gpstk::SatID sid15(PRN15,gpstk::SatID::systemGPS);
   gpstk::SatID sid32(PRN32,gpstk::SatID::systemGPS);
   gpstk::SatID sid33(PRN33,gpstk::SatID::systemGPS);

	try
	{
		CPPUNIT_ASSERT_THROW(GStore.findNearEphemeris(sid0,ComTime),gpstk::InvalidRequest);
		CPPUNIT_ASSERT_THROW(GStore.findNearEphemeris(sid33,ComTime),gpstk::InvalidRequest);
		CPPUNIT_ASSERT_THROW(GStore.findNearEphemeris(sid1,gpstk::CommonTime::END_OF_TIME),
					gpstk::InvalidRequest);

		CPPUNIT_ASSERT_NO_THROW(GStore.findNearEphemeris(sid1, ComTime));

		const gpstk::EngEphemeris Eph1 = GStore.findNearEphemeris(sid1, ComTime);
		const gpstk::EngEphemeris Eph15 = GStore.findNearEphemeris(sid15, ComTime);
		const gpstk::EngEphemeris Eph32 = GStore.findNearEphemeris(sid32, ComTime);

		GStore.clear();

		GStore.addEphemeris(Eph1);
		GStore.addEphemeris(Eph15);
		GStore.addEphemeris(Eph32);

		GStore.dump(DumpData,1);

	}
	catch (gpstk::Exception& e)
	{
                e.addLocation(FILE_LOCATION);
		cout << e;
	}
	CPPUNIT_ASSERT(fileEqualTest((char*)"Logs/findNearTest.txt",(char*)"Checks/findNearTest.chk"));
}
开发者ID:idaohang,项目名称:GPSTk,代码行数:59,代码来源:xRinexEphemerisStore.cpp

示例5: app

/**
 * @details
 * Try to create a PipelineApplication with a configuration file name.
 * Expect no exceptions.
 */
void PipelineApplicationTest::test_commandLine_config()
{
    int argc = 2;
    char *argv[] = {(char*)"pelican", (char*)"--config=settings.xml"};

    QCoreApplication app(argc, argv);
    CPPUNIT_ASSERT_NO_THROW(PipelineApplication(argc, argv));
}
开发者ID:Error323,项目名称:pelican,代码行数:13,代码来源:PipelineApplicationTest.cpp

示例6: callConstantMethodInBaseClass_usesConstantInstance_noException

 void callConstantMethodInBaseClass_usesConstantInstance_noException()
 {
     DerivesToUseConstMethod instance;
     DerivesToUseConstMethod const* const_instance = &instance;
     OOLUA::register_class<DerivesToUseConstMethod>(*m_lua);
     m_lua->run_chunk("return function(obj) obj:cpp_func_const() end");
     CPPUNIT_ASSERT_NO_THROW(m_lua->call(1, const_instance));
 }
开发者ID:RyanSwann1,项目名称:ClimLib,代码行数:8,代码来源:const_functions.cpp

示例7: CPPUNIT_ASSERT_NO_THROW

void TriangleTestFixture::predicateTesting()
{
	// Shouldn't throw an error, unless <= predicate was flipped
	CPPUNIT_ASSERT_NO_THROW(predicate1 = std::make_unique<Triangle>(3, 4, 5));

	// Should throw an error, unless an || was flipped
	CPPUNIT_ASSERT_THROW(predicate2 = std::make_unique<Triangle>(1, 1, 3), NotTriangleException);
}
开发者ID:Amazao2,项目名称:CPPUnitDemo,代码行数:8,代码来源:TriangleTestFixture.cpp

示例8: CPPUNIT_ASSERT_NO_THROW

void 
TestAssertTest::testAssertNoThrow()
{
   int x;
   CPPUNIT_ASSERT_NO_THROW( x = 1234 );
   (void)x;

   try
   {
      CPPUNIT_ASSERT_NO_THROW( throw std::exception() );
   }
   catch ( CPPUNIT_NS::Exception & )
   {
      return;
   }
   throw std::exception();
}
开发者ID:LesleyLai,项目名称:cppunit,代码行数:17,代码来源:TestAssertTest.cpp

示例9: type

void ImageReaderWriterTest::testImageWriterExtension()
{
    // Data to write
    const size_t dim = 3;
    ::fwTools::Type type("uint8");
    ::fwData::Image::SizeType sizeExpected(dim);
    sizeExpected[0] = 10;
    sizeExpected[1] = 20;
    sizeExpected[2] = 30;
    ::fwData::Image::SpacingType spacingExpected(dim);
    spacingExpected[0] = 0.24;
    spacingExpected[1] = 1.07;
    spacingExpected[2] = 2.21;
    ::fwData::Image::OriginType originExpected(dim);
    originExpected[0] = -05.6;
    originExpected[1] = 15.16;
    originExpected[2] = 11.11;

    ::fwData::Image::sptr image = ::fwData::Image::New();
    ::fwTest::generator::Image::generateImage(image, sizeExpected, spacingExpected, originExpected, type);

    // Write to vtk image.
    const ::boost::filesystem::path file = ::fwTools::System::getTemporaryFolder()/ "temporaryFile.xxx";


    {
        const std::string srvtype("::io::IWriter");
        const std::string srvname("::ioVTK::ImageWriterService");


        ::fwServices::IService::sptr srv;
        srv = ::fwServices::registry::ServiceFactory::getDefault()->create( srvtype, srvname );

        CPPUNIT_ASSERT_MESSAGE(std::string("Failed to create service ") + srvname, srv);

        ::fwServices::OSR::registerService( image , srv );

        CPPUNIT_ASSERT_NO_THROW( srv->setConfiguration(getIOConfiguration(file)) );
        CPPUNIT_ASSERT_NO_THROW( srv->configure() );
        CPPUNIT_ASSERT_NO_THROW( srv->start() );
        CPPUNIT_ASSERT_THROW( srv->update(), ::fwTools::Failed);
        CPPUNIT_ASSERT_NO_THROW( srv->stop() );
        ::fwServices::OSR::unregisterService( srv );
    }
}
开发者ID:corentindesfarges,项目名称:fw4spl,代码行数:45,代码来源:ImageReaderWriterTest.cpp

示例10: GetImageStatisticsNoRules

  void GetImageStatisticsNoRules() {
    auto statisticsNode = mitk::CreateImageStatisticsNode(m_statisticsContainer, "testStatistics");
    auto standaloneDataStorage = mitk::StandaloneDataStorage::New();
    standaloneDataStorage->Add(statisticsNode);

    //no rules + 1 image --> test return nullptr
    mitk::ImageStatisticsContainer::ConstPointer emptyStatistic;
    CPPUNIT_ASSERT_NO_THROW(emptyStatistic = mitk::ImageStatisticsContainerManager::GetImageStatistics(standaloneDataStorage.GetPointer(), m_image.GetPointer()));
    CPPUNIT_ASSERT_EQUAL(emptyStatistic.IsNull(), true);

    //no rules + 1 image + 1 mask --> test return nullptr
    CPPUNIT_ASSERT_NO_THROW(emptyStatistic = mitk::ImageStatisticsContainerManager::GetImageStatistics(standaloneDataStorage.GetPointer(), m_image.GetPointer(), m_mask.GetPointer()));
    CPPUNIT_ASSERT_EQUAL(emptyStatistic.IsNull(), true);

    //no rules + 1 image + 1 planarFigure --> test return nullptr
    CPPUNIT_ASSERT_NO_THROW(emptyStatistic = mitk::ImageStatisticsContainerManager::GetImageStatistics(standaloneDataStorage.GetPointer(), m_image.GetPointer(), m_planarFigure.GetPointer()));
    CPPUNIT_ASSERT_EQUAL(emptyStatistic.IsNull(), true);
  }
开发者ID:Cdebus,项目名称:MITK,代码行数:18,代码来源:mitkImageStatisticsContainerManagerTest.cpp

示例11: TestAssign

    void TestAssign(void)
    {
        SCXCoreLib::SCXFilePath fp = *m_path;

        // Check may assign to itself.
        CPPUNIT_ASSERT_NO_THROW(*m_path = *m_path);
        // Check content after assign operation is equal.
        CPPUNIT_ASSERT(fp.Get() == m_path->Get());
    }
开发者ID:Microsoft,项目名称:pal,代码行数:9,代码来源:scxfilepath_test.cpp

示例12: TestNoConsumers

 void TestNoConsumers()
 {
     SCXCoreLib::SCXLogMediatorSimple mediator;
     CPPUNIT_ASSERT_NO_THROW(mediator.LogThisItem(SCXCoreLib::SCXLogItem(L"scxcore.something",
                                                                         SCXCoreLib::eHysterical,
                                                                         L"cowabunga",
                                                                         SCXSRCLOCATION,
                                                                         0)));
 }
开发者ID:Microsoft,项目名称:pal,代码行数:9,代码来源:scxlogmediatorsimple_test.cpp

示例13: ImageImpl

 void ImageWrapperTest::testResizeLength()
 {
     m_image = new ImageImpl();
     CPPUNIT_ASSERT_NO_THROW(m_image->resize(300, 200, runtime::Image::BGR_24));
     CPPUNIT_ASSERT_EQUAL((unsigned int)(300), m_image->width());
     CPPUNIT_ASSERT_EQUAL((unsigned int)(200), m_image->height());
     CPPUNIT_ASSERT_EQUAL(runtime::Image::BGR_24, m_image->pixelType());
     CPPUNIT_ASSERT_EQUAL(runtime::Variant::BGR_24_IMAGE, m_image->variant());
 }
开发者ID:roteroktober,项目名称:stromx,代码行数:9,代码来源:ImageWrapperTest.cpp

示例14: GetImageStatisticsWithImageConnected

  void GetImageStatisticsWithImageConnected()
  {
    //create rules connection
    auto statisticsNode = mitk::CreateImageStatisticsNode(m_statisticsContainer, "testStatistics");
    CreateNodeRelationImage(m_statisticsContainer.GetPointer(), m_image.GetPointer());
    auto standaloneDataStorage = mitk::StandaloneDataStorage::New();
    standaloneDataStorage->Add(statisticsNode);

    //rule: (image-->statistics), 1 connected image --> test return image statistics
    mitk::ImageStatisticsContainer::ConstPointer statisticsWithImage;
    CPPUNIT_ASSERT_NO_THROW(statisticsWithImage = mitk::ImageStatisticsContainerManager::GetImageStatistics(standaloneDataStorage.GetPointer(), m_image.GetPointer()));
    CPPUNIT_ASSERT_EQUAL(statisticsWithImage->GetUID(), m_statisticsContainer->GetUID());

    //new rule: (image2-->statistics2 AND mask --> statistics2)
    CreateNodeRelationImage(m_statisticsContainer2.GetPointer(), m_image2.GetPointer());
    CreateNodeRelationMask(m_statisticsContainer2.GetPointer(), m_mask.GetPointer());

    auto statisticsNode2 = mitk::CreateImageStatisticsNode(m_statisticsContainer2, "testStatistics2");
    standaloneDataStorage->Add(statisticsNode2);

    //--> test return (still) image statistics (!= statistics2)
    mitk::ImageStatisticsContainer::ConstPointer statisticsWithImageAgain;
    CPPUNIT_ASSERT_NO_THROW(statisticsWithImageAgain = mitk::ImageStatisticsContainerManager::GetImageStatistics(standaloneDataStorage.GetPointer(), m_image.GetPointer()));
    CPPUNIT_ASSERT_EQUAL(statisticsWithImageAgain->GetUID(), m_statisticsContainer->GetUID());
    CPPUNIT_ASSERT_EQUAL(statisticsWithImageAgain->GetUID() != m_statisticsContainer2->GetUID(), true);

    //--> test return image statistics 2
    CPPUNIT_ASSERT_NO_THROW(statisticsWithImageAgain = mitk::ImageStatisticsContainerManager::GetImageStatistics(standaloneDataStorage.GetPointer(), m_image2.GetPointer(), m_mask.GetPointer()));
    CPPUNIT_ASSERT_EQUAL(statisticsWithImageAgain->GetUID(), m_statisticsContainer2->GetUID());
    CPPUNIT_ASSERT_EQUAL(statisticsWithImageAgain->GetUID() != m_statisticsContainer->GetUID(), true);

    //add another newer statistic: should return this newer one
    auto statisticsContainerNew = mitk::ImageStatisticsContainer::New();
    CreateNodeRelationImage(statisticsContainerNew.GetPointer(), m_image.GetPointer());

    auto statisticsNodeNew = mitk::CreateImageStatisticsNode(statisticsContainerNew, "testStatisticsNew");
    standaloneDataStorage->Add(statisticsNodeNew);
    statisticsContainerNew->Modified();

    mitk::ImageStatisticsContainer::ConstPointer statisticsWithImageNew;
    CPPUNIT_ASSERT_NO_THROW(statisticsWithImageNew = mitk::ImageStatisticsContainerManager::GetImageStatistics(standaloneDataStorage.GetPointer(), m_image.GetPointer()));
    CPPUNIT_ASSERT_EQUAL(statisticsWithImageNew->GetUID(), statisticsContainerNew->GetUID());
    CPPUNIT_ASSERT_EQUAL(statisticsWithImageNew->GetUID() != m_statisticsContainer->GetUID(), true);
  }
开发者ID:Cdebus,项目名称:MITK,代码行数:44,代码来源:mitkImageStatisticsContainerManagerTest.cpp

示例15: Save

void RecTestCase::TestContactList()
{
    recContactList record1;
    record1.FSetID( 0 );
    record1.FSetIndID( 3 );  // Doesn't exist so will cause an exception on Save()
#if ALLOW_SQL_MEMORY_LEAK
    // id = 0 so create new record and set id to new value.
    CPPUNIT_ASSERT_THROW( record1.Save(), wxSQLite3Exception );
#endif
    recIndividual ind(0);
    ind.FSetID(3);
    CPPUNIT_ASSERT_NO_THROW( ind.Save() );
    CPPUNIT_ASSERT_NO_THROW( record1.Save() );
    idt id = record1.FGetID();
    CPPUNIT_ASSERT( id > 0 );

    recContactList record2;
    record2.FSetID( record1.FGetID() );
    CPPUNIT_ASSERT_NO_THROW( record2.Read() );
    CPPUNIT_ASSERT( record1 == record2 );

    record1.FSetIndID( 0 );
    // id exists, so amend record leaving id to old value.
    CPPUNIT_ASSERT_NO_THROW( record1.Save() );
    CPPUNIT_ASSERT( record1.f_id == id );
    CPPUNIT_ASSERT_NO_THROW( record2.Read() );
    CPPUNIT_ASSERT( record1 == record2 );

    record1.FSetID( 999 );
    record1.FSetIndID( 3 );
    // id = 999 which doesn't exists, so create new record with no change to id.
    CPPUNIT_ASSERT_NO_THROW( record1.Save() );
    CPPUNIT_ASSERT( record1.FGetID() == 999 );
    record2.FSetID( record1.FGetID() );
    CPPUNIT_ASSERT_NO_THROW( record2.Read() );
    CPPUNIT_ASSERT( record1 == record2 );

    record1.FSetID( 0 );
    record1.FSetIndID( 0 );
    CPPUNIT_ASSERT_NO_THROW( record1.Save() );
    CPPUNIT_ASSERT( record1.FGetID() != 0 );
    CPPUNIT_ASSERT( record1.Exists() == true );
    CPPUNIT_ASSERT_NO_THROW( record1.Delete() );
    CPPUNIT_ASSERT( record1.Exists() == false );

    CPPUNIT_ASSERT( recContactList::Exists( 999 ) == true );
    recContactList::Delete( 999 );
    CPPUNIT_ASSERT( recContactList::Exists( 999 ) == false );
}
开发者ID:nickmat,项目名称:thefamilypack,代码行数:49,代码来源:testDatabase.cpp


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