本文整理汇总了C++中std::unique_ptr::BeginFixture方法的典型用法代码示例。如果您正苦于以下问题:C++ unique_ptr::BeginFixture方法的具体用法?C++ unique_ptr::BeginFixture怎么用?C++ unique_ptr::BeginFixture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::unique_ptr
的用法示例。
在下文中一共展示了unique_ptr::BeginFixture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
virtual void Run()
{
Given("an output stream and output", [&]()
{
m_actualOutput.str("");
m_output = std::unique_ptr<ut11::out::StdOutput>(new ut11::out::StdOutput(m_actualOutput));
});
When("begin and end without running any tests", [&]()
{
m_output->Begin();
m_output->Finish(10, 7);
});
Then("the output is as expected", [&]()
{
AssertThat(m_actualOutput.str(), ut11::Is::EqualTo("\nFinished!\nRan: 10\nSucceeded: 7\n"));
});
When("running a test fixture with just a Then", [&]()
{
m_output->Begin();
m_output->BeginFixture("fixture");
m_output->BeginTest();
m_output->BeginThen("then");
m_output->EndThen("then");
m_output->EndTest();
m_output->EndFixture("fixture");
m_output->Finish(1, 1);
});
Then("the output is as expected", [&]()
{
auto stringVal = m_actualOutput.str();
auto startOfTime = stringVal.find('[');
auto endOfTime = stringVal.find(']');
stringVal = stringVal.erase(startOfTime, endOfTime - startOfTime + 1);
AssertThat(stringVal, ut11::Is::EqualTo("Fixture: fixture\n\t\t\tThen: then \n\nFinished!\nRan: 1\nSucceeded: 1\n"));
});
When("running two test fixtures with just a Then", [&]()
{
m_output->Begin();
m_output->BeginFixture("fixture");
m_output->BeginTest();
m_output->BeginThen("then");
m_output->EndThen("then");
m_output->EndTest();
m_output->EndFixture("fixture");
m_output->BeginFixture("fixture2");
m_output->BeginTest();
m_output->BeginThen("then2");
m_output->EndThen("then2");
m_output->EndTest();
m_output->EndFixture("fixture2");
m_output->Finish(2, 2);
});
Then("the output is as expected", [&]()
{
auto stringVal = m_actualOutput.str();
auto startOfTime = stringVal.find('[');
auto endOfTime = stringVal.find(']');
stringVal = stringVal.erase(startOfTime, endOfTime - startOfTime + 1);
startOfTime = stringVal.find('[');
endOfTime = stringVal.find(']');
stringVal = stringVal.erase(startOfTime, endOfTime - startOfTime + 1);
AssertThat(stringVal, ut11::Is::EqualTo("Fixture: fixture\n\t\t\tThen: then \nFixture: fixture2\n\t\t\tThen: then2 \n\nFinished!\nRan: 2\nSucceeded: 2\n"));
});
When("running a test fixture with just a When and Then", [&]()
{
m_output->Begin();
m_output->BeginFixture("fixture");
m_output->BeginTest();
m_output->BeginWhen("when");
m_output->EndWhen("then");
m_output->BeginThen("then");
m_output->EndThen("then");
m_output->EndTest();
m_output->EndFixture("fixture");
m_output->Finish(1, 1);
});
Then("the output is as expected", [&]()
{
auto stringVal = m_actualOutput.str();
auto startOfTime = stringVal.find('[');
auto endOfTime = stringVal.find(']');
stringVal = stringVal.erase(startOfTime, endOfTime - startOfTime + 1);
AssertThat(stringVal, ut11::Is::EqualTo("Fixture: fixture\n\t\tWhen: when\n\t\t\tThen: then \n\nFinished!\nRan: 1\nSucceeded: 1\n"));
});
When("running a test fixture with a Given When and Then", [&]()
{
m_output->Begin();
m_output->BeginFixture("fixture");
m_output->BeginTest();
m_output->BeginGiven("given");
m_output->EndGiven("given");
m_output->BeginWhen("when");
//.........这里部分代码省略.........