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


C++ TearDown函数代码示例

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


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

示例1: main

int main()
{
    printf("hello world\n");

    if(SetUp() < 0)
    { 
        TearDown();
        return -1;
    }

    GetPortMappingNum();

    //int i = 0;
    //for(i=0; i<30; i++)
    //{
    //    GetPortMappingByIndex(i);
    //}

    GetPortMapping(16738, "TCP");
    GetPortMapping(16738, "UDP");

    AddPortMapping(16738, 16738, "TCP", g_lanaddr);
    AddPortMapping(16738, 16738, "UDP", g_lanaddr);
    AddPortMapping(16738, 16738, "TCP", "192.168.1.120");
    AddPortMapping(16738, 16738, "UDP", "192.168.1.120");

    TearDown();

    return 0;
}
开发者ID:sylcrq,项目名称:study,代码行数:30,代码来源:upnptest.c

示例2: TEST_F

TEST_F(MindMapModelTest, sortChangeParent)
{
	Mindmapmodel->createMindMap("Root");
	Mindmapmodel->createNode("Node1");
	Mindmapmodel->insertNodeChild(0, 1);
	Mindmapmodel->createNode("Node2");
	Mindmapmodel->insertNodeChild(1, 2);
	Mindmapmodel->createNode("Node3");
	Mindmapmodel->insertNodeSibling(1, 3);
	ASSERT_FALSE(Mindmapmodel->sortChangeParent(Mindmapmodel->MindMap[1]->getNodeList(), FIRST_NODE, 3));
	TearDown();
	SetUp();
	Mindmapmodel->createMindMap("Root");
	Mindmapmodel->createNode("Node1");
	Mindmapmodel->insertNodeChild(0, 1);
	Mindmapmodel->createNode("Node2");
	Mindmapmodel->insertNodeChild(1, 2);
	Mindmapmodel->createNode("Node3");
	Mindmapmodel->insertNodeSibling(1, 3);
	ASSERT_TRUE(Mindmapmodel->sortChangeParent(Mindmapmodel->MindMap[1]->getNodeList(), FIRST_NODE, 2));
	TearDown();
	SetUp();
	Mindmapmodel->createMindMap("Root");
	Mindmapmodel->createNode("Node1");
	Mindmapmodel->insertNodeChild(0, 1);
	Mindmapmodel->createNode("Node2");
	Mindmapmodel->insertNodeChild(1, 2);
	Mindmapmodel->createNode("Node3");
	Mindmapmodel->insertNodeChild(2, 3);
	ASSERT_TRUE(Mindmapmodel->sortChangeParent(Mindmapmodel->MindMap[1]->getNodeList(), FIRST_NODE, 3));
}
开发者ID:BonChou,项目名称:POSD_HW1,代码行数:31,代码来源:MindMapModelTest.cpp

示例3: SetUp

    void RattlerRemovalServiceTests::RemoveRattlers_ForMixedPacking_CorrectParticlesRemoved()
    {
        SetUp();

        // The second particle is outside
        const FLOAT_TYPE diameter = 1.0;
        const SpatialVector c0 = {{4, 4, 0}};
        const SpatialVector c1 = {{7, 7, 0}};
        const SpatialVector c2 = {{5, 4, 0}};
        const SpatialVector c3 = {{5, 5, 0}};
        particles[0] = DomainParticle(0, diameter, c0);
        particles[1] = DomainParticle(1, diameter, c1);
        particles[2] = DomainParticle(2, diameter, c2);
        particles[3] = DomainParticle(3, diameter, c3);

        rattlerRemovalService->SetParticles(particles);

        vector<bool> rattlerMask(particlesCount);
        rattlerRemovalService->FillRattlerMask(0.999, &rattlerMask);

        boost::array<bool, 4> expectedRattlerMask = {{false, true, false, false}};
        Assert::AreVectorsEqual(expectedRattlerMask, rattlerMask, "RemoveRattlers_ForMixedPacking_CorrectParticlesRemoved");

        TearDown();
    }
开发者ID:VasiliBaranov,项目名称:packing-generation,代码行数:25,代码来源:RattlerRemovalServiceTests.cpp

示例4: TEST_F

TEST_F(nearest_neighbor_test, save_load) {
  {
    core::fv_converter::datum d;
    d.string_values_.push_back(std::make_pair("k1", "val"));
    nearest_neighbor_->set_row("1", d);
  }

  // save to a buffer
  msgpack::sbuffer sbuf;
  msgpack::packer<msgpack::sbuffer> packer(sbuf);
  nearest_neighbor_->get_mixable_holder()->pack(packer);

  // restart the driver
  TearDown();
  SetUp();

  // unpack the buffer
  msgpack::unpacked unpacked;
  msgpack::unpack(&unpacked, sbuf.data(), sbuf.size());
  nearest_neighbor_->get_mixable_holder()->unpack(unpacked.get());

  std::vector<std::pair<std::string, float> > res
      = nearest_neighbor_->similar_row("1", 1);
  ASSERT_EQ(1u, res.size());
  EXPECT_EQ("1", res[0].first);
}
开发者ID:torash,项目名称:jubatus,代码行数:26,代码来源:nearest_neighbor_test.cpp

