Martin Hořeňovský
0c122c135d
Add constructor arg checking to WithinAbsMatcher
...
Also tests :-)
2017-12-06 15:42:03 +01:00
Phil Nash
5e063616df
Moved runner helpers into Catch namespace
...
not sure they weren't there to start with
2017-12-05 23:26:21 +00:00
Phil Nash
aa9d635014
Refactored StreamRedirect classes
2017-12-05 23:19:28 +00:00
Phil Nash
533cdc6bc1
Revirtualised IResultCapture methods
...
Didn't really impact runtime anyway, but will need to use interface for threading support.
2017-12-05 16:23:10 +00:00
Phil Nash
dfa817ae73
Just track whether last assertion passed directly, rather than deduce it from counts
2017-12-02 18:44:23 +00:00
Phil Nash
57c346a46d
Removed assertionRun() and rolled its logic into assertionPassed() and assertionEnded()
2017-12-02 18:44:23 +00:00
Phil Nash
b76e80ed3d
Small clean-ups
2017-11-30 17:54:44 +03:00
Phil Nash
7d0db6b8e9
Moved -Wparentheses suppression before the push for GCC
...
Because of bugs in GCC 4 & 5 that prevent _Pragma from working :-(
2017-11-29 20:19:50 +03:00
Phil Nash
8a7493cd88
Globally suppress Wunused-variable again, for now
2017-11-29 20:01:00 +03:00
Phil Nash
b5a5d9a6f8
Stop leaking some warning suppressions to user code
2017-11-29 19:14:33 +03:00
Phil Nash
e3941a9ad2
De-virtualised isBinaryExpression() and getResult() on ITransientExpression
2017-11-27 22:49:26 +03:00
Phil Nash
da86ddc620
Fixed accidental const & formating
2017-11-27 22:28:45 +03:00
Phil Nash
4b614ee1d1
Moved all AssertionHandler logic into RunContext and de-virtualised interface
...
This makes the assertion handling much less "chatty". AssertionHandler is now just a thin shim over RunContext
2017-11-27 22:23:15 +03:00
Phil Nash
5461242ffe
Renamed last usge specific handle method (and made the low level ones private)
2017-11-27 22:23:15 +03:00
Phil Nash
db44964e27
Refactored most handle() calls to more specific/ descriptive calls
2017-11-26 21:28:43 +00:00
Phil Nash
2800adba25
Qualified handleExceptionMatchExpr in Catch::
...
(was picking it up by ADL before - no need to rely on that!)
2017-11-26 21:28:43 +00:00
Phil Nash
c411c131cb
Move crtdbg.h include outside namespace
2017-11-24 10:36:54 +00:00
Phil Nash
091595780e
Clean-up re-usable string streams
2017-11-24 08:46:17 +00:00
Phil Nash
f417995afc
Cache IResultCapture in AssertionHandler to avoid repeated lookups
2017-11-23 19:21:09 +00:00
Phil Nash
9329d97a43
Always debug-break non-inline
2017-11-23 19:14:26 +00:00
Phil Nash
8141a7836f
Inline shouldDebugBreak()
2017-11-23 16:58:43 +00:00
Phil Nash
5323202652
Bake exception guard into assertion handler flow
2017-11-23 16:52:46 +00:00
Martin Hořeňovský
401ad7a189
Remove isTrue, alwaysTrue, alwaysFalse
...
isTrue and alwaysFalse were replaced by (void)0, 0 inspired by doctest
alwaysTrue was replaced by warning suppression
2017-11-22 16:03:45 +01:00
Martin Hořeňovský
87c125ecb8
Enable Werror for dev builds
2017-11-21 18:55:28 +01:00
Phil Nash
3b965aa501
(re)Inlined isTrue()
2017-11-21 13:12:22 +00:00
Phil Nash
e54dcdac8b
Added space in StringRef literal operator
2017-11-21 12:09:04 +00:00
Phil Nash
e4a898eaaa
Removed templated StringRef ctor and added StringRef literal
2017-11-21 11:08:39 +00:00
Martin Hořeňovský
a8a1c379c0
Introduce a way to intentionally expose interface for use in tests
...
Fixes #1076
2017-11-21 11:10:07 +01:00
Phil Nash
e08a4ed99e
Added missing <cstring> include to stringref.cpp
2017-11-21 09:26:56 +00:00
Phil Nash
fcba30569c
Refactored to resetAssertionInfo()
2017-11-20 16:33:06 +00:00
Phil Nash
4353614df7
Added StringRef constructor that captures string literal size at compile time
2017-11-20 16:33:05 +00:00
Martin Hořeňovský
baf3d2f360
Split out ratio_string::symbol bodies
2017-11-19 14:54:52 +01:00
Martin Hořeňovský
b083b04126
Fix compilation when using g++ with libc++
...
Fixes #1110
2017-11-19 14:47:18 +01:00
Neal Coombes
f18366150e
performance improvement - getCurrentContext
...
inlined getCurrentContext and getMutableContext
Further work on #1086 .
Brings test from 0m37.913 to 0m25.584s
Catch2 is now faster than Catch 1.x!!
2017-11-17 14:55:30 -06:00
Neal Coombes
fe725648a7
performance improvement - StringRef::operator=
...
inlined and reduced data copy in half.
Further work on #1086 .
Brings test from 0m44.942s to 0m37.913.
2017-11-17 14:15:26 -06:00
Phil Nash
b0c379f621
Inlined StringRef ctors/ dtor and size() and empty()
2017-11-17 18:38:54 +00:00
Neal Coombes
b9339333df
Performance improvement
...
Begin to address #1086
Brings test from 2m51.072s to 1m15.661s
2017-11-15 14:43:43 -06:00
Martin Hořeňovský
98d4c49d1c
Provide ConsoleReporter declaration with EXTERNAL_INTERFACES
...
Related to #991
2017-11-14 20:42:58 +01:00
Martin Hořeňovský
a096e4b3f2
Provide XmlReporter declaration with EXTERNAL_INTERFACES
...
Related to #991
2017-11-14 17:56:27 +01:00
Martin Hořeňovský
4b3730de8a
Provide JunitReporter declaration with EXTERNAL_INTERFACES
...
Related to #991
2017-11-14 17:15:13 +01:00
Martin Hořeňovský
6acdacfde0
Provide CompactReporter declaration with EXTERNAL_INTERFACES
...
Related to #991
2017-11-14 16:13:35 +01:00
Martin Hořeňovský
b0857e846f
Provide a regex matcher against std::string
...
Related to #1040
2017-11-13 15:35:31 +01:00
Martin Hořeňovský
a06b6dc3ea
Remove pointless StringRef -> std::string conversions
2017-11-13 13:08:59 +01:00
Martin Hořeňovský
0adb04807a
Change how non-nullness is enforce in StringRef constructor
2017-11-13 13:04:45 +01:00
Martin Hořeňovský
f80f28e09a
Fix pointless type mismatch between StringRef and std::string
2017-11-13 12:49:13 +01:00
Martin Hořeňovský
484eee973c
Move StringRef's impl details to anonymous namespace
2017-11-13 12:41:04 +01:00
Martin Hořeňovský
d09fe4459d
Stop recounting constant string's length on each passed assertion
2017-11-13 12:27:02 +01:00
Martin Hořeňovský
e484236825
Don't invoke UB when nullptr is passed to StringRef constructor
2017-11-13 12:09:19 +01:00
Martin Hořeňovský
e7c23b73da
Don't call strlen in StringRef when the length was already passed
2017-11-13 12:03:45 +01:00
Phil Nash
3537b7858f
Removed vestigal ComparatorT template arg to MatcherBase
2017-11-13 10:08:48 +00:00
Martin Hořeňovský
8dbaac61ff
Final set of fixes for floating matchers approvals
2017-11-12 11:49:36 +01:00
Martin Hořeňovský
a0dbc62955
Fix OS X compilation error
2017-11-10 19:56:39 +01:00
Martin Hořeňovský
5f961af70e
Remove leftover commented out lines
2017-11-10 18:37:58 +01:00
Martin Hořeňovský
0b1f1b1003
Add ULP and margin matcher
...
Closes #1074
2017-11-10 18:33:00 +01:00
Martin Hořeňovský
13370bddf2
Revert "Move <ctime> include out of line"
...
This reverts commit 36f02d76d6
.
2017-11-08 08:31:48 +01:00
Martin Hořeňovský
36f02d76d6
Move <ctime> include out of line
2017-11-07 21:59:52 +01:00
Phil Nash
0d3fc59f6d
Added missing <memory> include
2017-11-07 18:48:57 +00:00
Phil Nash
56e1075613
Introduced ReusableStringStream and removed all uses of std::ostringstream from the main path
...
ReusableStringStream holds a std::ostringstream internally, but only exposes the ostream interface.
It caches a pool of ostringstreams in a vector which is currently global, but will be made thread-local.
Altogether this should enable both runtime and compile-time benefits. although more work is needed to realise the compile time opportunities.
2017-11-07 18:01:10 +00:00
Phil Nash
868e125d49
Moved a lot of stream related stuff out of the public headers and replaced more ostream dependencies with iosfwd
2017-11-07 15:55:09 +00:00
Daniel Doubleday
e28763ad05
Fix platform detection for iOS
2017-11-06 10:08:22 +01:00
Martin Hořeňovský
4f9123dc20
Remove self-include in header
2017-11-03 22:34:49 +01:00
Phil Nash
4acf112c19
Removed zombie files
...
These files were removed from the Catch2 branch, and crept back in when Catch2 merged with master
2017-11-03 16:56:11 +00:00
Phil Nash
46c7c9d3a0
Merge branch 'catch2'
2017-11-03 12:05:38 +00:00
Phil Nash
b119ebdde1
v2.0.1 release
2017-11-03 12:01:52 +00:00
Phil Nash
fe05062f9e
Print any start-up exceptions in Session's constructor, so custom main's don't need to worry about them
2017-11-02 17:58:07 +00:00
Martin Hořeňovský
22ac9d2184
Approx cleanup: More tests, INFINITY handling, etc
2017-11-01 07:30:11 +01:00
Pfiffikus
00af677577
Approx rework: default scale == 0, epsilon applies to Approx::value
...
Also adds check to Approx::epsilon that the new epsilon has a valid
(ie one between 0 and 1)
Based on
http://realtimecollisiondetection.net/blog/?p=89
https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
https://en.wikipedia.org/wiki/Approximation_error#Formal_Definition
The given epsilon should refer to the target value, otherwise
the result would be unexpected, e.g. 101.02 == Approx(100).epsilon(0.01)
is true.
The default scale should be invisible, thus,
e.g. 101.01 == Approx(100).epsilon(0.01) gets false.
Finally even 101.000001 == Approx(100).epsilon(0.01) is false
2017-10-31 15:43:42 +01:00
Martin Hořeňovský
ae21020640
dev build 6
2017-10-31 15:17:21 +01:00
Martin Hořeňovský
11f716f28d
Make Approx::margin inclusive
...
Fixes #952 , related to #980
2017-10-31 14:49:00 +01:00
Sebastian Grottel
96c5de678d
RandomNumberGenerator::result_type
should be unsigned (#1050 )
...
`result_type` must be unsigned:
http://en.cppreference.com/w/cpp/concept/UniformRandomBitGenerator
Using a signed type causes an infinite loop working with MS Visual Studio 2017, targetting: v140, WindowsTargetPlatformVersion 10.0.15063.0, Debug, x64
2017-10-31 14:26:36 +01:00
Dmitry Kozhevnikov
44244713f1
Update handling of __JETBRAINS_IDE__ macro
...
1. Use it to conditionally define CATCH_INTERNAL_CONFIG_COUNTER, not
CATCH_CONFIG_COUNTER, as __JETBRAINS_IDE__ is similar to
compiler-provided macros, not to user-provided ones.
2. Since __COUNTER__ will work starting with CLion 2017.3, use it
when possible (and hopefully remove this check altogether
at some point).
2017-10-31 14:15:54 +01:00
Martin Hořeňovský
2a3606f8e3
v1.11.0
2017-10-31 13:55:48 +01:00
Martin Hořeňovský
a6cf19abff
Make Approx::margin inclusive
...
Fixes #952 , related to #980
2017-10-30 21:33:29 +01:00
Martin Hořeňovský
57b4e0b64c
Fix missing pragma warning(pop) and other warnings under MSVC
...
Fixes #1072
2017-10-30 09:58:13 +01:00
Sebastian Grottel
296955c437
RandomNumberGenerator::result_type
should be unsigned (#1050 )
...
`result_type` must be unsigned:
http://en.cppreference.com/w/cpp/concept/UniformRandomBitGenerator
Using a signed type causes an infinite loop working with MS Visual Studio 2017, targetting: v140, WindowsTargetPlatformVersion 10.0.15063.0, Debug, x64
2017-10-15 18:30:40 +02:00
Phil Nash
05b1ca2884
Fixed expansion of _FALSE binary expression
...
- see #1051
2017-10-13 19:45:19 +01:00
Phil Nash
da6c2a6914
Fixed expansion of _FALSE binary expression
...
- see #1051
2017-10-13 19:44:20 +01:00
Phil Nash
c2b7bd15c0
Changed rhs expression capture from universal ref to const ref.
...
- addresses #1027
2017-10-13 14:16:14 +01:00
Phil Nash
2eb93f47f7
enclosed more min/ max in parentheses to default MFC macros
2017-10-13 13:46:39 +01:00
Phil Nash
355ab78f4a
dev build 5
2017-10-12 13:06:41 +01:00
Phil Nash
927f520a97
Moved windows proxy inclusion outside of CATCH_CONFIG_COLOUR_WINDOWS guard, so workaround early inclusion can be removed
2017-10-12 10:37:23 +01:00
philsquared
cc0b093c20
unconditional windows proxy
2017-10-11 14:58:20 +01:00
Martin Hořeňovský
4899d891d3
Fix MSVC compilation when stringifying std::chrono::time_point
2017-10-09 13:13:30 +02:00
Martin Hořeňovský
79b405fd3f
Add stringification for std::chrono::{duration,time_point}
...
Also hides std::chrono, std::pair and std::chrono::* behind
new configuration macros, CATCH_CONFIG_ENABLE_*_STRINGMAKER
to avoid dragging in <utility>, <tuple> and <chrono> in common
path, unless requested.
2017-10-09 13:03:29 +02:00
Martin Hořeňovský
70e0d48978
Replace throw; with std::rethrow_exception(std::current_exception());
...
This works around a bug in libcxxrt handling of active exception count
that caused std::uncaught_exception() to return true even if there was
none.
Closes #1028
2017-09-28 12:53:09 +02:00
Phil Nash
2a1f8ae684
New version of Clara
2017-09-26 14:13:08 -07:00
Phil Nash
bd46f66754
dev build 4
2017-09-19 17:42:20 +01:00
Phil Nash
54f1ce2af2
Don't use console colour if running in XCode
2017-09-19 15:25:33 +01:00
Phil Nash
b9ff7ec301
Fixed issues for ObjC use (see #1011 )
2017-09-19 14:38:18 +01:00
Phil Nash
8da0d0473b
qualified a load of size_ts with std:: namespace (all those not from Clara)
2017-09-18 17:13:17 +01:00
Martin Hořeňovský
40209d1ae0
Use StringRef on fatal error path
...
So far the fatal error path only uses string literals, so this removes
an allocation from that context
2017-09-14 20:05:25 +02:00
Martin Hořeňovský
4e85267203
Add fatalErrorEncountered method to Reporter/Listener interface
...
An empty default implementation is provided to keep backward compatibility.
Called when signal or Structured Exception is encountered.
Related to #1005
2017-09-14 19:57:59 +02:00
Martin Hořeňovský
eaf850cd0c
Do not use SEH and console api under UWP
...
Fixes #1020
2017-09-11 21:09:35 +02:00
Dmitry Kozhevnikov
9c07718b5f
Update handling of __JETBRAINS_IDE__ macro
...
1. Use it to conditionally define CATCH_INTERNAL_CONFIG_COUNTER, not
CATCH_CONFIG_COUNTER, as __JETBRAINS_IDE__ is similar to
compiler-provided macros, not to user-provided ones.
2. Since __COUNTER__ will work starting with CLion 2017.3, use it
when possible (and hopefully remove this check altogether
at some point).
2017-09-07 18:00:04 +02:00
Martin Hořeňovský
9aa96712ae
Sweep out some extra warnings
...
Swept:
`-Wpadded` in some places (where it caused extra size, instead of just
saying "hey, we padded struct at the end to align, just as standard says")
`-Wweak-vtables` everywhere (Clang)
`-Wexit-time-destructors` everywhere (Clang)
`-Wmissing-noreturn` everywhere (Clang)
The last three are enabled for Clang compilation going forward.
Also enabled `-Wunreachable-code` for Clang and GCC
2017-09-07 17:25:15 +02:00
Phil Nash
03d41ce5b9
Suppressed meaningless function type qualifier warning in MSVC again
...
(this time in catch_tostring.h)
2017-09-07 11:25:10 +01:00
Phil Nash
c5608f0202
Changed all .hpp extensions to .h where there is now a corresponding .cpp
2017-09-07 11:24:33 +01:00
Phil Nash
8c39f9a725
Suppress MSVC warning about meaningless function type qualifier in generic code
2017-09-07 11:15:07 +01:00
Phil Nash
2d37649377
Fixed Objective-C mode
2017-09-06 15:44:42 +01:00
Martin Hořeňovský
8d03cb4915
Use StringRef to pass comparison operator name to BinaryExpr
...
Some nominally C++11 platforms do not have SSO (I am looking at
you libstdc++), where this avoids meaningless allocations.
2017-09-06 15:15:48 +02:00