本文整理汇总了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;
}
示例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));
}
示例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();
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例8: TearDown
void FOutputDeviceFile::SetFilename(const TCHAR* InFilename)
{
// Close any existing file.
TearDown();
FCString::Strncpy( Filename, InFilename, ARRAY_COUNT(Filename) );
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例14: SetUp
ECode TestCase::RunBare()
{
ECode ec = NOERROR;
SetUp();
ec = RunTest();
ECode ec1 = TearDown();
if (ec == NOERROR) ec = ec1;
return ec;
}
示例15: TearDown
VideoOutputOpenGL::~VideoOutputOpenGL()
{
gl_context_lock.lock();
TearDown();
if (gl_context)
gl_context->DownRef();
gl_context = NULL;
gl_context_lock.unlock();
}