Commit graph

174 commits

Author SHA1 Message Date
Alexander Grund
78a4fbe129 Fix test in C++17 and up 2025-04-30 12:36:56 +02:00
Alexander Grund
f18da714f2 Make inspect target explicit 2025-04-30 09:28:18 +02:00
Alexander Grund
f191de5a5a
Add test for serializing a string or functor matcher 2023-01-07 12:06:44 +01:00
Alexander Grund
6fecabcad5
Bring back the fixture
Without using a `std::string` the compiler may put the `const char*` C-Strings to the same memory address so our test might succeed when it should not.
Add a short descriptive comment and check the property where it is used.
2023-01-03 18:55:46 +01:00
Alexander Grund
700ceb9f4d
Remove fixture of tests in test_matcher
The fixture is not really required and can be replaced by definitions in
each test which even improves readability.
Also the tests are partially redundant due to implicit conversions so
add test in test_function for actual usage testing of string comparisons.
2023-01-03 18:55:45 +01:00
Alex Smith
e55342385e Review corrections
Corrected stylistic mistakes and simplified a couple of the new tests.
2023-01-03 16:28:27 +00:00
Alex Smith
528761b180 Unit test nullptr C-style strings
Added unit tests for the cases of matching and serializing C-style strings (char*) that are nullptr.

(As of this revision, these new tests correctly fail, except for the test of mock::equal; fix to follow.)
2023-01-02 17:30:54 +00: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
c34e4224fe
Remove benchmarks using MOCK_MAX_ARGS
No longer required.
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
9e2223d4be
Remove BOOST_THREAD_USES_MOVE define from tests
No longer needed as we require C++11/14 already and hence rvalue references can be used by Boost.Thread
2022-02-10 11:37:52 +01:00
Alexander Grund
23ac665c22
Add some more cases for the serialization test of expectations
Make sure the various constraint names/values are kept (they are stored type-erased!)
2022-02-09 15:45:32 +01:00
Alexander Grund
e2687dea1a
Add missing test cases for the invocation class
- error case where between was called with a min>max
- Corner case for `between(x, x)`
- Human readable output via stream operator of the base class
2022-02-09 15:45:32 +01:00
Alexander Grund
1a81536f3c
Improve tests
- Check callability of function.expect.with(...)
- Check serialization of MOCK_CONSTRAINT
- Actually test some variations of MOCK_CONSTRAINT usages
- Add more test for unique_ptr (move-only class)
- Remove redundant stuff from test_log and change a few values to catch mistakes
- Add test for *-matcher serialization
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
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
cdb4c1494a
Document test/mock_error.hpp
Those test-only macros and structs are a bit tricky to read.
2022-01-25 16:24:37 +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
2dede8303b
Avoid unused function warnings in compile fail tests
This avoids false positives when warnings-as-error is enabled
2022-01-07 18:28:08 +01:00
Alexander Grund
78fa67ecb8
Remove test checking for failure when NOT using "typename"/TPL macro
This is allowed in C++20 and doesn't need to be tested anyway.
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
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
558e1ca135
Don't error when TURTLE_AUTO_PTR=ON 2022-01-07 17:08:15 +01:00
Alexander Grund
91b738da27
Avoid Boost.Bind deprecation warning 2022-01-07 17:08:14 +01:00
Alexander Grund
c2617ba360
Update from deprecated unit test header inclusion 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
04dff97fde
Use explicit streaming ops instead of Boost.LexicalCast 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
446e70be53
Remove boost::result_of 2022-01-07 17:08:13 +01:00
Alexander Grund
9af9f0e2ea
Replace Boost.TypeInfo 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
a6aa140148
Remove superflous test instantiations 2022-01-07 17:08:12 +01:00
Alexander Grund
ed8c58d813
Remove Boost.Typeof 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
Mathieu Champlon
931345c722
Merge pull request #95 from Flamefire/mock_method_wo_sig
Auto-deduce method sig in MOCK_METHOD_(NON)CONST
2020-08-03 07:30:39 +02:00