示例5: Run

        /// @param iterations Number of iterations to gather data for.
        /// @returns the number of nanoseconds the run took.
        uint64_t Run(std::size_t iterations)
        {
            std::size_t iteration = iterations;
            
            // Set up the testing fixture.
            SetUp();

            // Get the starting time.
            Clock::TimePoint startTime, endTime;

            startTime = Clock::Now();

            // Run the test body for each iteration.
            while (iteration--)
                TestBody();

            // Get the ending time.
            endTime = Clock::Now();

            // Tear down the testing fixture.
            TearDown();

            // Return the duration in nanoseconds.
            return Clock::Duration(startTime, endTime);
        }
开发者ID:MariusHerget,项目名称:hayai,代码行数:27,代码来源:hayai_test.hpp

示例6: LOG

bool VideoOutputOpenGLVAAPI::InputChanged(const QSize &input_size, float aspect,
                              MythCodecID  av_codec_id, void *codec_private,
                              bool &aspect_only)
{
    LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("InputChanged(%1,%2,%3) %4->%5")
            .arg(input_size.width()).arg(input_size.height()).arg(aspect)
            .arg(toString(video_codec_id)).arg(toString(av_codec_id)));

    if (!codec_is_vaapi(av_codec_id))
        return VideoOutputOpenGL::InputChanged(input_size, aspect, av_codec_id,
                                               codec_private, aspect_only);
                                                   
    QMutexLocker locker(&gl_context_lock);

    bool wasembedding = window.IsEmbedding();
    QRect oldrect;
    if (wasembedding)
    {
        oldrect = window.GetEmbeddingRect();
        StopEmbedding();
    }

    bool cid_changed = (video_codec_id != av_codec_id);
    bool res_changed = input_size  != window.GetActualVideoDim();
    bool asp_changed = aspect      != window.GetVideoAspect();
    
    if (!res_changed && !cid_changed)
    {
        if (asp_changed)
        {
            aspect_only = true;
            VideoAspectRatioChanged(aspect);
            MoveResize();
            if (wasembedding)
                EmbedInWidget(oldrect);
        }
        return true;
    }

    if (gCoreContext->IsUIThread())
        TearDown();
    else
        DestroyCPUResources();

    QRect disp = window.GetDisplayVisibleRect();
    if (Init(input_size.width(), input_size.height(),
             aspect, gl_parent_win, disp, av_codec_id))
    {
        if (wasembedding)
            EmbedInWidget(oldrect);
        if (gCoreContext->IsUIThread())
            BestDeint();
        return true;
    }

    LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to re-initialise video output.");
    errorState = kError_Unknown;

    return false;
}
开发者ID:StefanRoss,项目名称:mythtv,代码行数:60,代码来源:videoout_openglvaapi.cpp

示例7: LOG

	void Test::__run()
	{
		LOG("[ RUN      ] %s.%s", name(), method());
		SetUp();

		TestContext &ctx = TestContext::getInstance();
		ctx.setTest(name(), method());

		StopWatch stopwatch;
		stopwatch.start();
		__test();
		stopwatch.stop();
		int ms = stopwatch.getTimeMillisecond();

		passCount_ = ctx.successCount();
		failCount_ = ctx.failCount();

		if(fail() == 0)
		{
			LOG("[       OK ] %s.%s (%d ms)", name(), method(), ms);
		}
		else
		{
			LOG("[  FAILED  ] %s.%s (%d ms)", name(), method(), ms);
		}

		TearDown();
	}
开发者ID:if1live,项目名称:akira,代码行数:28,代码来源:AKTestCase.cpp

示例8: TearDown

