Commit graph

897 commits

Author SHA1 Message Date
Alexander Grund
5aff52fcca Use newer CMake for Ubuntu 18 to make it find newer Boost 2023-08-15 09:47:38 +02:00
Alexander Grund
418d12b637
GHA: Update deprecated images and workflows
The Ubuntu 18.04 runners were deprecated and removed.
`actions/checkout@v2` uses node12 which is deprecated.
Same for `actions/cache@v2`
2023-08-13 20:33:25 +02:00
Alexander Grund
4b9d9aa4cb Update links for download doc generation deps on CI
The FTP URLs don't seem to work anymore
2023-08-12 21:19:37 +02:00
Alexander Grund
5e196bac29
Replace travis CI badge by GHA badge in README 2023-08-11 14:13:04 +02:00
Alexander Grund
127d7e4659
Merge pull request #117 from Flamefire/remove-fixture
Improve use of fixture in test_matcher
2023-01-07 13:31:00 +01:00
Alexander Grund
f191de5a5a
Add test for serializing a string or functor matcher 2023-01-07 12:06:44 +01:00
Alexander Grund
9f5a8131ae
Download docbook DTD/XSL 2023-01-05 18:49:06 +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
Alexander Grund
fa29eec0bb
Merge pull request #116 from AlexSmithEtas/fix-issue-115-null-c-string-derefs
Avoid dereferencing NULL C-strings
Fixes #115
2023-01-03 18:53:40 +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
dd7340e5f7 Avoid dereferencing nullptr C-style strings
Added runtime checks for C-style strings (char*) being nullptr during matching and serialization.

This fix prevents nullptr dereferences in the case that the null character pointer (as opposed to the null nullptr_t) is expected and in the case that a non-null string is expected but nullptr is actually passed.
2023-01-02 17:38:26 +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
0dd0dfa15f
Merge pull request #110 from Flamefire/remove_pp_iterate
Replace Boost PP_Iterate by C++11 variadic templates
2022-02-16 16:04:05 +01:00
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
c34e4224fe
Remove benchmarks using MOCK_MAX_ARGS
No longer required.
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
90d9ac8055
Merge pull request #112 from Flamefire/improve_tests
Improve tests
2022-02-10 17:45:17 +01:00
Alexander Grund
68700d4c3a
Document mechanism used in the functor constructor 2022-02-10 14:39:34 +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
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
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
50ea9982ed Move the boost-root to a sibling folder
This keeps the correct paths of our files in the coverage data.
2022-02-09 11:47:37 +01:00
Alexander Grund
f186dfbab0 Fix root path of coverage upload
The repo files were moved to a subfolder which confuses the coverage UI
2022-02-09 11:47:37 +01:00
Alexander Grund
b9a1a4a4b7
Merge pull request #108 from Flamefire/reduce-interface
Reduce interface, cleanup and docu updates
2022-01-28 18:27:57 +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
95ec79f8f1
Enhance formatting in reference.cpp
Due to the maximum line length some line breaks made the examples ugly.
Move the comments in front of the code for those.
2022-01-25 17:41:57 +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
c910d1db8c
[CMake] Add IDE target for the turtle headers
Allows easier development in e.g. Visual Studio
2022-01-25 17:18:11 +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
51fcd4f4b9
Remove usage of BOOST_IDENTITY_TYPE from official docs
Replaced by MOCK_PROTECT_FUNCTION_SIG
2022-01-25 16:07:19 +01:00
Alexander Grund
374482367f
Update changelog regarding TPL macros 2022-01-24 19:16:25 +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
3dda0bf328
Merge pull request #107 from Flamefire/clang-format
Format code using Clang-Format 10 and enforce via CI
2022-01-24 17:35:24 +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
b5bb500bd2
Merge pull request #88 from Flamefire/c++11
Port to C++11/C++14 removing superflous Boost facilities
2022-01-23 19:40:34 +01:00
Alexander Grund
23ed9584a0
Update CI
- Move travis to GHA (travis is dead for OSS)
- Update Boost on appveyor
2022-01-07 23:17:08 +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