mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	Template tests: added TEMPLATE_PRODUCT_TEST_CASE
support for generating test cases based on multiple template template
types combined with template arguments for each of the template template
types specified
e.g.
```
TEMPLATE_PRODUCT_TEST_CASE("template product","[template]",
			   (std::tuple, std::pair, std::map),
			   ((int,float),(char,double),(int,char)))
```
will effectively create 9 test cases with types:
std::tuple<int,float>
std::tuple<char,double>
std::tuple<int,char>
std::pair<int,float>
std::pair<char, double>
std::pair<int,char>
std::map<int,float>
std::map<char,double>
std::map<int,char>
Tested type is accessible in test case body as TestType
Unique name is created by appending ` - <index>` to test name
since preprocessor has some limitations in recursions
Closes #1454
			
			
This commit is contained in:
		| @@ -159,6 +159,14 @@ Generators.tests.cpp:<line number>: passed: x < y for: 10 < 109 | ||||
| Generators.tests.cpp:<line number>: passed: x < y for: 10 < 110 | ||||
| Class.tests.cpp:<line number>: failed: s == "world" for: "hello" == "world" | ||||
| Class.tests.cpp:<line number>: passed: s == "hello" for: "hello" == "hello" | ||||
| Class.tests.cpp:<line number>: failed: Template_Fixture_2<TestType>::m_a.size() == 1 for: 0 == 1 | ||||
| Class.tests.cpp:<line number>: failed: Template_Fixture_2<TestType>::m_a.size() == 1 for: 0 == 1 | ||||
| Class.tests.cpp:<line number>: failed: Template_Fixture_2<TestType>::m_a.size() == 1 for: 0 == 1 | ||||
| Class.tests.cpp:<line number>: failed: Template_Fixture_2<TestType>::m_a.size() == 1 for: 0 == 1 | ||||
| Class.tests.cpp:<line number>: passed: Template_Fixture_2<TestType>::m_a.size() == 0 for: 0 == 0 | ||||
| Class.tests.cpp:<line number>: passed: Template_Fixture_2<TestType>::m_a.size() == 0 for: 0 == 0 | ||||
| Class.tests.cpp:<line number>: passed: Template_Fixture_2<TestType>::m_a.size() == 0 for: 0 == 0 | ||||
| Class.tests.cpp:<line number>: passed: Template_Fixture_2<TestType>::m_a.size() == 0 for: 0 == 0 | ||||
| Class.tests.cpp:<line number>: failed: Template_Fixture<TestType>::m_a == 2 for: 1.0 == 2 | ||||
| Class.tests.cpp:<line number>: failed: Template_Fixture<TestType>::m_a == 2 for: 1.0f == 2 | ||||
| Class.tests.cpp:<line number>: failed: Template_Fixture<TestType>::m_a == 2 for: 1 == 2 | ||||
| @@ -167,6 +175,10 @@ Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: | ||||
| Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1 == 1 | ||||
| Class.tests.cpp:<line number>: failed: m_a == 2 for: 1 == 2 | ||||
| Class.tests.cpp:<line number>: passed: m_a == 1 for: 1 == 1 | ||||
| Misc.tests.cpp:<line number>: passed: x.size() == 0 for: 0 == 0 | ||||
| Misc.tests.cpp:<line number>: passed: x.size() == 0 for: 0 == 0 | ||||
| Misc.tests.cpp:<line number>: passed: x.size() == 0 for: 0 == 0 | ||||
| Misc.tests.cpp:<line number>: passed: x.size() == 0 for: 0 == 0 | ||||
| Approx.tests.cpp:<line number>: passed: d == 1.23_a for: 1.23 == Approx( 1.23 ) | ||||
| Approx.tests.cpp:<line number>: passed: d != 1.22_a for: 1.23 != Approx( 1.22 ) | ||||
| Approx.tests.cpp:<line number>: passed: -d == -1.23_a for: -1.23 == Approx( -1.23 ) | ||||
| @@ -750,6 +762,9 @@ CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--use-colour", "no" | ||||
| CmdLine.tests.cpp:<line number>: passed: config.useColour == UseColour::No for: 2 == 2 | ||||
| CmdLine.tests.cpp:<line number>: passed: !result for: true | ||||
| CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), Contains( "colour mode must be one of" ) for: "colour mode must be one of: auto, yes or no. 'wrong' not recognised" contains: "colour mode must be one of" | ||||
| Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 1 >= 1 | ||||
| Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 2 >= 1 | ||||
| Misc.tests.cpp:<line number>: passed: std::tuple_size<TestType>::value >= 1 for: 3 >= 1 | ||||
| Decomposition.tests.cpp:<line number>: failed: truthy(false) for: Hey, its truthy! | ||||
| Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches("this STRING contains 'abc' as a substring") for: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively | ||||
| Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches("contains 'abc' as a substring") for: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively | ||||
| @@ -1389,5 +1404,5 @@ Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5 | ||||
| Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5 | ||||
| Misc.tests.cpp:<line number>: passed: | ||||
| Misc.tests.cpp:<line number>: passed: | ||||
| Failed 65 test cases, failed 125 assertions. | ||||
| Failed 69 test cases, failed 129 assertions. | ||||
|  | ||||
|   | ||||
| @@ -92,6 +92,50 @@ Class.tests.cpp:<line number>: FAILED: | ||||
| with expansion: | ||||
|   "hello" == "world" | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - 0 | ||||
| ------------------------------------------------------------------------------- | ||||
| Class.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Class.tests.cpp:<line number>: FAILED: | ||||
|   REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) | ||||
| with expansion: | ||||
|   0 == 1 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - 1 | ||||
| ------------------------------------------------------------------------------- | ||||
| Class.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Class.tests.cpp:<line number>: FAILED: | ||||
|   REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) | ||||
| with expansion: | ||||
|   0 == 1 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - 2 | ||||
| ------------------------------------------------------------------------------- | ||||
| Class.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Class.tests.cpp:<line number>: FAILED: | ||||
|   REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) | ||||
| with expansion: | ||||
|   0 == 1 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - 3 | ||||
| ------------------------------------------------------------------------------- | ||||
| Class.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Class.tests.cpp:<line number>: FAILED: | ||||
|   REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) | ||||
| with expansion: | ||||
|   0 == 1 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A TEMPLATE_TEST_CASE_METHOD based test run that fails - double | ||||
| ------------------------------------------------------------------------------- | ||||
| @@ -1126,6 +1170,6 @@ due to unexpected exception with message: | ||||
|   Why would you throw a std::string? | ||||
|  | ||||
| =============================================================================== | ||||
| test cases:  228 |  172 passed |  52 failed |  4 failed as expected | ||||
| assertions: 1310 | 1178 passed | 111 failed | 21 failed as expected | ||||
| test cases:  243 |  183 passed |  56 failed |  4 failed as expected | ||||
| assertions: 1325 | 1189 passed | 115 failed | 21 failed as expected | ||||
|  | ||||
|   | ||||
| @@ -1577,6 +1577,94 @@ Class.tests.cpp:<line number>: PASSED: | ||||
| with expansion: | ||||
|   "hello" == "hello" | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - 0 | ||||
| ------------------------------------------------------------------------------- | ||||
| Class.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Class.tests.cpp:<line number>: FAILED: | ||||
|   REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) | ||||
| with expansion: | ||||
|   0 == 1 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - 1 | ||||
| ------------------------------------------------------------------------------- | ||||
| Class.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Class.tests.cpp:<line number>: FAILED: | ||||
|   REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) | ||||
| with expansion: | ||||
|   0 == 1 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - 2 | ||||
| ------------------------------------------------------------------------------- | ||||
| Class.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Class.tests.cpp:<line number>: FAILED: | ||||
|   REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) | ||||
| with expansion: | ||||
|   0 == 1 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - 3 | ||||
| ------------------------------------------------------------------------------- | ||||
| Class.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Class.tests.cpp:<line number>: FAILED: | ||||
|   REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ) | ||||
| with expansion: | ||||
|   0 == 1 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - 0 | ||||
| ------------------------------------------------------------------------------- | ||||
| Class.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Class.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 0 ) | ||||
| with expansion: | ||||
|   0 == 0 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - 1 | ||||
| ------------------------------------------------------------------------------- | ||||
| Class.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Class.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 0 ) | ||||
| with expansion: | ||||
|   0 == 0 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - 2 | ||||
| ------------------------------------------------------------------------------- | ||||
| Class.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Class.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 0 ) | ||||
| with expansion: | ||||
|   0 == 0 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - 3 | ||||
| ------------------------------------------------------------------------------- | ||||
| Class.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Class.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 0 ) | ||||
| with expansion: | ||||
|   0 == 0 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A TEMPLATE_TEST_CASE_METHOD based test run that fails - double | ||||
| ------------------------------------------------------------------------------- | ||||
| @@ -1665,6 +1753,50 @@ Class.tests.cpp:<line number>: PASSED: | ||||
| with expansion: | ||||
|   1 == 1 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A Template product test case - 0 | ||||
| ------------------------------------------------------------------------------- | ||||
| Misc.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Misc.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( x.size() == 0 ) | ||||
| with expansion: | ||||
|   0 == 0 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A Template product test case - 1 | ||||
| ------------------------------------------------------------------------------- | ||||
| Misc.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Misc.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( x.size() == 0 ) | ||||
| with expansion: | ||||
|   0 == 0 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A Template product test case - 2 | ||||
| ------------------------------------------------------------------------------- | ||||
| Misc.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Misc.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( x.size() == 0 ) | ||||
| with expansion: | ||||
|   0 == 0 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A Template product test case - 3 | ||||
| ------------------------------------------------------------------------------- | ||||
| Misc.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Misc.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( x.size() == 0 ) | ||||
| with expansion: | ||||
|   0 == 0 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| A comparison that uses literals instead of the normal constructor | ||||
| ------------------------------------------------------------------------------- | ||||
| @@ -5767,6 +5899,39 @@ with expansion: | ||||
|   "colour mode must be one of: auto, yes or no. 'wrong' not recognised" | ||||
|   contains: "colour mode must be one of" | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| Product with differing arities - 0 | ||||
| ------------------------------------------------------------------------------- | ||||
| Misc.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Misc.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( std::tuple_size<TestType>::value >= 1 ) | ||||
| with expansion: | ||||
|   1 >= 1 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| Product with differing arities - 1 | ||||
| ------------------------------------------------------------------------------- | ||||
| Misc.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Misc.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( std::tuple_size<TestType>::value >= 1 ) | ||||
| with expansion: | ||||
|   2 >= 1 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| Product with differing arities - 2 | ||||
| ------------------------------------------------------------------------------- | ||||
| Misc.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| Misc.tests.cpp:<line number>: PASSED: | ||||
|   REQUIRE( std::tuple_size<TestType>::value >= 1 ) | ||||
| with expansion: | ||||
|   3 >= 1 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| Reconstruction should be based on stringification: #914 | ||||
| ------------------------------------------------------------------------------- | ||||
| @@ -10464,6 +10629,6 @@ Misc.tests.cpp:<line number> | ||||
| Misc.tests.cpp:<line number>: PASSED: | ||||
|  | ||||
| =============================================================================== | ||||
| test cases:  228 |  159 passed |  65 failed |  4 failed as expected | ||||
| assertions: 1324 | 1178 passed | 125 failed | 21 failed as expected | ||||
| test cases:  243 |  170 passed |  69 failed |  4 failed as expected | ||||
| assertions: 1339 | 1189 passed | 129 failed | 21 failed as expected | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <testsuitesloose text artifact | ||||
| > | ||||
|   <testsuite name="<exe-name>" errors="17" failures="109" tests="1325" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> | ||||
|   <testsuite name="<exe-name>" errors="17" failures="113" tests="1340" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> | ||||
|     <testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="#1027" time="{duration}"/> | ||||
| @@ -77,6 +77,30 @@ Class.tests.cpp:<line number> | ||||
|       </failure> | ||||
|     </testcase> | ||||
|     <testcase classname="<exe-name>.TestClass" name="A METHOD_AS_TEST_CASE based test run that succeeds" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - 0" time="{duration}"> | ||||
|       <failure message="0 == 1" type="REQUIRE"> | ||||
| Class.tests.cpp:<line number> | ||||
|       </failure> | ||||
|     </testcase> | ||||
|     <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - 1" time="{duration}"> | ||||
|       <failure message="0 == 1" type="REQUIRE"> | ||||
| Class.tests.cpp:<line number> | ||||
|       </failure> | ||||
|     </testcase> | ||||
|     <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - 2" time="{duration}"> | ||||
|       <failure message="0 == 1" type="REQUIRE"> | ||||
| Class.tests.cpp:<line number> | ||||
|       </failure> | ||||
|     </testcase> | ||||
|     <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - 3" time="{duration}"> | ||||
|       <failure message="0 == 1" type="REQUIRE"> | ||||
| Class.tests.cpp:<line number> | ||||
|       </failure> | ||||
|     </testcase> | ||||
|     <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - 0" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - 1" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - 2" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.Template_Fixture_2" name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - 3" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.Template_Fixture" name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - double" time="{duration}"> | ||||
|       <failure message="1.0 == 2" type="REQUIRE"> | ||||
| Class.tests.cpp:<line number> | ||||
| @@ -101,6 +125,10 @@ Class.tests.cpp:<line number> | ||||
|       </failure> | ||||
|     </testcase> | ||||
|     <testcase classname="<exe-name>.Fixture" name="A TEST_CASE_METHOD based test run that succeeds" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="A Template product test case - 0" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="A Template product test case - 1" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="A Template product test case - 2" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="A Template product test case - 3" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="A comparison that uses literals instead of the normal constructor" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="A couple of nested sections followed by a failure" time="{duration}"> | ||||
|       <failure type="FAIL"> | ||||
| @@ -526,6 +554,9 @@ Message.tests.cpp:<line number> | ||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/use-colour/yes" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/use-colour/no" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/use-colour/error" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Product with differing arities - 0" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Product with differing arities - 1" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Product with differing arities - 2" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Reconstruction should be based on stringification: #914" time="{duration}"> | ||||
|       <failure message="Hey, its truthy!" type="CHECK"> | ||||
| Decomposition.tests.cpp:<line number> | ||||
|   | ||||
| @@ -1347,6 +1347,94 @@ | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - 0" tags="[.][class][failing][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|       <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|         <Original> | ||||
|           Template_Fixture_2<TestType>::m_a.size() == 1 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           0 == 1 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="false"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - 1" tags="[.][class][failing][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|       <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|         <Original> | ||||
|           Template_Fixture_2<TestType>::m_a.size() == 1 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           0 == 1 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="false"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - 2" tags="[.][class][failing][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|       <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|         <Original> | ||||
|           Template_Fixture_2<TestType>::m_a.size() == 1 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           0 == 1 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="false"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails - 3" tags="[.][class][failing][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|       <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|         <Original> | ||||
|           Template_Fixture_2<TestType>::m_a.size() == 1 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           0 == 1 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="false"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - 0" tags="[class][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|         <Original> | ||||
|           Template_Fixture_2<TestType>::m_a.size() == 0 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           0 == 0 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - 1" tags="[class][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|         <Original> | ||||
|           Template_Fixture_2<TestType>::m_a.size() == 0 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           0 == 0 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - 2" tags="[class][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|         <Original> | ||||
|           Template_Fixture_2<TestType>::m_a.size() == 0 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           0 == 0 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds - 3" tags="[class][product][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|         <Original> | ||||
|           Template_Fixture_2<TestType>::m_a.size() == 0 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           0 == 0 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="A TEMPLATE_TEST_CASE_METHOD based test run that fails - double" tags="[.][class][failing][template]" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|       <Expression success="false" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Class.tests.cpp" > | ||||
|         <Original> | ||||
| @@ -1435,6 +1523,50 @@ | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="A Template product test case - 0" tags="[product][template]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > | ||||
|         <Original> | ||||
|           x.size() == 0 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           0 == 0 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="A Template product test case - 1" tags="[product][template]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > | ||||
|         <Original> | ||||
|           x.size() == 0 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           0 == 0 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="A Template product test case - 2" tags="[product][template]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > | ||||
|         <Original> | ||||
|           x.size() == 0 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           0 == 0 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="A Template product test case - 3" tags="[product][template]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > | ||||
|         <Original> | ||||
|           x.size() == 0 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           0 == 0 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="A comparison that uses literals instead of the normal constructor" tags="[Approx]" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" > | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Approx.tests.cpp" > | ||||
|         <Original> | ||||
| @@ -6732,6 +6864,39 @@ | ||||
|       </Section> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="Product with differing arities - 0" tags="[product][template]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > | ||||
|         <Original> | ||||
|           std::tuple_size<TestType>::value >= 1 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           1 >= 1 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="Product with differing arities - 1" tags="[product][template]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > | ||||
|         <Original> | ||||
|           std::tuple_size<TestType>::value >= 1 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           2 >= 1 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="Product with differing arities - 2" tags="[product][template]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > | ||||
|         <Original> | ||||
|           std::tuple_size<TestType>::value >= 1 | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           3 >= 1 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="Reconstruction should be based on stringification: #914" tags="[.][Decomposition][failing]" filename="projects/<exe-name>/UsageTests/Decomposition.tests.cpp" > | ||||
|       <Expression success="false" type="CHECK" filename="projects/<exe-name>/UsageTests/Decomposition.tests.cpp" > | ||||
|         <Original> | ||||
| @@ -12099,7 +12264,7 @@ loose text artifact | ||||
|       </Section> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <OverallResults successes="1178" failures="126" expectedFailures="21"/> | ||||
|     <OverallResults successes="1189" failures="130" expectedFailures="21"/> | ||||
|   </Group> | ||||
|   <OverallResults successes="1178" failures="125" expectedFailures="21"/> | ||||
|   <OverallResults successes="1189" failures="129" expectedFailures="21"/> | ||||
| </Catch> | ||||
|   | ||||
| @@ -46,6 +46,18 @@ struct Template_Fixture { | ||||
|     T m_a; | ||||
| }; | ||||
|  | ||||
| template<typename T> | ||||
| struct Template_Fixture_2 { | ||||
|     Template_Fixture_2() {} | ||||
|  | ||||
|     T m_a; | ||||
| }; | ||||
|  | ||||
| template< typename T> | ||||
| struct Template_Foo { | ||||
|     size_t size() { return 0; } | ||||
| }; | ||||
|  | ||||
| #endif | ||||
|  | ||||
|  | ||||
| @@ -62,6 +74,11 @@ TEMPLATE_TEST_CASE_METHOD(Template_Fixture, "A TEMPLATE_TEST_CASE_METHOD based t | ||||
|     REQUIRE( Template_Fixture<TestType>::m_a == 1 ); | ||||
| } | ||||
|  | ||||
| TEMPLATE_PRODUCT_TEST_CASE_METHOD(Template_Fixture_2, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that succeeds","[class][template][product]",(std::vector,Template_Foo),(int,float)) | ||||
| { | ||||
|     REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 0 ); | ||||
| } | ||||
|  | ||||
| // We should be able to write our tests within a different namespace | ||||
| namespace Inner | ||||
| { | ||||
| @@ -74,6 +91,11 @@ namespace Inner | ||||
|     { | ||||
|         REQUIRE( Template_Fixture<TestType>::m_a == 2 ); | ||||
|     } | ||||
|  | ||||
|     TEMPLATE_PRODUCT_TEST_CASE_METHOD(Template_Fixture_2, "A TEMPLATE_PRODUCT_TEST_CASE_METHOD based test run that fails","[.][class][template][product][failing]",(std::vector,Template_Foo),(int,float)) | ||||
|     { | ||||
|         REQUIRE( Template_Fixture_2<TestType>::m_a.size() == 1 ); | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -61,6 +61,11 @@ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS | ||||
| static AutoTestReg autoTestReg; | ||||
| CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS | ||||
|  | ||||
| template<typename T> | ||||
| struct Foo { | ||||
|     size_t size() { return 0; } | ||||
| }; | ||||
|  | ||||
| #endif | ||||
|  | ||||
| TEST_CASE( "random SECTION tests", "[.][sections][failing]" ) { | ||||
| @@ -301,6 +306,15 @@ TEMPLATE_TEST_CASE( "TemplateTest: vectors can be sized and resized", "[vector][ | ||||
|     } | ||||
| } | ||||
|  | ||||
| TEMPLATE_PRODUCT_TEST_CASE("A Template product test case", "[template][product]", (std::vector, Foo), (int, float)) { | ||||
|     TestType x; | ||||
|     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); | ||||
| } | ||||
|  | ||||
| // https://github.com/philsquared/Catch/issues/166 | ||||
| TEST_CASE("A couple of nested sections followed by a failure", "[failing][.]") { | ||||
|     SECTION("Outer") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jozef Grajciar
					Jozef Grajciar