mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 07:16:10 +01:00
test-fixtures.md: Line-wrap code examples (#2464)
* test-fixtures.md: Line-wrap code examples * relinebreak Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
This commit is contained in:
parent
1f381a1f62
commit
a369267874
@ -59,7 +59,10 @@ struct Template_Fixture {
|
|||||||
T m_a;
|
T m_a;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEMPLATE_TEST_CASE_METHOD(Template_Fixture,"A TEMPLATE_TEST_CASE_METHOD based test run that succeeds", "[class][template]", int, float, double) {
|
TEMPLATE_TEST_CASE_METHOD(Template_Fixture,
|
||||||
|
"A TEMPLATE_TEST_CASE_METHOD based test run that succeeds",
|
||||||
|
"[class][template]",
|
||||||
|
int, float, double) {
|
||||||
REQUIRE( Template_Fixture<TestType>::m_a == 1 );
|
REQUIRE( Template_Fixture<TestType>::m_a == 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +80,11 @@ struct Foo_class {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEMPLATE_PRODUCT_TEST_CASE_METHOD(Template_Template_Fixture, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test succeeds", "[class][template]", (Foo_class, std::vector), int) {
|
TEMPLATE_PRODUCT_TEST_CASE_METHOD(Template_Template_Fixture,
|
||||||
|
"A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test succeeds",
|
||||||
|
"[class][template]",
|
||||||
|
(Foo_class, std::vector),
|
||||||
|
int) {
|
||||||
REQUIRE( Template_Template_Fixture<TestType>::m_a.size() == 0 );
|
REQUIRE( Template_Template_Fixture<TestType>::m_a.size() == 0 );
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -101,7 +108,12 @@ struct Nttp_Fixture{
|
|||||||
int value = V;
|
int value = V;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEMPLATE_TEST_CASE_METHOD_SIG(Nttp_Fixture, "A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds", "[class][template][nttp]",((int V), V), 1, 3, 6) {
|
TEMPLATE_TEST_CASE_METHOD_SIG(
|
||||||
|
Nttp_Fixture,
|
||||||
|
"A TEMPLATE_TEST_CASE_METHOD_SIG based test run that succeeds",
|
||||||
|
"[class][template][nttp]",
|
||||||
|
((int V), V),
|
||||||
|
1, 3, 6) {
|
||||||
REQUIRE(Nttp_Fixture<V>::value > 0);
|
REQUIRE(Nttp_Fixture<V>::value > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,8 +129,13 @@ struct Template_Foo_2 {
|
|||||||
size_t size() { return V; }
|
size_t size() { return V; }
|
||||||
};
|
};
|
||||||
|
|
||||||
TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG(Template_Fixture_2, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds", "[class][template][product][nttp]", ((typename T, size_t S), T, S),(std::array, Template_Foo_2), ((int,2), (float,6)))
|
TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG(
|
||||||
{
|
Template_Fixture_2,
|
||||||
|
"A TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG based test run that succeeds",
|
||||||
|
"[class][template][product][nttp]",
|
||||||
|
((typename T, size_t S), T, S),
|
||||||
|
(std::array, Template_Foo_2),
|
||||||
|
((int,2), (float,6))) {
|
||||||
REQUIRE(Template_Fixture_2<TestType>{}.m_a.size() >= 2);
|
REQUIRE(Template_Fixture_2<TestType>{}.m_a.size() >= 2);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -132,8 +149,10 @@ only difference is the source of types. This allows you to reuse the template ty
|
|||||||
Example:
|
Example:
|
||||||
```cpp
|
```cpp
|
||||||
using MyTypes = std::tuple<int, char, double>;
|
using MyTypes = std::tuple<int, char, double>;
|
||||||
TEMPLATE_LIST_TEST_CASE_METHOD(Template_Fixture, "Template test case method with test types specified inside std::tuple", "[class][template][list]", MyTypes)
|
TEMPLATE_LIST_TEST_CASE_METHOD(Template_Fixture,
|
||||||
{
|
"Template test case method with test types specified inside std::tuple",
|
||||||
|
"[class][template][list]",
|
||||||
|
MyTypes) {
|
||||||
REQUIRE( Template_Fixture<TestType>::m_a == 1 );
|
REQUIRE( Template_Fixture<TestType>::m_a == 1 );
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user