Commit graph

91 commits

Author SHA1 Message Date
Alexander Grund
c8c6af273e
Don't return *this in expectation::with
Chaining is done via the wrapper class not the expectation class
2022-02-10 17:46:01 +01:00
Alexander Grund
3845d57531
Use BOOST_PP_VARIADIC_SIZE instead of custom implementation 2022-02-10 17:46:01 +01:00
Alexander Grund
bb77c1702f
Add support for unlimited number of sequences in one call
This removes the need for those preprocessor macros and the MOCK_MAX_SEQUENCES define.
2022-02-10 17:46:00 +01:00
Alexander Grund
f3dc82f305
Rename move_helper.hpp to ref_arg.hpp and use template alias
Shortens the call sites a lot: `typename ref_arg<Ts>::type` -> `ref_arg_t<Ts>`
MSVC 2017 seems to have issues with std::conditional_t so use the C++11
variant here.
2022-02-10 17:46:00 +01:00
Alexander Grund
baaaa15489
Workaround compiler issues (constant conditions, compiler bugs...)
MSVC has issues with a tuple of references of incomplete classes and `virtual ~value() = default;`
Some compilers warn for constant expressions in the for-loop-condition
2022-02-10 17:46:00 +01:00
Alexander Grund
fca30e7780
Replace Boost PP_Iterate by C++11 variadic templates
This allows support for any number of arguments and makes setting MOCK_MAX_ARGS unnecessary.
It also allows for easier debugging due to being able to step into actual code instead of preprocessor generated stuff
2022-02-10 17:46:00 +01:00
Alexander Grund
68700d4c3a
Document mechanism used in the functor constructor 2022-02-10 14:39:34 +01:00
Alexander Grund
f19caf428c
Fixup coverage of type_name.hpp to 100%
Reassign the demangled name to avoid the (always untaken) branch and reduce code duplication
2022-02-09 15:45:31 +01:00
Alexander Grund
b802c51c2d
Reduce number of template instantiations
Combine result_type, function_arity, parameter_types into 1 trait.
This reduces the amount of template classes instantiated by a factor of 3 which should improve compile times and memory consumption.

