mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-22 19:33:29 +01:00
Merge branch 'catchorg:devel' into devel
This commit is contained in:
commit
26b9bcde1f
@ -34,7 +34,7 @@ Checks: >-
|
|||||||
-modernize-pass-by-value,
|
-modernize-pass-by-value,
|
||||||
|
|
||||||
performance-*,
|
performance-*,
|
||||||
-performance-enum-size,
|
performance-enum-size,
|
||||||
|
|
||||||
portability-*,
|
portability-*,
|
||||||
|
|
||||||
@ -49,6 +49,7 @@ Checks: >-
|
|||||||
-readability-implicit-bool-conversion,
|
-readability-implicit-bool-conversion,
|
||||||
-readability-isolate-declaration,
|
-readability-isolate-declaration,
|
||||||
-readability-magic-numbers,
|
-readability-magic-numbers,
|
||||||
|
-readability-math-missing-parentheses, #no, 'a + B * C' obeying math rules is not confusing,
|
||||||
-readability-named-parameter,
|
-readability-named-parameter,
|
||||||
-readability-qualified-auto,
|
-readability-qualified-auto,
|
||||||
-readability-redundant-access-specifiers,
|
-readability-redundant-access-specifiers,
|
||||||
|
@ -75,7 +75,7 @@ CATCH_TRANSLATE_EXCEPTION( MyType const& ex ) {
|
|||||||
|
|
||||||
Enums that already have a `<<` overload for `std::ostream` will convert to strings as expected.
|
Enums that already have a `<<` overload for `std::ostream` will convert to strings as expected.
|
||||||
If you only need to convert enums to strings for test reporting purposes you can provide a `StringMaker` specialisations as any other type.
|
If you only need to convert enums to strings for test reporting purposes you can provide a `StringMaker` specialisations as any other type.
|
||||||
However, as a convenience, Catch provides the `REGISTER_ENUM` helper macro that will generate the `StringMaker` specialisation for you with minimal code.
|
However, as a convenience, Catch provides the `CATCH_REGISTER_ENUM` helper macro that will generate the `StringMaker` specialisation for you with minimal code.
|
||||||
Simply provide it the (qualified) enum name, followed by all the enum values, and you're done!
|
Simply provide it the (qualified) enum name, followed by all the enum values, and you're done!
|
||||||
|
|
||||||
E.g.
|
E.g.
|
||||||
|
@ -144,7 +144,7 @@ same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
|
|||||||
``CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE`` variable if it is not passed when
|
``CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE`` variable if it is not passed when
|
||||||
calling ``catch_discover_tests``. This provides a mechanism for globally selecting
|
calling ``catch_discover_tests``. This provides a mechanism for globally selecting
|
||||||
a preferred test discovery behavior without having to modify each call site.
|
a preferred test discovery behavior without having to modify each call site.
|
||||||
|
|
||||||
``SKIP_IS_FAILURE``
|
``SKIP_IS_FAILURE``
|
||||||
Disables skipped test detection.
|
Disables skipped test detection.
|
||||||
|
|
||||||
@ -267,7 +267,6 @@ function(catch_discover_tests TARGET)
|
|||||||
" CTEST_FILE" " [==[" "${ctest_tests_file}" "]==]" "\n"
|
" CTEST_FILE" " [==[" "${ctest_tests_file}" "]==]" "\n"
|
||||||
" TEST_DL_PATHS" " [==[" "${_DL_PATHS}" "]==]" "\n"
|
" TEST_DL_PATHS" " [==[" "${_DL_PATHS}" "]==]" "\n"
|
||||||
" TEST_DL_FRAMEWORK_PATHS" " [==[" "${_DL_FRAMEWORK_PATHS}" "]==]" "\n"
|
" TEST_DL_FRAMEWORK_PATHS" " [==[" "${_DL_FRAMEWORK_PATHS}" "]==]" "\n"
|
||||||
" CTEST_FILE" " [==[" "${CTEST_FILE}" "]==]" "\n"
|
|
||||||
" )" "\n"
|
" )" "\n"
|
||||||
" endif()" "\n"
|
" endif()" "\n"
|
||||||
" include(\"${ctest_tests_file}\")" "\n"
|
" include(\"${ctest_tests_file}\")" "\n"
|
||||||
|
@ -22,7 +22,10 @@ namespace Detail {
|
|||||||
const int hexThreshold = 255;
|
const int hexThreshold = 255;
|
||||||
|
|
||||||
struct Endianness {
|
struct Endianness {
|
||||||
enum Arch { Big, Little };
|
enum Arch : uint8_t {
|
||||||
|
Big,
|
||||||
|
Little
|
||||||
|
};
|
||||||
|
|
||||||
static Arch which() {
|
static Arch which() {
|
||||||
int one = 1;
|
int one = 1;
|
||||||
|
@ -214,7 +214,7 @@ struct RowBreak {};
|
|||||||
struct OutputFlush {};
|
struct OutputFlush {};
|
||||||
|
|
||||||
class Duration {
|
class Duration {
|
||||||
enum class Unit {
|
enum class Unit : uint8_t {
|
||||||
Auto,
|
Auto,
|
||||||
Nanoseconds,
|
Nanoseconds,
|
||||||
Microseconds,
|
Microseconds,
|
||||||
@ -286,7 +286,10 @@ public:
|
|||||||
};
|
};
|
||||||
} // end anon namespace
|
} // end anon namespace
|
||||||
|
|
||||||
enum class Justification { Left, Right };
|
enum class Justification : uint8_t {
|
||||||
|
Left,
|
||||||
|
Right
|
||||||
|
};
|
||||||
|
|
||||||
struct ColumnInfo {
|
struct ColumnInfo {
|
||||||
std::string name;
|
std::string name;
|
||||||
|
@ -136,8 +136,8 @@ Nor would this
|
|||||||
:test-result: SKIP Empty generators can SKIP in constructor
|
:test-result: SKIP Empty generators can SKIP in constructor
|
||||||
:test-result: PASS Empty stream name opens cout stream
|
:test-result: PASS Empty stream name opens cout stream
|
||||||
:test-result: FAIL EndsWith string matcher
|
:test-result: FAIL EndsWith string matcher
|
||||||
:test-result: PASS Enums can quickly have stringification enabled using REGISTER_ENUM
|
:test-result: PASS Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
:test-result: PASS Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM
|
:test-result: PASS Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
:test-result: PASS Epsilon only applies to Approx's value
|
:test-result: PASS Epsilon only applies to Approx's value
|
||||||
:test-result: XFAIL Equality checks that should fail
|
:test-result: XFAIL Equality checks that should fail
|
||||||
:test-result: PASS Equality checks that should succeed
|
:test-result: PASS Equality checks that should succeed
|
||||||
|
@ -134,8 +134,8 @@
|
|||||||
:test-result: SKIP Empty generators can SKIP in constructor
|
:test-result: SKIP Empty generators can SKIP in constructor
|
||||||
:test-result: PASS Empty stream name opens cout stream
|
:test-result: PASS Empty stream name opens cout stream
|
||||||
:test-result: FAIL EndsWith string matcher
|
:test-result: FAIL EndsWith string matcher
|
||||||
:test-result: PASS Enums can quickly have stringification enabled using REGISTER_ENUM
|
:test-result: PASS Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
:test-result: PASS Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM
|
:test-result: PASS Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
:test-result: PASS Epsilon only applies to Approx's value
|
:test-result: PASS Epsilon only applies to Approx's value
|
||||||
:test-result: XFAIL Equality checks that should fail
|
:test-result: XFAIL Equality checks that should fail
|
||||||
:test-result: PASS Equality checks that should succeed
|
:test-result: PASS Equality checks that should succeed
|
||||||
|
@ -4083,7 +4083,7 @@ with expansion:
|
|||||||
insensitive)
|
insensitive)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Enums can quickly have stringification enabled using REGISTER_ENUM
|
Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
EnumToString.tests.cpp:<line number>
|
EnumToString.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@ -4117,7 +4117,7 @@ with expansion:
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Enums in namespaces can quickly have stringification enabled using
|
Enums in namespaces can quickly have stringification enabled using
|
||||||
REGISTER_ENUM
|
CATCH_REGISTER_ENUM
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
EnumToString.tests.cpp:<line number>
|
EnumToString.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
|
@ -4081,7 +4081,7 @@ with expansion:
|
|||||||
insensitive)
|
insensitive)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Enums can quickly have stringification enabled using REGISTER_ENUM
|
Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
EnumToString.tests.cpp:<line number>
|
EnumToString.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
@ -4115,7 +4115,7 @@ with expansion:
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Enums in namespaces can quickly have stringification enabled using
|
Enums in namespaces can quickly have stringification enabled using
|
||||||
REGISTER_ENUM
|
CATCH_REGISTER_ENUM
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
EnumToString.tests.cpp:<line number>
|
EnumToString.tests.cpp:<line number>
|
||||||
...............................................................................
|
...............................................................................
|
||||||
|
@ -521,8 +521,8 @@ with expansion:
|
|||||||
at Matchers.tests.cpp:<line number>
|
at Matchers.tests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase classname="<exe-name>.global" name="Enums can quickly have stringification enabled using REGISTER_ENUM" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Epsilon only applies to Approx's value" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Epsilon only applies to Approx's value" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Equality checks that should fail" time="{duration}" status="run">
|
<testcase classname="<exe-name>.global" name="Equality checks that should fail" time="{duration}" status="run">
|
||||||
<skipped message="TEST_CASE tagged with !mayfail"/>
|
<skipped message="TEST_CASE tagged with !mayfail"/>
|
||||||
|
@ -520,8 +520,8 @@ with expansion:
|
|||||||
at Matchers.tests.cpp:<line number>
|
at Matchers.tests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase classname="<exe-name>.global" name="Enums can quickly have stringification enabled using REGISTER_ENUM" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Epsilon only applies to Approx's value" time="{duration}" status="run"/>
|
<testcase classname="<exe-name>.global" name="Epsilon only applies to Approx's value" time="{duration}" status="run"/>
|
||||||
<testcase classname="<exe-name>.global" name="Equality checks that should fail" time="{duration}" status="run">
|
<testcase classname="<exe-name>.global" name="Equality checks that should fail" time="{duration}" status="run">
|
||||||
<skipped message="TEST_CASE tagged with !mayfail"/>
|
<skipped message="TEST_CASE tagged with !mayfail"/>
|
||||||
|
@ -998,8 +998,8 @@ at Decomposition.tests.cpp:<line number>
|
|||||||
</testCase>
|
</testCase>
|
||||||
</file>
|
</file>
|
||||||
<file path="tests/<exe-name>/UsageTests/EnumToString.tests.cpp">
|
<file path="tests/<exe-name>/UsageTests/EnumToString.tests.cpp">
|
||||||
<testCase name="Enums can quickly have stringification enabled using REGISTER_ENUM" duration="{duration}"/>
|
<testCase name="Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM" duration="{duration}"/>
|
||||||
<testCase name="Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM" duration="{duration}"/>
|
<testCase name="Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM" duration="{duration}"/>
|
||||||
<testCase name="toString(enum class w/operator<<)" duration="{duration}"/>
|
<testCase name="toString(enum class w/operator<<)" duration="{duration}"/>
|
||||||
<testCase name="toString(enum class)" duration="{duration}"/>
|
<testCase name="toString(enum class)" duration="{duration}"/>
|
||||||
<testCase name="toString(enum w/operator<<)" duration="{duration}"/>
|
<testCase name="toString(enum w/operator<<)" duration="{duration}"/>
|
||||||
|
@ -997,8 +997,8 @@ at Decomposition.tests.cpp:<line number>
|
|||||||
</testCase>
|
</testCase>
|
||||||
</file>
|
</file>
|
||||||
<file path="tests/<exe-name>/UsageTests/EnumToString.tests.cpp">
|
<file path="tests/<exe-name>/UsageTests/EnumToString.tests.cpp">
|
||||||
<testCase name="Enums can quickly have stringification enabled using REGISTER_ENUM" duration="{duration}"/>
|
<testCase name="Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM" duration="{duration}"/>
|
||||||
<testCase name="Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM" duration="{duration}"/>
|
<testCase name="Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM" duration="{duration}"/>
|
||||||
<testCase name="toString(enum class w/operator<<)" duration="{duration}"/>
|
<testCase name="toString(enum class w/operator<<)" duration="{duration}"/>
|
||||||
<testCase name="toString(enum class)" duration="{duration}"/>
|
<testCase name="toString(enum class)" duration="{duration}"/>
|
||||||
<testCase name="toString(enum w/operator<<)" duration="{duration}"/>
|
<testCase name="toString(enum w/operator<<)" duration="{duration}"/>
|
||||||
|
@ -1004,19 +1004,19 @@ ok {test-number} - Catch::makeStream( "" )->isConsole() for: true
|
|||||||
not ok {test-number} - testStringForMatching(), EndsWith( "Substring" ) for: "this string contains 'abc' as a substring" ends with: "Substring"
|
not ok {test-number} - testStringForMatching(), EndsWith( "Substring" ) for: "this string contains 'abc' as a substring" ends with: "Substring"
|
||||||
# EndsWith string matcher
|
# EndsWith string matcher
|
||||||
not ok {test-number} - testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" ends with: "this" (case insensitive)
|
not ok {test-number} - testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" ends with: "this" (case insensitive)
|
||||||
# Enums can quickly have stringification enabled using REGISTER_ENUM
|
# Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
ok {test-number} - stringify( EnumClass3::Value1 ) == "Value1" for: "Value1" == "Value1"
|
ok {test-number} - stringify( EnumClass3::Value1 ) == "Value1" for: "Value1" == "Value1"
|
||||||
# Enums can quickly have stringification enabled using REGISTER_ENUM
|
# Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
ok {test-number} - stringify( EnumClass3::Value2 ) == "Value2" for: "Value2" == "Value2"
|
ok {test-number} - stringify( EnumClass3::Value2 ) == "Value2" for: "Value2" == "Value2"
|
||||||
# Enums can quickly have stringification enabled using REGISTER_ENUM
|
# Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
ok {test-number} - stringify( EnumClass3::Value3 ) == "Value3" for: "Value3" == "Value3"
|
ok {test-number} - stringify( EnumClass3::Value3 ) == "Value3" for: "Value3" == "Value3"
|
||||||
# Enums can quickly have stringification enabled using REGISTER_ENUM
|
# Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
ok {test-number} - stringify( EnumClass3::Value4 ) == "{** unexpected enum value **}" for: "{** unexpected enum value **}" == "{** unexpected enum value **}"
|
ok {test-number} - stringify( EnumClass3::Value4 ) == "{** unexpected enum value **}" for: "{** unexpected enum value **}" == "{** unexpected enum value **}"
|
||||||
# Enums can quickly have stringification enabled using REGISTER_ENUM
|
# Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
ok {test-number} - stringify( ec3 ) == "Value2" for: "Value2" == "Value2"
|
ok {test-number} - stringify( ec3 ) == "Value2" for: "Value2" == "Value2"
|
||||||
# Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM
|
# Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
ok {test-number} - stringify( Bikeshed::Colours::Red ) == "Red" for: "Red" == "Red"
|
ok {test-number} - stringify( Bikeshed::Colours::Red ) == "Red" for: "Red" == "Red"
|
||||||
# Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM
|
# Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
ok {test-number} - stringify( Bikeshed::Colours::Blue ) == "Blue" for: "Blue" == "Blue"
|
ok {test-number} - stringify( Bikeshed::Colours::Blue ) == "Blue" for: "Blue" == "Blue"
|
||||||
# Epsilon only applies to Approx's value
|
# Epsilon only applies to Approx's value
|
||||||
ok {test-number} - 101.01 != Approx(100).epsilon(0.01) for: 101.01000000000000512 != Approx( 100.0 )
|
ok {test-number} - 101.01 != Approx(100).epsilon(0.01) for: 101.01000000000000512 != Approx( 100.0 )
|
||||||
|
@ -1002,19 +1002,19 @@ ok {test-number} - Catch::makeStream( "" )->isConsole() for: true
|
|||||||
not ok {test-number} - testStringForMatching(), EndsWith( "Substring" ) for: "this string contains 'abc' as a substring" ends with: "Substring"
|
not ok {test-number} - testStringForMatching(), EndsWith( "Substring" ) for: "this string contains 'abc' as a substring" ends with: "Substring"
|
||||||
# EndsWith string matcher
|
# EndsWith string matcher
|
||||||
not ok {test-number} - testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" ends with: "this" (case insensitive)
|
not ok {test-number} - testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" ends with: "this" (case insensitive)
|
||||||
# Enums can quickly have stringification enabled using REGISTER_ENUM
|
# Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
ok {test-number} - stringify( EnumClass3::Value1 ) == "Value1" for: "Value1" == "Value1"
|
ok {test-number} - stringify( EnumClass3::Value1 ) == "Value1" for: "Value1" == "Value1"
|
||||||
# Enums can quickly have stringification enabled using REGISTER_ENUM
|
# Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
ok {test-number} - stringify( EnumClass3::Value2 ) == "Value2" for: "Value2" == "Value2"
|
ok {test-number} - stringify( EnumClass3::Value2 ) == "Value2" for: "Value2" == "Value2"
|
||||||
# Enums can quickly have stringification enabled using REGISTER_ENUM
|
# Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
ok {test-number} - stringify( EnumClass3::Value3 ) == "Value3" for: "Value3" == "Value3"
|
ok {test-number} - stringify( EnumClass3::Value3 ) == "Value3" for: "Value3" == "Value3"
|
||||||
# Enums can quickly have stringification enabled using REGISTER_ENUM
|
# Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
ok {test-number} - stringify( EnumClass3::Value4 ) == "{** unexpected enum value **}" for: "{** unexpected enum value **}" == "{** unexpected enum value **}"
|
ok {test-number} - stringify( EnumClass3::Value4 ) == "{** unexpected enum value **}" for: "{** unexpected enum value **}" == "{** unexpected enum value **}"
|
||||||
# Enums can quickly have stringification enabled using REGISTER_ENUM
|
# Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
ok {test-number} - stringify( ec3 ) == "Value2" for: "Value2" == "Value2"
|
ok {test-number} - stringify( ec3 ) == "Value2" for: "Value2" == "Value2"
|
||||||
# Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM
|
# Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
ok {test-number} - stringify( Bikeshed::Colours::Red ) == "Red" for: "Red" == "Red"
|
ok {test-number} - stringify( Bikeshed::Colours::Red ) == "Red" for: "Red" == "Red"
|
||||||
# Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM
|
# Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM
|
||||||
ok {test-number} - stringify( Bikeshed::Colours::Blue ) == "Blue" for: "Blue" == "Blue"
|
ok {test-number} - stringify( Bikeshed::Colours::Blue ) == "Blue" for: "Blue" == "Blue"
|
||||||
# Epsilon only applies to Approx's value
|
# Epsilon only applies to Approx's value
|
||||||
ok {test-number} - 101.01 != Approx(100).epsilon(0.01) for: 101.01000000000000512 != Approx( 100.0 )
|
ok {test-number} - 101.01 != Approx(100).epsilon(0.01) for: 101.01000000000000512 != Approx( 100.0 )
|
||||||
|
@ -315,10 +315,10 @@
|
|||||||
##teamcity[testFailed name='EndsWith string matcher' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "Substring"|n']
|
##teamcity[testFailed name='EndsWith string matcher' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "Substring"|n']
|
||||||
##teamcity[testFailed name='EndsWith string matcher' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "this" (case insensitive)|n']
|
##teamcity[testFailed name='EndsWith string matcher' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "this" (case insensitive)|n']
|
||||||
##teamcity[testFinished name='EndsWith string matcher' duration="{duration}"]
|
##teamcity[testFinished name='EndsWith string matcher' duration="{duration}"]
|
||||||
##teamcity[testStarted name='Enums can quickly have stringification enabled using REGISTER_ENUM']
|
##teamcity[testStarted name='Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM']
|
||||||
##teamcity[testFinished name='Enums can quickly have stringification enabled using REGISTER_ENUM' duration="{duration}"]
|
##teamcity[testFinished name='Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM' duration="{duration}"]
|
||||||
##teamcity[testStarted name='Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM']
|
##teamcity[testStarted name='Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM']
|
||||||
##teamcity[testFinished name='Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM' duration="{duration}"]
|
##teamcity[testFinished name='Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM' duration="{duration}"]
|
||||||
##teamcity[testStarted name='Epsilon only applies to Approx|'s value']
|
##teamcity[testStarted name='Epsilon only applies to Approx|'s value']
|
||||||
##teamcity[testFinished name='Epsilon only applies to Approx|'s value' duration="{duration}"]
|
##teamcity[testFinished name='Epsilon only applies to Approx|'s value' duration="{duration}"]
|
||||||
##teamcity[testStarted name='Equality checks that should fail']
|
##teamcity[testStarted name='Equality checks that should fail']
|
||||||
|
@ -315,10 +315,10 @@
|
|||||||
##teamcity[testFailed name='EndsWith string matcher' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "Substring"|n']
|
##teamcity[testFailed name='EndsWith string matcher' message='Matchers.tests.cpp:<line number>|n...............................................................................|n|nMatchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "Substring" ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "Substring"|n']
|
||||||
##teamcity[testFailed name='EndsWith string matcher' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "this" (case insensitive)|n']
|
##teamcity[testFailed name='EndsWith string matcher' message='Matchers.tests.cpp:<line number>|nexpression failed|n CHECK_THAT( testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) )|nwith expansion:|n "this string contains |'abc|' as a substring" ends with: "this" (case insensitive)|n']
|
||||||
##teamcity[testFinished name='EndsWith string matcher' duration="{duration}"]
|
##teamcity[testFinished name='EndsWith string matcher' duration="{duration}"]
|
||||||
##teamcity[testStarted name='Enums can quickly have stringification enabled using REGISTER_ENUM']
|
##teamcity[testStarted name='Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM']
|
||||||
##teamcity[testFinished name='Enums can quickly have stringification enabled using REGISTER_ENUM' duration="{duration}"]
|
##teamcity[testFinished name='Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM' duration="{duration}"]
|
||||||
##teamcity[testStarted name='Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM']
|
##teamcity[testStarted name='Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM']
|
||||||
##teamcity[testFinished name='Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM' duration="{duration}"]
|
##teamcity[testFinished name='Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM' duration="{duration}"]
|
||||||
##teamcity[testStarted name='Epsilon only applies to Approx|'s value']
|
##teamcity[testStarted name='Epsilon only applies to Approx|'s value']
|
||||||
##teamcity[testFinished name='Epsilon only applies to Approx|'s value' duration="{duration}"]
|
##teamcity[testFinished name='Epsilon only applies to Approx|'s value' duration="{duration}"]
|
||||||
##teamcity[testStarted name='Equality checks that should fail']
|
##teamcity[testStarted name='Equality checks that should fail']
|
||||||
|
@ -4493,7 +4493,7 @@ C
|
|||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="false" skips="0"/>
|
<OverallResult success="false" skips="0"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Enums can quickly have stringification enabled using REGISTER_ENUM" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" >
|
<TestCase name="Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" >
|
||||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
stringify( EnumClass3::Value1 ) == "Value1"
|
stringify( EnumClass3::Value1 ) == "Value1"
|
||||||
@ -4538,7 +4538,7 @@ C
|
|||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="true" skips="0"/>
|
<OverallResult success="true" skips="0"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" >
|
<TestCase name="Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" >
|
||||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
stringify( Bikeshed::Colours::Red ) == "Red"
|
stringify( Bikeshed::Colours::Red ) == "Red"
|
||||||
|
@ -4493,7 +4493,7 @@ C
|
|||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="false" skips="0"/>
|
<OverallResult success="false" skips="0"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Enums can quickly have stringification enabled using REGISTER_ENUM" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" >
|
<TestCase name="Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" >
|
||||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
stringify( EnumClass3::Value1 ) == "Value1"
|
stringify( EnumClass3::Value1 ) == "Value1"
|
||||||
@ -4538,7 +4538,7 @@ C
|
|||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="true" skips="0"/>
|
<OverallResult success="true" skips="0"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<TestCase name="Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" >
|
<TestCase name="Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" >
|
||||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" >
|
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/EnumToString.tests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
stringify( Bikeshed::Colours::Red ) == "Red"
|
stringify( Bikeshed::Colours::Red ) == "Red"
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <helpers/type_with_lit_0_comparisons.hpp>
|
#include <helpers/type_with_lit_0_comparisons.hpp>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
// Setup for #1403 -- look for global overloads of operator << for classes
|
// Setup for #1403 -- look for global overloads of operator << for classes
|
||||||
@ -34,6 +35,7 @@ static std::ostream& operator<<(std::ostream& out, foo::helper_1403 const&) {
|
|||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
|
||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
#include <catch2/generators/catch_generators_range.hpp>
|
||||||
#include <catch2/matchers/catch_matchers_string.hpp>
|
#include <catch2/matchers/catch_matchers_string.hpp>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -467,3 +469,57 @@ TEST_CASE( "Comparing const std::weak_ordering instances must compile",
|
|||||||
REQUIRE( plain_ordering_1 == const_ordering_1 );
|
REQUIRE( plain_ordering_1 == const_ordering_1 );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Reproduce issue with yaml-cpp iterators, where the `const_iterator`
|
||||||
|
// for Node type has `const T` as the value_type. This is wrong for
|
||||||
|
// multitude of reasons, but there might be other libraries in the wild
|
||||||
|
// that share this issue, and the workaround needed to support
|
||||||
|
// `from_range(iter, iter)` helper with those libraries is easy enough.
|
||||||
|
class HasBadIterator {
|
||||||
|
std::array<int, 10> m_arr{};
|
||||||
|
|
||||||
|
public:
|
||||||
|
class iterator {
|
||||||
|
const int* m_ptr = nullptr;
|
||||||
|
|
||||||
|
public:
|
||||||
|
iterator( const int* ptr ): m_ptr( ptr ) {}
|
||||||
|
|
||||||
|
using difference_type = std::ptrdiff_t;
|
||||||
|
using value_type = const int;
|
||||||
|
using pointer = const int*;
|
||||||
|
using reference = const int&;
|
||||||
|
using iterator_category = std::input_iterator_tag;
|
||||||
|
|
||||||
|
iterator& operator++() {
|
||||||
|
++m_ptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator operator++( int ) {
|
||||||
|
auto ret( *this );
|
||||||
|
++( *this );
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend bool operator==( iterator lhs, iterator rhs ) {
|
||||||
|
return lhs.m_ptr == rhs.m_ptr;
|
||||||
|
}
|
||||||
|
friend bool operator!=( iterator lhs, iterator rhs ) {
|
||||||
|
return !( lhs == rhs );
|
||||||
|
}
|
||||||
|
|
||||||
|
int operator*() const { return *m_ptr; }
|
||||||
|
};
|
||||||
|
|
||||||
|
iterator cbegin() const { return { m_arr.data() }; }
|
||||||
|
iterator cend() const { return { m_arr.data() + m_arr.size() }; }
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_CASE("from_range(iter, iter) supports const_iterators", "[generators][from-range][approvals]") {
|
||||||
|
using namespace Catch::Generators;
|
||||||
|
|
||||||
|
HasBadIterator data;
|
||||||
|
auto gen = from_range(data.cbegin(), data.cend());
|
||||||
|
(void)gen;
|
||||||
|
}
|
||||||
|
@ -79,7 +79,7 @@ enum class EnumClass3 { Value1, Value2, Value3, Value4 };
|
|||||||
CATCH_REGISTER_ENUM( EnumClass3, EnumClass3::Value1, EnumClass3::Value2, EnumClass3::Value3 )
|
CATCH_REGISTER_ENUM( EnumClass3, EnumClass3::Value1, EnumClass3::Value2, EnumClass3::Value3 )
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE( "Enums can quickly have stringification enabled using REGISTER_ENUM" ) {
|
TEST_CASE( "Enums can quickly have stringification enabled using CATCH_REGISTER_ENUM" ) {
|
||||||
using Catch::Detail::stringify;
|
using Catch::Detail::stringify;
|
||||||
REQUIRE( stringify( EnumClass3::Value1 ) == "Value1" );
|
REQUIRE( stringify( EnumClass3::Value1 ) == "Value1" );
|
||||||
REQUIRE( stringify( EnumClass3::Value2 ) == "Value2" );
|
REQUIRE( stringify( EnumClass3::Value2 ) == "Value2" );
|
||||||
@ -101,7 +101,7 @@ CATCH_REGISTER_ENUM( Bikeshed::Colours,
|
|||||||
Bikeshed::Colours::Green,
|
Bikeshed::Colours::Green,
|
||||||
Bikeshed::Colours::Blue )
|
Bikeshed::Colours::Blue )
|
||||||
|
|
||||||
TEST_CASE( "Enums in namespaces can quickly have stringification enabled using REGISTER_ENUM" ) {
|
TEST_CASE( "Enums in namespaces can quickly have stringification enabled using CATCH_REGISTER_ENUM" ) {
|
||||||
using Catch::Detail::stringify;
|
using Catch::Detail::stringify;
|
||||||
REQUIRE( stringify( Bikeshed::Colours::Red ) == "Red" );
|
REQUIRE( stringify( Bikeshed::Colours::Red ) == "Red" );
|
||||||
REQUIRE( stringify( Bikeshed::Colours::Blue ) == "Blue" );
|
REQUIRE( stringify( Bikeshed::Colours::Blue ) == "Blue" );
|
||||||
|
Loading…
Reference in New Issue
Block a user