SECTION("embedded xml: <test>it should be possible to embed xml characters, such as <, \" or &, or even whole <xml>documents</xml> within an attribute</test>"){
SUCCEED();// We need this here to stop it failing due to no tests
}
SECTION("encoded chars: these should all be encoded: &&&\"\"\"<<<&\"<<&\""){
SUCCEED();// We need this here to stop it failing due to no tests
}
}
TEST_CASE("send a single char to INFO","[failing][.]"){
INFO(3);
REQUIRE(false);
}
TEST_CASE("Factorials are computed","[factorial]"){
REQUIRE(Factorial(0)==1);
REQUIRE(Factorial(1)==1);
REQUIRE(Factorial(2)==2);
REQUIRE(Factorial(3)==6);
REQUIRE(Factorial(10)==3628800);
}
TEST_CASE("An empty test with no assertions","[empty]"){}
TEST_CASE("vectors can be sized and resized","[vector]"){
std::vector<int>v(5);
REQUIRE(v.size()==5);
REQUIRE(v.capacity()>=5);
SECTION("resizing bigger changes size and capacity"){
v.resize(10);
REQUIRE(v.size()==10);
REQUIRE(v.capacity()>=10);
}
SECTION("resizing smaller changes size but not capacity"){
v.resize(0);
REQUIRE(v.size()==0);
REQUIRE(v.capacity()>=5);
SECTION("We can use the 'swap trick' to reset the capacity"){
std::vector<int>empty;
empty.swap(v);
REQUIRE(v.capacity()==0);
}
}
SECTION("reserving bigger changes capacity but not size"){
v.reserve(10);
REQUIRE(v.size()==5);
REQUIRE(v.capacity()>=10);
}
SECTION("reserving smaller does not change size or capacity"){
v.reserve(0);
REQUIRE(v.size()==5);
REQUIRE(v.capacity()>=5);
}
}
TEMPLATE_TEST_CASE("TemplateTest: vectors can be sized and resized","[vector][template]",int,float,std::string,(std::tuple<int,float>)){
std::vector<TestType>v(5);
REQUIRE(v.size()==5);
REQUIRE(v.capacity()>=5);
SECTION("resizing bigger changes size and capacity"){
v.resize(10);
REQUIRE(v.size()==10);
REQUIRE(v.capacity()>=10);
}
SECTION("resizing smaller changes size but not capacity"){
v.resize(0);
REQUIRE(v.size()==0);
REQUIRE(v.capacity()>=5);
SECTION("We can use the 'swap trick' to reset the capacity"){
std::vector<TestType>empty;
empty.swap(v);
REQUIRE(v.capacity()==0);
}
}
SECTION("reserving bigger changes capacity but not size"){
v.reserve(10);
REQUIRE(v.size()==5);
REQUIRE(v.capacity()>=10);
}
SECTION("reserving smaller does not change size or capacity"){
v.reserve(0);
REQUIRE(v.size()==5);
REQUIRE(v.capacity()>=5);
}
}
TEMPLATE_TEST_CASE_SIG("TemplateTestSig: vectors can be sized and resized","[vector][template][nttp]",((typenameTestType,intV),TestType,V),(int,5),(float,4),(std::string,15),((std::tuple<int,float>),6)){
std::vector<TestType>v(V);
REQUIRE(v.size()==V);
REQUIRE(v.capacity()>=V);
SECTION("resizing bigger changes size and capacity"){
v.resize(2*V);
REQUIRE(v.size()==2*V);
REQUIRE(v.capacity()>=2*V);
}
SECTION("resizing smaller changes size but not capacity"){
v.resize(0);
REQUIRE(v.size()==0);
REQUIRE(v.capacity()>=V);
SECTION("We can use the 'swap trick' to reset the capacity"){
std::vector<TestType>empty;
empty.swap(v);
REQUIRE(v.capacity()==0);
}
}
SECTION("reserving bigger changes capacity but not size"){
v.reserve(2*V);
REQUIRE(v.size()==V);
REQUIRE(v.capacity()>=2*V);
}
SECTION("reserving smaller does not change size or capacity"){
v.reserve(0);
REQUIRE(v.size()==V);
REQUIRE(v.capacity()>=V);
}
}
TEMPLATE_PRODUCT_TEST_CASE("A Template product test case","[template][product]",(std::vector,Foo),(int,float)){
TestTypex;
REQUIRE(x.size()==0);
}
TEMPLATE_PRODUCT_TEST_CASE_SIG("A Template product test case with array signature","[template][product][nttp]",((typenameT,size_tS),T,S),(std::array,Bar),((int,9),(float,42))){
TestTypex;
REQUIRE(x.size()>0);
}
TEMPLATE_PRODUCT_TEST_CASE("Product with differing arities","[template][product]",std::tuple,(int,(int,double),(int,double,float))){
REQUIRE(std::tuple_size<TestType>::value>=1);
}
usingMyTypes=std::tuple<int,char,float>;
TEMPLATE_LIST_TEST_CASE("Template test case with test types specified inside std::tuple","[template][list]",MyTypes)
TEMPLATE_LIST_TEST_CASE("Template test case with test types specified inside non-default-constructible std::tuple","[template][list]",MyNonDefaultConstructibleTypes)
TEMPLATE_LIST_TEST_CASE("Template test case with test types specified inside non-copyable and non-movable std::tuple","[template][list]",NonCopyableAndNonMovableTypes)