Also improve tests and documentation of touched classes/traits.
2022-01-26 20:03:42 +01:00
Alexander Grund
0c20ca1ce9
Make MOCK_SIGNATURE macro shorter
Put most of it into a template-alias as this may turn up in error messages
2022-01-25 18:46:18 +01:00
Alexander Grund
c00b03de44
Move the arity-mismatch assertion in front of the function
Shows that error first before deep-diving into templates
2022-01-25 18:45:32 +01:00
Alexander Grund
371859e81b
Enhance error message for parameter-trait
Also add a comment for when this is usually triggered
2022-01-25 18:28:51 +01:00
Alexander Grund
df10c59d21
Rename MOCK_PROTECT_FUNCTION_SIG to MOCK_PROTECT_SIGNATURE
Shorter and avoids the abbreviation
2022-01-25 18:05:06 +01:00
Alexander Grund
3d5ac2b94a
Remove support for BOOST_IDENTITY_TYPE
MOCK_PROTECT_FUNCTION_SIG should be used instead which even requires less parentheses.
Closes #109
2022-01-25 17:32:22 +01:00
Alexander Grund
dc9d98e5a5
Also move the error macros to the detail header 2022-01-24 19:14:51 +01:00
Alexander Grund
3fe72f66ea
Don't use MOCK_*_EXT in tests
This is not really part of the public interface anymore as the variadic functions are enough.
2022-01-24 19:11:08 +01:00
Alexander Grund
bd0a4cfc73
Reduce exposed interface (macros)
Move implementation details to mock_impl.hpp and remove MOCK_*_TPL macros.
Make sure all exposed macros (in mock.hpp) are properly documented.
Closes #105
2022-01-24 19:03:15 +01:00
Alexander Grund
ee72e8b9d8
Format code using Clang-Format 10 and enforce via CI
Makes the format of the code base uniform.
2022-01-24 16:30:59 +01:00
Alexander Grund
98541eb5a7
Change the threshold param of near to be inclusive
I.e. it means the maximum allowed difference, similar to how other testing frameworks handle this and it allows a threshold of 0 to mean "equal"
2022-01-07 17:08:17 +01:00
Alexander Grund
cf5ac87499
Remove support for auto_ptr 2022-01-07 17:08:16 +01:00
Alexander Grund
c7873cde4b
Adress review comments 2022-01-07 17:08:16 +01:00
Alexander Grund
279bb2c767
Fix memory include 2022-01-07 17:08:16 +01:00
Alexander Grund
476c1a7831
Remove some superflous typedefs and default impls 2022-01-07 17:08:15 +01:00
Alexander Grund
d9f9fce6fc
Make action classes non-relocatable
This fixes an issue with auto_ptr. As shown by missing coverage the
actual copy/move ctors are not required as C++11 emplace functions can
be used.
Furthermore some places using shared_ptr could be replaced by unique_ptr
leading to better performance.
2022-01-07 17:08:15 +01:00
Alexander Grund
f3d6564d2b
Use make_* functions instead of new 2022-01-07 17:08:15 +01:00
Alexander Grund
d9a10afc12
Include definition for void_t to avoid dependency on Boost 1.64+ 2022-01-07 17:08:14 +01:00
Alexander Grund
823fd994ff
Remove some Boost.PP stuff 2022-01-07 17:08:14 +01:00
Alexander Grund
898a5a4524
Document and improve is_functor 2022-01-07 17:08:13 +01:00
Alexander Grund
9af9f0e2ea
Replace Boost.TypeInfo 2022-01-07 17:08:13 +01:00
Alexander Grund
6702d68940
Use range-based for-loops 2022-01-07 17:08:13 +01:00
Alexander Grund
5ef17d0e33
Include examples in CI tests
Also fix and update examples and documentation where required
This allows to make sure examples are actually runnable avoiding them to
become outdated
2022-01-07 17:08:13 +01:00
Alexander Grund
908ca385b9
Add docstrings to mock.hpp 2022-01-07 17:08:12 +01:00
Alexander Grund
52d21a86af
Get rid of BOOST_IDENTITY_TYPE 2022-01-07 17:08:12 +01:00
Alexander Grund
a426e02759
Replace Boost.Bind by std::bind and lambdas 2022-01-07 17:08:12 +01:00
Alexander Grund
35e43d58a6
Use std::reference_wrapper instead of boost 2022-01-07 17:08:12 +01:00
Alexander Grund
353849e9ad
Use default/delete for ctor/dtor 2022-01-07 17:08:11 +01:00
Alexander Grund
35fa6e63e6
Use std smart pointers in code 2022-01-07 17:08:11 +01:00
Alexander Grund
2f72d5639e
Assume existance of lambdas 2022-01-07 17:08:11 +01:00
Alexander Grund
9faab7749c
Assume existance of <functional> 2022-01-07 17:08:11 +01:00
Alexander Grund
f154a1a22a
Assume existance of smart pointers 2022-01-07 17:08:11 +01:00
Alexander Grund
3b3700fda6
Assume support for variadic macros 2022-01-07 17:08:11 +01:00
Alexander Grund
f678f4d91f
Assume nullptr existance 2022-01-07 17:08:10 +01:00
Alexander Grund
cf330e8c86
Remove usage of Boost.MPL and reduce Boost.FunctionTypes usage
They are known to be slow on compilation and C++11 offer better alternatives
2022-01-07 17:08:10 +01:00
Alexander Grund
df5b77af95
Replace Boost.TypeTraits by std equivalents 2022-01-07 17:08:10 +01:00
Alexander Grund
9e664b52ab
Replace Boost.Move by std equivalents 2022-01-07 17:08:10 +01:00
Michael Jones
6c3ec0d785 Fix deprecation warning about implicit copy constructor 2021-08-16 17:12:03 -05:00
Alexander Grund
675969eafd
Auto-deduce method sig in MOCK_METHOD_(NON)CONST
Fixes #93
2020-07-27 17:05:05 +02:00
Dirk Faust
45450aa643 Remove boost deprecations
Fixes:

boost/test/floating_point_comparison.hpp:14:124: note: #pragma message: This header is deprecated. Use This header is deprecated. Please use <boost/test/tools/floating_point_comparison.hpp> instead. instead.
boost/detail/sp_typeinfo.hpp:23:54: note: #pragma message: This header is deprecated. Use <boost/core/typeinfo.hpp> instead.
2020-05-26 17:11:33 +02:00
Alexander Grund
b5db116933
Use const-ref for instance string 2020-05-18 10:45:19 +02:00
Alexander Grund
233046d738
Fix another unused variable warning 2020-04-17 20:31:32 +02:00