void FOutputDeviceFile::SetFilename(const TCHAR* InFilename)
{
	// Close any existing file.
	TearDown();

	FCString::Strncpy( Filename, InFilename, ARRAY_COUNT(Filename) );
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:7,代码来源:OutputDevices.cpp

示例9: locker

bool VideoOutputOpenGL::Init(const QSize &video_dim_buf,
                             const QSize &video_dim_disp,
                             float aspect, WId winid,
                             const QRect &win_rect, MythCodecID codec_id)
{
    QMutexLocker locker(&gl_context_lock);
    bool success = true;
    window.SetAllowPreviewEPG(true);
    gl_parent_win = winid;
    success &= VideoOutput::Init(video_dim_buf, video_dim_disp,
                                 aspect, winid,
                                 win_rect, codec_id);
    SetProfile();
    InitPictureAttributes();

    success &= CreateCPUResources();

    if (!gCoreContext->IsUIThread())
    {
        LOG(VB_GENERAL, LOG_NOTICE, LOC +
            "Deferring creation of OpenGL resources");
        gl_valid = false;
    }
    else
    {
        success &= CreateGPUResources();
        success &= CreateVideoResources();
    }

    if (!success)
        TearDown();
    return success;
}
开发者ID:garybuhrmaster,项目名称:mythtv,代码行数:33,代码来源:videoout_opengl.cpp

示例10: SetUp

    void ClosestPairProviderTests::RegisterPair_ForFourParticlesAndMovedParticlesAreCloseThroughPeriodic_MovedParticlesAreNearest()
    {
        SetUp();

        //Closest pair is 2-3 with distance 0.5
        const FLOAT_TYPE diameter = 1.0;
        const SpatialVector c0 = {{5, 5, 5}};
        const SpatialVector c1 = {{5.9, 5, 5}};
        const SpatialVector c2 = {{5, 8, 5}};
        const SpatialVector c3 = {{5.5, 8, 5}};
        particles[0] = DomainParticle(0, diameter, c0);
        particles[1] = DomainParticle(1, diameter, c1);
        particles[2] = DomainParticle(2, diameter, c2);
        particles[3] = DomainParticle(3, diameter, c3);

        closestPairProvider->SetParticles(particles);

        closestPairProvider->StartMove(0);
        particles[0].coordinates[Axis::X] = 0.2;
        closestPairProvider->EndMove();

        closestPairProvider->StartMove(1);
        particles[1].coordinates[Axis::X] = 9.99999;
        closestPairProvider->EndMove();
        ParticlePair actualPair = closestPairProvider->FindClosestPair();
        ParticlePair expectedPair(0, 1, 0.2 * 0.2);

        AssertPair(expectedPair, actualPair, "RegisterPair_ForFourParticlesAndMovedParticlesAreCloseThroughPeriodic_MovedParticlesAreNearest");

        TearDown();
    }
开发者ID:VasiliBaranov,项目名称:packing-generation,代码行数:31,代码来源:ClosestPairProviderTests.cpp

示例11: SetUp

    void HcpGeneratorTests::ArrangePacking_ForHcp_NoParticleIntersections()
    {
        SetUp();

        hcpGenerator->ArrangePacking(&particles);

        FLOAT_TYPE minDistanceSquare = FLT_MAX;
        FLOAT_TYPE currentDistanceSquare = 0;

        for (ParticleIndex i = 0; i < context->config->particlesCount - 1; i++)
        {
            for (ParticleIndex j = i + 1; j < context->config->particlesCount; j++)
            {
                currentDistanceSquare = mathService->GetNormalizedDistanceSquare(i, j, particles);
                if (currentDistanceSquare < minDistanceSquare)
                {
                    minDistanceSquare = currentDistanceSquare;
                }
            }
        }

        FLOAT_TYPE minDistance = sqrt(minDistanceSquare);

        Assert::AreAlmostEqual(minDistance, 1.0, "ArrangePacking_ForHcp_NoParticleIntersections");

        TearDown();
    }
开发者ID:VasiliBaranov,项目名称:packing-generation,代码行数:27,代码来源:HcpGeneratorTests.cpp

示例12: TEST_F

TEST_F(ProxygenTransportTest, push_abort_incomplete) {
  // Push a resource
  Array headers;
  uint8_t pri = 1;

  headers.add(String("hello"), String("world"));  // dict serializtion path
  pushResource(headers, pri);

  // Creates a new transaction and sends headers, but not body
  MockHTTPTransaction pushTxn(TransportDirection::DOWNSTREAM,
                              HTTPCodec::StreamID(1), 1, m_egressQueue,
                              WheelTimerInstance(m_timeouts.get()));
  HTTPPushTransactionHandler* pushHandler = nullptr;
  expectPushPromiseAndHeaders(pushTxn, pri, &pushHandler);
  m_server.deliverMessages();
  sendResponse("12345");

  EXPECT_CALL(pushTxn, sendAbort())
    .WillOnce(Invoke([pushHandler] {
          pushHandler->detachTransaction();
        }));
  // Simulate termination of the VM thread while there is an incomplete push
  // This aborts the incomplete push
  TearDown();
}
开发者ID:Thomascarette,项目名称:hhvm,代码行数:25,代码来源:proxygen-transport-test.cpp

示例13: SetUp

    void SphericalHarmonicsComputerTests::GetSphericalHarmonicValues_CompareWithAnalyticalForm_lIsOne_mIsZero_IsCorrect()
    {
        SetUp();

        FLOAT_TYPE error = GetSphericalHarmonicsError(1, 0);
        Assert::AreAlmostEqual(error, 0.0, "GetSphericalHarmonicValues_CompareWithAnalyticalForm_lIsOne_mIsZero_IsCorrect");

        TearDown();
    }
开发者ID:VasiliBaranov,项目名称:packing-generation,代码行数:9,代码来源:SphericalHarmonicsComputerTests.cpp

示例14: SetUp

ECode TestCase::RunBare()
{
    ECode ec = NOERROR;
    SetUp();
    ec = RunTest();
    ECode ec1 = TearDown();
    if (ec == NOERROR) ec = ec1;
    return ec;
}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:9,代码来源:TestCase.cpp

示例15: TearDown

VideoOutputOpenGL::~VideoOutputOpenGL()
{
    gl_context_lock.lock();
    TearDown();

    if (gl_context)
        gl_context->DownRef();
    gl_context = NULL;
    gl_context_lock.unlock();
}
开发者ID:mdda,项目名称:mythtv,代码行数:10,代码来源:videoout_opengl.cpp


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