Lyashenko Arsenii Maksimovich
021fcee636
Finish fixing invalid compilation using MinGW
2018-06-04 23:49:40 +02:00
Martin Hořeňovský
3a47b8b072
Add missing catch_platform include to compiler capabilities
...
This was removed in 64be2ad
, to fix OS X approval tests. At the time
I couldn't investigate because I didn't have access to OS X, but this
fixed it (and since we don't have MinGW in CI, the breakage went
unnoticed).
As it turns out, piece-wise compilation of the Compact
reporter had broken OS X detection for a long time, and fixing it
was what broke the approvals. After the approval scripts were
changed to compensate, this change passes approval tests and fixes
2018-06-04 23:19:55 +02:00
BiCapitalization
88d7b8da25
Ensure stack size for POSIX signal handling is sufficient
...
Until now, the stack size for POSIX signal handling was determined by
the implementation defined limit `STKSZ`, which in some cases turned out
to be insufficient, leading to stack overflow inside the signal handler.
The new size, which was determined experimentally, is the larger of 32kb
or `MINSTKSZ`.
Fixes #1225
2018-05-29 22:29:04 +02:00
Martin Hořeňovský
4c7b7d04fe
Move FALLBACK_STRINGIFIER to before the enum and range fallbacks
...
This should align more closely with the intended semantics, where
types without `StringMaker` specialization or `operator<<` overload
are passed down to the user defined fallback stringifier.
Related to #1024
2018-05-14 20:38:05 +02:00
Martin Hořeňovský
6c5c4c43a0
Add stringification support to std::exception and deriving classes
...
This support is based on overriden `std::exception::what` method, so
if an exception does not do so meaningfully, the message is still
pointless.
This is only used as a fallback, both `StringMaker` specialization and
`operator<<` overload have priority..
2018-05-12 17:46:25 +02:00
Martin Hořeňovský
0074926e5c
Provide a polyfill over std::to_string
...
Android apparently does not support `std::to_string`, so we add a
small polyfill over it. Right now only the ULP matcher uses it,
but we have had plans to use it in `StringMaker<int>` and friends,
as it performs a lot better than `std::stringstream` based
stringification on MSVC.
See #1280 for more details
2018-05-09 21:47:42 +02:00
Martin Hořeňovský
ae590fe216
Only use tmpfile workaround for MSVC and not MinGW and friends
...
Fixes #1270
2018-04-30 23:19:39 +02:00
Martin Hořeňovský
0510d4755f
Fix missing include and wrong comment format
...
While the comment format was valid C++, it breaks our tooling badly.
I opened up a github issue for our tooling, because unexpected
formatting of a block comment should not silently generate invalid
single header file, see #1269 .
2018-04-30 15:15:59 +02:00
Martin Hořeňovský
e92b9c07c3
Add an experimental new way of capturing stdout/stderr
...
Unlike the relatively non-invasive old way of capturing stdout/stderr,
this new way is also able to capture output from C's stdlib functions
such as `printf`. This is done by redirecting stdout and stderr file
descriptors to a file, and then reading this file back.
This approach has two sizeable drawbacks:
1) Performance, obviously. Previously an installed capture made the
program run faster (as long as it was then discarded), because a call
to `std::cout` did not result in text output to the console. This new
capture method in fact forces disk IO. While it is likely that any
modern OS will keep this file in memory-cache and might never actually
issue the IO to the backing storage, it is still a possibility and
calls to the file system are not free.
2) Nonportability. While POSIX is usually assumed portable, and this
implementation relies only on a very common parts of it, it is no
longer standard C++ (or just plain C) and thus might not be available
on some obscure platforms. Different C libs might also implement the
relevant functions in a less-than-useful ways (e.g. MS's `tmpfile`
generates a temp file inside system folder, so it will not work
without elevated privileges and thus is useless).
These two drawbacks mean that, at least for now, the new capture is
opt-in. To opt-in, `CATCH_CONFIG_EXPERIMENTAL_REDIRECT` needs to be
defined in the implementation file.
Closes #1243
2018-04-29 22:25:49 +02:00
Ian Hattendorf
88a6ff0b65
Cast to unsigned char when using std::isalnum
...
std::isalnum expects an int in the range of unsigned char or -1 (EOF),
otherwise it exhibits undefined behavior. Casting from char to unsigned
char avoids this.
MSVC warns about this when compiling with /analyze.
2018-04-29 20:28:35 +02:00
Martin Hořeňovský
64be2ad96c
Remove superfluous include and fix comment
2018-04-26 21:44:07 +02:00
Martin Hořeňovský
c651f239f0
Detect MinGW as Windows platform w/o SEH
...
Fixes #1257
2018-04-22 18:46:54 +02:00
Marcus Näslund
43769a19f7
Changed to c++ style includes
2018-04-21 15:58:05 +02:00
Barry
200d3ad824
Support for parenthesizing types with commas.
2018-04-20 15:11:09 +02:00
Martin Hořeňovský
f00257e374
Call listeners before calling reporters
...
Catch2's documentation promises that listeners are called _before_
reporters, but because of the previous implementation, they were
called _after_ reporters. This commit fixes that.
Closes #1234
2018-04-07 12:25:03 +02:00
Martin Hořeňovský
414dcae34a
Allow only 1 reporter at a time
2018-04-07 12:05:29 +02:00
Martin Hořeňovský
d2d8455b57
v2.2.2
2018-04-06 12:11:22 +02:00
Martin Hořeňovský
ab30621138
Fix stringifying static array of unsigned chars
...
The fix leaves an open question: should we keep treating refs
to static array of chars as strings, or should we instead
use `strnlen` to check if it is null-terminated within the buffer
Fixes #1238
2018-04-06 11:43:12 +02:00
Martin Hořeňovský
1ca8f43b01
Add PredicateMatcher that takes an arbitrary predicate functions
...
Also adds `Predicate` helper function to create `PredicateMatcher`.
Because of limitations in type inference it needs to be explicitly
typed, like so
`Predicate<std::string>([](std::string const& str) { ... })`.
It also takes an optional second argument for description of the
predicate.
It is possible to infer the argument with sufficient TMP, see
https://stackoverflow.com/questions/43560492/how-to-extract-lambdas-return-type-and-variadic-parameters-pack-back-from-gener/43561563#43561563
but I don't think that the magic is worth introducing ATM.
Closes #1236
2018-04-04 11:14:19 +02:00
David Aue
dfb83f20e9
Add stringification methods for CLR objects
2018-04-03 19:06:16 +02:00
Martin Hořeňovský
931441251e
Add an early bailout out of benchmark timer calibration
...
Specific platforms (e.g. TDM-GCC) can have terrible timer resolution,
and our checking code will then loop for an inordinate amount of time.
This change will make it so that the calibration gives up after 3
seconds and just uses the already measured values.
This leaves one open question, how to signal that the resolution
is terrible and benchmarking should not happen?
Fixes #1237
2018-04-01 22:50:39 +02:00
Mike
3641706923
Leak less GCC warnings suppressions out of Catch
2018-04-01 13:57:05 +02:00
Martin Hořeňovský
3b801c4fda
Modify XML encoder to hex-encode invalid UTF-8 sequences
...
There are still some holes, e.g. we leave surrogate pairs be
even though they are not a part of valid UTF-8, but this might
be for the better -- WTF-8 does support surrogate pairs inside
text.
Closes #1207
2018-03-27 16:49:14 +02:00
Zsolt Parragi
886d799b79
Fix clang-tidy 6 diagnostic about virtual call in destructor
2018-03-21 17:05:15 +01:00
jsc
8b78087412
Fix bug in WithinAbs::match() and add tests for it
2018-03-21 13:47:12 +01:00
Martin Hořeňovský
0a34cc201e
v2.2.1
2018-03-11 12:04:28 +01:00
Martin Hořeňovský
dc3e7f9cf7
Fix incorrectly clamped return value
...
Fixes #1215
2018-03-09 10:00:55 +01:00
Martin Hořeňovský
d14b7563c2
v2.2.0
2018-03-07 11:06:15 +01:00
Martin Hořeňovský
552589f25b
Merge branch 'master' into master
2018-03-07 10:37:50 +01:00
Tomas Zeman
95c849f613
Introduce support for DJGPP cross compiler
...
DJGPP cross compiler is targeting DOS which does not support POSIX
signals. Probably for the same reason (targeting DOS) this compiler
does not support wide characters.
2018-03-07 10:35:32 +01:00
Tomas Zeman
352853ed7e
Introduce conditional wchar_t (and std::wstring) support
...
The support is turned on by default but the user might need to be able
to turn it off which is now possible by defining CATCH_CONFIG_NO_WCHAR.
2018-03-07 10:35:31 +01:00
Josh Soref
b11175548a
Fixup various spelling errors ( #1208 )
2018-03-07 10:08:35 +01:00
Martin Hořeňovský
9d1858b195
Simplify internal configuration of POSIX signals
2018-03-06 17:58:37 +01:00
Martin Hořeňovský
2e285b9579
Use char const * const * for Session::run
...
Needed to embed newer version of Clara
Closes #1178
Closes #1031
2018-03-04 17:58:27 +01:00
Martin Hořeňovský
d2ddb997a7
Cleanup for performance reasons
...
* Eliminated some copies
* Made makeTestCase fit into 4 arguments -- avoids spills on Win64
* Made string literals into StringRef literals
2018-03-02 16:24:35 +01:00
Tomas Zeman
865d5f59b4
Fix 'defined but not used' warning
...
The warning occurred when !CATCH_CONFIG_WINDOWS_SEH
&& !CATCH_CONFIG_POSIX_SIGNALS.
2018-03-01 13:37:23 +01:00
Martin Hořeňovský
05cd05743a
Provide a public method to get StringRef's underlying pointer
...
This allows reducing the amount of friends needed for its interface
and some extra tricks later.
The bad part is that the pointer can become invalidated via
calls to other StringRef's public methods, but c'est la vie.
2018-02-28 22:49:00 +01:00
Martin Hořeňovský
950ccf4749
StringRef appends itself to std::string efficiently
2018-02-28 16:02:25 +01:00
Martin Hořeňovský
cf4b7eead9
Document CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS macro
...
Also fix how it can be disabled.
2018-02-25 21:22:38 +01:00
Martin Hořeňovský
7b6e49d795
Simplify logic selecting between signal handling/SEH/nothing
...
It was a bit of a mess previously
2018-02-23 14:56:07 +01:00
Martin Hořeňovský
0c5df42c28
Fix how windows.h is included in our files.
...
To prevent bugs with stitching system headers inside Catch,
the proxy header is responsible for guarding against inclusion
on Linux, rather than the includers.
Might be related to #1197
2018-02-23 12:40:12 +01:00
Martin Hořeňovský
4e57661919
StringRef will not take ownership when writing itself to stream
...
This also fixes some tests that were previously failing unnoticed - WTF?
2018-02-17 20:41:50 +01:00
Martin Hořeňovský
da783abee9
Move fallback conversion after enum-check
2018-02-15 16:06:35 +01:00
Phil Nash
bb84f0788a
Removed unnecessary use of ostringstream from catch_enforce.h
2018-02-15 13:59:02 +00:00
Martin Hořeňovský
34d7a33574
Add a way to change fallback stringifier
...
This allows reuse of projects existing stringification machinery
Closes #1024
2018-02-11 16:31:12 +01:00
Martin Hořeňovský
ef2e112561
Disable POSIX signals for Emscripten
...
Related to #1114
2018-02-10 20:42:08 +01:00
dvirtz
ca8470fbad
https://github.com/catchorg/Catch2/issues/1175 - don't list hidden tests by default
2018-02-09 19:55:40 +01:00
dvirtz
355b3f9952
Add option to warn when no tests ran
...
Closes #1158
2018-02-09 18:49:36 +01:00
Martin Hořeňovský
7cbd0b587a
v2.1.2
2018-02-09 17:10:27 +01:00
Martin Hořeňovský
1b2fa601c6
Remove superfluous comment
2018-02-08 13:09:02 +01:00
Martin Hořeňovský
ba6d33fb8c
Enable -Wpedantic, fix unconditional use of C++14 extension
2018-02-05 10:04:59 +01:00
Zachary Michaels
4be81d3588
Remove unnecessary semicolons
2018-02-05 10:03:51 +01:00
Josh Lospinoso
5201e92564
Redirect std::uncaught_exception to Catch::uncaught_exception
...
This means that only one place needs to work with warnings from
the deprecation of `std::uncaught_exception()` in C++17.
Closes #1162 .
2018-02-02 15:36:15 +01:00
philsquared
5713381d06
Fixes for cygwin
2018-02-01 16:14:20 +00:00
Martin Hořeňovský
1ab6be30a2
Add a BrightYellow colour, also use it for reconstructed exprs
...
Closes #979
2018-02-01 14:58:33 +00:00
Martin Hořeňovský
126850e76b
Prefer operator<< to range-based stringification
...
Fixes #1172
2018-02-01 14:07:23 +01:00
Phil Nash
ca2455e6e6
Fixed NoAssertions warning
2018-01-26 16:52:28 +00:00
Martin Hořeňovský
62dae592c3
v2.1.1
2018-01-26 16:06:07 +01:00
Martin Hořeňovský
a1aefce6e4
Guard against CLR exceptions when translating exceptions
...
Partially fixes #1138 , need to decide what to do about structured
exceptions.
2018-01-24 12:11:29 +01:00
Martin Hořeňovský
8d854c689b
Provide useful and unambigous stringification for static arrays
2018-01-14 18:06:43 +01:00
Martin Hořeňovský
de36b2ada6
Fix compilation for types where relops don't return bool
...
Closes #1147
2018-01-12 15:49:56 +01:00
Martin Hořeňovský
4575594bbf
Comment why the return code is clamped
2018-01-12 11:49:48 +01:00
Martin Hořeňovský
cd76f5730c
v2.1.0
2018-01-10 13:53:04 +01:00
Phil Nash
421ab16062
Exclude string-literal arrays from automatic range serialisation
...
These have specialised serialisers already anyway, and were causing ambiguities in VS 2015 & 2017
2018-01-08 15:15:44 +00:00
Phil Nash
32eb90b9bd
Fix stringifying of unknown enums
2018-01-04 10:21:52 +00:00
Phil Nash
702cfdaf6e
Added special handling for vector<bool> when stringifying
2018-01-04 10:05:02 +00:00
Phil Nash
af3f2499bc
Added generic container detection in StringMaker.
...
Removed vector specialisation as this is now covered generically - as are any containers that can be called via (freestanding) begin/ end
2018-01-04 09:30:06 +00:00
Martin Hořeňovský
f466d9a1ed
Fix a7a9ee5
2017-12-09 20:49:06 +01:00
Martin Hořeňovský
a7a9ee5552
Manual cherry-pick from #1111
...
This hsould merge still-valid piece of #1111 into master.
2017-12-09 20:17:47 +01:00
Phil Nash
347be87126
Removed debug code accidentally left in previous commit
2017-12-08 16:30:16 +00:00
Phil Nash
4da655c1b0
Increased int size for timers to avoid truncations
2017-12-08 15:59:00 +00:00
Martin Hořeňovský
c4d1aa9033
Fix std::uncaught_exception deprecation warning in ~ScopedMessage
...
Closes #1124
2017-12-07 19:10:28 +01:00
Martin Hořeňovský
495d2458e0
Add UnorderedEqualsMatcher for vectors
...
Closes #1093
2017-12-07 19:05:00 +01:00
Phil Nash
3035120dc7
Some bits of tidy up
2017-12-07 00:02:32 +00:00
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
Martin Hořeňovský
b000411434
Stop accepting non-const comparison operators
...
A) non-const comparison operators should not exist and should not be
encouraged
B) The logic breaks comparing function pointers certain way
C) It was inconsistent anyway, as it only applied to `==` and `!=`
Closes #925
2017-09-06 15:01:03 +02:00
Martin Hořeňovský
e8ec6bd73c
General cleanup for C++11
...
Also less allocations and less stack usage on the fatal condition path
2017-08-31 11:46:37 +02:00
Martin Hořeňovský
e871742534
Move session to internal, split apart implementation
2017-08-31 10:31:52 +02:00
Martin Hořeňovský
6388fc946f
Remove last usage of NotImplementedException
...
TeamCity reporter now uses CATCH_ERROR instead
2017-08-30 20:03:54 +02:00
Martin Hořeňovský
a4df0b2c37
Remove obsoleted utility functions on matchers
...
Natural operators, &&, || and ! are preferred and do not have
limited arity.
2017-08-30 19:45:09 +02:00
Martin Hořeňovský
49a1408ff2
Fix compilation of main file with CATCH_CONFIG_FAST_COMPILE
2017-08-30 18:07:29 +02:00
Martin Hořeňovský
255f7d7369
Minor cleanup
2017-08-30 15:53:39 +02:00
Martin Hořeňovský
0673b9be35
Split RNG related things into its own file
...
This further removes 2 function declarations from the common path
2017-08-30 15:32:44 +02:00
Martin Hořeňovský
48db47c737
Remove unused internal macro from the common path
2017-08-30 15:30:10 +02:00
Martin Hořeňovský
fc495ba0cb
Dev build 3
2017-08-30 12:20:21 +02:00
Martin Hořeňovský
61d2c375dd
Add evaluation specialization for T* and long
...
Fixes #1005
2017-08-30 12:11:41 +02:00
Martin Hořeňovský
dd8e79c529
Streamline includes in external interfaces
2017-08-29 16:44:02 +02:00
Martin Hořeňovský
4453fefb00
Remove check for compiler version before using __COUNTER__
...
All still supported compiler versions support __COUNTER__.
User can also still turn off use of __COUNTER__ by defining
CATCH_CONFIG_NO_COUNTER.
2017-08-29 15:45:58 +02:00
Martin Hořeňovský
6e46f29830
Remove empty compiler detection
...
If they are needed in the future, they can be reinstated, but there
is no point in keeping them around currently.
2017-08-29 15:40:19 +02:00
Martin Hořeňovský
92444d8b72
Remove catch_context.h from the common include path
2017-08-29 15:36:09 +02:00
Martin Hořeňovský
bcb430b837
Clean up various minor things
2017-08-29 14:02:14 +02:00
Martin Hořeňovský
5932576f53
Split writeToDebugConsole out of main path
2017-08-29 13:51:55 +02:00
Martin Hořeňovský
3b8b25c59d
Make REGISTER_TEST_CASE auto registering
...
This also means it can be used in global scope
2017-08-29 09:52:58 +02:00
Martin Hořeňovský
75f143835e
Prevent exception translator registration with CATCH_CONFIG_DISABLE
2017-08-29 09:52:25 +02:00
Martin Hořeňovský
05b6f03f3e
Disable reporter/listener registration with CATCH_CONFIG_DISABLE
2017-08-29 09:48:52 +02:00
Sam Bristow
a04bd6d436
Remove duplicate CLI option
...
The "use-colour" option was accidentally duplicated as part of commit
feaf355
(Implemented libidentify support).
2017-08-28 12:16:23 +02:00
Martin Hořeňovský
053c29a2b8
Add partial implementation of CATCH_CONFIG_DISABLE
...
* Assertions are defined into (void)(0) no-op
* SECTIONs are defined away (leaving {} as scope)
* TEST_CASEs and TEST_CASE_METHODs are not registered.
* REGISTER_TEST_CASE is defined into (void)(0) no-op
* METHOD_AS_TEST_CASE is defined away
2017-08-27 22:05:25 +02:00
Martin Hořeňovský
8f6d6a4a2d
Remove legacy [hide] tag
...
Also removed even legacier "./" prefix for test case name...
2017-08-27 16:45:53 +02:00
Martin Hořeňovský
e8d3be3621
Workaround raw string literal bug in VS2017
2017-08-27 12:38:59 +02:00
Martin Hořeňovský
7818e2666d
v1.10.0
2017-08-26 15:34:18 +02:00
Martin Hořeňovský
cd30dd1a70
Workaround raw string literal bug in VS2017
2017-08-26 15:14:27 +02:00
Phil Nash
8e8c0c1675
Tweaked how failedButOk assertions are recorded
...
- fixes issue where sections in !shouldfail or !mayfail test cases that have failing assertions where marked as failed instead of failedButOk
2017-08-25 11:37:49 +01:00
Phil Nash
b1d0085796
Tweaked how failedButOk assertions are recorded
...
- fixes issue where sections in !shouldfail or !mayfail test cases that have failing assertions where marked as failed instead of failedButOk
2017-08-25 11:33:40 +01:00
Phil Nash
b6e7c9bd7a
Specialise removeConst for nullptr
2017-08-24 23:07:44 +02:00
Phil Nash
180d9242f5
Suppress more signed/ unsigned mismatches during Evaluator calls on MSVC
2017-08-24 23:07:03 +02:00
Phil Nash
b7bd52cc98
Cherry-picked "evaluate" refactoring from dev-modernize branch
...
- fixed up NULL comparisons to allow for NULL being a long
- should address #981
2017-08-24 23:07:03 +02:00
Martin Hořeňovský
489b639587
Change include guards in catch_external_interfaces.h
...
Previously they weren't recognized by the generateSingleHeader.py
script and weren't removed during stitching
2017-08-18 19:33:00 +02:00
Phil Nash
5d6c1f4dd0
Dev build 2
2017-08-18 15:58:00 +01:00
Phil Nash
3bc03cd617
Went back to Catch 1.x behaviour for -d
...
-d takes "yes" or "no", rather than being a standalone flag option. The default is "defaultForReporter" so the previous change actually dropped some control.
2017-08-18 15:53:10 +01:00
Martin Hořeňovský
24af32f378
Add define that pulls in reporter and listeners interfaces
...
This allows users to define reporters and listeners in files different
from the main file.
Related to #991 , #986
2017-08-17 20:23:30 +02:00
Phil Nash
0545de0a31
Hold translated exception in local string while matching
2017-08-17 19:21:00 +01:00
Martin Hořeňovský
597fca3c89
Remove <algorithm> header from the common path
...
It was only used for std::max<double> within Approx, so we now have
::Catch::Detail::max(double, double) that is used instead.
2017-08-17 20:04:53 +02:00
Martin Hořeňovský
f99f511155
Removed *_REGISTER_REPORTER from main path
...
Also simplified them to single macro: CATCH_REGISTER_REPORTER
2017-08-17 20:03:16 +02:00
Martin Hořeňovský
9a18ba042f
Remove deprecated listener registration macro
2017-08-17 20:03:16 +02:00
Martin Hořeňovský
8e6641c19b
Replace stdint.h include with cstdint include
...
Just small unification of includes
2017-08-17 20:03:16 +02:00
Phil Nash
aaedae60b4
Fixed issue with comparing non-copyable values
2017-08-17 16:46:05 +01:00
Phil Nash
8582780f11
Don't include string/ vector matchers if CATCH_CONFIG_MATCHERS defined
2017-08-16 14:38:04 +01:00
Phil Nash
a36395e2ff
Changed use of strncpy to memcpy
2017-08-15 23:47:52 +01:00
Phil Nash
699e571400
Documented benchmark-resolution-multiple command line option
...
- and increased default to 100
2017-08-15 19:51:22 +01:00
Phil Nash
61c5675c11
Removed inadvertent use of auto merged from dev-modernise
2017-08-15 19:34:10 +01:00
Phil Nash
70e4af9d44
Implemented wait-for-keypress option
2017-08-15 14:12:11 +01:00
Phil Nash
917a51da6b
Added libidentify support, including option for waiting for keypress on exit (and/ or start)
2017-08-15 13:48:14 +01:00
Phil Nash
7be258536e
Suppress strncpy copy warnings on MSVC
2017-08-14 12:12:28 +01:00
Phil Nash
94d347b059
Removed StringData
2017-08-14 09:14:49 +01:00
Phil Nash
3772f69f0f
Removed String and StringBuilder
2017-08-14 09:04:14 +01:00
Phil Nash
ece64c3b3a
Removed redundant .c_str()s from StringRef usages
2017-08-14 08:54:57 +01:00
Phil Nash
fa3535e95e
Added << ostream overload to StringRef
2017-08-14 08:50:44 +01:00
Phil Nash
c659e0fd3d
StringRef conversions to/ from std::string
2017-08-14 08:39:14 +01:00
Phil Nash
eed4ae86ad
Added config to control multiple of clock resolution to run benchmark iterations for
2017-08-11 22:24:52 +01:00
Phil Nash
feaf355489
Implemented libidentify support
...
- see https://github.com/janwilmans/LibIdentify
2017-08-11 19:55:55 +01:00
Martin Hořeňovský
2ce6c74f8f
v1.9.7
2017-08-11 00:01:20 +02:00
Phil Nash
9688891868
Fix issue with fatal errors and non-failing assertions
...
Fixes #990
2017-08-10 21:44:54 +02:00
Phil Nash
684cbb2631
Fixes issue with fatal errors and non-failing assertions
...
Fixes #990
2017-08-10 17:10:13 +01:00
Phil Nash
97c06ca6fb
Merge branch 'reevaluate' into dev-modernize
2017-08-10 16:18:05 +01:00
Martin Hořeňovský
11295a2663
Make catch_stream.hpp a standard .cpp file
2017-08-10 11:45:05 +02:00
Martin Hořeňovský
aa42dd92d1
Merge branch 'master' into dev-modernize
2017-08-10 11:34:26 +02:00
Martin Hořeňovský
7e4038d848
Capture std::clog writes and combine them with std::cerr writes ( #989 )
...
This also introduces Catch::clog() method to allow embedded targets
to override std::clog usage with their own stream (presumably null-sink),
similarly to how Catch::cout() and Catch::cerr() are used.
Fixes #989
2017-08-09 15:28:40 +02:00
Phil Nash
ee9b19efd3
Moved matcher-based capture macros into their own file
...
- this file excluded from the CATCH_CONFIG_DISABLE_MATCHERS path.
- matchers are always compiled in to the impl file
- _THROWS_WITH macros are still available with matchers disabled - but only the ones that take a string
- tests that use matchers have #ifdefs, so the whole SelfTest project can compile with matchers disable.
2017-08-09 12:10:14 +01:00
Phil Nash
b59e0ed48a
Collapsed alternate capture macros now originals are redundant
2017-08-09 11:36:33 +01:00
Phil Nash
8d21b4a916
Removed some unnecessary #includes
...
- and don't #include "catch_debugger.h" in the header path when CATCH_CONFIG_FAST_COMPILE is defined
2017-08-09 10:51:50 +01:00
Phil Nash
4b5ac4d3d9
Actually do what the previous commit claimed to do!
...
:-s
2017-08-09 10:29:05 +01:00
Phil Nash
8382d99081
Workaround for GCC 4.8 "deleted ctor in aggregate" bug
2017-08-09 10:18:31 +01:00
Phil Nash
dc1df297e3
Suppressed some warnings
...
- signed/ unsigned mismatches
- virtual destructor on ITransientExpression (even though not needed)
2017-08-09 09:29:44 +01:00
Phil Nash
8c95a81448
Removed all (well, most) of the redundant, ResultBuilder-based, code
2017-08-09 09:08:33 +01:00
Phil Nash
7df290dfc1
Integrated new AssertionHandler into unexpected exception handling in RunContext
2017-08-09 08:49:59 +01:00
Phil Nash
201028d6ec
Integrated INTERNAL_CATCH_THROWS with new AssertionHandler
2017-08-09 00:52:20 +01:00
Phil Nash
27fd8f80bd
Integrated INTERNAL_CATCH_THROWS_STR_MATCHES with new AssertionHandler
2017-08-09 00:44:30 +01:00
Phil Nash
ef4fa56b71
integrated INTERNAL_CATCH_THROWS_MATCHES with new AssertionHandler
2017-08-08 23:41:55 +01:00
Phil Nash
9668410b8e
integrated INTERNAL_CHECK_THAT with new AssertionHandler
2017-08-08 23:31:43 +01:00
Phil Nash
2832e23aa9
Restored exceptionGuard functionality under CATCH_CONFIG_FAST_COMPILE
2017-08-08 21:07:30 +01:00
Phil Nash
5f91724368
integrated AssertionHandler into INTERNAL_CATCH_MSG
2017-08-08 20:17:09 +01:00