Compare commits

..

146 commits
v1.3.2 ... main

Author SHA1 Message Date
Alexander Grund
2a9438ea7e
Merge pull request #132 from Farmer-Markus/android
Added boost source build support
2025-08-24 12:21:17 +02:00
Farmer_Markus
bfd964961e Added boost source build support 2025-08-15 19:38:06 +02:00
Alexander Grund
ad456c684b
Merge pull request #131 from Flamefire/gha-windows
Add Windows runners to GHA CI
2025-06-15 11:08:45 +02:00
Alexander Grund
f974db3b08 Increase verbosity of Boost tests in Appveyor 2025-06-13 15:40:37 +02:00
Alexander Grund
68e66eefb4 Workaround file-too-big error on MinGW CI 2025-06-12 09:28:40 +02:00
Alexander Grund
2f02e9c870 Use MinGW generator for GCC on Windows 2025-06-12 09:18:11 +02:00
Alexander Grund
d8809dca2a Improve check for std::uncaught_exceptions
GCC 8 on MinGW still warns about that.
Check the version of the feature macro and add parens to ensure correct
evaluation.
2025-06-11 15:16:36 +02:00
Alexander Grund
3980cc97e1
Fix CMake parallel flag for MSVC 2025-06-09 18:27:33 +02:00
Alexander Grund
66bfbe115c
Set stage dir as boost root 2025-06-09 14:18:33 +02:00
Alexander Grund
6683b829c3
CI: Add Boost debug output to CMake search 2025-06-09 14:18:33 +02:00
Alexander Grund
0d4a9f1e33
Remove std::bind1st test for C++17 2025-06-09 14:18:33 +02:00
Alexander Grund
29c7e2d067
GHA: Separate out doc and inspect builds
Don't run doc build on Windows due to missing dependencies.
Use separate steps for different builds to easier differentiate them.
2025-06-09 14:18:32 +02:00
Alexander Grund
1d2fb3f3df
GHA: Add Windows builds 2025-06-09 14:18:32 +02:00
Alexander Grund
8151fe20c7
Merge pull request #130 from Flamefire/appveyor-cxx
Enhance CI
2025-05-02 12:37:41 +02:00
Alexander Grund
a334c4fb3b Split appveyor jobs to fit time limit 2025-04-30 15:40:17 +02:00
Alexander Grund
78a4fbe129 Fix test in C++17 and up 2025-04-30 12:36:56 +02:00
Alexander Grund
c34cbb56ab Add MOCK_CXX_VERSION macro 2025-04-30 12:32:02 +02:00
Alexander Grund
f18da714f2 Make inspect target explicit 2025-04-30 09:28:18 +02:00
Alexander Grund
2e2a6525ba Appveyor: Add VS 2022 builds 2025-04-30 09:28:18 +02:00
Alexander Grund
3555de3c89 Appveyor: Update Boost version for VS 2019 2025-04-30 09:11:20 +02:00
Flamefire
d7c80fbf28 GHA: Fix ownership of repo in container
Avoid:
> fatal: detected dubious ownership in repository at '/__w/turtle/turtle'

by adding that path to the git `safe.path`.
This is caused by the command(s) running inside the container but the
folder being created outside the container so the owner inside the container is not what is expected by git.
2025-04-30 09:11:20 +02:00
Alexander Grund
20dafe08a6 Remove some detail macros and rename parameters for readability 2025-04-21 11:58:18 +02:00
Alexander Grund
cd6f5ea70d Fix GHA CI
Move Ubuntu 20.04 tests to containers as that runner image has been removed.
2025-04-21 11:21:25 +02:00
Alexander Grund
26583bebf3
GHA: Fix doc build
Use Boost 1.87 to include fix for libxslt 1.1.35:  https://github.com/boostorg/boostbook/issues/14
2025-04-05 18:38:43 +02:00
Alexander Grund
d675a05d95
Require CMake 3.16
With CMake 4 compatibility with CMake 3.5 was dropped and 3.10 deprecated.
Use a reasonably new lower bound based on Ubuntu 20
2025-04-05 18:27:25 +02:00
Mathieu Champlon
d8808f56e9
Merge pull request #125 from mat007/prepare-release
Prepare v2.0.0
2024-10-02 13:33:51 +02:00
Mathieu Champlon
e9f6716aa8 Bump version to 2.0.0 2024-09-29 20:42:36 +02:00
Mathieu Champlon
2a54301cc3
Merge pull request #123 from mat007/prepare-release
Prepare v2.0.0 release
2024-09-29 19:50:20 +02:00
Mathieu Champlon
5b498ff551 Add more prominent link to documentation 2024-09-29 17:54:26 +02:00
Mathieu Champlon
9d5689a588 Bump requirement to a C++14 compiler 2024-09-29 17:54:26 +02:00
Mathieu Champlon
ebadb64b6e Prepare v2.0.0 release 2024-09-29 17:54:26 +02:00
Mathieu Champlon
636c59b93a
Merge pull request #124 from mat007/fix-ci
Fix CI
2024-09-29 14:52:23 +02:00
Mathieu Champlon
80f8cc5e49 Test more recent compiler and boost versions 2024-09-29 14:08:56 +02:00
Mathieu Champlon
6b735c4c03 Bump actions/checkout to v4 2024-09-28 12:25:38 +02:00
Mathieu Champlon
a3c9605237
Merge pull request #122 from mat007/rename-master-to-main
Rename master branch to main
2024-09-28 11:47:52 +02:00
Mathieu Champlon
f6f3990ddf Rename master branch to main 2024-09-28 11:06:17 +02:00
Alexander Grund
1796f40e58
Merge pull request #119 from Flamefire/update-gha
GHA: Update deprecated images and workflows
2023-08-15 12:13:27 +02:00
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
Alexander Grund
f4c7401e2c
Rename class concept to avoid name clash with C++20 concept keyword 2022-01-07 17:08:17 +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
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
e26601672e
Remove ASSERT_VERIFY_FAIL macro from static_objects_problem 2022-01-07 17:08:17 +01:00
Alexander Grund
e43059423e
Remove test-artifact from user visible part of how_to_invoke_a_functor_passed_as_parameter_of_a_mock_method
Only show what is required
2022-01-07 17:08:16 +01:00
Alexander Grund
728dfd06eb
Remove user(doc) visible change to zero_plus_zero_is_zero_with_action
Tests via Fixture::teardown that the assertion is fulfilled
2022-01-07 17:08:16 +01:00
Alexander Grund
40a4b3ceb4
Add documentation about unwrap_ref back and add example 2022-01-07 17:08:16 +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
66a046469a
"notok" -> "not ok" 2022-01-07 17:08:15 +01:00
Alexander Grund
d21f78edf1
Remove "using namespace mock_test" from patterns_retrieve_cref.cpp 2022-01-07 17:08:15 +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
558e1ca135
Don't error when TURTLE_AUTO_PTR=ON 2022-01-07 17:08:15 +01:00
Alexander Grund
492e6281d7
Avoid unused paramter warning in example 2022-01-07 17:08:14 +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
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
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
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
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
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
Mathieu Champlon
b86100a667
Merge pull request #102 from jonesmz/patch-1
Fix deprecation warning about implicit copy constructor
2021-08-17 06:15:34 +02:00
Michael Jones
6c3ec0d785 Fix deprecation warning about implicit copy constructor 2021-08-16 17:12:03 -05:00
Mathieu Champlon
bfd1701fcb
Merge pull request #96 from Flamefire/update_changelog
Add changelog for auto deducing method sig
2020-08-31 19:02:40 +02:00
Alexander Grund
139918dc35
Add changelog for auto deducing method sig 2020-08-12 17:11:19 +02: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
Mathieu Champlon
08213cd723
Merge pull request #92 from Flamefire/clean_build_dir
Clean build dir
2020-08-03 07:29:48 +02:00
Alexander Grund
675969eafd
Auto-deduce method sig in MOCK_METHOD_(NON)CONST
Fixes #93
2020-07-27 17:05:05 +02:00
Alexander Grund
1083954cfe
Remove remaining references to Boost.Mock 2020-07-16 13:08:46 +02:00
Alexander Grund
01013cce2f
Only use BOOST_ROOT 2020-07-16 12:59:05 +02:00
Alexander Grund
32d16f773b
Clean and remove build directory
Move scripts into scripts folder
Move doc-stuff into docs
Update CI & CMake scripts

See #89
2020-07-16 12:56:23 +02:00
Alexander Grund
3d44f9bfda
Create documentation on GHA 2020-07-15 22:53:19 +02:00
Mathieu Champlon
62494bccfd
Merge pull request #90 from Flamefire/ci
Fix and improve CI
2020-07-15 16:39:59 +02:00
Alexander Grund
626c3b8cbb
[CI] Fix coverage collection
Binaries are build multiple times with different configurations.
Copying them into 1 folder will collapse that to one random
configuration.
Hence just use lcov to gather all data
2020-07-14 17:42:52 +02:00
Alexander Grund
56f68565c8
[CI] Fix B2 build files 2020-07-14 17:42:52 +02:00
Alexander Grund
074c82315c
[CI] Require C++14 on travis 2020-07-14 17:42:52 +02:00
Alexander Grund
9c4354314e
Remove outdated MSVC solutions 2020-07-13 17:22:58 +02:00
161 changed files with 9841 additions and 14686 deletions

152
.clang-format Normal file
View file

@ -0,0 +1,152 @@
---
Language: Cpp
# BasedOnStyle: Mozilla
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: AfterColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 2
Cpp11BracedListStyle: false
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '<turtle/'
Priority: 10
SortPriority: 0
- Regex: '<boost/'
Priority: 20
SortPriority: 0
- Regex: '^<'
Priority: 30
SortPriority: 0
- Regex: '.*'
Priority: 1
SortPriority: 0
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: true
IndentGotoLabels: true
IndentPPDirectives: AfterHash
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: false
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: Never
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: c++14
StatementMacros:
- MOCK_BASE_CLASS
- MOCK_CLASS
- MOCK_CONSTRUCTOR
- MOCK_CONST_CONVERSION_OPERATOR
- MOCK_CONST_METHOD
- MOCK_CONST_METHOD_EXT
- MOCK_CONVERSION_OPERATOR
- MOCK_DESTRUCTOR
- MOCK_METHOD
- MOCK_METHOD_EXT
- MOCK_NON_CONST_CONVERSION_OPERATOR
- MOCK_NON_CONST_METHOD
- MOCK_NON_CONST_METHOD_EXT
- MOCK_STATIC_METHOD
TabWidth: 4
UseCRLF: false
UseTab: Never
...

211
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,211 @@
# Copyright 2022-2025 Alexander Grund
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
name: CI
on:
pull_request:
push:
branches:
- main
- develop
- feature/**
concurrency:
group: ${{format('{0}:{1}', github.repository, github.ref)}}
cancel-in-progress: true
env:
NET_RETRY_COUNT: 5
DOCBOOK_XSL_DIR: /usr/share/xml/docbook/stylesheet/docbook-xsl
DOCBOOK_DTD_DIR: /usr/share/xml/docbook/schema/dtd/4.2
jobs:
Formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Formatting
uses: DoozyX/clang-format-lint-action@v0.13
with:
clangFormatVersion: 10
Build:
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
# Linux, gcc
- { compiler: gcc-7, cxxstd: '14,17', boostBranch: boost-1.86.0, os: ubuntu-latest, container: 'ubuntu:20.04' }
- { compiler: gcc-10, cxxstd: '14,17,20', boostBranch: boost-1.86.0, os: ubuntu-22.04 }
- { compiler: gcc-12, cxxstd: '14,17,20', boostBranch: master, os: ubuntu-22.04 }
- { compiler: gcc-14, cxxstd: '14,17,20', boostBranch: boost-1.86.0, os: ubuntu-24.04 }
- { compiler: gcc-14, cxxstd: '14,17,20', boostBranch: master, os: ubuntu-24.04 }
# Linux, clang
- { compiler: clang-14, cxxstd: '14,17,20', boostBranch: boost-1.86.0, os: ubuntu-24.04 }
- { compiler: clang-18, cxxstd: '14,17,20', boostBranch: boost-1.86.0, os: ubuntu-24.04 }
- { compiler: clang-18, cxxstd: '14,17,20', boostBranch: master, os: ubuntu-24.04 }
# Windows
- { toolset: msvc-14.2, os: windows-2019, cxxstd: 14, generator: 'Visual Studio 16 2019' }
- { toolset: gcc, os: windows-2019, cxxstd: 17, generator: 'MinGW Makefiles' }
- { toolset: msvc-14.3, os: windows-2022, cxxstd: 20, generator: 'Visual Studio 17 2022' }
- { name: Collect coverage, coverage: yes,
compiler: gcc-8, cxxstd: '14', boostBranch: boost-1.86.0, os: ubuntu-latest, container: 'ubuntu:20.04' }
timeout-minutes: 120
runs-on: ${{matrix.os}}
container: ${{matrix.container}}
steps:
- name: Prepare container environment
if: matrix.container
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common curl lsb-release
# Need (newer) git & cmake, and the older Ubuntu container may require requesting the key manually using port 80
curl -sSL --retry ${NET_RETRY_COUNT:-5} 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xE1DD270288B4E6030699E45FA1715D88E1DF1F24' | sudo gpg --dearmor > /etc/apt/trusted.gpg.d/git-core_ubuntu_ppa.gpg
for i in {1..${NET_RETRY_COUNT:-5}}; do sudo -E add-apt-repository -y ppa:git-core/ppa && break || sleep 10; done
curl -sSL --retry ${NET_RETRY_COUNT:-5} 'https://apt.kitware.com/keys/kitware-archive-latest.asc' | sudo gpg --dearmor > /etc/apt/trusted.gpg.d/kitware-archive-latest.gpg
for i in {1..${NET_RETRY_COUNT:-5}}; do sudo -E add-apt-repository -y "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" && break || sleep 10; done
apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y g++ git cmake
git config --global pack.threads 0
git config --global --add safe.directory "$GITHUB_WORKSPACE" # Avoid ownership issues of repo in container
- uses: actions/checkout@v4
with:
# For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary'
fetch-depth: ${{ matrix.coverage && '0' || '1' }}
# Checking out Boost and all its submodules takes ages...
- name: Cache Boost
uses: actions/cache@v4
with:
path: boost-root
key: boost-${{matrix.boostBranch}}
- name: Checkout Boost
uses: actions/checkout@v4
with:
repository: boostorg/boost
ref: ${{matrix.boostBranch}}
submodules: true
path: boost-root
persist-credentials: false
- name: Install packages and setup env
run: |
B2_TOOLSET=${{matrix.toolset}}
if [[ ! "${{matrix.os}}" == "windows-"* ]]; then
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
CXX=${{matrix.compiler}}
CXX="${CXX/gcc-/g++-}"
# Package names are g++-* and clang-*, so set this before correcting CXX for Clang
pkgs="$CXX xsltproc docbook-xsl docbook-xml lcov ccache"
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs
CXX="ccache ${CXX/clang-/clang++-}"
echo "CXX=$CXX" >> $GITHUB_ENV
echo "CC=${{matrix.compiler}}" >> $GITHUB_ENV
if [[ -z $B2_TOOLSET ]]; then
if [[ "$CXX" =~ clang ]]; then
B2_TOOLSET=clang
else
B2_TOOLSET=gcc
fi
fi
[[ -z $CXX ]] || echo "using $B2_TOOLSET : : $CXX ;" > ~/user-config.jam
fi
echo "B2_TOOLSET=$B2_TOOLSET" >> $GITHUB_ENV
B2_FLAGS+=" --toolset=$B2_TOOLSET cxxstd=${{matrix.cxxstd}}"
if [[ "${{matrix.coverage}}" == "yes" ]]; then
B2_FLAGS+=" cxxflags=--coverage linkflags=--coverage"
fi
echo "B2_FLAGS=$B2_FLAGS" >> $GITHUB_ENV
# Move the Boost root to a sibling folder
mv boost-root ..
echo "BOOST_ROOT=${{github.workspace}}/../boost-root" >> $GITHUB_ENV
- name: Cache ccache
uses: hendrikmuhs/ccache-action@v1
if: startsWith(matrix.os, 'ubuntu')
with:
key: ${{matrix.os}}-${{matrix.compiler}}-${{matrix.boostBranch}}
- name: Prepare boost
working-directory: ${{env.BOOST_ROOT}}
run: ./bootstrap.sh && ./b2 headers
- name: Boost build
run: |
./b2 "$GITHUB_WORKSPACE/test" -q $B2_FLAGS -j3
./b2 "$GITHUB_WORKSPACE/doc//mock_examples" -q $B2_FLAGS "$@"
working-directory: ${{env.BOOST_ROOT}}
- name: Run inspect check
run: ./b2 "$GITHUB_WORKSPACE/test//inspect" -q $B2_FLAGS
working-directory: ${{env.BOOST_ROOT}}
- name: Build doc
if: startsWith(matrix.os, 'ubuntu')
run: scripts/build_doc.sh $B2_FLAGS -j3
- name: Collect coverage
if: matrix.coverage
run: |
lcov --version
lcov --gcov-tool=gcov-8 --directory "$GITHUB_WORKSPACE/test" --capture --output-file all.info
# dump a summary on the console
lcov --list all.info
# Limit to our files (header-only in this case)
lcov --extract all.info "$GITHUB_WORKSPACE/include/*" --output-file coverage.info
# Output what was collected
lcov --list coverage.info
- name: Upload coverage
if: matrix.coverage
uses: coverallsapp/github-action@master
with:
path-to-lcov: ${{github.workspace}}/coverage.info
github-token: ${{secrets.GITHUB_TOKEN}}
- name: Build required boost libs
working-directory: ${{env.BOOST_ROOT}}
run: |
./b2 --toolset=$B2_TOOLSET --with-test --with-thread --with-chrono --with-system --with-atomic --with-date_time -a -j3
# Add lib folder to LD_LIBRARY_PATH, so the tests can load them
echo "LD_LIBRARY_PATH=$PWD/stage/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
- name: CMake build
run: |
mkdir build && cd build
CXX_STANDARD="${{matrix.cxxstd}}"
if [[ "${{matrix.os}}" == "windows-"* ]]; then
extra_args=()
else
extra_args=(-DCMAKE_CXX_COMPILER_LAUNCHER=ccache)
fi
if [[ -n "${{matrix.generator}}" ]]; then
extra_args+=(-G "${{matrix.generator}}")
fi
if [[ "${{matrix.generator}}" == "MinGW"* ]]; then
extra_args+=(-DCMAKE_CXX_FLAGS="-Wa,-mbig-obj")
fi
echo "Using extra args: ${extra_args[*]}"
cmake .. -DCMAKE_BUILD_TYPE=Debug -DBoost_ROOT="$BOOST_ROOT/stage" -DCMAKE_CXX_STANDARD="${CXX_STANDARD##*,}" "${extra_args[@]}" -DCMAKE_VERBOSE_MAKEFILE=ON -DBoost_DEBUG=ON -DBoost_VERBOSE=ON
cmake --build . --config Debug --parallel 3
ctest --output-on-failure --build-config Debug
- name: Cleanup Boost folder to reduce cache usage
if: ${{ always() }}
working-directory: ${{env.BOOST_ROOT}}
run: git clean -fxd

63
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,63 @@
# Copyright 2020-2025 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
name: Release
on:
push:
branches: [main]
tags: ['v*']
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
env:
BOOST_VERSION: 1.87.0
BOOST_ROOT: ${{github.workspace}}/dependencies/boost
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: boostorg/boost
ref: boost-${{env.BOOST_VERSION}}
path: ${{env.BOOST_ROOT}}
fetch-depth: 1
- name: Prepare boost
working-directory: ${{env.BOOST_ROOT}}
run: |
git submodule update --init --jobs 3 tools/boostdep tools/quickbook tools/boostbook
python tools/boostdep/depinst/depinst.py --exclude test --git_args '--jobs 3' ../tools/quickbook
./bootstrap.sh || (cat bootstrap.log && false)
- name: Install dependencies
run: sudo apt-get install xsltproc docbook-xsl docbook-xml
- name: Create documentation
run: scripts/build_doc.sh -j3
- name: Package documentation
run: tar -czvf turtle_doc.tar.gz html
working-directory: doc
# This runs only when actual tags are created
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
C++ mock object library for Boost
draft: true
prerelease: false
- name: Upload docs
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: doc/turtle_doc.tar.gz
asset_name: turtle_doc.tar.gz
asset_content_type: application/tar.gz

2
.gitignore vendored
View file

@ -1,5 +1,5 @@
.vscode .vscode
bin bin
out out
build/xsl /build
__build __build

View file

@ -1,103 +0,0 @@
# Use, modification, and distribution are
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Copyright Antony Polukhin 2014.
#
# See https://svn.boost.org/trac/boost/wiki/TravisCoverals for description of this file
# and how it can be used with Boost libraries.
#
language: cpp
branches:
only:
- master
env:
- CXX_STANDARD=c++17 BRANCH_TO_TEST=master
- CXX_STANDARD=c++14 BRANCH_TO_TEST=master
- CXX_STANDARD=c++11 BRANCH_TO_TEST=master
- CXX_STANDARD=c++11 BRANCH_TO_TEST=boost-1.58.0
- CXX_STANDARD=c++11 BRANCH_TO_TEST=boost-1.59.0
- CXX_STANDARD=c++11 BRANCH_TO_TEST=boost-1.67.0
compiler:
- clang
- gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise
packages:
- gcc-5
- g++-5
- clang-5.0
- lld-5.0
- xsltproc
- docbook-xsl
- docbook-xml
before_install:
- DOCBOOK_XSL_DIR=/usr/share/xml/docbook/stylesheet/docbook-xsl
- DOCBOOK_DTD_DIR=/usr/share/xml/docbook/schema/dtd/4.2
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5
- gcc --version
# Set this to the name of your Boost library
# Autodetect library name by using the following code: - PROJECT_TO_TEST=$(basename $(pwd))
- PROJECT_TO_TEST=$(basename $(pwd))
# Files, which coverage results must be ignored (files from other projects). Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/path.cpp'
- IGNORE_COVERAGE='*/boost-local/*'
# From this point and below code is same for all the Boost libs
# Cloning Boost libraries (fast nondeep cloning)
- PROJECT_DIR=`pwd`
- git --version
- BOOST=$HOME/boost-local
- git clone -b $BRANCH_TO_TEST https://github.com/boostorg/boost.git $BOOST
- cd $BOOST
- git submodule update --init --merge
- ./bootstrap.sh
- ./b2 headers
script:
- cd $PROJECT_DIR/build
- export BOOST_ROOT=$BOOST
# `--coverage` flags required to generate coverage info for Coveralls
- ./build.sh --toolset=$CC "cxxflags=-std=$CXX_STANDARD -Wno-unused-local-typedefs -Wno-unused-function -Wno-deprecated-declarations --coverage" "linkflags=--coverage" -j3
- cd $BOOST && ./b2 --with-test --with-thread --with-chrono --with-system --with-atomic --with-date_time -a -j3 # Build required libs
- mkdir $PROJECT_DIR/__build && cd $PROJECT_DIR/__build
- export CXXFLAGS="-std=$CXX_STANDARD"
- cmake .. -DCMAKE_BUILD_TYPE=Debug
- cmake --build . --config Debug -- -j3
- ctest --output-on-failure --build-config Debug
after_success:
- COVERALS_DIR=$PROJECT_DIR/coverals
# Copying Coveralls data to a separate folder
- mkdir -p $COVERALS_DIR
- find $PROJECT_DIR/test/bin/ -name "*.gcda" -exec cp "{}" $COVERALS_DIR/ \;
- find $PROJECT_DIR/test/bin/ -name "*.gcno" -exec cp "{}" $COVERALS_DIR/ \;
# Preparing Coveralls data by
# ... installing the tools
- sudo apt-get install -qq python-yaml lcov
# ... changing data format to a readable one
- lcov --directory $COVERALS_DIR --base-directory $PROJECT_DIR/test --capture --output-file $COVERALS_DIR/coverage.info
# ... erasing /test/ /example/ folder data
- lcov --remove $COVERALS_DIR/coverage.info "/usr*" "/test/*" $IGNORE_COVERAGE "tests/*" "*/doc/examples/*" -o $COVERALS_DIR/coverage.info
# Output what was collected
- lcov --list $COVERALS_DIR/coverage.info
# Sending data to Coveralls
- cd $PROJECT_DIR
- gem install coveralls-lcov
- coveralls-lcov $COVERALS_DIR/coverage.info

View file

@ -1,9 +1,9 @@
# Copyright 2019 Alexander Grund # Copyright 2019-2025 Alexander Grund
# Distributed under the Boost Software License, Version 1.0. # Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.8) cmake_minimum_required(VERSION 3.16..3.20)
project(turtle VERSION 1.3.2 LANGUAGES CXX) project(turtle VERSION 2.0.0 LANGUAGES CXX)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(IS_ROOT_PROJECT ON) set(IS_ROOT_PROJECT ON)
@ -13,23 +13,34 @@ else()
endif() endif()
option(TURTLE_INSTALL "Enable to add install target" ${IS_ROOT_PROJECT}) option(TURTLE_INSTALL "Enable to add install target" ${IS_ROOT_PROJECT})
option(TURTLE_AUTO_PTR "Enable support for auto_ptr" OFF)
# Default boost libs are static on windows and dynamic on linux # Default boost libs are static on windows and dynamic on linux
if(WIN32 AND NOT DEFINED Boost_USE_STATIC_LIBS) if(WIN32 AND NOT DEFINED Boost_USE_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_STATIC_LIBS ON)
endif() endif()
find_package(Boost 1.58 REQUIRED)
# Allows boost to be build by parent project
if(NOT TARGET Boost::boost)
find_package(Boost 1.58 REQUIRED)
endif()
set(MOCK_VERSION "\"${PROJECT_VERSION}\"") set(MOCK_VERSION "\"${PROJECT_VERSION}\"")
configure_file(build/version.hpp ${CMAKE_CURRENT_BINARY_DIR}/include/turtle/version.hpp @ONLY) set(_turtleVersionFile ${CMAKE_CURRENT_BINARY_DIR}/include/turtle/version.hpp)
configure_file(version.hpp.cmake ${_turtleVersionFile} @ONLY)
add_library(turtle INTERFACE) add_library(turtle INTERFACE)
add_library(turtle::turtle ALIAS turtle) add_library(turtle::turtle ALIAS turtle)
target_include_directories(turtle INTERFACE $<BUILD_INTERFACE:include;${CMAKE_CURRENT_BINARY_DIR}/include>) target_include_directories(turtle INTERFACE $<BUILD_INTERFACE:include;${CMAKE_CURRENT_BINARY_DIR}/include>)
target_compile_features(turtle INTERFACE cxx_std_14)
target_link_libraries(turtle INTERFACE Boost::boost Boost::disable_autolinking) target_link_libraries(turtle INTERFACE Boost::boost Boost::disable_autolinking)
if(NOT TURTLE_AUTO_PTR)
target_compile_definitions(turtle INTERFACE MOCK_NO_AUTO_PTR) if(NOT CMAKE_VERSION VERSION_LESS 3.19)
file(GLOB _turtleHeaders include/turtle/*.hpp)
file(GLOB _turtleHeadersDetail include/turtle/detail/*.hpp)
source_group(turtle FILES ${_turtleHeaders} ${_turtleVersionFile})
source_group(turtle/detail FILES ${_turtleHeadersDetail})
target_sources(turtle PRIVATE ${_turtleHeaders} ${_turtleVersionFile} ${_turtleHeadersDetail})
endif() endif()
if(BUILD_TESTING) if(BUILD_TESTING)
@ -60,14 +71,7 @@ if(TURTLE_INSTALL)
INSTALL_DESTINATION ${configInstallDestination} INSTALL_DESTINATION ${configInstallDestination}
) )
if(NOT CMAKE_VERSION VERSION_LESS 3.14) write_basic_package_version_file(${versionFile} COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT)
write_basic_package_version_file(${versionFile} COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT)
else()
set(OLD_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
set(CMAKE_SIZEOF_VOID_P "")
write_basic_package_version_file(${versionFile} COMPATIBILITY SameMajorVersion)
set(CMAKE_SIZEOF_VOID_P ${OLD_CMAKE_SIZEOF_VOID_P})
endif()
install(FILES ${configFile} ${versionFile} DESTINATION ${configInstallDestination}) install(FILES ${configFile} ${versionFile} DESTINATION ${configInstallDestination})

View file

@ -1,28 +0,0 @@
# Copyright Rene Rivera 2007.
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# Usage:
#
# bjam [options | properties | targets]
#
# Options:
#
# --boost=<BOOST> The directory of a Boost source tree.
# Default; BOOST env var (if found)
# Default; ../boost (if found)
#
# --boost-build=<BOOST_BUILD>
# The directory for the Boost.Build v2 files.
# Default; BOOST_BUILD_PATH env var (if found)
# Default; BOOST_BUILD env var (if found)
# Default; <BOOST>/tools/build/v2 (if found)
#~ If we have the Boost sources we can use the project...
if [ GLOB $(BOOST) : [ modules.peek project : JAMFILE ] ]
{
use-project /boost : $(BOOST) ;
}

View file

@ -6,9 +6,11 @@
import modules ; import modules ;
local boost = [ modules.peek : BOOST ] ; if BOOST_ROOT
{
local boost = [ modules.peek : BOOST_ROOT ] ;
project mock : requirements <include>$(boost) <include>. ; project mock : requirements <include>$(boost) ;
# This seems to prevent some Boost.Build errors that otherwise occur :-( #use-project /boost : $(boost) ;
use-project /boost : $(boost) ; }

View file

@ -4,8 +4,10 @@
Distributed under the [Boost Software License, Version 1.0](http://boost.org/LICENSE_1_0.txt). Distributed under the [Boost Software License, Version 1.0](http://boost.org/LICENSE_1_0.txt).
[![Build Status](https://travis-ci.org/mat007/turtle.svg)](https://travis-ci.org/mat007/turtle) [![CI](https://github.com/mat007/turtle/actions/workflows/ci.yml/badge.svg)](https://github.com/mat007/turtle/actions/workflows/ci.yml)
[![Build status](https://ci.appveyor.com/api/projects/status/459hvqkb5rts4hw7?svg=true)](https://ci.appveyor.com/project/mat007/turtle) [![Build status](https://ci.appveyor.com/api/projects/status/459hvqkb5rts4hw7?svg=true)](https://ci.appveyor.com/project/mat007/turtle)
[![Coverage Status](https://coveralls.io/repos/mat007/turtle/badge.png)](https://coveralls.io/r/mat007/turtle) [![Coverage Status](https://coveralls.io/repos/mat007/turtle/badge.png)](https://coveralls.io/r/mat007/turtle)
Boost and a C++11 compatible compiler is required. Boost and a C++14 compatible compiler is required.
More information in the [documentation](http://turtle.sourceforge.net).

View file

@ -2,56 +2,88 @@
# subject to the Boost Software License, Version 1.0. (See accompanying # subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# #
# Copyright Mathieu Champlon 2015. # Copyright 2015 Mathieu Champlon
# Copyright Alexander Grund 2020. # Copyright 2020-2025 Alexander Grund
skip_branch_with_pr: true skip_branch_with_pr: true
branches: branches:
only: only:
- master - main
environment: environment:
global:
ADDRESS_MODEL: 32,64
VARIANT: debug,release
matrix: matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
BOOST: 1_60_0 BOOST: 1_65_1
TOOLSET: msvc-14.0 TOOLSET: msvc-14.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
BOOST: 1_65_1 BOOST: 1_65_1
TOOLSET: msvc-14.1 TOOLSET: msvc-14.1
CXX_STANDARD: 14
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
BOOST: 1_67_0 BOOST: 1_69_0
TOOLSET: msvc-14.1 TOOLSET: msvc-14.1
CXX_STANDARD: 14 CXX_STANDARD: 14,17
# CXX_STANDARD: 17 ADDRESS_MODEL: 64
VARIANT: debug
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
BOOST: 1_83_0
TOOLSET: msvc-14.3
CXX_STANDARD: 14,17,20
ADDRESS_MODEL: 64
VARIANT: debug
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
BOOST: 1_86_0
TOOLSET: msvc-14.3
CXX_STANDARD: 14,17
ADDRESS_MODEL: 64
VARIANT: debug
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
BOOST: 1_86_0
TOOLSET: msvc-14.3
CXX_STANDARD: 20
# CMake builds
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
BOOST: 1_60_0 BOOST: 1_65_1
CMAKE: true CMAKE: true
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
BOOST: 1_71_0 BOOST: 1_83_0
CMAKE: true
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
BOOST: 1_86_0
CMAKE: true CMAKE: true
install: install:
- cd %APPVEYOR_BUILD_FOLDER%\doc - appveyor-retry powershell Invoke-WebRequest http://www.oasis-open.org/docbook/xml/4.2/docbook-xml-4.2.zip -OutFile docbook-xml.zip
- appveyor-retry powershell Invoke-WebRequest ftp://ftp.zlatkovic.com/libxml/iconv-1.9.2.win32.zip -OutFile iconv.zip - appveyor-retry powershell Invoke-WebRequest https://github.com/docbook/xslt10-stylesheets/releases/download/release/1.79.2/docbook-xsl-1.79.2.zip -OutFile docbook-xsl.zip
- 7z x -oC:\Boost\share\docbook-xml docbook-xml.zip
- 7z x -oC:\Boost\share docbook-xsl.zip
- mkdir %APPVEYOR_BUILD_FOLDER%\bin
- cd %APPVEYOR_BUILD_FOLDER%\bin
- appveyor-retry powershell Invoke-WebRequest https://www.zlatkovic.com/pub/libxml/iconv-1.9.2.win32.zip -OutFile iconv.zip
- 7z e iconv.zip iconv.dll -r - 7z e iconv.zip iconv.dll -r
- appveyor-retry powershell Invoke-WebRequest ftp://ftp.zlatkovic.com/libxml/libxml2-2.7.8.win32.zip -OutFile libxml2.zip - appveyor-retry powershell Invoke-WebRequest https://www.zlatkovic.com/pub/libxml/libxml2-2.7.8.win32.zip -OutFile libxml2.zip
- 7z e libxml2.zip libxml2.dll -r - 7z e libxml2.zip libxml2.dll -r
- appveyor-retry powershell Invoke-WebRequest ftp://ftp.zlatkovic.com/libxml/libxslt-1.1.26.win32.zip -OutFile libxslt.zip - appveyor-retry powershell Invoke-WebRequest https://www.zlatkovic.com/pub/libxml/libxslt-1.1.26.win32.zip -OutFile libxslt.zip
- 7z e libxslt.zip libexslt.dll libxslt.dll xsltproc.exe -r - 7z e libxslt.zip libexslt.dll libxslt.dll xsltproc.exe -r
- appveyor-retry powershell Invoke-WebRequest ftp://ftp.zlatkovic.com/libxml/zlib-1.2.5.win32.zip -OutFile zlib.zip - appveyor-retry powershell Invoke-WebRequest https://www.zlatkovic.com/pub/libxml/zlib-1.2.5.win32.zip -OutFile zlib.zip
- 7z e zlib.zip zlib1.dll -r - 7z e zlib.zip zlib1.dll -r
- xsltproc -V - xsltproc -V
build_script: build_script:
- set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%\bin
- set BOOST_ROOT=C:\Libraries\boost_%BOOST% - set BOOST_ROOT=C:\Libraries\boost_%BOOST%
- cd %BOOST_ROOT% - cd %BOOST_ROOT%
- call bootstrap.bat - call bootstrap.bat
- cd %APPVEYOR_BUILD_FOLDER%\build - cd %APPVEYOR_BUILD_FOLDER%
- if NOT "%CXX_STANDARD%"=="" set CXX_FLAGS=cxxflags=/std:c++%CXX_STANDARD% - if NOT "%CXX_STANDARD%"=="" set CXX_FLAGS=cxxstd=%CXX_STANDARD%
- set BUILD_ARGS=address-model=32,64 variant=debug,release - set BUILD_ARGS=address-model=%ADDRESS_MODEL% variant=%VARIANT%
- call build.bat --toolset=%TOOLSET% %CXX_FLAGS% -j3 - set BOOST_TEST_LOG_LEVEL=all
- call scripts\build.bat --toolset=%TOOLSET% %CXX_FLAGS% -j3
for: for:
- matrix: - matrix:
@ -60,8 +92,7 @@ for:
build_script: build_script:
- set BOOST_ROOT=C:\Libraries\boost_%BOOST% - set BOOST_ROOT=C:\Libraries\boost_%BOOST%
- cd %APPVEYOR_BUILD_FOLDER% - cd %APPVEYOR_BUILD_FOLDER%
- mkdir __build - mkdir build && cd build
- cd __build
- cmake .. -DCMAKE_BUILD_TYPE=Debug - cmake .. -DCMAKE_BUILD_TYPE=Debug
- cmake --build . --config Debug - cmake --build . --config Debug
- ctest --output-on-failure --build-config Debug - ctest --output-on-failure --build-config Debug

View file

@ -1,29 +0,0 @@
@echo off
rem Copyright (C) 2015 Mathieu Champlon
rem
rem Distributed under the Boost Software License, Version 1.0.
rem (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
setlocal
rem error if BOOST_ROOT not set
set BOOST=%BOOST_ROOT%
pushd ..\test
%BOOST%\b2.exe -q %BUILD_ARGS% %*
popd
if errorlevel 1 exit /b %ERRORLEVEL%
set BOOSTBOOK_DIR=..\bin\turtle\boostbook
xcopy /Y /S /Q /I %BOOST%\tools\boostbook\xsl %BOOSTBOOK_DIR%\xsl
xcopy /Y /S /Q /I %BOOST%\tools\boostbook\dtd %BOOSTBOOK_DIR%\dtd
xcopy /Y /S /Q /I boostbook %BOOSTBOOK_DIR%
xcopy /Y /S /Q /I %BOOST%\doc\src\boostbook.css ..\doc\html
xcopy /Y /S /Q /I %BOOST%\doc\src\images\*.png ..\doc\html\images
xcopy /Y /S /Q /I %BOOST%\doc\src\images\callouts\*.png ..\doc\html\images\callouts
if errorlevel 1 exit /b %ERRORLEVEL%
pushd ..\doc
%BOOST%\b2.exe -q %*
popd
if errorlevel 1 exit /b %ERRORLEVEL%

View file

@ -1 +0,0 @@
extensions = headers,check,run

View file

@ -1,32 +0,0 @@
#!/bin/sh
# Copyright (C) 2015 Mathieu Champlon
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
copy()
{
for dir; do true; done
mkdir -p $dir
cp $@
}
set -ex
export BOOST=$BOOST_ROOT
cd ../test
$BOOST/b2 -q "$@"
cd ../build
export BOOSTBOOK_DIR=../bin/turtle/boostbook
copy -r "$BOOST"/tools/boostbook/xsl $BOOSTBOOK_DIR
copy -r "$BOOST"/tools/boostbook/dtd $BOOSTBOOK_DIR
copy -r boostbook/* $BOOSTBOOK_DIR
copy "$BOOST"/doc/src/boostbook.css ../doc/html
copy "$BOOST"/doc/src/images/*.png ../doc/html/images
copy "$BOOST"/doc/src/images/callouts/*.png ../doc/html/images/callouts
cd ../doc
$BOOST/b2 -q "$@"
cd ../build

View file

@ -1,115 +0,0 @@
<!--
Copyright Mathieu Champlon 2008.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
-->
<project name="turtle" default="all">
<property environment="env"/>
<fail unless="env.BOOST_ROOT" message="missing BOOST_ROOT environment variable"/>
<property name="boost.dir" value="${env.BOOST_ROOT}"/>
<property name="src.dir" value="${root.dir}"/>
<property name="doc.dir" value="${src.dir}/doc"/>
<property name="libraries.dir" value="${src.dir}/include"/>
<property name="out.dir" value="${root.dir}/bin/poney/${platform}"/>
<property name="boost-mock.dir" value="${out.dir}/boost-mock"/>
<property name="version" value="unreleased"/>
<target name="package" depends="build" description="produce release packages">
<fail unless="version" message="missing version property"/>
<copy file="version.hpp" tofile="${out.dir}/version.hpp" overwrite="true">
<filterset>
<filter token="MOCK_VERSION" value="${version}"/>
</filterset>
</copy>
<mkdir dir="${dist.dir}"/>
<zip destfile="${dist.dir}/${ant.project.name}-${version}.zip">
<fileset dir="${src.dir}" includes="include/**"/>
<zipfileset dir="${doc.dir}/html" prefix="doc"/>
<zipfileset dir="${out.dir}" includes="version.hpp" prefix="include/turtle"/>
</zip>
<tar destfile="${dist.dir}/${ant.project.name}-${version}.tar.bz2" compression="bzip2">
<fileset dir="${src.dir}" includes="include/**"/>
<zipfileset dir="${doc.dir}/html" prefix="doc"/>
<zipfileset dir="${out.dir}" includes="version.hpp" prefix="include/turtle"/>
</tar>
</target>
<target name="all" depends="build,reports,package" description="build documentation, run tests and package distribution"/>
<target name="boost.convert" description="convert Boost.Mock">
<delete dir="${boost-mock.dir}"/>
<copy todir="${boost-mock.dir}">
<fileset dir="${root.dir}" excludes="bin/**"/>
</copy>
<move file="${boost-mock.dir}/include/turtle" tofile="${boost-mock.dir}/include/boost/mock"/>
<delete dir="${boost-mock.dir}/doc/html/turtle"/>
<replaceregexp match="MOCK" replace="BOOST_MOCK" flags="g">
<fileset dir="${boost-mock.dir}" includes="**/*.cpp,**/*.hpp,**/*.qbk"/>
</replaceregexp>
<replaceregexp match="BOOST_MOCK_BOOST_MOCK" replace="BOOST_MOCK" flags="g">
<fileset dir="${boost-mock.dir}" includes="**/*.cpp,**/*.hpp,**/*.qbk"/>
</replaceregexp>
<replaceregexp match='"([^"]+\.hpp)"' replace="&lt;boost/mock/\1&gt;" flags="g">
<fileset dir="${boost-mock.dir}/include" includes="**/*.hpp" excludes="**/detail/*.hpp"/>
</replaceregexp>
<replaceregexp match='"\.\./([^"]+\.hpp)"' replace="&lt;boost/mock/\1&gt;" flags="g">
<fileset dir="${boost-mock.dir}/include" includes="**/*.hpp"/>
</replaceregexp>
<replaceregexp match='"([^"]+\.hpp)"' replace="&lt;boost/mock/detail/\1&gt;" flags="g">
<fileset dir="${boost-mock.dir}/include" includes="**/detail/*.hpp"/>
</replaceregexp>
<replaceregexp match="&lt;turtle/([^&gt;]+)" replace="&lt;boost/mock/\1" flags="g">
<fileset dir="${boost-mock.dir}" includes="**/*.cpp,**/*.hpp,**/*.qbk"/>
</replaceregexp>
<replaceregexp match="(namespace mock)" replace="namespace boost${line.separator}{${line.separator}\1" flags="g">
<fileset dir="${boost-mock.dir}" includes="**/*.cpp,**/*.hpp,**/*.qbk"/>
</replaceregexp>
<replaceregexp match="} // mock" replace="}${line.separator}}" flags="g">
<fileset dir="${boost-mock.dir}" includes="**/*.cpp,**/*.hpp"/>
</replaceregexp>
<replaceregexp match=" mock::" replace=" boost::mock::" flags="g">
<fileset dir="${boost-mock.dir}" includes="**/*.cpp,**/*.hpp,**/*.qbk"/>
</replaceregexp>
<replaceregexp match="^mock::" replace="boost::mock::" flags="m">
<fileset dir="${boost-mock.dir}" includes="**/*.cpp,**/*.hpp,**/*.qbk"/>
</replaceregexp>
<replaceregexp match="http://turtle.sourceforge.net" replace="Boost.Mock" flags="g">
<fileset dir="${boost-mock.dir}" includes="**/*.cpp,**/*.hpp"/>
</replaceregexp>
<replaceregexp match="reference.helpers." replace="reference.helpers.boost_" flags="g">
<fileset dir="${boost-mock.dir}" includes="**/*.qbk"/>
</replaceregexp>
<replaceregexp match="turtle." replace="boost_mock." flags="g">
<fileset dir="${boost-mock.dir}" includes="**/*.qbk"/>
</replaceregexp>
<replaceregexp match="Turtle" replace="Boost.Mock" flags="g">
<fileset dir="${boost-mock.dir}" includes="**/*.qbk"/>
</replaceregexp>
<replaceregexp match="\[include changelog.qbk\]" replace="" flags="g">
<fileset dir="${boost-mock.dir}" includes="**/mock.qbk"/>
</replaceregexp>
</target>
<target name="boost.build" depends="boost.convert" description="build Boost.Mock tests and documentation">
<run dir="${boost-mock.dir}/build" script="build"/>
</target>
<target name="boost.package" depends="boost.build" description="package Boost.Mock">
<fail unless="version" message="missing version property"/>
<zip destfile="${dist.dir}/boost-mock-${version}.zip">
<fileset dir="${boost-mock.dir}" includes="include/**,test/**,doc/**" excludes="**/bin/**"/>
<fileset dir="${boost-mock.dir}" includes="LICENSE_1_0.txt,index.html"/>
</zip>
<tar destfile="${dist.dir}/boost-mock-${version}.tar.bz2" compression="bzip2">
<fileset dir="${boost-mock.dir}" includes="include/**,test/**,doc/**" excludes="**/bin/**"/>
<fileset dir="${boost-mock.dir}" includes="LICENSE_1_0.txt,index.html"/>
</tar>
</target>
<target name="boost" depends="boost.convert,boost.build,boost.package" description="convert and package to boost with documentation and tests"/>
</project>

View file

@ -1,17 +0,0 @@
# $ docker build --platform=linux -f clang/Dockerfile -t turtle-clang .
FROM buildpack-deps:stretch
RUN apt-get update && apt-get install -y xsltproc docbook-xsl docbook-xml && apt-get autoremove && apt-get clean
ENV DOCBOOK_XSL_DIR=/usr/share/xml/docbook/stylesheet/docbook-xsl \
DOCBOOK_DTD_DIR=/usr/share/xml/docbook/schema/dtd/4.2 \
BOOST_ROOT=/home/dev/cpp/boost/
# wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add - && \
RUN echo "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-5.0 main" >> /etc/apt/sources.list && \
apt-get update && \
apt-get install -y --allow-unauthenticated clang-5.0 lld-5.0 libc++1 && \
apt-get autoremove && \
apt-get clean && \
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-5.0 100 && \
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-5.0 100
RUN echo 'cd /home/dev/cpp/turtle/build' >> ~/.bashrc
# $ docker run --platform=linux --rm -v C:/dev:/home/dev -m 32g -it turtle-clang
# ./build.sh --toolset=clang "cxxflags=-std=c++17 -stdlib=libc++ -Wno-unused-variable"

View file

@ -1,9 +0,0 @@
# $ docker build -f Dockerfile -t turtle-gcc .
FROM gcc
RUN apt-get update && apt-get install -y xsltproc docbook-xsl docbook-xml && apt-get autoremove && apt-get clean
ENV DOCBOOK_XSL_DIR=/usr/share/xml/docbook/stylesheet/docbook-xsl \
DOCBOOK_DTD_DIR=/usr/share/xml/docbook/schema/dtd/4.2 \
BOOST_ROOT=/home/dev/cpp/boost/
RUN echo 'cd /home/dev/cpp/turtle/build' >> ~/.bashrc
# $ docker run --platform=linux --rm -v C:/dev:/home/dev -m 16g -it turtle-gcc
# ./build.sh --toolset=gcc "cxxflags=-std=c++17 -Wno-noexcept-type -Wno-unused-variable -Wno-unused-function -Wno-deprecated-declarations"

View file

@ -1,7 +0,0 @@
.vs
*.db
*.ipch
*.opendb
*.opensdf
*.sdf
*.suo

View file

@ -1,35 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "turtle", "turtle.vcxproj", "{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "turtle_test", "turtle_test.vcxproj", "{74810A2A-33D8-47D6-9A50-71261F1683F5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
debug|Win32 = debug|Win32
debug|x64 = debug|x64
release|Win32 = release|Win32
release|x64 = release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}.debug|Win32.ActiveCfg = debug|Win32
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}.debug|Win32.Build.0 = debug|Win32
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}.debug|x64.ActiveCfg = debug|x64
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}.debug|x64.Build.0 = debug|x64
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}.release|Win32.ActiveCfg = release|Win32
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}.release|Win32.Build.0 = release|Win32
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}.release|x64.ActiveCfg = release|x64
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}.release|x64.Build.0 = release|x64
{74810A2A-33D8-47D6-9A50-71261F1683F5}.debug|Win32.ActiveCfg = debug|Win32
{74810A2A-33D8-47D6-9A50-71261F1683F5}.debug|Win32.Build.0 = debug|Win32
{74810A2A-33D8-47D6-9A50-71261F1683F5}.debug|x64.ActiveCfg = debug|x64
{74810A2A-33D8-47D6-9A50-71261F1683F5}.debug|x64.Build.0 = debug|x64
{74810A2A-33D8-47D6-9A50-71261F1683F5}.release|Win32.ActiveCfg = release|Win32
{74810A2A-33D8-47D6-9A50-71261F1683F5}.release|Win32.Build.0 = release|Win32
{74810A2A-33D8-47D6-9A50-71261F1683F5}.release|x64.ActiveCfg = release|x64
{74810A2A-33D8-47D6-9A50-71261F1683F5}.release|x64.Build.0 = release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -1,196 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="debug|Win32">
<Configuration>debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="debug|x64">
<Configuration>debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="release|Win32">
<Configuration>release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="release|x64">
<Configuration>release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\turtle\cleanup.hpp" />
<ClInclude Include="..\..\include\turtle\config.hpp" />
<ClInclude Include="..\..\include\turtle\constraint.hpp" />
<ClInclude Include="..\..\include\turtle\constraints.hpp" />
<ClInclude Include="..\..\include\turtle\detail\action.hpp" />
<ClInclude Include="..\..\include\turtle\detail\addressof.hpp" />
<ClInclude Include="..\..\include\turtle\detail\child.hpp" />
<ClInclude Include="..\..\include\turtle\detail\context.hpp" />
<ClInclude Include="..\..\include\turtle\detail\expectation_template.hpp" />
<ClInclude Include="..\..\include\turtle\detail\formatter.hpp" />
<ClInclude Include="..\..\include\turtle\detail\function.hpp" />
<ClInclude Include="..\..\include\turtle\detail\function_impl_template.hpp" />
<ClInclude Include="..\..\include\turtle\detail\function_iterate.hpp" />
<ClInclude Include="..\..\include\turtle\detail\function_template.hpp" />
<ClInclude Include="..\..\include\turtle\detail\functor.hpp" />
<ClInclude Include="..\..\include\turtle\detail\group.hpp" />
<ClInclude Include="..\..\include\turtle\detail\invocation.hpp" />
<ClInclude Include="..\..\include\turtle\detail\is_functor.hpp" />
<ClInclude Include="..\..\include\turtle\detail\matcher_base_template.hpp" />
<ClInclude Include="..\..\include\turtle\detail\mutex.hpp" />
<ClInclude Include="..\..\include\turtle\detail\object_impl.hpp" />
<ClInclude Include="..\..\include\turtle\detail\parameter.hpp" />
<ClInclude Include="..\..\include\turtle\detail\parent.hpp" />
<ClInclude Include="..\..\include\turtle\detail\root.hpp" />
<ClInclude Include="..\..\include\turtle\detail\sequence_impl.hpp" />
<ClInclude Include="..\..\include\turtle\detail\signature.hpp" />
<ClInclude Include="..\..\include\turtle\detail\type_name.hpp" />
<ClInclude Include="..\..\include\turtle\detail\verifiable.hpp" />
<ClInclude Include="..\..\include\turtle\error.hpp" />
<ClInclude Include="..\..\include\turtle\exception.hpp" />
<ClInclude Include="..\..\include\turtle\format.hpp" />
<ClInclude Include="..\..\include\turtle\log.hpp" />
<ClInclude Include="..\..\include\turtle\matcher.hpp" />
<ClInclude Include="..\..\include\turtle\mock.hpp" />
<ClInclude Include="..\..\include\turtle\object.hpp" />
<ClInclude Include="..\..\include\turtle\reset.hpp" />
<ClInclude Include="..\..\include\turtle\sequence.hpp" />
<ClInclude Include="..\..\include\turtle\stream.hpp" />
<ClInclude Include="..\..\include\turtle\verify.hpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../out/vc100/$(Configuration)/libraries/$(ProjectName)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../out/vc100_x64/$(Configuration)/libraries/$(ProjectName)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../out/vc100/$(Configuration)/libraries/$(ProjectName)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../out/vc100_x64/$(Configuration)/libraries/$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../out/vc100/$(Configuration)/libraries/$(ProjectName)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../out/vc100_x64/$(Configuration)/libraries/$(ProjectName)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../out/vc100/$(Configuration)/libraries/$(ProjectName)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../out/vc100_x64/$(Configuration)/libraries/$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
<IncludePath>C:\dev\home\boost;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
<IncludePath>C:\dev\home\boost;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
<IncludePath>C:\dev\home\boost;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
<IncludePath>C:\dev\home\boost;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalOptions>/Zm179 %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(IntDir); ../../include; ../../src/libraries; ../../src/libraries/$(ProjectName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)$(ProjectName)d.lib</OutputFile>
<AdditionalLibraryDirectories>$(OutDir) ; ../../lib/vc100;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalOptions>/Zm179 %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(IntDir); ../../include; ../../src/libraries; ../../src/libraries/$(ProjectName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)$(ProjectName)d.lib</OutputFile>
<AdditionalLibraryDirectories>$(OutDir) ; ../../lib/vc100_x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
<ClCompile>
<AdditionalOptions>/Zm176 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(IntDir); ../../include; ../../src/libraries; ../../src/libraries/$(ProjectName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32; NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
<AdditionalLibraryDirectories>$(OutDir) ; ../../lib/vc100;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
<ClCompile>
<AdditionalOptions>/Zm176 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(IntDir); ../../include; ../../src/libraries; ../../src/libraries/$(ProjectName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32; NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
<AdditionalLibraryDirectories>$(OutDir) ; ../../lib/vc100_x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,131 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Source Files\detail">
<UniqueIdentifier>{b9cb2ff2-1351-456d-985e-cb0dd3f4e12d}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\turtle\config.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\constraint.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\constraints.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\error.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\exception.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\format.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\log.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\matcher.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\mock.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\object.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\reset.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\sequence.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\stream.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\verify.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\function.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\function_impl_template.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\function_iterate.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\function_template.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\functor.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\group.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\invocation.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\is_functor.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\matcher_base_template.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\mutex.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\object_impl.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\parameter.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\parent.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\root.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\sequence_impl.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\signature.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\type_name.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\verifiable.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\action.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\addressof.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\child.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\context.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\expectation_template.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\formatter.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\cleanup.hpp">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View file

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

View file

@ -1,192 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="debug|Win32">
<Configuration>debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="debug|x64">
<Configuration>debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="release|Win32">
<Configuration>release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="release|x64">
<Configuration>release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\test\bench_0_class.cpp" />
<ClCompile Include="..\..\test\bench_0_class_10_max_args.cpp" />
<ClCompile Include="..\..\test\bench_0_class_20_max_args.cpp" />
<ClCompile Include="..\..\test\bench_0_class_30_max_args.cpp" />
<ClCompile Include="..\..\test\bench_30_classes_30_methods_30_args_30_max_args.cpp" />
<ClCompile Include="..\..\test\bench_30_classes_30_methods_9_args.cpp" />
<ClCompile Include="..\..\test\bench_30_classes_30_methods_9_args_10_max_args.cpp" />
<ClCompile Include="..\..\test\bench_30_classes_30_methods_9_args_20_max_args.cpp" />
<ClCompile Include="..\..\test\bench_30_classes_30_methods_9_args_30_max_args.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{2D607783-30B9-46DE-81E2-28513B31D5D2}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../out/applications/$(ProjectName)/vc100/$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../out/applications/$(ProjectName)/vc100_x64/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../out/applications/$(ProjectName)/vc100/$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../out/applications/$(ProjectName)/vc100_x64/$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../out/applications/$(ProjectName)/vc100/$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../out/applications/$(ProjectName)/vc100_x64/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../out/applications/$(ProjectName)/vc100/$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../out/applications/$(ProjectName)/vc100_x64/$(Configuration)\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">$(ProjectName)</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release|x64'">$(ProjectName)</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../..; ../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../..; ../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>../..; ../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<FixedBaseAddress>false</FixedBaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>../..; ../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<FixedBaseAddress>false</FixedBaseAddress>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{0ddf67a0-6350-4b1a-ad9f-0648d3985709}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx;h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\test\bench_0_class_30_max_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\bench_30_classes_30_methods_9_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\bench_30_classes_30_methods_9_args_10_max_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\bench_30_classes_30_methods_9_args_20_max_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\bench_30_classes_30_methods_9_args_30_max_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\bench_30_classes_30_methods_30_args_30_max_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\bench_0_class.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\bench_0_class_10_max_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\bench_0_class_20_max_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

View file

@ -1,238 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="debug|Win32">
<Configuration>debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="debug|x64">
<Configuration>debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="release|Win32">
<Configuration>release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="release|x64">
<Configuration>release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\test\defined.hpp" />
<ClInclude Include="..\..\test\mock_error.hpp" />
<ClInclude Include="..\..\test\undefined.hpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\test\defined_1.cpp" />
<ClCompile Include="..\..\test\defined_2.cpp" />
<ClCompile Include="..\..\test\detail\test_function.cpp" />
<ClCompile Include="..\..\test\detail\test_invocation.cpp" />
<ClCompile Include="..\..\test\detail\test_is_functor.cpp" />
<ClCompile Include="..\..\test\detail\test_signature.cpp" />
<ClCompile Include="..\..\test\detail\test_type_name.cpp" />
<ClCompile Include="..\..\test\test_constraint.cpp" />
<ClCompile Include="..\..\test\test_constraints.cpp" />
<ClCompile Include="..\..\test\test_exception.cpp" />
<ClCompile Include="..\..\test\test_integration.cpp">
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='release|x64'">BOOST_AUTO_TEST_MAIN;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='debug|x64'">BOOST_AUTO_TEST_MAIN;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="..\..\test\test_log.cpp" />
<ClCompile Include="..\..\test\test_matcher.cpp" />
<ClCompile Include="..\..\test\test_max_args.cpp" />
<ClCompile Include="..\..\test\test_mock.cpp" />
<ClCompile Include="..\..\test\test_object.cpp" />
<ClCompile Include="..\..\test\test_sequence.cpp" />
<ClCompile Include="..\..\test\undefined.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{74810A2A-33D8-47D6-9A50-71261F1683F5}</ProjectGuid>
<RootNamespace>turtle_test</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../out/vc100/$(Configuration)/tests/$(ProjectName)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../out/vc100_x64/$(Configuration)/tests/$(ProjectName)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../out/vc100/$(Configuration)/tests/$(ProjectName)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../out/vc100_x64/$(Configuration)/tests/$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../out/vc100/$(Configuration)/tests/$(ProjectName)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../out/vc100_x64/$(Configuration)/tests/$(ProjectName)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../out/vc100/$(Configuration)/tests/$(ProjectName)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../out/vc100_x64/$(Configuration)/tests/$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
<IncludePath>C:\dev\home\boost;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
<LibraryPath>C:\dev\home\boost\stage\lib;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
<IncludePath>C:\dev\home\boost;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
<LibraryPath>C:\dev\home\boost\stage\lib;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
<IncludePath>C:\dev\home\boost;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
<LibraryPath>C:\dev\home\boost\stage\lib;$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSdkDir)lib\x64;</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
<IncludePath>C:\dev\home\boost;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
<LibraryPath>C:\dev\home\boost\stage\lib;$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSdkDir)lib\x64;</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalOptions>/Zm172 %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../../lib/vc100;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)$(TargetName).exe" --result_code=no --report_level=no --log_level=warning
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalOptions>/Zm172 %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../../lib/vc100;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)$(TargetName).exe" --result_code=no --report_level=no --log_level=warning</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
<ClCompile>
<AdditionalOptions>/Zm162 %(AdditionalOptions)</AdditionalOptions>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../../lib/vc100;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)$(TargetName).exe" --result_code=no --report_level=no --log_level=warning
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
<ClCompile>
<AdditionalOptions>/Zm162 %(AdditionalOptions)</AdditionalOptions>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../../lib/vc100;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)$(TargetName).exe" --result_code=no --report_level=no --log_level=warning</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,79 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{7b7d91a4-7b1e-441a-ac3f-2f93e73ae2ac}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx;h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Source Files\detail">
<UniqueIdentifier>{214599f8-6837-4d60-96ae-b913798819ae}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\test\mock_error.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\test\undefined.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\test\defined.hpp">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\test\test_constraints.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_integration.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_log.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_max_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_mock.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_object.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_sequence.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\detail\test_signature.cpp">
<Filter>Source Files\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\test\detail\test_type_name.cpp">
<Filter>Source Files\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\test\detail\test_function.cpp">
<Filter>Source Files\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\test\detail\test_invocation.cpp">
<Filter>Source Files\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\test\detail\test_is_functor.cpp">
<Filter>Source Files\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_matcher.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\undefined.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_constraint.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_exception.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\defined_1.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\defined_2.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

View file

@ -1,7 +0,0 @@
.vs
*.db
*.ipch
*.opendb
*.opensdf
*.sdf
*.suo

View file

@ -1,35 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "turtle", "turtle.vcxproj", "{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "turtle_test", "turtle_test.vcxproj", "{74810A2A-33D8-47D6-9A50-71261F1683F5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
debug|Win32 = debug|Win32
debug|x64 = debug|x64
release|Win32 = release|Win32
release|x64 = release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}.debug|Win32.ActiveCfg = debug|Win32
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}.debug|Win32.Build.0 = debug|Win32
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}.debug|x64.ActiveCfg = debug|x64
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}.debug|x64.Build.0 = debug|x64
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}.release|Win32.ActiveCfg = release|Win32
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}.release|Win32.Build.0 = release|Win32
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}.release|x64.ActiveCfg = release|x64
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}.release|x64.Build.0 = release|x64
{74810A2A-33D8-47D6-9A50-71261F1683F5}.debug|Win32.ActiveCfg = debug|Win32
{74810A2A-33D8-47D6-9A50-71261F1683F5}.debug|Win32.Build.0 = debug|Win32
{74810A2A-33D8-47D6-9A50-71261F1683F5}.debug|x64.ActiveCfg = debug|x64
{74810A2A-33D8-47D6-9A50-71261F1683F5}.debug|x64.Build.0 = debug|x64
{74810A2A-33D8-47D6-9A50-71261F1683F5}.release|Win32.ActiveCfg = release|Win32
{74810A2A-33D8-47D6-9A50-71261F1683F5}.release|Win32.Build.0 = release|Win32
{74810A2A-33D8-47D6-9A50-71261F1683F5}.release|x64.ActiveCfg = release|x64
{74810A2A-33D8-47D6-9A50-71261F1683F5}.release|x64.Build.0 = release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View file

@ -1,196 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="debug|Win32">
<Configuration>debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="debug|x64">
<Configuration>debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="release|Win32">
<Configuration>release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="release|x64">
<Configuration>release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\turtle\cleanup.hpp" />
<ClInclude Include="..\..\include\turtle\config.hpp" />
<ClInclude Include="..\..\include\turtle\constraint.hpp" />
<ClInclude Include="..\..\include\turtle\constraints.hpp" />
<ClInclude Include="..\..\include\turtle\detail\action.hpp" />
<ClInclude Include="..\..\include\turtle\detail\addressof.hpp" />
<ClInclude Include="..\..\include\turtle\detail\child.hpp" />
<ClInclude Include="..\..\include\turtle\detail\context.hpp" />
<ClInclude Include="..\..\include\turtle\detail\expectation_template.hpp" />
<ClInclude Include="..\..\include\turtle\detail\formatter.hpp" />
<ClInclude Include="..\..\include\turtle\detail\function.hpp" />
<ClInclude Include="..\..\include\turtle\detail\function_impl_template.hpp" />
<ClInclude Include="..\..\include\turtle\detail\function_iterate.hpp" />
<ClInclude Include="..\..\include\turtle\detail\function_template.hpp" />
<ClInclude Include="..\..\include\turtle\detail\functor.hpp" />
<ClInclude Include="..\..\include\turtle\detail\group.hpp" />
<ClInclude Include="..\..\include\turtle\detail\invocation.hpp" />
<ClInclude Include="..\..\include\turtle\detail\is_functor.hpp" />
<ClInclude Include="..\..\include\turtle\detail\matcher_base_template.hpp" />
<ClInclude Include="..\..\include\turtle\detail\mutex.hpp" />
<ClInclude Include="..\..\include\turtle\detail\object_impl.hpp" />
<ClInclude Include="..\..\include\turtle\detail\parameter.hpp" />
<ClInclude Include="..\..\include\turtle\detail\parent.hpp" />
<ClInclude Include="..\..\include\turtle\detail\root.hpp" />
<ClInclude Include="..\..\include\turtle\detail\sequence_impl.hpp" />
<ClInclude Include="..\..\include\turtle\detail\signature.hpp" />
<ClInclude Include="..\..\include\turtle\detail\type_name.hpp" />
<ClInclude Include="..\..\include\turtle\detail\verifiable.hpp" />
<ClInclude Include="..\..\include\turtle\error.hpp" />
<ClInclude Include="..\..\include\turtle\exception.hpp" />
<ClInclude Include="..\..\include\turtle\format.hpp" />
<ClInclude Include="..\..\include\turtle\log.hpp" />
<ClInclude Include="..\..\include\turtle\matcher.hpp" />
<ClInclude Include="..\..\include\turtle\mock.hpp" />
<ClInclude Include="..\..\include\turtle\object.hpp" />
<ClInclude Include="..\..\include\turtle\reset.hpp" />
<ClInclude Include="..\..\include\turtle\sequence.hpp" />
<ClInclude Include="..\..\include\turtle\stream.hpp" />
<ClInclude Include="..\..\include\turtle\verify.hpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../out/vc140/$(Configuration)/libraries/$(ProjectName)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../out/vc140_x64/$(Configuration)/libraries/$(ProjectName)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../out/vc140/$(Configuration)/libraries/$(ProjectName)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../out/vc140_x64/$(Configuration)/libraries/$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../out/vc140/$(Configuration)/libraries/$(ProjectName)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../out/vc140_x64/$(Configuration)/libraries/$(ProjectName)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../out/vc140/$(Configuration)/libraries/$(ProjectName)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../out/vc140_x64/$(Configuration)/libraries/$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
<IncludePath>C:\dev\home\boost;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
<IncludePath>C:\dev\home\boost;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
<IncludePath>C:\dev\home\boost;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
<IncludePath>C:\dev\home\boost;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalOptions>/Zm179 %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(IntDir); ../../include; ../../src/libraries; ../../src/libraries/$(ProjectName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)$(ProjectName)d.lib</OutputFile>
<AdditionalLibraryDirectories>$(OutDir) ; ../../lib/vc140;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalOptions>/Zm179 %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(IntDir); ../../include; ../../src/libraries; ../../src/libraries/$(ProjectName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)$(ProjectName)d.lib</OutputFile>
<AdditionalLibraryDirectories>$(OutDir) ; ../../lib/vc140_x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
<ClCompile>
<AdditionalOptions>/Zm176 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(IntDir); ../../include; ../../src/libraries; ../../src/libraries/$(ProjectName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32; NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
<AdditionalLibraryDirectories>$(OutDir) ; ../../lib/vc140;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
<ClCompile>
<AdditionalOptions>/Zm176 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(IntDir); ../../include; ../../src/libraries; ../../src/libraries/$(ProjectName);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32; NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
<AdditionalLibraryDirectories>$(OutDir) ; ../../lib/vc140_x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Lib>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,131 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Source Files\detail">
<UniqueIdentifier>{b9cb2ff2-1351-456d-985e-cb0dd3f4e12d}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\turtle\config.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\constraint.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\constraints.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\error.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\exception.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\format.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\log.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\matcher.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\mock.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\object.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\reset.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\sequence.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\stream.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\verify.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\function.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\function_impl_template.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\function_iterate.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\function_template.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\functor.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\group.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\invocation.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\is_functor.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\matcher_base_template.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\mutex.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\object_impl.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\parameter.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\parent.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\root.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\sequence_impl.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\signature.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\type_name.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\verifiable.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\action.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\addressof.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\child.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\context.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\expectation_template.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\detail\formatter.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\include\turtle\cleanup.hpp">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View file

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

View file

@ -1,192 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="debug|Win32">
<Configuration>debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="debug|x64">
<Configuration>debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="release|Win32">
<Configuration>release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="release|x64">
<Configuration>release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\test\bench_0_class.cpp" />
<ClCompile Include="..\..\test\bench_0_class_10_max_args.cpp" />
<ClCompile Include="..\..\test\bench_0_class_20_max_args.cpp" />
<ClCompile Include="..\..\test\bench_0_class_30_max_args.cpp" />
<ClCompile Include="..\..\test\bench_30_classes_30_methods_30_args_30_max_args.cpp" />
<ClCompile Include="..\..\test\bench_30_classes_30_methods_9_args.cpp" />
<ClCompile Include="..\..\test\bench_30_classes_30_methods_9_args_10_max_args.cpp" />
<ClCompile Include="..\..\test\bench_30_classes_30_methods_9_args_20_max_args.cpp" />
<ClCompile Include="..\..\test\bench_30_classes_30_methods_9_args_30_max_args.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{2D607783-30B9-46DE-81E2-28513B31D5D2}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../out/applications/$(ProjectName)/vc140/$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../out/applications/$(ProjectName)/vc140_x64/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../out/applications/$(ProjectName)/vc140/$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../out/applications/$(ProjectName)/vc140_x64/$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../out/applications/$(ProjectName)/vc140/$(Configuration)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../out/applications/$(ProjectName)/vc140_x64/$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../out/applications/$(ProjectName)/vc140/$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../out/applications/$(ProjectName)/vc140_x64/$(Configuration)\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release|Win32'">$(ProjectName)</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release|x64'">$(ProjectName)</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../..; ../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../..; ../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>../..; ../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<FixedBaseAddress>false</FixedBaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>../..; ../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<FixedBaseAddress>false</FixedBaseAddress>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{0ddf67a0-6350-4b1a-ad9f-0648d3985709}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx;h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\test\bench_0_class_30_max_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\bench_30_classes_30_methods_9_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\bench_30_classes_30_methods_9_args_10_max_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\bench_30_classes_30_methods_9_args_20_max_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\bench_30_classes_30_methods_9_args_30_max_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\bench_30_classes_30_methods_30_args_30_max_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\bench_0_class.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\bench_0_class_10_max_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\bench_0_class_20_max_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

View file

@ -1,241 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="debug|Win32">
<Configuration>debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="debug|x64">
<Configuration>debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="release|Win32">
<Configuration>release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="release|x64">
<Configuration>release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\test\defined.hpp" />
<ClInclude Include="..\..\test\mock_error.hpp" />
<ClInclude Include="..\..\test\undefined.hpp" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\test\defined_1.cpp" />
<ClCompile Include="..\..\test\defined_2.cpp" />
<ClCompile Include="..\..\test\detail\test_function.cpp" />
<ClCompile Include="..\..\test\detail\test_invocation.cpp" />
<ClCompile Include="..\..\test\detail\test_is_functor.cpp" />
<ClCompile Include="..\..\test\detail\test_signature.cpp" />
<ClCompile Include="..\..\test\detail\test_type_name.cpp" />
<ClCompile Include="..\..\test\test_constraint.cpp" />
<ClCompile Include="..\..\test\test_constraints.cpp" />
<ClCompile Include="..\..\test\test_exception.cpp" />
<ClCompile Include="..\..\test\test_integration.cpp">
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='release|x64'">BOOST_AUTO_TEST_MAIN;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='debug|x64'">BOOST_AUTO_TEST_MAIN;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="..\..\test\test_log.cpp" />
<ClCompile Include="..\..\test\test_matcher.cpp" />
<ClCompile Include="..\..\test\test_max_args.cpp" />
<ClCompile Include="..\..\test\test_mock.cpp" />
<ClCompile Include="..\..\test\test_object.cpp" />
<ClCompile Include="..\..\test\test_sequence.cpp" />
<ClCompile Include="..\..\test\undefined.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{74810A2A-33D8-47D6-9A50-71261F1683F5}</ProjectGuid>
<RootNamespace>turtle_test</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../out/vc140/$(Configuration)/tests/$(ProjectName)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../out/vc140_x64/$(Configuration)/tests/$(ProjectName)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../out/vc140/$(Configuration)/tests/$(ProjectName)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../out/vc140_x64/$(Configuration)/tests/$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../out/vc140/$(Configuration)/tests/$(ProjectName)\</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../out/vc140_x64/$(Configuration)/tests/$(ProjectName)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release|Win32'">../../out/vc140/$(Configuration)/tests/$(ProjectName)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release|x64'">../../out/vc140_x64/$(Configuration)/tests/$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'">
<IncludePath>C:\dev\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(UniversalCRT_IncludePath);</IncludePath>
<LibraryPath>C:\dev\lib\vc140;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
<IncludePath>C:\dev\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(UniversalCRT_IncludePath);</IncludePath>
<LibraryPath>C:\dev\lib\vc140;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'">
<IncludePath>C:\dev\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(IncludePath);</IncludePath>
<LibraryPath>C:\dev\lib\vc140_x64;$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSdkDir)lib\x64;$(LibraryPath);</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
<IncludePath>C:\dev\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(IncludePath);</IncludePath>
<LibraryPath>C:\dev\lib\vc140_x64;$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSdkDir)lib\x64;$(LibraryPath);</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalOptions>/Zm172 %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../../lib/vc140;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)$(TargetName).exe" --result_code=no --report_level=no --log_level=warning</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalOptions>/Zm172 %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../../lib/vc140;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)$(TargetName).exe" --result_code=no --report_level=no --log_level=warning</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'">
<ClCompile>
<AdditionalOptions>/Zm162 %(AdditionalOptions)</AdditionalOptions>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../../lib/vc140;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)$(TargetName).exe" --result_code=no --report_level=no --log_level=warning</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'">
<ClCompile>
<AdditionalOptions>/Zm162 %(AdditionalOptions)</AdditionalOptions>
<Optimization>MaxSpeed</Optimization>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeaderFile>$(ProjectName)_pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>../../lib/vc140;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
<PostBuildEvent>
<Command>"$(TargetDir)$(TargetName).exe" --result_code=no --report_level=no --log_level=warning</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -1,79 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{7b7d91a4-7b1e-441a-ac3f-2f93e73ae2ac}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx;h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Source Files\detail">
<UniqueIdentifier>{214599f8-6837-4d60-96ae-b913798819ae}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\test\mock_error.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\test\undefined.hpp">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\..\test\defined.hpp">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\test\test_constraints.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_integration.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_log.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_max_args.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_mock.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_object.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_sequence.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\detail\test_signature.cpp">
<Filter>Source Files\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\test\detail\test_type_name.cpp">
<Filter>Source Files\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\test\detail\test_function.cpp">
<Filter>Source Files\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\test\detail\test_invocation.cpp">
<Filter>Source Files\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\test\detail\test_is_functor.cpp">
<Filter>Source Files\detail</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_matcher.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\undefined.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_constraint.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\test_exception.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\defined_1.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\test\defined_2.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

View file

@ -1,5 +1,3 @@
# Boost.Mock
#
# Copyright Mathieu Champlon 2012 # Copyright Mathieu Champlon 2012
# #
# Distributed under the Boost Software License version 1.0. (See # Distributed under the Boost Software License version 1.0. (See
@ -46,7 +44,15 @@ project example
rule compile-examples rule compile-examples
{ {
for name in [ glob example/*.cpp ] { compile $(name) ; } local examples ;
for name in [ glob example/*.cpp ]
{
local compile-target = [ compile $(name) ] ;
explicit $(compile-target) ;
examples += $(compile-target) ;
}
return $(examples) ;
} }
alias mock_examples : [ compile-examples ] ; alias mock_examples : [ compile-examples ] ;
explicit mock_examples ;

View file

@ -7,6 +7,18 @@
[section Changelog] [section Changelog]
[section 2.0.0]
Released 29 September 2024
* Allow auto-deducing signature in `MOCK_METHOD_(NON_)CONST`
* Replaced Boost facilities with std:: equivalents where existing in C++14
* Removed MOCK_*_TPL as they are no longer required, use the non _TPL variant even for templates
* Added MOCK_PROTECT_SIGNATURE to pass function signatures with commas in the return type
* Remove support for protecting function signatures via BOOST_IDENTITY_TYPE, use MOCK_PROTECT_SIGNATURE instead
* Add support for unlimited number of arguments and sequences making MOCK_MAX_ARGS and MOCK_MAX_SEQUENCES superflous
[endsect]
[section 1.3.2] [section 1.3.2]
Released 19 June 2020 Released 19 June 2020

View file

@ -98,7 +98,7 @@ The purpose of the 'near' template function is to :
* remove the burden of specifying the template parameter when instantiating near_constraint * remove the burden of specifying the template parameter when instantiating near_constraint
* wrap the constraint in a mock::constraint so that it plays nicely with !, && and ||. * wrap the constraint in a mock::constraint so that it plays nicely with !, && and ||.
The use of boost::unwrap_ref provides support for passing arguments as references with boost::ref and boost::cref and delaying their initialization, for instance : The use of mock::unwrap_ref provides support for passing arguments as references with std::ref and std::cref and delaying their initialization, for instance :
[near_constraint_cref_test] [near_constraint_cref_test]
@ -110,24 +110,6 @@ For more information about the serialization operator and the use of mock::forma
[endsect] [endsect]
[section Number of arguments]
The maximum number of arguments a mocked method can have is defined by MOCK_MAX_ARGS.
By default this value is set to 9, but if needed it can be changed before including the library :
[max_args]
This means methods with up to 20 arguments will then be accepted.
The mock object library uses several boost libraries and will adjust some of their constants if they haven't already been defined :
* Boost.Function with BOOST_FUNCTION_MAX_ARGS required at MOCK_MAX_ARGS or higher
* Boost.FunctionTypes with BOOST_FT_MAX_ARITY required at MOCK_MAX_ARGS + 1 or higher
A compilation error will happen if one of those constants is already defined too low.
[endsect]
[section Test framework integration] [section Test framework integration]
By default the library expects to be used in conjunction with Boost.Test e.g. : By default the library expects to be used in conjunction with Boost.Test e.g. :

View file

@ -9,15 +9,17 @@
#ifndef CALCULATOR #ifndef CALCULATOR
#define CALCULATOR #define CALCULATOR
class view; #include "view.hpp"
//[ calculator //[ calculator
class calculator class calculator
{ {
public: view& v;
calculator( view& v );
void add( int a, int b ); // the result will be sent to the view 'v' public:
calculator(view& v) : v(v) {}
void add(int a, int b) { v.display(a + b); } // the result will be sent to the view 'v'
}; };
//] //]

View file

@ -12,137 +12,146 @@
//] //]
#include "calculator.hpp" #include "calculator.hpp"
#include "mock_view.hpp" #include "mock_view.hpp"
#include <boost/test/unit_test.hpp>
//[ mock_stream_user_type //[ mock_stream_user_type
namespace user_namespace namespace user_namespace {
{ struct user_type
struct user_type {};
{};
inline mock::stream& operator<<( mock::stream& s, const user_type& ) inline mock::stream& operator<<(mock::stream& s, const user_type&)
{ {
return s << "user_type"; return s << "user_type";
}
} }
} // namespace user_namespace
//] //]
namespace custom_constraint_free_function_test namespace custom_constraint_free_function_test {
{
//[ custom_constraint_free_function //[ custom_constraint_free_function
bool custom_constraint( int actual ) bool custom_constraint(int actual)
{ {
return actual == 42; return actual == 42;
} }
//] //]
//[ custom_constraint_free_function_test //[ custom_constraint_free_function_test
BOOST_AUTO_TEST_CASE( forty_one_plus_one_is_forty_two ) BOOST_AUTO_TEST_CASE(forty_one_plus_one_is_forty_two_free_function)
{ {
mock_view v; mock_view v;
calculator c( v ); calculator c(v);
MOCK_EXPECT( v.display ).with( &custom_constraint ); MOCK_EXPECT(v.display).with(&custom_constraint);
c.add( 41, 1 ); c.add(41, 1);
}
//]
} }
//]
} // namespace custom_constraint_free_function_test
namespace custom_constraint_functor_test namespace custom_constraint_functor_test {
{
//[ custom_constraint_functor //[ custom_constraint_functor
struct custom_constraint struct custom_constraint
{ {
friend bool operator==( int actual, const custom_constraint& ) friend bool operator==(int actual, const custom_constraint&) { return actual == 42; }
{
return actual == 42;
}
friend std::ostream& operator<<( std::ostream& s, const custom_constraint& ) friend std::ostream& operator<<(std::ostream& s, const custom_constraint&) { return s << "_ == 42"; }
{
return s << "_ == 42";
}
}; };
//] //]
//[ custom_constraint_functor_test //[ custom_constraint_functor_test
BOOST_AUTO_TEST_CASE( forty_one_plus_one_is_forty_two ) BOOST_AUTO_TEST_CASE(forty_one_plus_one_is_forty_two_custom_constraint)
{ {
mock_view v; mock_view v;
calculator c( v ); calculator c(v);
MOCK_EXPECT( v.display ).with( custom_constraint() ); MOCK_EXPECT(v.display).with(custom_constraint());
c.add( 41, 1 ); c.add(41, 1);
} }
//] //]
} } // namespace custom_constraint_functor_test
//[ near_constraint //[ near_constraint
template< typename Expected > template<typename Expected>
struct near_constraint struct near_constraint
{ {
near_constraint( Expected expected, Expected threshold ) near_constraint(Expected expected, Expected threshold) : expected_(expected), threshold_(threshold) {}
: expected_( expected )
, threshold_( threshold )
{}
template< typename Actual > template<typename Actual>
bool operator()( Actual actual ) const bool operator()(Actual actual) const
{ {
return std::abs( actual - boost::unwrap_ref( expected_ ) ) return std::abs(actual - mock::unwrap_ref(expected_)) <= mock::unwrap_ref(threshold_);
< boost::unwrap_ref( threshold_ );
} }
friend std::ostream& operator<<( std::ostream& s, const near_constraint& c ) friend std::ostream& operator<<(std::ostream& s, const near_constraint& c)
{ {
return s << "near( " << mock::format( c.expected_ ) return s << "near( " << mock::format(c.expected_) << ", " << mock::format(c.threshold_) << " )";
<< ", " << mock::format( c.threshold_ ) << " )";
} }
Expected expected_, threshold_; Expected expected_, threshold_;
}; };
template< typename Expected > template<typename Expected>
mock::constraint< near_constraint< Expected > > near( Expected expected, Expected threshold ) mock::constraint<near_constraint<Expected>> near(Expected expected, Expected threshold)
{ {
return near_constraint< Expected >( expected, threshold ); return near_constraint<Expected>(expected, threshold);
} }
//] //]
namespace near_constraint_test namespace near_constraint_test {
{
//[ near_constraint_test //[ near_constraint_test
BOOST_AUTO_TEST_CASE( forty_one_plus_one_is_forty_two_plus_or_minus_one ) BOOST_AUTO_TEST_CASE(forty_one_plus_one_is_forty_two_plus_or_minus_one_near)
{ {
mock_view v; mock_view v;
calculator c( v ); calculator c(v);
MOCK_EXPECT( v.display ).with( near( 42, 1 ) ); MOCK_EXPECT(v.display).with(near(42, 1));
c.add( 41, 1 ); c.add(41, 1);
} }
//] //]
} } // namespace near_constraint_test
namespace near_constraint_cref_test namespace near_constraint_cref_test {
{
//[ near_constraint_cref_test //[ near_constraint_cref_test
BOOST_AUTO_TEST_CASE( forty_one_plus_one_is_forty_two_plus_or_minus_one ) BOOST_AUTO_TEST_CASE(forty_one_plus_one_is_forty_two_plus_or_minus_one_near_cref)
{ {
mock_view v; mock_view v;
calculator c( v ); calculator c(v);
int expected, threshold; int expected = 0, threshold = 0;
MOCK_EXPECT( v.display ).with( near( boost::cref( expected ), boost::cref( threshold ) ) ); MOCK_EXPECT(v.display).with(near(std::cref(expected), std::cref(threshold)));
expected = 42; expected = 42;
threshold = 1; threshold = 1;
c.add( 41, 1 ); c.add(41, 1);
} }
//] //]
}
#undef MOCK_MAX_ARGS // Example of a "strong type" float
//[ max_args struct float_wrapper
#define MOCK_MAX_ARGS 20 {
#include <turtle/mock.hpp> float value;
//] float_wrapper(float value) : value(value) {}
operator float() const { return value; }
friend std::ostream& operator<<(std::ostream& s, const float_wrapper& f) { return s << f.value; }
};
BOOST_AUTO_TEST_CASE(near_constraint_works_with_with_float_wrapper_and_cref)
{
mock_view v;
calculator c(v);
float_wrapper expected = 0, threshold = 0;
// This works even without the unwrap_ref
MOCK_EXPECT(v.display).once().with(near(expected, threshold));
// This requires 2 implicit conversion: from reference_wrapper to float_wrapper, then to float
// so unwrap_ref in near is required as C++ allows only 1 implicit conversion
MOCK_EXPECT(v.display).once().with(near(std::cref(expected), std::cref(threshold)));
expected = 42;
threshold = 1;
c.add(0, 0);
c.add(41, 1);
}
} // namespace near_constraint_cref_test
#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
//[ custom_policy //[ custom_policy
template< typename Result > template<typename Result>
struct custom_policy struct custom_policy
{ {
static Result abort() static Result abort()
@ -150,23 +159,27 @@ struct custom_policy
// Notify the test framework that an error occurs which makes it impossible to continue the test. // Notify the test framework that an error occurs which makes it impossible to continue the test.
// This should most likely throw an exception of some kind. // This should most likely throw an exception of some kind.
} }
template< typename Context > template<typename Context>
static void fail( const char* message, const Context& context, const char* file = "unknown location", int line = 0 ) static void fail(const char* message, const Context& context, const char* file = "unknown location", int line = 0)
{ {
// Notify the test framework that an unexpected call has occurred. // Notify the test framework that an unexpected call has occurred.
} }
template< typename Context > template<typename Context>
static void call( const Context& context, const char* file, int line ) static void call(const Context& context, const char* file, int line)
{ {
// Notify the test framework that an expectation has been fulfilled. // Notify the test framework that an expectation has been fulfilled.
} }
static void pass( const char* file, int line ) static void pass(const char* file, int line)
{ {
// Notify the test framework that the test execution merely passed the given code location. // Notify the test framework that the test execution merely passed the given code location.
} }
}; };
//] //]
#if defined(__GNUC__)
# pragma GCC diagnostic pop
#endif
#undef MOCK_ERROR_POLICY #undef MOCK_ERROR_POLICY
//[ define_custom_policy //[ define_custom_policy
#define MOCK_ERROR_POLICY custom_policy #define MOCK_ERROR_POLICY custom_policy

View file

@ -6,124 +6,203 @@
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#include <functional>
#include <sstream>
#include <string>
std::function<void()> error_handler_abort;
std::function<void(const char*, int)> error_handler_pass;
std::function<void(const std::string&, const char*, int)> error_handler_call;
std::function<void(const char* message, const std::string&, const char*, int)> error_handler_fail;
template<typename Result>
struct configurable_mock_error
{
static Result abort()
{
error_handler_abort();
return Result();
}
static void pass(const char* file, int line) { error_handler_pass(file, line); }
template<typename Context>
static void call(const Context& context, const char* file, int line)
{
std::stringstream s;
s << context;
error_handler_call(s.str(), file, line);
}
template<typename Context>
static void fail(const char* message, const Context& context, const char* file = "", int line = 0)
{
std::stringstream s;
s << context;
error_handler_fail(message, s.str(), file, line);
}
};
#define MOCK_ERROR_POLICY configurable_mock_error
#define MOCK_USE_BOOST_TEST
//[ prerequisite //[ prerequisite
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#include <turtle/mock.hpp> #include <turtle/mock.hpp>
#include <boost/test/unit_test.hpp>
//] //]
#include "calculator.hpp" #include "calculator.hpp"
#include "mock_view.hpp" #include "mock_view.hpp"
namespace phases struct Fixture
{ {
Fixture()
{
error_handler_abort = mock::error<void>::abort;
error_handler_pass = mock::error<void>::pass;
error_handler_call = mock::error<void>::call<std::string>;
error_handler_fail = mock::error<void>::fail<std::string>;
}
};
BOOST_FIXTURE_TEST_SUITE(GettingStarted, Fixture)
namespace phases {
//[ phases //[ phases
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero ) BOOST_AUTO_TEST_CASE(zero_plus_zero_is_zero)
{ {
mock_view v; // create mock objects mock_view v; // create mock objects
calculator c( v ); // create object under test calculator c(v); // create object under test
MOCK_EXPECT( v.display ).once().with( 0 ); // configure mock objects MOCK_EXPECT(v.display).once().with(0); // configure mock objects
c.add( 0, 0 ); // exercise object under test c.add(0, 0); // exercise object under test
} // verify mock objects } // verify mock objects
//] //]
} } // namespace phases
namespace verify_reset namespace verify_reset {
{
//[ verify_reset //[ verify_reset
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero ) BOOST_AUTO_TEST_CASE(zero_plus_zero_is_zero_reset)
{ {
mock_view v; mock_view v;
calculator c( v ); calculator c(v);
MOCK_EXPECT( v.display ).once().with( 0 ); MOCK_EXPECT(v.display).once().with(0);
c.add( 0, 0 ); c.add(0, 0);
MOCK_VERIFY( v.display ); // verify all expectations are fulfilled for the 'display' method MOCK_VERIFY(v.display); // verify all expectations are fulfilled for the 'display' method
mock::verify( v ); // verify all expectations are fulfilled for all methods of 'v' mock::verify(v); // verify all expectations are fulfilled for all methods of 'v'
mock::verify(); // verify all expectations are fulfilled for all existing mock objects mock::verify(); // verify all expectations are fulfilled for all existing mock objects
MOCK_RESET( v.display ); // reset all expectations for the 'display' method MOCK_RESET(v.display); // reset all expectations for the 'display' method
mock::reset( v ); // reset all expectations for all methods of 'v' mock::reset(v); // reset all expectations for all methods of 'v'
mock::reset(); // reset all expectations for all existing mock objects mock::reset(); // reset all expectations for all existing mock objects
} // automatically verify all expectations are fulfilled for all mock objects going out of scope } // automatically verify all expectations are fulfilled for all mock objects going out of scope
//] //]
} } // namespace verify_reset
namespace expectations namespace expectations {
{
//[ expectations //[ expectations
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero ) BOOST_AUTO_TEST_CASE(zero_plus_zero_is_zero_expect)
{ {
mock_view v; mock_view v;
calculator c( v ); calculator c(v);
MOCK_EXPECT( v.display ).once().with( 0 ); // this call must occur once (and only once) MOCK_EXPECT(v.display).once().with(0); // this call must occur once (and only once)
MOCK_EXPECT( v.display ).with( 1 ); // this call can occur any number of times (including never) MOCK_EXPECT(v.display).with(1); // this call can occur any number of times (including never)
c.add( 0, 0 ); c.add(0, 0);
} }
//] //]
} } // namespace expectations
namespace sequence namespace sequence {
{
//[ sequence //[ sequence
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero ) BOOST_AUTO_TEST_CASE(zero_plus_zero_is_zero_then_1_plus_0_is_1)
{ {
mock_view v; mock_view v;
calculator c( v ); calculator c(v);
mock::sequence s; mock::sequence s;
MOCK_EXPECT( v.display ).once().with( 0 ).in( s ); // add this expectation to the sequence MOCK_EXPECT(v.display).once().with(0).in(s); // add this expectation to the sequence
MOCK_EXPECT( v.display ).with( 1 ).in( s ); // add this expectation to the sequence after the previous call MOCK_EXPECT(v.display).with(1).in(s); // add this expectation to the sequence after the previous call
c.add( 0, 0 ); c.add(0, 0);
c.add( 1, 0 ); c.add(1, 0);
} }
//] //]
} } // namespace sequence
namespace several_sequences namespace several_sequences {
{
//[ several_sequences //[ several_sequences
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero ) BOOST_AUTO_TEST_CASE(add_several_numbers_in_sequences)
{ {
mock_view v; mock_view v;
calculator c( v ); calculator c(v);
mock::sequence s1, s2; mock::sequence s1, s2;
MOCK_EXPECT( v.display ).once().with( 0 ).in( s1 ); MOCK_EXPECT(v.display).once().with(0).in(s1);
MOCK_EXPECT( v.display ).once().with( 1 ).in( s2 ); MOCK_EXPECT(v.display).once().with(1).in(s2);
MOCK_EXPECT( v.display ).with( 2 ).in( s1, s2 ); // add this expectation to both sequences after the previous calls MOCK_EXPECT(v.display).with(2).in(s1, s2); // add this expectation to both sequences after the previous calls
c.add( 0, 0 ); c.add(0, 0);
c.add( 1, 0 ); c.add(1, 0);
c.add( 1, 1 ); c.add(1, 1);
c.add( 2, 0 ); c.add(2, 0);
} }
//] //]
} } // namespace several_sequences
BOOST_AUTO_TEST_SUITE_END()
namespace action namespace action {
{
//[ action_view //[ action_view
class view class view
{ {
public: public:
virtual bool display( int result ) = 0; // returns a boolean virtual bool display(int result) = 0; // returns a boolean
}; };
//] //]
MOCK_BASE_CLASS( mock_view, view ) MOCK_BASE_CLASS(mock_view, view)
{ {
MOCK_METHOD( display, 1 ) MOCK_METHOD(display, 1)
}; };
class calculator class calculator
{ {
public: view& v;
calculator( view& v );
void add( int a, int b ); public:
calculator(view& v) : v(v) {}
void add(int a, int b) { v.display(a + b); }
}; };
//[ action_test
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero ) struct CatchFailureFixture : Fixture
{ {
mock_view v; static bool aborted;
calculator c( v ); static std::string fail_msg;
MOCK_EXPECT( v.display ).once().with( 0 ); // missing returns( true )
c.add( 0, 0 ); static void abort() { aborted = true; }
static void fail(const std::string& message, const std::string&, const char* = "", int = 0) { fail_msg = message; }
CatchFailureFixture()
{
error_handler_abort = abort;
error_handler_fail = fail;
}
void assert_failure(const std::string& required_message)
{
BOOST_CHECK(aborted);
BOOST_CHECK(fail_msg.find(required_message) != std::string::npos);
}
};
bool CatchFailureFixture::aborted = false;
std::string CatchFailureFixture::fail_msg;
struct AssertMissingAction : CatchFailureFixture
{
void teardown() { assert_failure("missing action"); }
};
BOOST_FIXTURE_TEST_SUITE(MissingReturnActionSuite, AssertMissingAction)
//[ action_test
BOOST_AUTO_TEST_CASE(zero_plus_zero_is_zero_with_action)
{
mock_view v;
calculator c(v);
MOCK_EXPECT(v.display).once().with(0); // missing returns( true )
c.add(0, 0);
} }
//] //]
} } // namespace action
BOOST_AUTO_TEST_SUITE_END()

View file

@ -1,48 +0,0 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2014
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#include <turtle/mock.hpp>
namespace
{
//[ limitations_comma_in_macro_problem
template< typename T1, typename T2 >
struct my_base_class
{};
//]
}
namespace limitations_comma_in_macro_solution_1
{
//[ limitations_comma_in_macro_solution_1
typedef my_base_class< int, int > my_base_type;
MOCK_BASE_CLASS( my_mock, my_base_type )
{};
//]
}
namespace limitations_comma_in_macro_solution_2
{
//[ limitations_comma_in_macro_solution_2
template< typename T1, typename T2 >
MOCK_BASE_CLASS( my_mock, my_base_class< T1 BOOST_PP_COMMA() T2 > )
{};
//]
}
namespace limitations_comma_in_macro_solution_3
{
//[ limitations_comma_in_macro_solution_3
template< typename T1, typename T2 >
struct my_mock : my_base_class< T1, T2 >, mock::object
{};
//]
}

View file

@ -6,45 +6,46 @@
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#include <turtle/mock.hpp> #include <turtle/mock.hpp>
#include <boost/test/unit_test.hpp>
namespace namespace {
{
//[ limitations_const_parameter_warning_problem //[ limitations_const_parameter_warning_problem
class base class base
{
public:
virtual void method( const int ) = 0;
};
//]
}
namespace limitations_const_parameter_warning_explanation
{ {
public:
virtual void method(const int) = 0;
};
//]
} // namespace
namespace limitations_const_parameter_warning_explanation {
//[ limitations_const_parameter_warning_explanation //[ limitations_const_parameter_warning_explanation
class derived : public base class derived : public base
{
public:
virtual void method( const int );
};
void derived::method( int )
{}
//]
}
namespace limitations_const_parameter_warning_solution
{ {
//[ limitations_const_parameter_warning_solution public:
MOCK_BASE_CLASS( mock_base, base ) virtual void method(const int);
{ };
void method( const int i )
{ void derived::method(int) {}
method_stub( i );
}
MOCK_METHOD( method_stub, 1, void( int ), method )
};
//] //]
} // namespace limitations_const_parameter_warning_explanation
namespace {
//[ limitations_const_parameter_warning_solution
MOCK_BASE_CLASS(mock_base, base)
{
void method(const int i) { method_stub(i); }
MOCK_METHOD(method_stub, 1, void(int), method)
};
//]
} // namespace
BOOST_AUTO_TEST_CASE(check_method_stub_is_called)
{
mock_base b;
MOCK_EXPECT(b.method).once().with(1);
// Example user code taking a base* (or smart pointer variant)
auto callMethod = [](base* bPtr) { bPtr->method(1); };
callMethod(&b);
} }

View file

@ -6,38 +6,34 @@
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#include <turtle/mock.hpp> #include <turtle/mock.hpp>
#include <boost/test/unit_test.hpp>
namespace namespace {
{
//[ limitations_literal_zero_problem //[ limitations_literal_zero_problem
class base class base
{ {
public: public:
virtual void method( int* i ) = 0; virtual void method(int* i) = 0;
}; };
MOCK_BASE_CLASS( mock_base, base ) MOCK_BASE_CLASS(mock_base, base)
{ {
MOCK_METHOD( method, 1 ) MOCK_METHOD(method, 1)
}; };
//] //]
} } // namespace
BOOST_AUTO_TEST_CASE( literal_zero ) BOOST_AUTO_TEST_CASE(literal_zero)
{ {
mock_base m; mock_base m;
//[ limitations_literal_zero_solution_1 //[ limitations_literal_zero_solution_1
MOCK_EXPECT( m.method ).with( mock::equal< int* >( 0 ) ); // this compiles MOCK_EXPECT(m.method).with(mock::equal<int*>(0)); // this compiles
//] //]
//[ limitations_literal_zero_solution_2 //[ limitations_literal_zero_solution_2
MOCK_EXPECT( m.method ).with( mock::negate ); MOCK_EXPECT(m.method).with(mock::negate);
//] //]
#ifdef MOCK_NULLPTR //[ limitations_literal_zero_solution_3
//[ limitations_literal_zero_solution_3 MOCK_EXPECT(m.method).with(nullptr);
MOCK_EXPECT( m.method ).with( nullptr ); //]
//]
#endif
} }

View file

@ -6,9 +6,8 @@
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#include <turtle/mock.hpp> #include <turtle/mock.hpp>
#include <boost/test/unit_test.hpp>
//[ limitations_non_virtual_method_problem //[ limitations_non_virtual_method_problem
class base class base
@ -20,8 +19,15 @@ public:
//] //]
//[ limitations_non_virtual_method_problem_2 //[ limitations_non_virtual_method_problem_2
MOCK_BASE_CLASS( mock_base, base ) MOCK_BASE_CLASS(mock_base, base)
{ {
MOCK_METHOD( method, 0 ) MOCK_METHOD(method, 0)
}; };
//] //]
BOOST_AUTO_TEST_CASE(method_not_called_through_base)
{
mock_base b;
MOCK_EXPECT(b.method).never();
static_cast<base*>(&b)->method(); // Doesn't call the mocked method as asserted above
}

View file

@ -6,27 +6,41 @@
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#include <turtle/mock.hpp> #include <turtle/mock.hpp>
#include <boost/test/unit_test.hpp>
namespace namespace {
{
//[ limitations_protected_private_method_problem //[ limitations_protected_private_method_problem
class base class base
{
public:
void call()
{ {
protected: method_1();
virtual void method_1() = 0; method_2();
private: }
virtual void method_2() = 0;
}; protected:
virtual void method_1() = 0;
private:
virtual void method_2() = 0;
};
//] //]
//[ limitations_protected_private_method_solution //[ limitations_protected_private_method_solution
MOCK_BASE_CLASS( mock_base, base ) MOCK_BASE_CLASS(mock_base, base)
{ {
MOCK_METHOD( method_1, 0, void() ) MOCK_METHOD(method_1, 0, void())
MOCK_METHOD( method_2, 0, void() ) MOCK_METHOD(method_2, 0, void())
}; };
//] //]
} // namespace
BOOST_AUTO_TEST_CASE(mocked_methods_are_called)
{
mock_base b;
MOCK_EXPECT(b.method_1).once();
MOCK_EXPECT(b.method_2).once();
static_cast<base*>(&b)->call();
} }

View file

@ -6,29 +6,33 @@
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#include <turtle/mock.hpp> #include <turtle/mock.hpp>
#include <boost/test/unit_test.hpp>
namespace namespace {
{
//[ limitations_template_base_class_method_problem //[ limitations_template_base_class_method_problem
template< typename T > template<typename T>
class base class base
{ {
public: public:
virtual ~base() virtual ~base() = default;
{}
virtual void method() = 0; virtual void method() = 0;
}; };
//] //]
//[ limitations_template_base_class_method_solution //[ limitations_template_base_class_method_solution
template< typename T > template<typename T>
MOCK_BASE_CLASS( mock_base, base< T > ) MOCK_BASE_CLASS(mock_base, base<T>)
{ {
MOCK_METHOD( method, 1, void() ) MOCK_METHOD(method, 0, void())
}; };
//] //]
} // namespace
BOOST_AUTO_TEST_CASE(call_method_from_templated_class)
{
mock_base<int> b;
MOCK_EXPECT(b.method).once();
static_cast<base<int>*>(&b)->method();
} }

View file

@ -6,78 +6,90 @@
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#include <turtle/mock.hpp> #include <turtle/mock.hpp>
#include <boost/test/unit_test.hpp>
namespace limitations_template_method_problem namespace limitations_template_method_problem {
{
//[ limitations_template_method_problem //[ limitations_template_method_problem
class concept class concept_class
{ {
public: public:
template< typename T > template<typename T>
void method( T t ) void method(T t);
{}
}; };
template< typename T > template<typename T>
void function_under_test( T t ) // T is supposed to model the previous concept void function_under_test(T t) // T is supposed to model the previous concept
{ {
t.method( 42 ); t.method(42);
t.method( "string" ); t.method("string");
} }
//] //]
//[ limitations_template_method_solution //[ limitations_template_method_solution
MOCK_CLASS( mock_concept ) MOCK_CLASS(mock_concept)
{ {
MOCK_METHOD( method, 1, void( int ), method_int ) MOCK_METHOD(method, 1, void(int), method_int)
MOCK_METHOD( method, 1, void( const char* ), method_string ) MOCK_METHOD(method, 1, void(const char*), method_string)
}; };
//] //]
}
namespace limitations_template_method_problem_2 BOOST_AUTO_TEST_CASE(mocked_templated_methods_are_called)
{ {
mock_concept b;
MOCK_EXPECT(b.method_int).once().with(42);
MOCK_EXPECT(b.method_string).once().with(mock::equal(std::string("string")));
function_under_test(b);
}
} // namespace limitations_template_method_problem
namespace limitations_template_method_problem_2 {
//[ limitations_template_method_problem_2 //[ limitations_template_method_problem_2
class concept class concept_class
{ {
public: public:
template< typename T > template<typename T>
T create() T create()
{ {
return T(); return T();
} }
}; };
template< typename T > template<typename T>
void function_under_test( T t ) // T is supposed to model the previous concept void function_under_test(T t) // T is supposed to model the previous concept
{ {
t.template create< int >(); t.template create<int>();
t.template create< std::string >(); t.template create<std::string>();
} }
//] //]
//[ limitations_template_method_solution_2 //[ limitations_template_method_solution_2
MOCK_CLASS( mock_concept ) MOCK_CLASS(mock_concept)
{ {
template< typename T > template<typename T>
T create(); T create();
MOCK_METHOD( create_int, 0, int(), create_int ) MOCK_METHOD(create_int, 0, int(), create_int)
MOCK_METHOD( create_string, 0, std::string(), create_string ) MOCK_METHOD(create_string, 0, std::string(), create_string)
}; };
template<> template<>
int mock_concept::create< int >() int mock_concept::create<int>()
{ {
return create_int(); return create_int();
} }
template<> template<>
std::string mock_concept::create< std::string >() std::string mock_concept::create<std::string>()
{ {
return create_string(); return create_string();
} }
//] //]
BOOST_AUTO_TEST_CASE(dispatch_methods_are_called)
{
mock_concept b;
MOCK_EXPECT(b.create_int).once().returns(0);
MOCK_EXPECT(b.create_string).once().returns("");
function_under_test(b);
} }
} // namespace limitations_template_method_problem_2

View file

@ -6,30 +6,31 @@
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#include <turtle/mock.hpp> #include <turtle/mock.hpp>
#include <boost/test/unit_test.hpp>
namespace namespace {
{
//[ limitations_throw_specifier_problem //[ limitations_throw_specifier_problem
struct base_class struct base_class
{ {
virtual ~base_class() virtual ~base_class() = default;
{}
virtual void method() throw (); virtual void method() throw() = 0;
}; };
//] //]
//[ limitations_throw_specifier_solution //[ limitations_throw_specifier_solution
MOCK_BASE_CLASS( mock_class, base_class ) MOCK_BASE_CLASS(mock_class, base_class)
{ {
void method() throw () void method() throw() override { method_proxy(); }
{ MOCK_METHOD(method_proxy, 0, void(), method)
method_proxy(); };
}
MOCK_METHOD( method_proxy, 0, void(), method )
};
//] //]
} // namespace
BOOST_AUTO_TEST_CASE(call_method_proxy)
{
mock_class b;
MOCK_EXPECT(b.method).once();
static_cast<base_class*>(&b)->method();
} }

View file

@ -9,14 +9,14 @@
#ifndef MOCK_VIEW #ifndef MOCK_VIEW
#define MOCK_VIEW #define MOCK_VIEW
#include <turtle/mock.hpp>
#include "view.hpp" #include "view.hpp"
#include <turtle/mock.hpp>
//[ mock_view //[ mock_view
MOCK_BASE_CLASS( mock_view, view ) // declare a 'mock_view' class implementing 'view' MOCK_BASE_CLASS(mock_view, view) // declare a 'mock_view' class implementing 'view'
{ {
MOCK_METHOD( display, 1 ) // implement the 'display' method from 'view' (taking 1 argument) MOCK_METHOD(display, 1) // implement the 'display' method from 'view' (taking 1 argument)
}; };
//] //]
#endif // MOCK_VIEW #endif // MOCK_VIEW

View file

@ -6,41 +6,41 @@
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#include <turtle/mock.hpp>
#include "calculator.hpp" #include "calculator.hpp"
#include "mock_view.hpp" #include "mock_view.hpp"
#include <turtle/mock.hpp>
#include <boost/test/unit_test.hpp>
namespace simple namespace simple {
{
//[ simple_calculator //[ simple_calculator
class calculator class calculator
{ {
public: public:
int add( int a, int b ); int add(int a, int b);
}; };
//] //]
//[ simple_zero_plus_zero_is_zero int calculator::add(int a, int b)
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
{ {
calculator c; return a + b;
BOOST_CHECK_EQUAL( 0, c.add( 0, 0 ) );
}
//]
} }
namespace without_mock_object //[ simple_zero_plus_zero_is_zero
BOOST_AUTO_TEST_CASE(zero_plus_zero_is_zero)
{ {
calculator c;
BOOST_CHECK_EQUAL(0, c.add(0, 0));
}
//]
} // namespace simple
namespace without_mock_object {
//[ my_view //[ my_view
class my_view : public view class my_view : public view
{ {
public: public:
my_view() my_view() : called(false) {}
: called( false ) virtual void display(int result)
{}
virtual void display( int result )
{ {
called = true; called = true;
value = result; value = result;
@ -51,26 +51,26 @@ public:
//] //]
//[ zero_plus_zero_is_zero_without_mock_object //[ zero_plus_zero_is_zero_without_mock_object
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero ) BOOST_AUTO_TEST_CASE(zero_plus_zero_is_zero_without_mock_object)
{ {
my_view v; my_view v;
calculator c( v ); calculator c(v);
c.add( 0, 0 ); c.add(0, 0);
BOOST_REQUIRE( v.called ); BOOST_REQUIRE(v.called);
BOOST_CHECK_EQUAL( 0, v.value ); BOOST_CHECK_EQUAL(0, v.value);
} }
//] //]
} } // namespace without_mock_object
namespace with_mock_object namespace with_mock_object {
{
//[ zero_plus_zero_is_zero_with_mock_object //[ zero_plus_zero_is_zero_with_mock_object
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero ) BOOST_AUTO_TEST_CASE(zero_plus_zero_is_zero_with_mock_object)
{ {
mock_view v; mock_view v;
calculator c( v ); calculator c(v);
MOCK_EXPECT( v.display ).once().with( 0 ); // expect the 'display' method to be called once (and only once) with a parameter value equal to 0 MOCK_EXPECT(v.display).once().with(
c.add( 0, 0 ); 0); // expect the 'display' method to be called once (and only once) with a parameter value equal to 0
c.add(0, 0);
} }
//] //]
} } // namespace with_mock_object

View file

@ -7,67 +7,66 @@
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
//[ async_call_problem //[ async_call_problem
namespace namespace mock_test {
class base_class
{ {
class base_class public:
{ virtual void method() = 0;
public: };
virtual void method() = 0;
};
class my_class class my_class
{ {
public: base_class& b;
explicit my_class( base_class& );
void flush(); // repetitively calling this method will in turn call base_class::method at some point public:
}; explicit my_class(base_class&);
}
void flush(); // repetitively calling this method will in turn call base_class::method at some point
};
} // namespace mock_test
//] //]
namespace mock_test {
my_class::my_class(base_class& b) : b(b) {}
void my_class::flush()
{
static int counter = 7;
if(--counter == 0)
b.method();
}
} // namespace mock_test
//[ async_call_solution //[ async_call_solution
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/thread.hpp>
#include <turtle/mock.hpp> #include <turtle/mock.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/thread.hpp>
namespace namespace mock_test {
template<typename F>
void check(bool& condition, F flush, int attempts = 100, int sleep = 100)
{ {
template< typename F > while(!condition && attempts > 0)
void check( bool& condition, F flush, int attempts = 100, int sleep = 100 )
{ {
while( !condition && attempts > 0 ) --attempts;
{ boost::this_thread::sleep(boost::posix_time::milliseconds(sleep));
--attempts; flush();
boost::this_thread::sleep( boost::posix_time::milliseconds( sleep ) );
flush();
}
}
MOCK_BASE_CLASS( mock_base_class, base_class )
{
MOCK_METHOD( method, 0 )
};
void set_bool(bool& b)
{
b = true;
} }
} }
BOOST_AUTO_TEST_CASE( method_is_called ) MOCK_BASE_CLASS(mock_base_class, base_class)
{
MOCK_METHOD(method, 0)
};
BOOST_AUTO_TEST_CASE(method_is_called)
{ {
mock_base_class m; mock_base_class m;
my_class c( m ); my_class c(m);
bool done = false; bool done = false;
// when method is called it will set done to true MOCK_EXPECT(m.method).once().calls([&done]() { done = true; });
// Note: Boost 1.57 introduced a bug preventing usage of the lambda with clang in C++98 check(done, [&c]() { c.flush(); }); // just wait on done, flushing from time to time
// See: https://svn.boost.org/trac10/ticket/10785
#if defined(BOOST_CLANG) && (BOOST_VERSION >= 105700)
MOCK_EXPECT( m.method ).once().calls( boost::bind(&set_bool, done) );
#else
MOCK_EXPECT( m.method ).once().calls( boost::lambda::var( done ) = true );
#endif
check( done, boost::bind( &my_class::flush, &c ) ); // just wait on done, flushing from time to time
} }
} // namespace mock_test
//] //]

View file

@ -6,39 +6,61 @@
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// Intentionally duplicate to have complete examples and minimal user visible, yet tested test code
#include <boost/test/unit_test.hpp>
static void someFunctor(int newValue);
//[ invoke_functor_problem //[ invoke_functor_problem
#include <boost/function.hpp> #include <functional>
namespace class base_class
{ {
class base_class public:
{ virtual void method(const std::function<void(int)>& functor) = 0;
public: };
virtual void method( const boost::function< void( int ) >& functor ) = 0;
};
void function( base_class& ); // the function will call 'method' with a functor to be applied // the function will call 'method' with a functor to be applied
void function(base_class& c)
{
c.method(someFunctor);
} }
//] //]
// Some test-only code to verify what is described
static int receivedValue = 0;
static void someFunctor(int newValue)
{
receivedValue = newValue;
}
// Check that the functor was called with 42
struct CheckReceivedValue
{
void teardown()
{
BOOST_CHECK(receivedValue == 42); // functor was called and received the value 42
}
};
// And force using it w/o showing that in the docs
#undef BOOST_AUTO_TEST_CASE
#define BOOST_AUTO_TEST_CASE(name) BOOST_FIXTURE_TEST_CASE(name, CheckReceivedValue)
//[ invoke_functor_solution //[ invoke_functor_solution
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#include <boost/bind/apply.hpp>
#include <turtle/mock.hpp> #include <turtle/mock.hpp>
#include <boost/test/unit_test.hpp>
namespace namespace {
MOCK_BASE_CLASS(mock_class, base_class)
{ {
MOCK_BASE_CLASS( mock_class, base_class ) MOCK_METHOD(method, 1)
{ };
MOCK_METHOD( method, 1 ) } // namespace
};
}
BOOST_AUTO_TEST_CASE( how_to_invoke_a_functor_passed_as_parameter_of_a_mock_method ) BOOST_AUTO_TEST_CASE(how_to_invoke_a_functor_passed_as_parameter_of_a_mock_method)
{ {
mock_class mock; mock_class mock;
MOCK_EXPECT( mock.method ).calls( boost::bind( boost::apply< void >(), _1, 42 ) ); // whenever 'method' is called, invoke the functor with 42 MOCK_EXPECT(mock.method).calls([](const auto& functor) {
function( mock ); functor(42);
}); // whenever 'method' is called, invoke the functor with 42
function(mock);
} }
//] //]

View file

@ -7,49 +7,50 @@
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
//[ quick_constraint_problem //[ quick_constraint_problem
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#include <turtle/mock.hpp> #include <turtle/mock.hpp>
#include <boost/test/unit_test.hpp>
#include <iostream> #include <iostream>
namespace namespace {
class my_class
{ {
class my_class public:
{ explicit my_class(int data) : data_(data) {}
public: int data_;
explicit my_class( int data ) };
: data_( data )
{}
int data_;
};
std::ostream& operator<<( std::ostream& os, const my_class& c ) // my_class is serializable to an std::ostream std::ostream& operator<<(std::ostream& os, const my_class& c) // my_class is serializable to an std::ostream
{ {
return os << "my_class( " << c.data_ << " )"; return os << "my_class( " << c.data_ << " )";
}
MOCK_CLASS( my_mock )
{
MOCK_METHOD( method, 1, void( const my_class& ) ) // how to simply write a custom constraint ?
};
} }
MOCK_CLASS(my_mock)
{
MOCK_METHOD(method, 1, void(const my_class&)) // how to simply write a custom constraint ?
};
} // namespace
//] //]
//[ quick_constraint_solution //[ quick_constraint_solution
#include <boost/lexical_cast.hpp> #include <sstream>
namespace // in the same namespace as 'my_class' namespace // in the same namespace as 'my_class'
{ {
bool operator==( const my_class& actual, const std::string& expected ) // the first part of the trick is to compare to a string bool operator==(const my_class& actual,
{ const std::string& expected) // the first part of the trick is to compare to a string
return boost::lexical_cast< std::string >( actual ) == expected; {
} std::ostringstream s;
} // mock s << actual;
return s.str() == expected;
}
} // namespace
BOOST_AUTO_TEST_CASE( method_is_called ) BOOST_AUTO_TEST_CASE(method_is_called)
{ {
my_mock mock; my_mock mock;
MOCK_EXPECT( mock.method ).once().with( "my_class( 42 )" ); // the second part of the trick is to express the constraint as a string MOCK_EXPECT(mock.method)
mock.method( my_class( 42 ) ); .once()
.with("my_class( 42 )"); // the second part of the trick is to express the constraint as a string
mock.method(my_class(42));
} }
//] //]

View file

@ -7,44 +7,59 @@
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
//[ retrieve_cref_problem //[ retrieve_cref_problem
namespace namespace {
class base_class
{ {
class base_class public:
{ virtual void method(int value) = 0;
public: };
virtual void method( int value ) = 0;
};
class my_class class my_class
{ {
public: public:
explicit my_class( base_class& ); explicit my_class(base_class&);
void process(); // the processing will call 'method' two times with the same value, but we don't know what value beforehand void process(); // the processing will call 'method' two times with the same value, but we don't know what value
}; // beforehand
} };
} // namespace
//] //]
//[ retrieve_cref_solution namespace {
#define BOOST_AUTO_TEST_MAIN static base_class* global_b = nullptr;
#include <boost/test/auto_unit_test.hpp> my_class::my_class(base_class& b)
#include <turtle/mock.hpp>
namespace
{ {
MOCK_BASE_CLASS( mock_base_class, base_class ) global_b = &b;
{
MOCK_METHOD( method, 1 )
};
} }
void my_class::process()
{
int secret_value = 42;
global_b->method(secret_value);
global_b->method(secret_value);
}
} // namespace
BOOST_AUTO_TEST_CASE( method_is_called_two_times_with_the_same_value ) //[ retrieve_cref_solution
#include <turtle/mock.hpp>
#include <boost/test/unit_test.hpp>
namespace {
MOCK_BASE_CLASS(mock_base_class, base_class)
{
MOCK_METHOD(method, 1)
};
} // namespace
BOOST_AUTO_TEST_CASE(method_is_called_two_times_with_the_same_value)
{ {
mock_base_class mock; mock_base_class mock;
my_class c( mock ); my_class c(mock);
int value; int value;
MOCK_EXPECT( mock.method ).once().with( mock::retrieve( value ) ); // on first call retrieve the value, this expectation takes precedence because it can never fail MOCK_EXPECT(mock.method).once().with(mock::retrieve(value)); // on first call retrieve the value, this expectation
MOCK_EXPECT( mock.method ).once().with( boost::cref( value ) ); // on second call compare the previously retrieved value with the newly received one // takes precedence because it can never fail
MOCK_EXPECT(mock.method)
.once()
.with(std::cref(value)); // on second call compare the previously retrieved value with the newly received one
c.process(); c.process();
} }
//] //]

View file

@ -6,35 +6,42 @@
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#include <boost/test/unit_test.hpp>
// Used to make this test file pass. Define to 0 to see other tests fail
#define MOCK_MAKE_TEST_PASS 1
#if MOCK_MAKE_TEST_PASS
# undef BOOST_AUTO_TEST_CASE
# define BOOST_AUTO_TEST_CASE(name) BOOST_FIXTURE_TEST_CASE(name, mock::cleanup)
#endif
//[ static_objects_problem //[ static_objects_problem
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp>
#include <turtle/mock.hpp> #include <turtle/mock.hpp>
#include <boost/test/unit_test.hpp>
#include <ostream> #include <ostream>
namespace namespace {
struct my_class
{ {
struct my_class my_class(int i) : i_(i) {}
{
my_class( int i )
: i_( i )
{}
int i_; int i_;
}; };
std::ostream& operator<<( std::ostream& os, const my_class* c ) std::ostream& operator<<(std::ostream& os, const my_class* c)
{ {
return os << "my_class " << c->i_; // the 'c' pointer must be valid when logging return os << "my_class " << c->i_; // the 'c' pointer must be valid when logging
}
MOCK_FUNCTION( f, 1, void( my_class* ) ) // being static 'f' outlive the test case
} }
BOOST_AUTO_TEST_CASE( static_objects_problem ) MOCK_FUNCTION(f, 1, void(my_class*)) // being static 'f' outlives the test case
} // namespace
BOOST_AUTO_TEST_CASE(static_objects_problem)
{ {
my_class c( 42 ); my_class c(42);
MOCK_EXPECT( f ).once().with( &c ); // the set expectation will also outlive the test case and leak into other test cases using 'f' MOCK_EXPECT(f).once().with(
&c); // the set expectation will also outlive the test case and leak into other test cases using 'f'
} // the 'c' instance goes out of scope and the '&c' pointer becomes dangling } // the 'c' instance goes out of scope and the '&c' pointer becomes dangling
//] //]
@ -43,25 +50,28 @@ struct fixture
{ {
~fixture() ~fixture()
{ {
mock::reset(); // the use of a fixture ensures the reset will prevent the expectations from leaking into other test cases mock::reset(); // the use of a fixture ensures the reset will prevent the expectations from leaking into other
// test cases
} }
}; };
BOOST_FIXTURE_TEST_CASE( static_object_partial_solution, fixture ) BOOST_FIXTURE_TEST_CASE(static_object_partial_solution, fixture)
{ {
my_class c( 42 ); my_class c(42);
MOCK_EXPECT( f ).once().with( &c ); MOCK_EXPECT(f).once().with(&c);
f( &c ); f(&c);
mock::verify(); // verify the expectations before local objects are destroyed and before the fixture resets them mock::verify(); // verify the expectations before local objects are destroyed and before the fixture resets them
} }
//] //]
//[ static_objects_solution //[ static_objects_solution
BOOST_FIXTURE_TEST_CASE( static_objects_solution, mock::cleanup ) // actually the library includes a ready to use fixture just like the one described BOOST_FIXTURE_TEST_CASE(
static_objects_solution,
mock::cleanup) // actually the library includes a ready to use fixture just like the one described
{ {
my_class c( 42 ); my_class c(42);
MOCK_EXPECT( f ).once().with( &c ); MOCK_EXPECT(f).once().with(&c);
f( &c ); f(&c);
mock::verify(); mock::verify();
} }
//] //]

View file

@ -6,15 +6,30 @@
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#include <turtle/mock.hpp>
#include "calculator.hpp" #include "calculator.hpp"
#include "mock_view.hpp" #include "mock_view.hpp"
#include <turtle/mock.hpp>
#include <boost/test/unit_test.hpp>
#include <iostream>
#include <limits>
#include <stdexcept>
// Dummy to detect if the assertion unexpectedly succeeded to test what is explained
#undef BOOST_CHECK_THROW
#define BOOST_CHECK_THROW(expr, exc) \
try \
{ \
expr; \
} catch(const exc&) \
{ \
std::cerr << "Exception thrown but should not"; \
}
//[ overflow_throws //[ overflow_throws
BOOST_AUTO_TEST_CASE( overflow_throws ) BOOST_AUTO_TEST_CASE(overflow_throws)
{ {
mock_view v; mock_view v;
calculator c( v ); calculator c(v);
BOOST_CHECK_THROW( c.add( (std::numeric_limits< int >::max)(), 1 ), std::exception ); BOOST_CHECK_THROW(c.add((std::numeric_limits<int>::max)(), 1), std::exception);
} }
//] //]

File diff suppressed because it is too large Load diff

View file

@ -13,7 +13,7 @@
class view class view
{ {
public: public:
virtual void display( int result ) = 0; virtual void display(int result) = 0;
}; };
//] //]

View file

@ -12,7 +12,6 @@
[import example/limitations_template_base_class_method.cpp] [import example/limitations_template_base_class_method.cpp]
[import example/limitations_template_method.cpp] [import example/limitations_template_method.cpp]
[import example/limitations_protected_private_method.cpp] [import example/limitations_protected_private_method.cpp]
[import example/limitations_comma_in_macro.cpp]
[import example/limitations_const_parameter_warning.cpp] [import example/limitations_const_parameter_warning.cpp]
This section lists the library known limitations. This section lists the library known limitations.
@ -76,7 +75,7 @@ Given :
[limitations_template_method_problem] [limitations_template_method_problem]
writing a mock object modeling 'concept' requires to list all the possible versions of 'method' : writing a mock object modeling the 'concept class' requires to list all the possible versions of 'method' :
[limitations_template_method_solution] [limitations_template_method_solution]
@ -151,43 +150,6 @@ A workaround would be to write a proxy member function :
[endsect] [endsect]
[section Compilers without support for variadic macros fail on commas in MOCK_BASE_CLASS]
For compilers without support for variadic macros given :
[limitations_comma_in_macro_problem]
the following code does not compile :
MOCK_BASE_CLASS( my_mock, my_base_class< int, int > ) // this fails because the pre-processor believes the macro to be called with 3 arguments
{};
One workaround is :
[limitations_comma_in_macro_solution_1]
Of course this is not always possible, as in :
template< typename T1, typename T2 >
MOCK_BASE_CLASS( my_mock, my_base_type< T1, T2 > )
{};
Another workaround would make use of [@http://www.boost.org/libs/preprocessor Boost.Preprocessor] :
[limitations_comma_in_macro_solution_2]
Actually BOOST_PP_COMMA implementation is quite trivial, being only :
#define BOOST_PP_COMMA() ,
Finally another workaround would be to not use the macro at all :
[limitations_comma_in_macro_solution_3]
Note that [@http://www.boost.org/libs/utility/identity_type/doc/html/index.html Boost.IdentityType] is of little help here because the type is by essence very often abstract, which doesn't work well for some compilers (e.g. gcc).
[endsect]
[section Warning C4505: '...' : unreferenced local function has been removed] [section Warning C4505: '...' : unreferenced local function has been removed]
Example : Example :

View file

@ -7,8 +7,7 @@
[article Turtle [article Turtle
[quickbook 1.5] [quickbook 1.5]
[/ [authors [Champlon, Mathieu]] ] [authors [Champlon, Mathieu]]
[authors [,A C++ mock object library for Boost]]
[copyright 2008-2014 Mathieu Champlon] [copyright 2008-2014 Mathieu Champlon]
[license [license
Distributed under the [@http://www.boost.org/LICENSE_1_0.txt Boost Software License, Version 1.0]. Distributed under the [@http://www.boost.org/LICENSE_1_0.txt Boost Software License, Version 1.0].
@ -16,8 +15,6 @@
[/ [purpose A C++ mock object library for Boost] ] [/ [purpose A C++ mock object library for Boost] ]
] ]
[note Turtle is not an official Boost library.]
[/ [/
[section:introduction Introduction] [section:introduction Introduction]

View file

@ -90,32 +90,22 @@ Synopsis :
MOCK_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates both const and non-const methods MOCK_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates both const and non-const methods
MOCK_CONST_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates only the const version of the method MOCK_CONST_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates only the const version of the method
MOCK_NON_CONST_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates only the non-const version of the method MOCK_NON_CONST_METHOD( [calling convention] name, arity[, signature[, identifier]] ) // generates only the non-const version of the method
MOCK_METHOD_TPL( [calling convention] name, arity, signature[, identifier] ) // must be used if the signature uses a template parameter of the class, generates both const and non-const methods
MOCK_CONST_METHOD_TPL( [calling convention] name, arity, signature[, identifier] ) // must be used if the signature uses a template parameter of the class, generates only the const version of the method
MOCK_NON_CONST_METHOD_TPL( [calling convention] name, arity, signature[, identifier] ) // must be used if the signature uses a template parameter of the class, generates only the non-const version of the method
[note If the identifier is omitted it will default to the method name.] [note If the identifier is omitted it will default to the method name.]
[note If the method name is not ambiguous both the signature and the identifier can be omitted in the context of a derived MOCK_BASE_CLASS or base_type typedef.] [note If the method name is not ambiguous both the signature and the identifier can be omitted in the context of a derived MOCK_BASE_CLASS or base_type typedef.]
[note The signature cannot be omitted for the _TPL familly of macros, see the related [link turtle.limitations.template_base_class_methods_cannot_be_mocked_without_specifying_the_signature limitation section].] [note The signature cannot be omitted if it uses a template parameter of the class, see the related [link turtle.limitations.template_base_class_methods_cannot_be_mocked_without_specifying_the_signature limitation section].]
[note [link turtle.reference.creation.constructor Constructors], [link turtle.reference.creation.destructor destructors] and [link turtle.reference.creation.conversion_operator conversion operators] require special care.] [note [link turtle.reference.creation.constructor Constructors], [link turtle.reference.creation.destructor destructors] and [link turtle.reference.creation.conversion_operator conversion operators] require special care.]
[note In case of a calling convention specified, all four parameters must be provided.] [note In case of a calling convention specified, all four parameters must be provided.]
[warning For compilers without support for variadic macros the MOCK_METHOD_EXT familly set of macros must be used.]
Synopsis : Synopsis :
MOCK_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates both const and non-const methods MOCK_METHOD( [calling convention] name, arity, signature, identifier ) // generates both const and non-const methods
MOCK_CONST_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates only the const version of the method MOCK_CONST_METHOD( [calling convention] name, arity, signature, identifier ) // generates only the const version of the method
MOCK_NON_CONST_METHOD_EXT( [calling convention] name, arity, signature, identifier ) // generates only the non-const version of the method MOCK_NON_CONST_METHOD( [calling convention] name, arity, signature, identifier ) // generates only the non-const version of the method
MOCK_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates both const and non-const methods
MOCK_CONST_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates only the const version of the method
MOCK_NON_CONST_METHOD_EXT_TPL( [calling convention] name, arity, signature, identifier ) // must be used if the signature uses a template parameter of the class, generates only the non-const version of the method
Example : Example :
@ -160,15 +150,11 @@ Example for gcc :
Synopsis : Synopsis :
MOCK_STATIC_METHOD( [calling convention] name, arity, signature[, identifier] ) // if 'identifier' is omitted it will default to 'name' MOCK_STATIC_METHOD( [calling convention] name, arity, signature[, identifier] ) // if 'identifier' is omitted it will default to 'name'
MOCK_STATIC_METHOD_TPL( [calling convention] name, arity, signature[, identifier] ) // must be used if the signature uses a template parameter of the class, if 'identifier' is omitted it will default to 'name'
[note A static object is used behind the scene in order to keep track of the expectations of a mock static method, therefore to ensure all tests run in isolation it is strongly suggested to manually [link turtle.reference.verification verify] and [link turtle.reference.reset reset] the static method at the end of each test, see the related [link turtle.patterns.managing_static_mock_objects pattern section].] [note A static object is used behind the scene in order to keep track of the expectations of a mock static method, therefore to ensure all tests run in isolation it is strongly suggested to manually [link turtle.reference.verification verify] and [link turtle.reference.reset reset] the static method at the end of each test, see the related [link turtle.patterns.managing_static_mock_objects pattern section].]
[note In case of a calling convention specified, all four parameters must be provided.] [note In case of a calling convention specified, all four parameters must be provided.]
[warning For compilers without support for variadic macros the identifier cannot be omitted and must be given explicitly.]
Example : Example :
[static_member_function_example_1] [static_member_function_example_1]
@ -193,8 +179,6 @@ Synopsis :
MOCK_CONSTRUCTOR( [calling convention] name, arity, parameters, identifier ) MOCK_CONSTRUCTOR( [calling convention] name, arity, parameters, identifier )
MOCK_CONSTRUCTOR_TPL( [calling convention] name, arity, parameters, identifier ) // must be used if the signature uses a template parameter of the class
[note As constructors do not have a return type, the usual signature gets restricted here to just the parameters.] [note As constructors do not have a return type, the usual signature gets restricted here to just the parameters.]
Example : Example :
@ -245,10 +229,6 @@ Synopsis :
MOCK_CONST_CONVERSION_OPERATOR( [calling convention] name, type, identifier ) // generates only a const operator MOCK_CONST_CONVERSION_OPERATOR( [calling convention] name, type, identifier ) // generates only a const operator
MOCK_NON_CONST_CONVERSION_OPERATOR( [calling convention] name, type, identifier ) // generates only a non-const operator MOCK_NON_CONST_CONVERSION_OPERATOR( [calling convention] name, type, identifier ) // generates only a non-const operator
MOCK_CONVERSION_OPERATOR_TPL( [calling convention] name, type, identifier ) // must be used if the signature uses a template parameter of the class
MOCK_CONST_CONVERSION_OPERATOR_TPL( [calling convention] name, type, identifier ) // must be used if the signature uses a template parameter of the class
MOCK_NON_CONST_CONVERSION_OPERATOR_TPL( [calling convention] name, type, identifier ) // must be used if the signature uses a template parameter of the class
Example : Example :
[conversion_operator_example_1] [conversion_operator_example_1]
@ -277,8 +257,6 @@ Synopsis :
[note In case of a calling convention specified, all four parameters must be provided.] [note In case of a calling convention specified, all four parameters must be provided.]
[warning For compilers without support for variadic macros the identifier cannot be omitted and must be given explicitly.]
Example : Example :
[function_example_1] [function_example_1]
@ -299,8 +277,6 @@ Synopsis :
MOCK_FUNCTOR( [calling convention] name, signature ); MOCK_FUNCTOR( [calling convention] name, signature );
MOCK_FUNCTOR_TPL( [calling convention] name, signature ); // must be used if the signature uses a template parameter
Example : Example :
[functor_example_1] [functor_example_1]
@ -415,13 +391,13 @@ Constraints :
[[mock::evaluate] [['actual]()] [evaluates ['actual] as a functor returning a ['bool] and taking no argument]] [[mock::evaluate] [['actual]()] [evaluates ['actual] as a functor returning a ['bool] and taking no argument]]
] ]
[important When passing ['expected] directly as a shortcut mock::call is implied for a function, a function pointer, an instance of a type with a result_type member typedef (support for standard library, [@http://www.boost.org/libs/bind/bind.html Boost.Bind], [@http://www.boost.org/libs/function Boost.Function] functors), an instance of a type with a sig member (support for [@http://www.boost.org/libs/lambda Boost.Lambda] functors), an instance of a type with a result member (support for [@http://www.boost.org/libs/phoenix Boost.Phoenix] functors); mock::equal is implied for anything else.] [important When passing ['expected] directly as a shortcut mock::call is implied for a callable (function, function pointer, functor, ...); mock::equal is implied for anything else.]
[warning Because mock::assign and mock::retrieve have side effects they may modify ['expected] in unexpected ways. For instance they may be called again after their expectations have already been exhausted because of the way the [link turtle.getting_started.expectation_selection_algorithm expectation selection algorithm] works. Therefore it is probably a good idea to use an [link turtle.reference.expectation.actions action] instead.] [warning Because mock::assign and mock::retrieve have side effects they may modify ['expected] in unexpected ways. For instance they may be called again after their expectations have already been exhausted because of the way the [link turtle.getting_started.expectation_selection_algorithm expectation selection algorithm] works. Therefore it is probably a good idea to use an [link turtle.reference.expectation.actions action] instead.]
[note For mock::assign and mock::retrieve the switch to one form or another is made depending on whichever is the most relevant based on types involved.] [note For mock::assign and mock::retrieve the switch to one form or another is made depending on whichever is the most relevant based on types involved.]
[note All constraints accepting a parameter support the use of boost::ref and boost::cref in order to delay initialization.] [note All constraints accepting a parameter support the use of std::ref and std::cref in order to delay initialization.]
[note All constraints can be combined using the && and || operators, as well as negated with the ! operator.] [note All constraints can be combined using the && and || operators, as well as negated with the ! operator.]
@ -437,7 +413,7 @@ Example using a standard library functor :
[constraints_example_3] [constraints_example_3]
Example using [@http://www.boost.org/libs/bind Boost.Bind] : Example using std::bind :
[constraints_example_4] [constraints_example_4]
@ -473,10 +449,7 @@ Synopsis :
Each sequence is an instance of mock::sequence. Each sequence is an instance of mock::sequence.
The maximum number of sequences that can be set is MOCK_MAX_SEQUENCES which defaults to 10. If needed the value can be increased before including the library : The maximum number of sequences that can be set is basically unlimited.
#define MOCK_MAX_SEQUENCES 12
#include <turtle/mock.hpp>
Example : Example :
@ -491,13 +464,13 @@ An action performs additional treatments after an expectation has been deemed va
Synopsis : Synopsis :
MOCK_EXPECT( identifier ).returns( value ); // stored internally by copy MOCK_EXPECT( identifier ).returns( value ); // stored internally by copy
MOCK_EXPECT( identifier ).moves( value ); // stored internally by copy MOCK_EXPECT( identifier ).moves( value ); // stored internally by copy/move
MOCK_EXPECT( identifier ).throws( exception ); // stored internally by copy MOCK_EXPECT( identifier ).throws( exception ); // stored internally by copy
MOCK_EXPECT( identifier ).calls( functor ); // stored internally by copy, throws std::invalid_argument if empty MOCK_EXPECT( identifier ).calls( functor ); // stored internally by copy, throws std::invalid_argument if empty
[note The returns and moves actions are not available for mock methods returning void, including constructors and destructors.] [note The returns and moves actions are not available for mock methods returning void, including constructors and destructors.]
[note Actions are captured by copy, boost::ref and boost::cref can however be used to turn the copies into references.] [note Actions are captured by copy, std::ref and std::cref can however be used to turn the copies into references.]
Example : Example :
@ -581,38 +554,18 @@ Synopsis :
The expression manipulates a received parameter ['actual] in order to implement the constraint, as well as extra optional arguments named ['expected_1], ['expected_2], ... The expression manipulates a received parameter ['actual] in order to implement the constraint, as well as extra optional arguments named ['expected_1], ['expected_2], ...
For compilers without support for variadic macros the alternate following macro must be used.
Synopsis :
MOCK_CONSTRAINT_EXT( name, arity, ( expected_1, expected_2, ... ), expression ) // defines a constraint 'name' based on the given 'expression'
Of course this macro is also available for compilers which support variadic macros.
Example without any extra argument : Example without any extra argument :
[helpers_example_1] [helpers_example_1]
or with the alternate more portable macro :
[helpers_example_4]
Example with one extra argument : Example with one extra argument :
[helpers_example_2] [helpers_example_2]
or with the alternate more portable macro :
[helpers_example_5]
Example with two extra arguments : Example with two extra arguments :
[helpers_example_3] [helpers_example_3]
or with the alternate more portable macro :
[helpers_example_6]
[endsect] [endsect]
[endsect] [endsect]

View file

@ -11,34 +11,33 @@
#include <catch.hpp> #include <catch.hpp>
template< typename Result > template<typename Result>
struct catch_mock_error_policy struct catch_mock_error_policy
{ {
static Result abort() static Result abort()
{ {
FAIL( "Aborted" ); FAIL("Aborted");
throw std::runtime_error( "unreachable" ); throw std::runtime_error("unreachable");
} }
template< typename Context > template<typename Context>
static void fail( const char* message, const Context& context, static void fail(const char* message,
const char* file = "file://unknown-location", int line = 0 ) const Context& context,
const char* file = "file://unknown-location",
int line = 0)
{ {
CAPTURE( context ); CAPTURE(context);
FAIL_CHECK( message << " in: " << file << ":" << line ); FAIL_CHECK(message << " in: " << file << ":" << line);
} }
template< typename Context > template<typename Context>
static void call( const Context& context, const char* file, int line ) static void call(const Context& context, const char* file, int line)
{ {
CAPTURE( context ); CAPTURE(context);
INFO( file << ":" << line ); INFO(file << ":" << line);
}
static void pass( const char* file, int line )
{
INFO( file << ":" << line );
} }
static void pass(const char* file, int line) { INFO(file << ":" << line); }
}; };
#define MOCK_ERROR_POLICY catch_mock_error_policy #define MOCK_ERROR_POLICY catch_mock_error_policy

View file

@ -10,30 +10,25 @@
#define MOCK_CLEANUP_HPP_INCLUDED #define MOCK_CLEANUP_HPP_INCLUDED
#include "config.hpp" #include "config.hpp"
#include "verify.hpp"
#include "reset.hpp" #include "reset.hpp"
#include "verify.hpp"
#ifdef MOCK_USE_BOOST_TEST #ifdef MOCK_USE_BOOST_TEST
#include <boost/test/unit_test_suite.hpp> # include <boost/test/unit_test_suite.hpp>
#endif #endif
namespace mock namespace mock {
struct cleanup
{ {
struct cleanup ~cleanup() { mock::reset(); }
{ };
~cleanup()
{
mock::reset();
}
};
#ifdef MOCK_USE_BOOST_TEST #ifdef MOCK_USE_BOOST_TEST
BOOST_GLOBAL_FIXTURE( cleanup ) BOOST_GLOBAL_FIXTURE(cleanup)
#if BOOST_VERSION >= 105900 # if BOOST_VERSION >= 105900
; ;
#endif # endif
#endif #endif
} // mock } // namespace mock
#endif // MOCK_CLEANUP_HPP_INCLUDED #endif // MOCK_CLEANUP_HPP_INCLUDED

View file

@ -1,6 +1,7 @@
// http://turtle.sourceforge.net // http://turtle.sourceforge.net
// //
// Copyright Mathieu Champlon 2009 // Copyright Mathieu Champlon 2009
// Copyright 2020-2025 Alexander Grund
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
@ -12,93 +13,36 @@
#define MOCK_CONFIG_HPP_INCLUDED #define MOCK_CONFIG_HPP_INCLUDED
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/comparison/less.hpp>
#ifndef MOCK_ERROR_POLICY #ifndef MOCK_ERROR_POLICY
# define MOCK_ERROR_POLICY mock::error # define MOCK_ERROR_POLICY mock::error
# define MOCK_USE_BOOST_TEST # define MOCK_USE_BOOST_TEST
#endif
#ifndef MOCK_MAX_ARGS
# define MOCK_MAX_ARGS 9
#endif
#ifndef MOCK_MAX_SEQUENCES
# define MOCK_MAX_SEQUENCES 10
#endif
#ifndef BOOST_FUNCTION_MAX_ARGS
# define BOOST_FUNCTION_MAX_ARGS MOCK_MAX_ARGS
#elif BOOST_PP_LESS(BOOST_FUNCTION_MAX_ARGS, MOCK_MAX_ARGS)
# error BOOST_FUNCTION_MAX_ARGS must be set to MOCK_MAX_ARGS or higher
#endif
#ifndef BOOST_FT_MAX_ARITY
# define BOOST_FT_MAX_ARITY BOOST_PP_INC(MOCK_MAX_ARGS)
#elif BOOST_PP_LESS_EQUAL(BOOST_FT_MAX_ARITY, MOCK_MAX_ARGS)
# error BOOST_FT_MAX_ARITY must be set to MOCK_MAX_ARGS + 1 or higher
#endif
#if !defined(BOOST_NO_CXX11_NULLPTR) && !defined(BOOST_NO_NULLPTR)
# ifndef MOCK_NO_NULLPTR
# define MOCK_NULLPTR
# endif
#endif
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_DECLTYPE)
# ifndef MOCK_NO_DECLTYPE
# define MOCK_DECLTYPE
# endif
#endif
#if !defined(BOOST_NO_CXX11_VARIADIC_MACROS) && !defined(BOOST_NO_VARIADIC_MACROS)
# ifndef MOCK_NO_VARIADIC_MACROS
# define MOCK_VARIADIC_MACROS
# endif
#endif
#if !defined(BOOST_NO_CXX11_SMART_PTR) && !defined(BOOST_NO_SMART_PTR)
# ifndef MOCK_NO_SMART_PTR
# define MOCK_SMART_PTR
# endif
#endif
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_RVALUE_REFERENCES)
# ifndef MOCK_NO_RVALUE_REFERENCES
# define MOCK_RVALUE_REFERENCES
# endif
#endif
#if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
# ifndef MOCK_NO_HDR_FUNCTIONAL
# define MOCK_HDR_FUNCTIONAL
# endif
#endif #endif
#if !defined(BOOST_NO_CXX11_HDR_MUTEX) && !defined(BOOST_NO_0X_HDR_MUTEX) #if !defined(BOOST_NO_CXX11_HDR_MUTEX) && !defined(BOOST_NO_0X_HDR_MUTEX)
# ifndef MOCK_NO_HDR_MUTEX # ifndef MOCK_NO_HDR_MUTEX
# define MOCK_HDR_MUTEX # define MOCK_HDR_MUTEX
# endif # endif
#endif #endif
#if !defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_LAMBDAS) #ifndef MOCK_NO_UNCAUGHT_EXCEPTIONS
# ifndef MOCK_NO_LAMBDAS # if(defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411) || \
# define MOCK_LAMBDAS (defined(_MSC_VER) && _MSC_VER >= 1900)
# endif # define MOCK_UNCAUGHT_EXCEPTIONS
# endif
#endif #endif
#if !defined(BOOST_NO_AUTO_PTR) #if BOOST_VERSION >= 107700
# ifndef MOCK_NO_AUTO_PTR # define MOCK_CXX_VERSION BOOST_CXX_VERSION
# define MOCK_AUTO_PTR #elif defined(_MSC_VER)
# endif # ifdef _MSVC_LANG
# define MOCK_CXX_VERSION _MSVC_LANG
# elif defined(_HAS_CXX17)
# define MOCK_CXX_VERSION 201703L
# endif
#endif #endif
#ifndef MOCK_CXX_VERSION
#if defined(__cpp_lib_uncaught_exceptions) || \ # define MOCK_CXX_VERSION __cplusplus
defined(_MSC_VER) && (_MSC_VER >= 1900)
# ifndef MOCK_NO_UNCAUGHT_EXCEPTIONS
# define MOCK_UNCAUGHT_EXCEPTIONS
# endif
#endif #endif
#endif // MOCK_CONFIG_HPP_INCLUDED #endif // MOCK_CONFIG_HPP_INCLUDED

View file

@ -1,6 +1,7 @@
// http://turtle.sourceforge.net // http://turtle.sourceforge.net
// //
// Copyright Mathieu Champlon 2008 // Copyright Mathieu Champlon 2008
// Copyright 2020-2025 Alexander Grund
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
@ -11,249 +12,179 @@
#include "config.hpp" #include "config.hpp"
#include "log.hpp" #include "log.hpp"
#include <boost/ref.hpp> #include "unwrap_reference.hpp"
#include <boost/preprocessor/stringize.hpp> #include <boost/preprocessor/array.hpp>
#include <boost/preprocessor/control/if.hpp> #include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/variadic/to_array.hpp> #include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp> #include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp> #include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum.hpp> #include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/array.hpp> #include <boost/preprocessor/stringize.hpp>
#include <boost/move/move.hpp> #include <boost/preprocessor/variadic/size.hpp>
#include <boost/type_traits/decay.hpp> #include <functional>
#include <type_traits>
namespace mock namespace mock {
template<typename Constraint>
struct constraint
{ {
template< typename Constraint > constraint() {}
struct constraint constraint(const Constraint& c) : c_(c) {}
{ Constraint c_;
constraint() };
{}
constraint( const Constraint& c )
: c_( c )
{}
Constraint c_;
};
namespace detail namespace detail {
{ template<typename Lhs, typename Rhs>
template< typename Lhs, typename Rhs >
class and_ class and_
{ {
public: public:
and_( const Lhs& lhs, const Rhs& rhs ) and_(const Lhs& lhs, const Rhs& rhs) : lhs_(lhs), rhs_(rhs) {}
: lhs_( lhs ) template<typename Actual>
, rhs_( rhs ) bool operator()(const Actual& actual) const
{}
template< typename Actual >
bool operator()( const Actual& actual ) const
{ {
return lhs_( actual ) && rhs_( actual ); return lhs_(actual) && rhs_(actual);
} }
friend std::ostream& operator<<( std::ostream& s, const and_& a ) friend std::ostream& operator<<(std::ostream& s, const and_& a)
{ {
return s << "( " << mock::format( a.lhs_ ) return s << "( " << mock::format(a.lhs_) << " && " << mock::format(a.rhs_) << " )";
<< " && " << mock::format( a.rhs_ ) << " )";
} }
private: private:
Lhs lhs_; Lhs lhs_;
Rhs rhs_; Rhs rhs_;
}; };
template< typename Lhs, typename Rhs > template<typename Lhs, typename Rhs>
class or_ class or_
{ {
public: public:
or_( const Lhs& lhs, const Rhs& rhs ) or_(const Lhs& lhs, const Rhs& rhs) : lhs_(lhs), rhs_(rhs) {}
: lhs_( lhs ) template<typename Actual>
, rhs_( rhs ) bool operator()(const Actual& actual) const
{}
template< typename Actual >
bool operator()( const Actual& actual ) const
{ {
return lhs_( actual ) || rhs_( actual ); return lhs_(actual) || rhs_(actual);
} }
friend std::ostream& operator<<( std::ostream& s, const or_& o ) friend std::ostream& operator<<(std::ostream& s, const or_& o)
{ {
return s << "( " << mock::format( o.lhs_ ) return s << "( " << mock::format(o.lhs_) << " || " << mock::format(o.rhs_) << " )";
<< " || " << mock::format( o.rhs_ )<< " )";
} }
private: private:
Lhs lhs_; Lhs lhs_;
Rhs rhs_; Rhs rhs_;
}; };
template< typename Constraint > template<typename Constraint>
class not_ class not_
{ {
public: public:
explicit not_( const Constraint& c ) explicit not_(const Constraint& c) : c_(c) {}
: c_( c ) template<typename Actual>
{} bool operator()(const Actual& actual) const
template< typename Actual >
bool operator()( const Actual& actual ) const
{ {
return ! c_( actual ); return !c_(actual);
}
friend std::ostream& operator<<( std::ostream& s, const not_& n )
{
return s << "! " << mock::format( n.c_ );
} }
friend std::ostream& operator<<(std::ostream& s, const not_& n) { return s << "! " << mock::format(n.c_); }
private: private:
Constraint c_; Constraint c_;
}; };
} // namespace detail
template<typename Lhs, typename Rhs>
const constraint<detail::or_<Lhs, Rhs>> operator||(const constraint<Lhs>& lhs, const constraint<Rhs>& rhs)
{
return detail::or_<Lhs, Rhs>(lhs.c_, rhs.c_);
} }
template< typename Lhs, typename Rhs > template<typename Lhs, typename Rhs>
const constraint< detail::or_< Lhs, Rhs > > const constraint<detail::and_<Lhs, Rhs>> operator&&(const constraint<Lhs>& lhs, const constraint<Rhs>& rhs)
operator||( const constraint< Lhs >& lhs, {
const constraint< Rhs >& rhs ) return detail::and_<Lhs, Rhs>(lhs.c_, rhs.c_);
{ }
return detail::or_< Lhs, Rhs >( lhs.c_, rhs.c_ );
}
template< typename Lhs, typename Rhs > template<typename Constraint>
const constraint< detail::and_< Lhs, Rhs > > const constraint<detail::not_<Constraint>> operator!(const constraint<Constraint>& c)
operator&&( const constraint< Lhs >& lhs, {
const constraint< Rhs >& rhs ) return detail::not_<Constraint>(c.c_);
{ }
return detail::and_< Lhs, Rhs >( lhs.c_, rhs.c_ ); } // namespace mock
}
template< typename Constraint > #define MOCK_UNARY_CONSTRAINT(Name, n, Args, Expr) \
const constraint< detail::not_< Constraint > > namespace detail { \
operator!( const constraint< Constraint >& c ) struct Name \
{ { \
return detail::not_< Constraint >( c.c_ ); template<typename Actual> \
} bool operator()(const Actual& actual) const \
} // mock { \
(void)actual; \
return Expr; \
} \
friend std::ostream& operator<<(std::ostream& s, const Name&) { return s << BOOST_STRINGIZE(Name); } \
}; \
} \
const mock::constraint<detail::Name> Name;
#define MOCK_UNARY_CONSTRAINT(Name, n, Args, Expr) \ #define MOCK_CONSTRAINT_ASSIGN(z, n, d) expected##n(std::forward<T##n>(e##n))
namespace detail \
{ \
struct Name \
{ \
template< typename Actual > \
bool operator()( const Actual& actual ) const \
{ \
return Expr; \
} \
friend std::ostream& operator<<( std::ostream& s, const Name& ) \
{ \
return s << BOOST_STRINGIZE(Name); \
} \
}; \
} \
const mock::constraint< detail::Name > Name;
#define MOCK_CONSTRAINT_ASSIGN(z, n, d) \ #define MOCK_CONSTRAINT_UNWRAP_REF(z, n, d) mock::unwrap_ref(expected##n)
expected##n( boost::forward< T##n >(e##n) )
#define MOCK_CONSTRAINT_UNWRAP_REF(z, n, d) \ #define MOCK_CONSTRAINT_FORMAT(z, n, d) BOOST_PP_IF(n, << ", " <<, ) mock::format(c.expected##n)
boost::unwrap_ref( expected##n )
#define MOCK_CONSTRAINT_FORMAT(z, n, d) \ #define MOCK_CONSTRAINT_MEMBER(z, n, d) Expected_##n expected##n;
BOOST_PP_IF(n, << ", " <<,) mock::format( c.expected##n )
#define MOCK_CONSTRAINT_MEMBER(z, n, d) \ #define MOCK_CONSTRAINT_TPL_TYPE(z, n, d) std::decay_t<const T##n>
Expected_##n expected##n;
#define MOCK_CONSTRAINT_TPL_TYPE(z, n, d) \
typename boost::decay< const T##n >::type
#define MOCK_CONSTRAINT_CREF_PARAM(z, n, Args) \ #define MOCK_CONSTRAINT_CREF_PARAM(z, n, Args) \
const typename boost::unwrap_reference< Expected_##n >::type& \ const mock::unwrap_reference_t<Expected_##n>& BOOST_PP_ARRAY_ELEM(n, Args)
BOOST_PP_ARRAY_ELEM(n, Args)
#define MOCK_CONSTRAINT_ARG(z, n, Args) \ #define MOCK_CONSTRAINT_ARG(z, n, Args) T##n&& BOOST_PP_ARRAY_ELEM(n, Args)
BOOST_FWD_REF(T##n) BOOST_PP_ARRAY_ELEM(n, Args)
#define MOCK_CONSTRAINT_ARGS(z, n, Args) \ #define MOCK_CONSTRAINT_ARGS(z, n, Args) T##n&& e##n
BOOST_FWD_REF(T##n) e##n
#define MOCK_CONSTRAINT_PARAM(z, n, Args) \ #define MOCK_CONSTRAINT_PARAM(z, n, Args) std::forward<T##n>(BOOST_PP_ARRAY_ELEM(n, Args))
boost::forward< T##n >( BOOST_PP_ARRAY_ELEM(n, Args) )
#define MOCK_NARY_CONSTRAINT(Name, n, Args, Expr) \ #define MOCK_NARY_CONSTRAINT(Name, n, Args, Expr) \
namespace detail \ namespace detail { \
{ \ template<BOOST_PP_ENUM_PARAMS(n, typename Expected_)> \
template< BOOST_PP_ENUM_PARAMS(n, typename Expected_) > \ struct Name \
struct Name \ { \
{ \ template<BOOST_PP_ENUM_PARAMS(n, typename T)> \
template< BOOST_PP_ENUM_PARAMS(n, typename T) > \ explicit Name(BOOST_PP_ENUM(n, MOCK_CONSTRAINT_ARGS, _)) : BOOST_PP_ENUM(n, MOCK_CONSTRAINT_ASSIGN, _) \
explicit Name( \ {} \
BOOST_PP_ENUM(n, MOCK_CONSTRAINT_ARGS, _) ) \ template<typename Actual> \
: BOOST_PP_ENUM(n, MOCK_CONSTRAINT_ASSIGN, _) \ bool operator()(const Actual& actual) const \
{} \ { \
template< typename Actual > \ return test(actual, BOOST_PP_ENUM(n, MOCK_CONSTRAINT_UNWRAP_REF, _)); \
bool operator()( const Actual& actual ) const \ } \
{ \ template<typename Actual> \
return test( actual, \ bool test(const Actual& actual, BOOST_PP_ENUM(n, MOCK_CONSTRAINT_CREF_PARAM, (n, Args))) const \
BOOST_PP_ENUM(n, MOCK_CONSTRAINT_UNWRAP_REF, _) ); \ { \
} \ return Expr; \
template< typename Actual > \ } \
bool test( const Actual& actual, \ friend std::ostream& operator<<(std::ostream& s, const Name& c) \
BOOST_PP_ENUM(n, \ { \
MOCK_CONSTRAINT_CREF_PARAM, (n, Args)) ) const \ return s << BOOST_STRINGIZE(Name) << "( " << BOOST_PP_REPEAT(n, MOCK_CONSTRAINT_FORMAT, _) << " )"; \
{ \ } \
return Expr; \ BOOST_PP_REPEAT(n, MOCK_CONSTRAINT_MEMBER, _) \
} \ }; \
friend std::ostream& operator<<( std::ostream& s, const Name& c ) \ } \
{ \ template<BOOST_PP_ENUM_PARAMS(n, typename T)> \
return s << BOOST_STRINGIZE(Name) << "( " \ mock::constraint<detail::Name<BOOST_PP_ENUM(n, MOCK_CONSTRAINT_TPL_TYPE, _)>> Name( \
<< BOOST_PP_REPEAT(n, MOCK_CONSTRAINT_FORMAT, _) \ BOOST_PP_ENUM(n, MOCK_CONSTRAINT_ARG, (n, Args))) \
<< " )"; \ { \
} \ return detail::Name<BOOST_PP_ENUM(n, MOCK_CONSTRAINT_TPL_TYPE, _)>( \
BOOST_PP_REPEAT(n, MOCK_CONSTRAINT_MEMBER, _) \ BOOST_PP_ENUM(n, MOCK_CONSTRAINT_PARAM, (n, Args))); \
}; \
} \
template< BOOST_PP_ENUM_PARAMS(n, typename T) > \
mock::constraint< \
detail::Name< BOOST_PP_ENUM(n, MOCK_CONSTRAINT_TPL_TYPE, _) > \
> Name( BOOST_PP_ENUM(n, MOCK_CONSTRAINT_ARG, (n, Args)) ) \
{ \
return detail::Name< BOOST_PP_ENUM(n, MOCK_CONSTRAINT_TPL_TYPE, _) >( \
BOOST_PP_ENUM(n, MOCK_CONSTRAINT_PARAM, (n, Args)) ); \
} }
#define MOCK_CONSTRAINT_EXT(Name, n, Args, Expr) \ #define MOCK_CONSTRAINT_EXT(Name, n, Args, Expr) \
BOOST_PP_IF(n, \ BOOST_PP_IF(n, MOCK_NARY_CONSTRAINT, MOCK_UNARY_CONSTRAINT)(Name, n, Args, Expr)
MOCK_NARY_CONSTRAINT, \
MOCK_UNARY_CONSTRAINT)(Name, n, Args, Expr)
#ifdef MOCK_VARIADIC_MACROS
#ifdef BOOST_MSVC
# define MOCK_VARIADIC_SIZE(...) \
BOOST_PP_CAT(MOCK_VARIADIC_SIZE_I(__VA_ARGS__, \
32, 31, 30, 29, 28, 27, 26, 25, 24, 23, \
22, 21, 20, 19, 18, 17, 16, 15, 14, 13, \
12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,),)
#else // BOOST_MSVC
# define MOCK_VARIADIC_SIZE(...) \
MOCK_VARIADIC_SIZE_I(__VA_ARGS__, \
32, 31, 30, 29, 28, 27, 26, 25, 24, 23, \
22, 21, 20, 19, 18, 17, 16, 15, 14, 13, \
12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,)
#endif // BOOST_MSVC
#define MOCK_VARIADIC_SIZE_I( \
e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, \
e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, \
e25, e26, e27, e28, e29, e30, e31, size, ...) size
#define MOCK_CONSTRAINT_AUX_AUX(Name, n, Array) \ #define MOCK_CONSTRAINT_AUX_AUX(Name, n, Array) \
MOCK_CONSTRAINT_EXT( \ MOCK_CONSTRAINT_EXT(Name, n, BOOST_PP_ARRAY_TO_TUPLE(BOOST_PP_ARRAY_POP_BACK(Array)), BOOST_PP_ARRAY_ELEM(n, Array))
Name, n, \
BOOST_PP_ARRAY_TO_TUPLE(BOOST_PP_ARRAY_POP_BACK(Array)), \
BOOST_PP_ARRAY_ELEM(n, Array))
#define MOCK_CONSTRAINT_AUX(Name, Size, Tuple) \ #define MOCK_CONSTRAINT_AUX(Name, Size, Tuple) MOCK_CONSTRAINT_AUX_AUX(Name, BOOST_PP_DEC(Size), (Size, Tuple))
MOCK_CONSTRAINT_AUX_AUX(Name, BOOST_PP_DEC(Size), (Size,Tuple))
#define MOCK_CONSTRAINT(Name, ...) \ #define MOCK_CONSTRAINT(Name, ...) MOCK_CONSTRAINT_AUX(Name, BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), (__VA_ARGS__))
MOCK_CONSTRAINT_AUX( \
Name, MOCK_VARIADIC_SIZE(__VA_ARGS__), (__VA_ARGS__))
#endif // MOCK_VARIADIC_MACROS
#endif // MOCK_CONSTRAINT_HPP_INCLUDED #endif // MOCK_CONSTRAINT_HPP_INCLUDED

View file

@ -11,302 +11,243 @@
#include "config.hpp" #include "config.hpp"
#include "constraint.hpp" #include "constraint.hpp"
#include "detail/addressof.hpp" #include "detail/void_t.hpp"
#include "detail/move_helper.hpp" #include "unwrap_reference.hpp"
#include <boost/ref.hpp>
#include <boost/version.hpp> #include <boost/version.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/common_type.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/has_equal_to.hpp>
#if BOOST_VERSION >= 107000 #if BOOST_VERSION >= 107000
#include <boost/test/tools/floating_point_comparison.hpp> # include <boost/test/tools/floating_point_comparison.hpp>
#else #else
#include <boost/test/floating_point_comparison.hpp> # include <boost/test/floating_point_comparison.hpp>
#endif #endif
#include <functional>
#include <memory>
#include <type_traits>
namespace mock namespace mock {
{ MOCK_UNARY_CONSTRAINT(any, 0, , ((void)actual, true))
MOCK_UNARY_CONSTRAINT( any, 0,, ((void)actual, true) ) MOCK_UNARY_CONSTRAINT(affirm, 0, , !!actual)
MOCK_UNARY_CONSTRAINT( affirm, 0,, !! actual ) MOCK_UNARY_CONSTRAINT(negate, 0, , !actual)
MOCK_UNARY_CONSTRAINT( negate, 0,, ! actual ) MOCK_UNARY_CONSTRAINT(evaluate, 0, , actual())
MOCK_UNARY_CONSTRAINT( evaluate, 0,, actual() )
MOCK_NARY_CONSTRAINT( less, 1, ( expected ), actual < expected ) MOCK_NARY_CONSTRAINT(less, 1, (expected), actual < expected)
MOCK_NARY_CONSTRAINT( greater, 1, ( expected ), actual > expected ) MOCK_NARY_CONSTRAINT(greater, 1, (expected), actual > expected)
MOCK_NARY_CONSTRAINT( less_equal, 1, ( expected ), actual <= expected ) MOCK_NARY_CONSTRAINT(less_equal, 1, (expected), actual <= expected)
MOCK_NARY_CONSTRAINT( greater_equal, 1, ( expected ), actual >= expected ) MOCK_NARY_CONSTRAINT(greater_equal, 1, (expected), actual >= expected)
#if BOOST_VERSION < 105900 #if BOOST_VERSION < 105900
# define MOCK_SMALL() \ # define MOCK_SMALL() boost::test_tools::check_is_small(actual, tolerance)
boost::test_tools::check_is_small( actual, tolerance ) # define MOCK_PERCENT_TOLERANCE() \
# define MOCK_PERCENT_TOLERANCE() \ boost::test_tools::check_is_close(actual, expected, boost::test_tools::percent_tolerance(tolerance))
boost::test_tools::check_is_close( \ # define MOCK_FRACTION_TOLERANCE() \
actual, \ boost::test_tools::check_is_close(actual, expected, boost::test_tools::fraction_tolerance(tolerance))
expected, \
boost::test_tools::percent_tolerance( tolerance ) )
# define MOCK_FRACTION_TOLERANCE() \
boost::test_tools::check_is_close( \
actual, \
expected, \
boost::test_tools::fraction_tolerance( tolerance ) )
#else // BOOST_VERSION < 105900 #else // BOOST_VERSION < 105900
namespace detail namespace detail {
{ template<typename T, typename Tolerance>
template< typename T, typename Tolerance > bool is_small(const T& t, const Tolerance& tolerance)
bool is_small( const T& t, const Tolerance& tolerance )
{ {
return boost::math::fpc::small_with_tolerance< T >( tolerance )( t ); return boost::math::fpc::small_with_tolerance<T>(tolerance)(t);
} }
template< typename T1, typename T2, typename Tolerance > template<typename T1, typename T2, typename Tolerance>
bool is_close( const T1& t1, const T2& t2, const Tolerance& tolerance ) bool is_close(const T1& t1, const T2& t2, const Tolerance& tolerance)
{ {
typedef typename boost::common_type< T1, T2 >::type common_type; typedef std::common_type_t<T1, T2> common_type;
return boost::math::fpc::close_at_tolerance< common_type >( return boost::math::fpc::close_at_tolerance<common_type>(tolerance, boost::math::fpc::FPC_STRONG)(t1, t2);
tolerance, boost::math::fpc::FPC_STRONG )( t1, t2 );
} }
} } // namespace detail
# define MOCK_SMALL() \ # define MOCK_SMALL() detail::is_small(actual, tolerance)
detail::is_small( actual, tolerance ) # define MOCK_PERCENT_TOLERANCE() detail::is_close(actual, expected, boost::math::fpc::percent_tolerance(tolerance))
# define MOCK_PERCENT_TOLERANCE() \ # define MOCK_FRACTION_TOLERANCE() detail::is_close(actual, expected, tolerance)
detail::is_close( actual, expected, \
boost::math::fpc::percent_tolerance( tolerance ) )
# define MOCK_FRACTION_TOLERANCE() \
detail::is_close( actual, expected, tolerance )
#endif // BOOST_VERSION < 105900 #endif // BOOST_VERSION < 105900
#ifdef small #ifdef small
# pragma push_macro( "small" ) # pragma push_macro("small")
# undef small # undef small
# define MOCK_SMALL_DEFINED # define MOCK_SMALL_DEFINED
#endif #endif
MOCK_NARY_CONSTRAINT( small, 1, ( tolerance ), MOCK_NARY_CONSTRAINT(small, 1, (tolerance), (MOCK_SMALL()))
( MOCK_SMALL() ) )
#ifdef MOCK_SMALL_DEFINED #ifdef MOCK_SMALL_DEFINED
# pragma pop_macro( "small" ) # pragma pop_macro("small")
#endif #endif
MOCK_NARY_CONSTRAINT( close, 2, ( expected, tolerance ), MOCK_NARY_CONSTRAINT(close, 2, (expected, tolerance), (MOCK_PERCENT_TOLERANCE()))
( MOCK_PERCENT_TOLERANCE() ) )
MOCK_NARY_CONSTRAINT( close_fraction, 2, ( expected, tolerance ), MOCK_NARY_CONSTRAINT(close_fraction, 2, (expected, tolerance), (MOCK_FRACTION_TOLERANCE()))
( MOCK_FRACTION_TOLERANCE() ) )
#undef MOCK_PERCENT_TOLERANCE #undef MOCK_PERCENT_TOLERANCE
#undef MOCK_FRACTION_TOLERANCE #undef MOCK_FRACTION_TOLERANCE
#ifdef near #ifdef near
# pragma push_macro( "near" ) # pragma push_macro("near")
# undef near # undef near
# define MOCK_NEAR_DEFINED # define MOCK_NEAR_DEFINED
#endif #endif
MOCK_NARY_CONSTRAINT( near, 2, ( expected, tolerance ), MOCK_NARY_CONSTRAINT(near, 2, (expected, tolerance), std::abs(actual - expected) <= tolerance)
std::abs( actual - expected ) < tolerance )
#ifdef MOCK_NEAR_DEFINED #ifdef MOCK_NEAR_DEFINED
# pragma pop_macro( "near" ) # pragma pop_macro("near")
#endif #endif
namespace detail namespace detail {
{ template<class T, class U = T, class = void>
template< typename Expected > struct has_equal_to : std::false_type
{};
template<class T, class U>
struct has_equal_to<T, U, void_t<decltype(std::declval<T>() == std::declval<U>())>> : std::true_type
{};
template<typename Expected>
struct equal struct equal
{ {
explicit equal( Expected expected ) explicit equal(Expected expected) : expected_(expected) {}
: expected_( expected ) template<typename Actual>
{} bool operator()(const Actual& actual,
template< typename Actual > std::enable_if_t<has_equal_to<Actual, unwrap_reference_t<Expected>>::value>* = 0) const
bool operator()( const Actual& actual,
typename boost::enable_if<
boost::has_equal_to<
Actual,
typename
boost::unwrap_reference< Expected >::type
>
>::type* = 0 ) const
{ {
return actual == boost::unwrap_ref( expected_ ); return actual == unwrap_ref(expected_);
} }
template< typename Actual > template<typename Actual>
bool operator()( const Actual& actual, bool operator()(const Actual& actual,
typename boost::disable_if< std::enable_if_t<!has_equal_to<Actual, unwrap_reference_t<Expected>>::value>* = 0) const
boost::has_equal_to<
Actual,
typename
boost::unwrap_reference< Expected >::type
>
>::type* = 0 ) const
{ {
return actual && *actual == boost::unwrap_ref( expected_ ); return actual && *actual == unwrap_ref(expected_);
} }
friend std::ostream& operator<<( std::ostream& s, const equal& e ) friend std::ostream& operator<<(std::ostream& s, const equal& e)
{ {
return s << "equal( " << mock::format( e.expected_ ) << " )"; return s << "equal( " << mock::format(e.expected_) << " )";
} }
Expected expected_; Expected expected_;
}; };
template< typename Expected > template<typename Expected>
struct same struct same
{ {
explicit same( const Expected& expected ) explicit same(const Expected& expected) : expected_(std::addressof(unwrap_ref(expected))) {}
: expected_( detail::addressof( boost::unwrap_ref( expected ) ) ) template<typename Actual>
{} bool operator()(const Actual& actual) const
template< typename Actual >
bool operator()( const Actual& actual ) const
{ {
return detail::addressof( actual ) == expected_; return std::addressof(actual) == expected_;
} }
friend std::ostream& operator<<( std::ostream& os, const same& s ) friend std::ostream& operator<<(std::ostream& os, const same& s)
{ {
return os << "same( " << mock::format( *s.expected_ ) << " )"; return os << "same( " << mock::format(*s.expected_) << " )";
} }
const typename const unwrap_reference_t<Expected>* expected_;
boost::unwrap_reference< Expected >::type* expected_;
}; };
template< typename Expected > template<typename Expected>
struct retrieve struct retrieve
{ {
explicit retrieve( Expected& expected ) explicit retrieve(Expected& expected) : expected_(std::addressof(unwrap_ref(expected))) {}
: expected_( detail::addressof( boost::unwrap_ref( expected ) ) ) template<typename Actual>
{} bool operator()(
template< typename Actual > const Actual& actual,
bool operator()( const Actual& actual, std::enable_if_t<!std::is_convertible<const Actual*, unwrap_reference_t<Expected>>::value>* = 0) const
typename boost::disable_if<
boost::is_convertible<
const Actual*,
typename
boost::unwrap_reference< Expected >::type
>
>::type* = 0 ) const
{ {
*expected_ = actual; *expected_ = actual;
return true; return true;
} }
template< typename Actual > template<typename Actual>
bool operator()( BOOST_RV_REF(Actual) actual, bool operator()(
typename boost::disable_if< Actual&& actual,
boost::is_convertible< std::enable_if_t<!std::is_convertible<const Actual*, unwrap_reference_t<Expected>>::value>* = 0) const
const Actual*,
typename
boost::unwrap_reference< Expected >::type
>
>::type* = 0 ) const
{ {
*expected_ = boost::move( actual ); *expected_ = std::move(actual);
return true; return true;
} }
template< typename Actual > template<typename Actual>
bool operator()( Actual& actual, bool operator()(Actual& actual,
typename boost::enable_if< std::enable_if_t<std::is_convertible<Actual*, unwrap_reference_t<Expected>>::value>* = 0) const
boost::is_convertible< Actual*,
typename
boost::unwrap_reference< Expected >::type
>
>::type* = 0 ) const
{ {
*expected_ = detail::addressof( actual ); *expected_ = std::addressof(actual);
return true; return true;
} }
friend std::ostream& operator<<( std::ostream& s, const retrieve& r ) friend std::ostream& operator<<(std::ostream& s, const retrieve& r)
{ {
return s << "retrieve( " << mock::format( *r.expected_ ) << " )"; return s << "retrieve( " << mock::format(*r.expected_) << " )";
} }
typename unwrap_reference_t<Expected>* expected_;
boost::unwrap_reference< Expected >::type* expected_;
}; };
template< typename Expected > template<typename Expected>
struct assign struct assign
{ {
explicit assign( const Expected& expected ) explicit assign(const Expected& expected) : expected_(expected) {}
: expected_( expected ) template<typename Actual>
{} bool operator()(Actual& actual) const
template< typename Actual >
bool operator()( Actual& actual ) const
{ {
actual = boost::unwrap_ref( expected_ ); actual = unwrap_ref(expected_);
return true; return true;
} }
template< typename Actual > template<typename Actual>
bool operator()( Actual* actual, bool operator()(Actual* actual,
typename boost::enable_if< std::enable_if_t<std::is_convertible<unwrap_reference_t<Expected>, Actual>::value>* = 0) const
boost::is_convertible<
typename
boost::unwrap_reference< Expected >::type,
Actual
>
>::type* = 0 ) const
{ {
if( ! actual ) if(!actual)
return false; return false;
*actual = boost::unwrap_ref( expected_ ); *actual = unwrap_ref(expected_);
return true; return true;
} }
friend std::ostream& operator<<( std::ostream& s, const assign& a ) friend std::ostream& operator<<(std::ostream& s, const assign& a)
{ {
return s << "assign( " << mock::format( a.expected_ ) << " )"; return s << "assign( " << mock::format(a.expected_) << " )";
} }
Expected expected_; Expected expected_;
}; };
template< typename Expected > template<typename Expected>
struct contain struct contain
{ {
explicit contain( const Expected& expected ) explicit contain(const Expected& expected) : expected_(expected) {}
: expected_( expected ) bool operator()(const std::string& actual) const
{}
bool operator()( const std::string& actual ) const
{ {
return actual.find( boost::unwrap_ref( expected_ ) ) return actual.find(unwrap_ref(expected_)) != std::string::npos;
!= std::string::npos;
} }
friend std::ostream& operator<<( std::ostream& s, const contain& n ) friend std::ostream& operator<<(std::ostream& s, const contain& n)
{ {
return s << "contain( " << mock::format( n.expected_ ) << " )"; return s << "contain( " << mock::format(n.expected_) << " )";
} }
Expected expected_; Expected expected_;
}; };
} // namespace detail
template<typename T>
constraint<detail::equal<T>> equal(T&& t)
{
return detail::equal<T>(std::forward<T>(t));
} }
template< typename T > template<typename T>
constraint< detail::equal< typename detail::forward_type< T >::type > > equal( BOOST_FWD_REF(T) t ) constraint<detail::same<T>> same(T& t)
{ {
return detail::equal< typename detail::forward_type< T >::type >( boost::forward< T >( t ) ); return detail::same<T>(t);
} }
template<typename T>
constraint<detail::retrieve<T>> retrieve(T& t)
{
return detail::retrieve<T>(t);
}
template<typename T>
constraint<detail::assign<T>> assign(T t)
{
return detail::assign<T>(t);
}
template<typename T>
constraint<detail::contain<T>> contain(T t)
{
return detail::contain<T>(t);
}
template< typename T > template<typename T>
constraint< detail::same< T > > same( T& t ) constraint<T> call(T t)
{ {
return detail::same< T >( t ); return constraint<T>(t);
} }
template< typename T > } // namespace mock
constraint< detail::retrieve< T > > retrieve( T& t )
{
return detail::retrieve< T >( t );
}
template< typename T >
constraint< detail::assign< T > > assign( T t )
{
return detail::assign< T >( t );
}
template< typename T >
constraint< detail::contain< T > > contain( T t )
{
return detail::contain< T >( t );
}
template< typename T >
constraint< T > call( T t )
{
return constraint< T >( t );
}
} // mock
#endif // MOCK_CONSTRAINTS_HPP_INCLUDED #endif // MOCK_CONSTRAINTS_HPP_INCLUDED

View file

@ -10,217 +10,128 @@
#define MOCK_ACTION_HPP_INCLUDED #define MOCK_ACTION_HPP_INCLUDED
#include "../config.hpp" #include "../config.hpp"
#include <boost/type_traits/remove_reference.hpp> #include <functional>
#include <boost/type_traits/remove_const.hpp> #include <memory>
#include <boost/noncopyable.hpp> #include <type_traits>
#include <boost/shared_ptr.hpp>
#include <boost/move/move.hpp>
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <boost/ref.hpp>
namespace mock namespace mock { namespace detail {
{ template<typename Result, typename Signature>
namespace detail
{
template< typename Result, typename Signature >
class action_base class action_base
{ {
private: private:
#ifdef MOCK_HDR_FUNCTIONAL typedef std::function<Signature> functor_type;
typedef std::function< Signature > functor_type; typedef std::function<Result()> action_type;
typedef std::function< Result() > action_type;
#else protected:
typedef boost::function< Signature > functor_type; // Meant to be subclassed and not be directly used
typedef boost::function< Result() > action_type; // Non-relocatable (contained functions may wrap references/pointers which could be invalidated)
#endif action_base() = default;
action_base(const action_base&) = delete;
action_base(action_base&&) = delete;
action_base& operator=(const action_base&) = delete;
action_base& operator=(action_base&&) = delete;
public: public:
const functor_type& functor() const const functor_type& functor() const { return f_; }
{ bool valid() const { return f_ || a_; }
return f_; Result trigger() const { return a_(); }
}
bool valid() const
{
return f_ || a_;
}
Result trigger() const
{
return a_();
}
void calls( const functor_type& f ) void calls(const functor_type& f)
{ {
if( ! f ) if(!f)
throw std::invalid_argument( "null functor" ); throw std::invalid_argument("null functor");
f_ = f; f_ = f;
} }
template< typename Exception > template<typename Exception>
void throws( Exception e ) void throws(Exception e)
{ {
a_ = boost::bind( &do_throw< Exception >, e ); a_ = [e]() -> Result { throw e; };
} }
protected: protected:
void set( const action_type& a ) void set(const action_type& a) { a_ = a; }
template<typename Y>
void set(const std::reference_wrapper<Y>& r)
{ {
a_ = a; a_ = [r]() -> Result { return r.get(); };
}
template< typename Y >
void set( const boost::reference_wrapper< Y >& r )
{
a_ = boost::bind( &do_ref< Y >, r.get_pointer() );
} }
private: private:
template< typename T >
static T& do_ref( T* t )
{
return *t;
}
template< typename T >
static Result do_throw( T t )
{
throw t;
}
functor_type f_; functor_type f_;
action_type a_; action_type a_;
}; };
template< typename Result, typename Signature > /// Type erased value storage
class action : public action_base< Result, Signature > struct value
{
value() = default;
value(const value&) = delete;
value& operator=(const value&) = delete;
virtual ~value() = default;
};
/// Actual value storage,
/// holds an instance of T (stripped of reference qualifiers)
template<typename T>
struct value_imp : value
{
using type = std::remove_const_t<std::remove_reference_t<T>>;
template<typename U>
value_imp(U&& t) : t_(std::forward<U>(t))
{}
type t_;
};
template<typename Result, typename Signature>
class action : public action_base<Result, Signature>
{ {
public: public:
template< typename Value > template<typename Value>
void returns( const Value& v ) void returns(const Value& v)
{ {
this->set( boost::ref( store( v ) ) ); this->set(std::ref(store(v)));
} }
template< typename Y > template<typename Y>
void returns( const boost::reference_wrapper< Y >& r ) void returns(const std::reference_wrapper<Y>& r)
{ {
this->set( r ); this->set(r);
} }
template< typename Value > template<typename Value>
void moves( BOOST_RV_REF(Value) v ) void moves(Value&& v)
{ {
this->set( auto vRef = std::ref(store(std::move(v)));
boost::bind( this->set([vRef]() { return std::move(vRef.get()); });
&move< typename boost::remove_reference< Value >::type >,
boost::ref( store( boost::move( v ) ) ) ) );
} }
private: private:
template< typename Value > template<typename T>
static BOOST_RV_REF(Value) move( Value& t ) typename value_imp<T>::type& store(T&& t)
{ {
return boost::move( t ); v_ = std::make_unique<value_imp<T>>(std::forward<T>(t));
return static_cast<value_imp<T>&>(*v_).t_;
} }
struct value : boost::noncopyable template<typename T>
std::remove_reference_t<Result>& store(T* t)
{ {
virtual ~value() v_ = std::make_unique<value_imp<Result>>(t);
{} return static_cast<value_imp<Result>&>(*v_).t_;
};
template< typename T >
struct value_imp : value
{
typedef
typename boost::remove_const<
typename boost::remove_reference<
T
>::type
>::type value_type;
value_imp( BOOST_RV_REF(value_type) t )
: t_( boost::move( t ) )
{}
value_imp( const value_type& t )
: t_( t )
{}
template< typename Y >
value_imp( Y* y )
: t_( y )
{}
value_type t_;
};
template< typename T >
T& store( BOOST_RV_REF(T) t )
{
v_.reset( new value_imp< T >( boost::move( t ) ) );
return static_cast< value_imp< T >& >( *v_ ).t_;
}
template< typename T >
T& store( const T& t )
{
v_.reset( new value_imp< T >( t ) );
return static_cast< value_imp< T >& >( *v_ ).t_;
}
template< typename T >
typename boost::remove_reference< Result >::type& store( T* t )
{
v_.reset( new value_imp< Result >( t ) );
return static_cast< value_imp< Result >& >( *v_ ).t_;
} }
boost::shared_ptr< value > v_; std::unique_ptr<value> v_;
}; };
template< typename Signature > template<typename Signature>
class action< void, Signature > : public action_base< void, Signature > class action<void, Signature> : public action_base<void, Signature>
{ {
public: public:
action() action()
{ {
this->set( boost::bind( &do_nothing ) ); this->set([]() {});
} }
private:
static void do_nothing()
{}
}; };
#ifdef MOCK_AUTO_PTR }} // namespace mock::detail
template< typename Result, typename Signature >
class action< std::auto_ptr< Result >, Signature >
: public action_base< std::auto_ptr< Result >, Signature >
{
public:
action()
{}
action( const action& rhs )
: v_( rhs.v_.release() )
{
if( v_.get() )
returns( boost::ref( v_ ) );
}
template< typename Y >
void returns( Y* r )
{
v_.reset( r );
this->set( boost::ref( v_ ) );
}
template< typename Y >
void returns( std::auto_ptr< Y > r )
{
v_ = r;
this->set( boost::ref( v_ ) );
}
template< typename Y >
void returns( const boost::reference_wrapper< Y >& r )
{
this->set( r );
}
private:
mutable std::auto_ptr< Result > v_;
};
#endif // MOCK_AUTO_PTR
}
} // mock
#endif // MOCK_ACTION_HPP_INCLUDED #endif // MOCK_ACTION_HPP_INCLUDED

View file

@ -1,36 +0,0 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2013
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef MOCK_ADDRESSOF_HPP_INCLUDED
#define MOCK_ADDRESSOF_HPP_INCLUDED
#include "../config.hpp"
#include <boost/utility/addressof.hpp>
namespace mock
{
namespace detail
{
using boost::addressof;
#ifdef MOCK_NULLPTR
inline const std::nullptr_t* addressof( const std::nullptr_t& p )
{
return &p;
}
inline std::nullptr_t* addressof( std::nullptr_t& p )
{
return &p;
}
#endif
}
} // mock
#endif // MOCK_ADDRESSOF_HPP_INCLUDED

View file

@ -10,43 +10,38 @@
#define MOCK_CHILD_HPP_INCLUDED #define MOCK_CHILD_HPP_INCLUDED
#include "../config.hpp" #include "../config.hpp"
#include "type_name.hpp"
#include "parent.hpp" #include "parent.hpp"
#include <boost/test/utils/basic_cstring/basic_cstring.hpp> #include "type_name.hpp"
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
#include <ostream> #include <ostream>
namespace mock namespace mock { namespace detail {
{
namespace detail
{
class child class child
{ {
public: public:
child() child() : parent_(0) {}
: parent_( 0 ) void update(parent& p,
{} boost::unit_test::const_string instance,
void update( parent& p, boost::optional<type_name> type,
boost::unit_test::const_string instance, boost::unit_test::const_string name)
boost::optional< type_name > type,
boost::unit_test::const_string name )
{ {
if( instance != "?." || name_.empty() ) if(instance != "?." || name_.empty())
p = parent( instance, type ); p = parent(instance, type);
parent_ = &p; parent_ = &p;
name_ = name; name_ = name;
} }
friend std::ostream& operator<<( std::ostream& s, const child& c ) friend std::ostream& operator<<(std::ostream& s, const child& c)
{ {
if( c.parent_ ) if(c.parent_)
s << *c.parent_; s << *c.parent_;
return s << c.name_; return s << c.name_;
} }
private: private:
const parent* parent_; const parent* parent_;
boost::unit_test::const_string name_; boost::unit_test::const_string name_;
}; };
} }} // namespace mock::detail
} // mock
#endif // MOCK_CHILD_HPP_INCLUDED #endif // MOCK_CHILD_HPP_INCLUDED

View file

@ -11,34 +11,32 @@
#include "../config.hpp" #include "../config.hpp"
#include "type_name.hpp" #include "type_name.hpp"
#include <boost/noncopyable.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/test/utils/basic_cstring/basic_cstring.hpp> #include <boost/test/utils/basic_cstring/basic_cstring.hpp>
#include <ostream> #include <ostream>
namespace mock namespace mock { namespace detail {
{
namespace detail
{
class verifiable; class verifiable;
class context : boost::noncopyable class context
{ {
public: public:
context() {} context() = default;
virtual ~context() {} context(const context&) = delete;
context& operator=(const context&) = delete;
virtual void add( const void* p, verifiable& v, virtual ~context() = default;
boost::unit_test::const_string instance,
boost::optional< type_name > type,
boost::unit_test::const_string name ) = 0;
virtual void add( verifiable& v ) = 0;
virtual void remove( verifiable& v ) = 0;
virtual void serialize( std::ostream& s, virtual void add(const void* p,
const verifiable& v ) const = 0; verifiable& v,
boost::unit_test::const_string instance,
boost::optional<type_name> type,
boost::unit_test::const_string name) = 0;
virtual void add(verifiable& v) = 0;
virtual void remove(verifiable& v) = 0;
virtual void serialize(std::ostream& s, const verifiable& v) const = 0;
}; };
} }} // namespace mock::detail
} // mock
#endif // MOCK_CONTEXT_HPP_INCLUDED #endif // MOCK_CONTEXT_HPP_INCLUDED

View file

@ -0,0 +1,183 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef MOCK_EXPECTATION_HPP_INCLUDED
#define MOCK_EXPECTATION_HPP_INCLUDED
#include "../matcher.hpp"
#include "../sequence.hpp"
#include "action.hpp"
#include "invocation.hpp"
#include "matcher_base.hpp"
#include <memory>
#include <tuple>
#include <type_traits>
#include <vector>
namespace mock { namespace detail {
template<typename... Args>
class default_matcher : public matcher_base<Args...>
{
private:
bool operator()(ref_arg_t<Args>...) override { return true; }
void serialize(std::ostream& s) const override
{
constexpr auto arity = sizeof...(Args);
for(unsigned i = 0; i < arity; ++i)
{
if(i)
s << ", ";
s << "any";
}
}
};
template<typename ConstraintPack, typename... Args>
class single_matcher;
template<typename... Constraints, typename... Args>
class single_matcher<void(Constraints...), Args...> : public matcher_base<Args...>
{
static_assert(sizeof...(Args) > 0, "This class is only useful for functions with arguments");
static_assert(sizeof...(Constraints) == sizeof...(Args), "Need exactly 1 constraint per argument");
public:
single_matcher(Constraints... constraints) : matchers_(matcher<Args, Constraints>(constraints)...) {}
private:
template<std::size_t... I>
bool is_valid_impl(std::index_sequence<I...>, ref_arg_t<Args>... t)
{
using expander = bool[];
bool result = true;
(void)expander{ result &= std::get<I>(matchers_)(static_cast<ref_arg_t<Args>>(t))... };
return result;
}
bool operator()(ref_arg_t<Args>... t) override
{
return is_valid_impl(std::make_index_sequence<sizeof...(Args)>{}, static_cast<ref_arg_t<Args>>(t)...);
}
template<std::size_t... I>
void serialize_impl(std::index_sequence<I...>, std::ostream& s) const
{
using expander = int[];
s << std::get<0>(matchers_);
(void)expander{ 0, (s << ", " << std::get<I + 1>(matchers_), 0)... };
}
void serialize(std::ostream& s) const override
{
serialize_impl(std::make_index_sequence<sizeof...(Args) - 1>{}, s);
}
private:
std::tuple<matcher<Args, Constraints>...> matchers_;
};
template<typename F, typename... Args>
class multi_matcher : public matcher_base<Args...>
{
static_assert(sizeof...(Args) > 0, "This class is only useful for functions with arguments");
public:
multi_matcher(const F& f) : f_(f) {}
private:
bool operator()(ref_arg_t<Args>... t) override { return f_(static_cast<ref_arg_t<Args>>(t)...); }
void serialize(std::ostream& s) const override { s << mock::format(f_); }
private:
F f_;
};
template<typename Signature>
class expectation;
template<typename R, typename... Args>
class expectation<R(Args...)> : public action<R, R(Args...)>
{
static constexpr std::size_t arity = sizeof...(Args);
public:
expectation() : expectation("unknown location", 0) {}
expectation(const char* file, int line)
: invocation_(std::make_unique<unlimited>()), matcher_(std::make_unique<default_matcher<Args...>>()),
file_(file), line_(line)
{}
expectation(expectation&&) = default;
expectation(expectation const&) = default;
expectation& operator=(expectation&&) = default;
expectation& operator=(expectation const&) = default;
~expectation()
{
for(auto& sequence : sequences_)
sequence->remove(this);
}
void invoke(std::unique_ptr<invocation> i) { invocation_ = std::move(i); }
template<typename... Constraints>
std::enable_if_t<(arity > 0u) && sizeof...(Constraints) == arity> with(Constraints... c)
{
matcher_ = std::make_unique<single_matcher<void(Constraints...), Args...>>(c...);
}
template<typename Constraint, std::size_t Arity = arity>
std::enable_if_t<(Arity > 1u)> with(const Constraint& c)
{
matcher_ = std::make_unique<multi_matcher<Constraint, Args...>>(c);
}
void add(sequence& s)
{
s.impl_->add(this);
sequences_.push_back(s.impl_);
}
bool verify() const { return invocation_->verify(); }
bool is_valid(ref_arg_t<Args>... t) const
{
return !invocation_->exhausted() && (*matcher_)(static_cast<ref_arg_t<Args>>(t)...);
}
bool invoke() const
{
for(auto& sequence : sequences_)
{
if(!sequence->is_valid(this))
return false;
}
bool result = invocation_->invoke();
for(auto& sequence : sequences_)
sequence->invalidate(this);
return result;
}
const char* file() const { return file_; }
int line() const { return line_; }
friend std::ostream& operator<<(std::ostream& s, const expectation& e)
{
s << (e.invocation_->exhausted() ? 'v' : '.') << ' ' << *e.invocation_;
constexpr bool hasArguments = arity > 0u;
if(hasArguments)
s << ".with( " << *e.matcher_ << " )";
return s;
}
private:
std::unique_ptr<invocation> invocation_;
std::unique_ptr<matcher_base<Args...>> matcher_;
std::vector<std::shared_ptr<sequence_impl>> sequences_;
const char* file_;
int line_;
};
}} // namespace mock::detail
#endif // MOCK_EXPECTATION_HPP_INCLUDED

View file

@ -1,276 +0,0 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include "matcher_base_template.hpp"
#define MOCK_EXPECTATION_INITIALIZE(z, n, d) \
BOOST_PP_COMMA_IF(n) c##n##_( c##n )
#define MOCK_EXPECTATION_MEMBER(z, n, d) \
matcher< T##n, Constraint_##n > c##n##_;
#define MOCK_EXPECTATION_IS_VALID(z, n, d) \
BOOST_PP_IF(n, &&,) c##n##_( mock::detail::move_if_not_lvalue_reference< T##n >( a##n ) )
#define MOCK_EXPECTATION_SERIALIZE(z, n, d) \
BOOST_PP_IF(n, << ", " <<,) c##n##_
#define MOCK_EXPECTATION_SERIALIZE_ANY(z, n, d) \
BOOST_PP_IF(n, << ", " <<,) "any"
#define MOCK_EXPECTATION_PARAM(z, n, Args) \
mock::detail::move_if_not_lvalue_reference< T##n >( a##n )
#define MOCK_REF_ARG(z, n, d) \
typename ref_arg< T##n >::type a##n
#define MOCK_REF_ARG_T(z, n, d) \
typename ref_arg< T##n >::type
namespace mock
{
namespace detail
{
template< typename Signature > class default_matcher;
template<
BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, typename T) >
class default_matcher< void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) >
: public matcher_base< void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) >
{
private:
virtual bool operator()(
BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_REF_ARG_T, _) )
{
return true;
}
virtual void serialize( std::ostream& s ) const
{
s << "" BOOST_PP_REPEAT(MOCK_NUM_ARGS,
MOCK_EXPECTATION_SERIALIZE_ANY, _);
}
};
#ifndef MOCK_NUM_ARGS_0
template< typename Constraint, typename Signature > class single_matcher;
template<
BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, typename Constraint_),
BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, typename T)
>
class single_matcher<
void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, Constraint_) ),
void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) )
>
: public matcher_base< void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) >
{
public:
single_matcher(
BOOST_PP_ENUM_BINARY_PARAMS(MOCK_NUM_ARGS, Constraint_, c) )
: BOOST_PP_REPEAT(MOCK_NUM_ARGS,
MOCK_EXPECTATION_INITIALIZE, _)
{}
private:
virtual bool operator()(
BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_REF_ARG, _) )
{
return BOOST_PP_REPEAT(MOCK_NUM_ARGS,
MOCK_EXPECTATION_IS_VALID, _);
}
virtual void serialize( std::ostream& s ) const
{
s << BOOST_PP_REPEAT(MOCK_NUM_ARGS,
MOCK_EXPECTATION_SERIALIZE, _);
}
private:
BOOST_PP_REPEAT(
MOCK_NUM_ARGS, MOCK_EXPECTATION_MEMBER, _)
};
template< typename F, typename Signature > class multi_matcher;
template< typename F,
BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, typename T) >
class multi_matcher< F, void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) >
: public matcher_base< void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) >
{
public:
multi_matcher( const F& f )
: f_( f )
{}
private:
virtual bool operator()(
BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_REF_ARG, _) )
{
return f_( BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_EXPECTATION_PARAM, _) );
}
virtual void serialize( std::ostream& s ) const
{
s << mock::format( f_ );
}
private:
F f_;
};
#endif
template< typename Signature > class expectation;
template< typename R
BOOST_PP_ENUM_TRAILING_PARAMS(MOCK_NUM_ARGS, typename T) >
class expectation< R (BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS,T)) >
: public action< R, R (BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS,T)) >
{
public:
expectation()
: invocation_( boost::make_shared< unlimited >() )
, matcher_(
boost::make_shared<
default_matcher<
void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) )
>
> () )
, file_( "unknown location" )
, line_( 0 )
{}
expectation( const char* file, int line )
: invocation_( boost::make_shared< unlimited >() )
, matcher_(
boost::make_shared<
default_matcher<
void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) )
>
> () )
, file_( file )
, line_( line )
{}
~expectation()
{
for( sequences_cit it = sequences_.begin();
it != sequences_.end(); ++it )
(*it)->remove( this );
}
void invoke( const boost::shared_ptr< invocation >& i )
{
invocation_ = i;
}
#ifndef MOCK_NUM_ARGS_0
template<
BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, typename Constraint_)
>
expectation& with(
BOOST_PP_ENUM_BINARY_PARAMS(MOCK_NUM_ARGS, Constraint_, c) )
{
matcher_.reset(
new single_matcher<
void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, Constraint_) ),
void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) )
>( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, c) ) );
return *this;
}
#if MOCK_NUM_ARGS > 1
template< typename Constraint >
expectation& with( const Constraint& c )
{
matcher_.reset(
new multi_matcher<
Constraint,
void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) )
>( c ) );
return *this;
}
#endif
#endif
void add( sequence& s )
{
s.impl_->add( this );
sequences_.push_back( s.impl_ );
}
bool verify() const
{
return invocation_->verify();
}
bool is_valid(
BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_REF_ARG, _) ) const
{
return !invocation_->exhausted()
&& (*matcher_)( BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_EXPECTATION_PARAM, _) );
}
bool invoke() const
{
for( sequences_cit it = sequences_.begin();
it != sequences_.end(); ++it )
if( ! (*it)->is_valid( this ) )
return false;
bool result = invocation_->invoke();
for( sequences_cit it = sequences_.begin();
it != sequences_.end(); ++it )
(*it)->invalidate( this );
return result;
}
const char* file() const
{
return file_;
}
int line() const
{
return line_;
}
friend std::ostream& operator<<(
std::ostream& s, const expectation& e )
{
return s << ( e.invocation_->exhausted() ? 'v' : '.' )
<< ' ' << *e.invocation_
#ifndef MOCK_NUM_ARGS_0
<< ".with( " << *e.matcher_ << " )"
#endif
;
}
private:
typedef std::vector<
boost::shared_ptr< sequence_impl >
> sequences_type;
typedef sequences_type::const_iterator sequences_cit;
boost::shared_ptr< invocation > invocation_;
boost::shared_ptr<
matcher_base<
void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) )
>
> matcher_;
sequences_type sequences_;
const char* file_;
int line_;
};
}
} // mock
#undef MOCK_EXPECTATION_INITIALIZE
#undef MOCK_EXPECTATION_MEMBER
#undef MOCK_EXPECTATION_IS_VALID
#undef MOCK_EXPECTATION_SERIALIZE
#undef MOCK_EXPECTATION_SERIALIZE_ANY
#undef MOCK_EXPECTATION_PARAM
#undef MOCK_REF_ARG
#undef MOCK_REF_ARG_T
#undef MOCK_RV_REF

View file

@ -11,40 +11,31 @@
#include "../config.hpp" #include "../config.hpp"
#include "../stream.hpp" #include "../stream.hpp"
#include "addressof.hpp" #include <memory>
namespace mock namespace mock { namespace detail {
{ template<typename T>
namespace detail
{
template< typename T >
struct formatter struct formatter
{ {
explicit formatter( const T& t ) explicit formatter(const T& t) : t_(std::addressof(t)) {}
: t_( detail::addressof( t ) ) void serialize(stream& s) const { detail::serialize(s, *t_); }
{}
void serialize( stream& s ) const
{
detail::serialize( s, *t_ );
}
const T* t_; const T* t_;
}; };
template< typename T > template<typename T>
stream& operator<<( stream& s, const formatter< T >& f ) stream& operator<<(stream& s, const formatter<T>& f)
{ {
f.serialize( s ); f.serialize(s);
return s; return s;
} }
template< typename T > template<typename T>
std::ostream& operator<<( std::ostream& s, const formatter< T >& f ) std::ostream& operator<<(std::ostream& s, const formatter<T>& f)
{ {
stream ss( s ); stream ss(s);
f.serialize( ss ); f.serialize(ss);
return s; return s;
} }
} }} // namespace mock::detail
} // mock
#endif // MOCK_FORMATTER_HPP_INCLUDED #endif // MOCK_FORMATTER_HPP_INCLUDED

View file

@ -10,106 +10,72 @@
#define MOCK_FUNCTION_HPP_INCLUDED #define MOCK_FUNCTION_HPP_INCLUDED
#include "../config.hpp" #include "../config.hpp"
#include "../error.hpp"
#include "../log.hpp" #include "../log.hpp"
#include "../constraints.hpp"
#include "../sequence.hpp" #include "../sequence.hpp"
#include "../matcher.hpp"
#include "action.hpp"
#include "verifiable.hpp"
#include "invocation.hpp"
#include "type_name.hpp"
#include "context.hpp" #include "context.hpp"
#include "mutex.hpp" #include "function_impl.hpp"
#include "move_helper.hpp" #include "type_name.hpp"
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/comparison/equal.hpp>
#include <boost/preprocessor/comparison/greater.hpp>
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
#include <boost/test/utils/lazy_ostream.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/call_traits.hpp>
#include <boost/make_shared.hpp>
#include <boost/noncopyable.hpp>
#include <boost/move/move.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
#include <ostream> #include <ostream>
#include <vector>
#include <list>
namespace mock namespace mock { namespace detail {
{ template<typename Signature>
namespace detail class function;
{
template< typename R, typename E > template<typename R, typename... Ts>
struct wrapper_base class function<R(Ts...)>
{ {
wrapper_base( E& e ) private:
: e_( &e ) typedef function_impl<R(Ts...)> impl_type;
{} typedef typename impl_type::wrapper_type expectation_type;
typedef typename impl_type::error_type error_type;
template< typename T > public:
void returns( T t ) function() : impl_(std::make_shared<impl_type>()) {}
bool verify() const { return impl_->verify(); }
bool verify(const char* file, int line) const
{ {
e_->returns( t ); error_type::pass(file, line);
return impl_->verify();
}
void reset() { impl_->reset(); }
void reset(const char* file, int line)
{
error_type::pass(file, line);
impl_->reset();
} }
E* e_; expectation_type expect(const char* file, int line)
};
template< typename E >
struct wrapper_base< void, E >
{
wrapper_base( E& e )
: e_( &e )
{}
E* e_;
};
template< typename R, typename E >
struct wrapper_base< R*, E >
{
wrapper_base( E& e )
: e_( &e )
{}
void returns( R* r )
{ {
e_->returns( r ); error_type::pass(file, line);
return impl_->expect(file, line);
} }
template< typename Y > expectation_type expect() { return impl_->expect(); }
void returns( const boost::reference_wrapper< Y >& r )
R operator()(Ts... args) const { return (*impl_)(static_cast<ref_arg_t<Ts>>(args)...); }
friend std::ostream& operator<<(std::ostream& s, const function& f) { return s << *f.impl_; }
function& operator()(context& c, boost::unit_test::const_string instance)
{ {
e_->returns( r ); impl_->add(c, impl_.get(), instance, boost::none, "");
return *this;
} }
E* e_; void configure(context& c,
const void* p,
boost::unit_test::const_string instance,
boost::optional<type_name> type,
boost::unit_test::const_string name) const
{
impl_->add(c, p, instance, type, name);
}
private:
std::shared_ptr<impl_type> impl_;
}; };
}} // namespace mock::detail
inline int exceptions()
{
#ifdef MOCK_UNCAUGHT_EXCEPTIONS
using namespace std;
return uncaught_exceptions();
#else
return std::uncaught_exception() ? 1 : 0;
#endif
}
}
} // mock
#define MOCK_NUM_ARGS 0
#define MOCK_NUM_ARGS_0
#include "function_template.hpp"
#undef MOCK_NUM_ARGS_0
#undef MOCK_NUM_ARGS
#define BOOST_PP_FILENAME_1 <turtle/detail/function_iterate.hpp>
#define BOOST_PP_ITERATION_LIMITS (1, MOCK_MAX_ARGS)
#include BOOST_PP_ITERATE()
#undef BOOST_PP_FILENAME_1
#undef BOOST_PP_ITERATION_LIMITS
#endif // MOCK_FUNCTION_HPP_INCLUDED #endif // MOCK_FUNCTION_HPP_INCLUDED

View file

@ -0,0 +1,362 @@
// http://turtle.sourceforge.net
//
// Copyright 2012 Mathieu Champlon
// Copyright 2025 Alexander Grund
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef MOCK_FUNCTION_IMPL_HPP_INCLUDED
#define MOCK_FUNCTION_IMPL_HPP_INCLUDED
#include "../error.hpp"
#include "expectation.hpp"
#include "mutex.hpp"
#include "verifiable.hpp"
#include <boost/test/utils/lazy_ostream.hpp>
#include <list>
#include <memory>
#ifndef MOCK_ERROR_POLICY
# error no error policy has been set
#endif
namespace mock { namespace detail {
template<typename R, typename E>
struct wrapper_base
{
wrapper_base(E& e) : e_(&e) {}
template<typename T>
void returns(T t)
{
e_->returns(t);
}
E* e_;
};
template<typename E>
struct wrapper_base<void, E>
{
wrapper_base(E& e) : e_(&e) {}
E* e_;
};
template<typename R, typename E>
struct wrapper_base<R*, E>
{
wrapper_base(E& e) : e_(&e) {}
void returns(R* r) { e_->returns(r); }
template<typename Y>
void returns(const std::reference_wrapper<Y>& r)
{
e_->returns(r);
}
E* e_;
};
inline int exceptions()
{
#ifdef MOCK_UNCAUGHT_EXCEPTIONS
using namespace std;
return uncaught_exceptions();
#else
return std::uncaught_exception() ? 1 : 0;
#endif
}
template<typename... Arg>
class lazy_args;
template<typename Signature>
class function_impl;
template<typename R, typename... Args>
class function_impl<R(Args...)> : public verifiable, public std::enable_shared_from_this<function_impl<R(Args...)>>
{
public:
typedef safe_error<R, MOCK_ERROR_POLICY<R>> error_type;
public:
function_impl() : exceptions_(exceptions()), mutex_(std::make_shared<mutex>()) {}
virtual ~function_impl()
{
if(valid_ && exceptions_ >= exceptions())
{
for(const auto& expectation : expectations_)
{
if(!expectation.verify())
{
error_type::fail("untriggered expectation",
boost::unit_test::lazy_ostream::instance()
<< lazy_context(this) << lazy_expectations(this),
expectation.file(),
expectation.line());
}
}
}
if(context_)
context_->remove(*this);
}
virtual bool verify() const
{
lock _(mutex_);
for(const auto& expectation : expectations_)
{
if(!expectation.verify())
{
valid_ = false;
error_type::fail("verification failed",
boost::unit_test::lazy_ostream::instance()
<< lazy_context(this) << lazy_expectations(this),
expectation.file(),
expectation.line());
}
}
return valid_;
}
virtual void reset()
{
lock _(mutex_);
valid_ = true;
std::shared_ptr<function_impl> guard = this->shared_from_this();
expectations_.clear();
}
private:
typedef expectation<R(Args...)> expectation_type;
class wrapper : public wrapper_base<R, expectation_type>
{
private:
typedef wrapper_base<R, expectation_type> base_type;
static constexpr std::size_t arity = sizeof...(Args);
public:
wrapper(const std::shared_ptr<mutex>& m, expectation_type& e) : base_type(e), lock_(m) {}
wrapper(const wrapper&) = delete;
wrapper(wrapper&& x) = default;
wrapper& operator=(const wrapper&) = delete;
wrapper& operator=(wrapper&& x) = default;
wrapper& once()
{
this->e_->invoke(std::make_unique<detail::once>());
return *this;
}
wrapper& never()
{
this->e_->invoke(std::make_unique<detail::never>());
return *this;
}
wrapper& exactly(std::size_t count)
{
this->e_->invoke(std::make_unique<detail::exactly>(count));
return *this;
}
wrapper& at_least(std::size_t min)
{
this->e_->invoke(std::make_unique<detail::at_least>(min));
return *this;
}
wrapper& at_most(std::size_t max)
{
this->e_->invoke(std::make_unique<detail::at_most>(max));
return *this;
}
wrapper& between(std::size_t min, std::size_t max)
{
this->e_->invoke(std::make_unique<detail::between>(min, max));
return *this;
}
/// Callable only for functions taking arguments
/// Number of constraints must match the number of arguments
/// or a single constraint checking all arguments must be passed
template<typename... Constraints>
std::enable_if_t<(arity > 0u && (sizeof...(Constraints) == arity || sizeof...(Constraints) == 1u)),
wrapper&>
with(Constraints... c)
{
this->e_->with(c...);
return *this;
}
/// Ensure the expectation is met in the given sequence(s)
template<class... MockSequences>
wrapper& in(sequence& s0, MockSequences&... s)
{
using expander = int[];
(void)expander{ (this->e_->add(s0), 0), (this->e_->add(s), 0)... };
return *this;
}
template<typename TT>
void calls(TT t)
{
this->e_->calls(t);
}
template<typename TT>
void throws(TT t)
{
this->e_->throws(t);
}
template<typename TT>
void moves(TT&& t)
{
this->e_->moves(std::move(t));
}
lock lock_;
};
public:
typedef wrapper wrapper_type;
wrapper expect(const char* file, int line)
{
lock _(mutex_);
expectations_.emplace_back(file, line);
valid_ = true;
return wrapper(mutex_, expectations_.back());
}
wrapper expect()
{
lock _(mutex_);
expectations_.emplace_back();
valid_ = true;
return wrapper(mutex_, expectations_.back());
}
R operator()(Args... args) const
{
// Due to lifetime rules of references this must be created and consumed in one line
#define MOCK_FUNCTION_CONTEXT \
boost::unit_test::lazy_ostream::instance() \
<< lazy_context(this) << lazy_args<Args...>(args...) << lazy_expectations(this)
lock _(mutex_);
valid_ = false;
for(const auto& expectation : expectations_)
{
if(expectation.is_valid(static_cast<ref_arg_t<Args>>(args)...))
{
if(!expectation.invoke())
{
error_type::fail(
"sequence failed", MOCK_FUNCTION_CONTEXT, expectation.file(), expectation.line());
return error_type::abort();
}
if(!expectation.valid())
{
error_type::fail(
"missing action", MOCK_FUNCTION_CONTEXT, expectation.file(), expectation.line());
return error_type::abort();
}
valid_ = true;
error_type::call(MOCK_FUNCTION_CONTEXT, expectation.file(), expectation.line());
if(expectation.functor())
return expectation.functor()(static_cast<ref_arg_t<Args>>(args)...);
return expectation.trigger();
}
}
error_type::fail("unexpected call", MOCK_FUNCTION_CONTEXT);
return error_type::abort();
#undef MOCK_FUNCTION_CONTEXT
}
void add(context& c,
const void* p,
boost::unit_test::const_string instance,
boost::optional<type_name> type,
boost::unit_test::const_string name)
{
lock _(mutex_);
if(!context_)
c.add(*this);
c.add(p, *this, instance, type, name);
context_ = &c;
}
friend std::ostream& operator<<(std::ostream& s, const function_impl& impl)
{
lock _(impl.mutex_);
return s << lazy_context(&impl) << lazy_expectations(&impl);
}
struct lazy_context
{
lazy_context(const function_impl* impl) : impl_(impl) {}
friend std::ostream& operator<<(std::ostream& s, const lazy_context& c)
{
if(c.impl_->context_)
c.impl_->context_->serialize(s, *c.impl_);
else
s << '?';
return s;
}
const function_impl* impl_;
};
struct lazy_expectations
{
lazy_expectations(const function_impl* impl) : impl_(impl) {}
friend std::ostream& operator<<(std::ostream& s, const lazy_expectations& e)
{
for(const auto& expectation : e.impl_->expectations_)
s << std::endl << expectation;
return s;
}
const function_impl* impl_;
};
std::list<expectation_type> expectations_;
context* context_ = nullptr;
mutable bool valid_ = true;
const int exceptions_;
const std::shared_ptr<mutex> mutex_;
};
template<typename ArgFirst, typename... ArgRest>
class lazy_args<ArgFirst, ArgRest...> : lazy_args<ArgRest...>
{
ArgFirst& arg_;
public:
lazy_args(ArgFirst& arg, std::add_lvalue_reference_t<ArgRest>... args)
: lazy_args<ArgRest...>(args...), arg_(arg)
{}
std::ostream& print(std::ostream& s) const
{
s << ' ' << mock::format(arg_) << ',';
return lazy_args<ArgRest...>::print(s);
}
};
template<typename ArgFirst>
class lazy_args<ArgFirst>
{
ArgFirst& arg_;
public:
lazy_args(ArgFirst& arg) : arg_(arg) {}
std::ostream& print(std::ostream& s) const { return s << ' ' << mock::format(arg_) << ' '; }
};
template<>
class lazy_args<>
{
public:
std::ostream& print(std::ostream& s) const { return s; }
};
template<typename... Args>
std::ostream& operator<<(std::ostream& s, const lazy_args<Args...>& a)
{
s << '(';
return a.print(s) << ')';
}
}} // namespace mock::detail
#endif // MOCK_FUNCTION_IMPL_HPP_INCLUDED

View file

@ -1,329 +0,0 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include "expectation_template.hpp"
#ifndef MOCK_ERROR_POLICY
# error no error policy has been set
#endif
#define MOCK_FUNCTION_FORMAT(z, n, N) \
<< ' ' << mock::format( t##n ) \
<< BOOST_PP_IF(BOOST_PP_EQUAL(N,n), ' ', ',')
#define MOCK_FUNCTION_CONTEXT \
boost::unit_test::lazy_ostream::instance() \
<< lazy_context( this ) \
<< '(' BOOST_PP_REPEAT(MOCK_NUM_ARGS, MOCK_FUNCTION_FORMAT, \
BOOST_PP_DEC(MOCK_NUM_ARGS)) \
<< ')' \
<< lazy_expectations( this )
#define MOCK_MOVE(z, n, d) \
mock::detail::move_if_not_lvalue_reference< T##n >( t##n )
namespace mock
{
namespace detail
{
template< typename Signature > class function_impl;
template< typename R
BOOST_PP_ENUM_TRAILING_PARAMS(MOCK_NUM_ARGS, typename T) >
class function_impl< R ( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) >
: public verifiable, public boost::enable_shared_from_this<
function_impl< R ( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) )> >
{
public:
typedef safe_error< R, MOCK_ERROR_POLICY< R > > error_type;
public:
function_impl()
: context_( 0 )
, valid_( true )
, exceptions_( exceptions() )
, mutex_( boost::make_shared< mutex >() )
{}
virtual ~function_impl()
{
if( valid_ && exceptions_ >= exceptions() )
for( expectations_cit it = expectations_.begin();
it != expectations_.end(); ++it )
if( ! it->verify() )
error_type::fail( "untriggered expectation",
boost::unit_test::lazy_ostream::instance()
<< lazy_context( this )
<< lazy_expectations( this ),
it->file(), it->line() );
if( context_ )
context_->remove( *this );
}
virtual bool verify() const
{
lock _( mutex_ );
for( expectations_cit it = expectations_.begin();
it != expectations_.end(); ++it )
if( ! it->verify() )
{
valid_ = false;
error_type::fail( "verification failed",
boost::unit_test::lazy_ostream::instance()
<< lazy_context( this )
<< lazy_expectations( this ),
it->file(), it->line() );
}
return valid_;
}
virtual void reset()
{
lock _( mutex_ );
valid_ = true;
boost::shared_ptr< function_impl > guard =
this->shared_from_this();
expectations_.clear();
}
private:
typedef expectation<
R( BOOST_PP_ENUM_PARAMS( MOCK_NUM_ARGS, T ) )
> expectation_type;
class wrapper : public wrapper_base< R, expectation_type >
{
private:
typedef wrapper_base< R, expectation_type > base_type;
BOOST_MOVABLE_BUT_NOT_COPYABLE(wrapper)
public:
wrapper( const boost::shared_ptr< mutex >& m, expectation_type& e )
: base_type( e )
, lock_( m )
{}
wrapper( BOOST_RV_REF( wrapper ) x )
: base_type( x )
, lock_( boost::move( x.lock_) )
{}
wrapper& operator=( BOOST_RV_REF( wrapper ) x )
{
static_cast< base_type& >( *this ) = x;
lock_ = boost::move( x.lock_ );
return *this;
}
wrapper& once()
{
this->e_->invoke( boost::make_shared< detail::once >() );
return *this;
}
wrapper& never()
{
this->e_->invoke( boost::make_shared< detail::never >() );
return *this;
}
wrapper& exactly( std::size_t count )
{
this->e_->invoke(
boost::make_shared< detail::exactly >( count ) );
return *this;
}
wrapper& at_least( std::size_t min )
{
this->e_->invoke(
boost::make_shared< detail::at_least >( min ) );
return *this;
}
wrapper& at_most( std::size_t max )
{
this->e_->invoke(
boost::make_shared< detail::at_most >( max ) );
return *this;
}
wrapper& between( std::size_t min, std::size_t max )
{
this->e_->invoke(
boost::make_shared< detail::between >( min, max ) );
return *this;
}
#ifndef MOCK_NUM_ARGS_0
template<
BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, typename Constraint_)
>
wrapper& with(
BOOST_PP_ENUM_BINARY_PARAMS(MOCK_NUM_ARGS, Constraint_, c) )
{
this->e_->with(
BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, c) );
return *this;
}
#if MOCK_NUM_ARGS > 1
template< typename Constraint >
wrapper& with( const Constraint& c )
{
this->e_->with( c );
return *this;
}
#endif
#endif
#define MOCK_FUNCTION_IN_ADD(z, n, d) \
this->e_->add( s##n );
#define MOCK_FUNCTION_IN(z, n, d) \
wrapper& in( BOOST_PP_ENUM_PARAMS(n, sequence& s) ) \
{ \
BOOST_PP_REPEAT(n, MOCK_FUNCTION_IN_ADD, _) \
return *this; \
}
BOOST_PP_REPEAT(MOCK_MAX_SEQUENCES,
MOCK_FUNCTION_IN, _)
#undef MOCK_FUNCTION_IN
#undef MOCK_FUNCTION_IN_ADD
template< typename TT >
void calls( TT t )
{
this->e_->calls( t );
}
template< typename TT >
void throws( TT t )
{
this->e_->throws( t );
}
template< typename TT >
void moves( BOOST_RV_REF(TT) t )
{
this->e_->moves( boost::move( t ) );
}
lock lock_;
};
public:
typedef wrapper wrapper_type;
wrapper expect( const char* file, int line )
{
lock _( mutex_ );
expectations_.push_back( expectation_type( file, line ) );
valid_ = true;
return wrapper( mutex_, expectations_.back() );
}
wrapper expect()
{
lock _( mutex_ );
expectations_.push_back( expectation_type() );
valid_ = true;
return wrapper( mutex_, expectations_.back() );
}
R operator()(
BOOST_PP_ENUM_BINARY_PARAMS(MOCK_NUM_ARGS, T, t) ) const
{
lock _( mutex_ );
valid_ = false;
for( expectations_cit it = expectations_.begin();
it != expectations_.end(); ++it )
if( it->is_valid(
BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_MOVE, _) ) )
{
if( ! it->invoke() )
{
error_type::fail( "sequence failed",
MOCK_FUNCTION_CONTEXT, it->file(), it->line() );
return error_type::abort();
}
if( ! it->valid() )
{
error_type::fail( "missing action",
MOCK_FUNCTION_CONTEXT, it->file(), it->line() );
return error_type::abort();
}
valid_ = true;
error_type::call(
MOCK_FUNCTION_CONTEXT, it->file(), it->line() );
if( it->functor() )
return it->functor()(
BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_MOVE, _) );
return it->trigger();
}
error_type::fail( "unexpected call", MOCK_FUNCTION_CONTEXT );
return error_type::abort();
}
void add( context& c, const void* p,
boost::unit_test::const_string instance,
boost::optional< type_name > type,
boost::unit_test::const_string name )
{
lock _( mutex_ );
if( ! context_ )
c.add( *this );
c.add( p, *this, instance, type, name );
context_ = &c;
}
friend std::ostream& operator<<(
std::ostream& s, const function_impl& impl )
{
lock _( impl.mutex_ );
return s << lazy_context( &impl ) << lazy_expectations( &impl );
}
struct lazy_context
{
lazy_context( const function_impl* impl )
: impl_( impl )
{}
friend std::ostream& operator<<(
std::ostream& s, const lazy_context& c )
{
if( c.impl_->context_ )
c.impl_->context_->serialize( s, *c.impl_ );
else
s << '?';
return s;
}
const function_impl* impl_;
};
struct lazy_expectations
{
lazy_expectations( const function_impl* impl )
: impl_( impl )
{}
friend std::ostream& operator<<(
std::ostream& s, const lazy_expectations& e )
{
for( expectations_cit it = e.impl_->expectations_.begin();
it != e.impl_->expectations_.end(); ++it )
s << std::endl << *it;
return s;
}
const function_impl* impl_;
};
typedef std::list< expectation_type > expectations_type;
typedef typename expectations_type::const_iterator expectations_cit;
expectations_type expectations_;
context* context_;
mutable bool valid_;
const int exceptions_;
const boost::shared_ptr< mutex > mutex_;
};
}
} // mock
#undef MOCK_FUNCTION_FORMAT
#undef MOCK_FUNCTION_CONTEXT
#undef MOCK_MOVE

View file

@ -1,11 +0,0 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#define MOCK_NUM_ARGS BOOST_PP_ITERATION()
#include "function_template.hpp"
#undef MOCK_NUM_ARGS

View file

@ -1,106 +0,0 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2008
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include "function_impl_template.hpp"
#define MOCK_MOVE(z, n, d) \
mock::detail::move_if_not_lvalue_reference< T##n >( t##n )
namespace mock
{
namespace detail
{
template< typename Signature > class function;
template< typename R
BOOST_PP_ENUM_TRAILING_PARAMS(MOCK_NUM_ARGS, typename T) >
class function< R ( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) >
{
public:
typedef R result_type;
template< typename Args >
struct sig
{
typedef R type;
};
private:
typedef function_impl<
R ( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) )
> impl_type;
typedef typename impl_type::wrapper_type expectation_type;
typedef typename impl_type::error_type error_type;
public:
function()
: impl_( boost::make_shared< impl_type >() )
{}
bool verify() const
{
return impl_->verify();
}
bool verify( const char* file, int line ) const
{
error_type::pass( file, line );
return impl_->verify();
}
void reset()
{
impl_->reset();
}
void reset( const char* file, int line )
{
error_type::pass( file, line );
impl_->reset();
}
expectation_type expect( const char* file, int line )
{
error_type::pass( file, line );
return impl_->expect( file, line );
}
expectation_type expect()
{
return impl_->expect();
}
R operator()(
BOOST_PP_ENUM_BINARY_PARAMS(MOCK_NUM_ARGS, T, t) ) const
{
return (*impl_)( BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_MOVE, _) );
}
friend std::ostream& operator<<( std::ostream& s, const function& f )
{
return s << *f.impl_;
}
function& operator()( context& c,
boost::unit_test::const_string instance )
{
impl_->add( c, impl_.get(), instance, boost::none, "" );
return *this;
}
void configure( context& c, const void* p,
boost::unit_test::const_string instance,
boost::optional< type_name > type,
boost::unit_test::const_string name ) const
{
impl_->add( c, p, instance, type, name );
}
private:
boost::shared_ptr< impl_type > impl_;
};
}
} // mock
#undef MOCK_MOVE

View file

@ -14,39 +14,41 @@
#include "mutex.hpp" #include "mutex.hpp"
#include "singleton.hpp" #include "singleton.hpp"
namespace mock namespace mock { namespace detail {
{ class functor_mutex_t : public singleton<functor_mutex_t>, public mutex
namespace detail
{
class functor_mutex_t :
public singleton< functor_mutex_t >,
public mutex
{ {
MOCK_SINGLETON_CONS( functor_mutex_t ); MOCK_SINGLETON_CONS(functor_mutex_t);
}; };
MOCK_SINGLETON_INST( functor_mutex ) MOCK_SINGLETON_INST(functor_mutex)
template< typename Signature > template<typename Signature>
struct functor : function< Signature > struct functor : function<Signature>
{ {
functor() functor()
{ {
scoped_lock _( functor_mutex ); scoped_lock _(functor_mutex);
static functor* f = 0; // MOCK_FUNCTOR creates 2 functor objects:
if( f ) // The user-usable one with the passed name and a 2nd used by MOCK_EXPECT with a suffixed name
// We need the 2nd to be a copy of the first and use a static variable for storing a pointer to the first
static functor* f = nullptr;
if(f)
{ {
*this = *f; // Release the lock from the first call (see below) so other threads can create functors again
f = 0; // after the function exits (the scoped_lock still holds the mutex)
functor_mutex.unlock(); functor_mutex.unlock();
} // Copy the first functor to the current (2nd) one
else *this = *f;
f = nullptr;
} else
{ {
functor_mutex.lock(); // This is the first object, store its pointer
f = this; f = this;
// Lock the mutex again so only this thread can create new instances of a functor
// making sure that we copy the right instance above and not one from a concurrent thread
functor_mutex.lock();
} }
} }
}; };
} }} // namespace mock::detail
} // mock
#endif // MOCK_FUNCTOR_HPP_INCLUDED #endif // MOCK_FUNCTOR_HPP_INCLUDED

View file

@ -11,54 +11,39 @@
#include "../config.hpp" #include "../config.hpp"
#include "verifiable.hpp" #include "verifiable.hpp"
#include <functional>
#include <algorithm> #include <algorithm>
#include <functional>
#include <vector> #include <vector>
namespace mock namespace mock { namespace detail {
{
namespace detail
{
class group class group
{ {
public: public:
void add( verifiable& v ) void add(verifiable& v) { verifiables_.push_back(&v); }
void remove(verifiable& v)
{ {
verifiables_.push_back( &v ); verifiables_.erase(std::remove(verifiables_.begin(), verifiables_.end(), &v), verifiables_.end());
}
void remove( verifiable& v )
{
verifiables_.erase(
std::remove( verifiables_.begin(), verifiables_.end(), &v ),
verifiables_.end() );
} }
bool verify() const bool verify() const
{ {
bool valid = true; bool valid = true;
for( verifiables_cit it = verifiables_.begin(); for(const auto* verifiable : verifiables_)
it != verifiables_.end(); ++it ) if(!verifiable->verify())
if( ! (*it)->verify() )
valid = false; valid = false;
return valid; return valid;
} }
void reset() void reset()
{ {
const verifiables_t verifiables = verifiables_; const auto verifiables = verifiables_;
for( verifiables_cit it = verifiables.begin(); for(auto* verifiable : verifiables)
it != verifiables.end(); ++it ) if(std::find(verifiables_.begin(), verifiables_.end(), verifiable) != verifiables_.end())
if( std::find( verifiables_.begin(), verifiables_.end(), *it ) verifiable->reset();
!= verifiables_.end() )
(*it)->reset();
} }
private: private:
typedef std::vector< verifiable* > verifiables_t; std::vector<verifiable*> verifiables_;
typedef verifiables_t::const_iterator verifiables_cit;
verifiables_t verifiables_;
}; };
} }} // namespace mock::detail
} // mock
#endif // MOCK_GROUP_HPP_INCLUDED #endif // MOCK_GROUP_HPP_INCLUDED

View file

@ -10,86 +10,70 @@
#define MOCK_INVOCATION_HPP_INCLUDED #define MOCK_INVOCATION_HPP_INCLUDED
#include "../config.hpp" #include "../config.hpp"
#include <boost/noncopyable.hpp>
#include <stdexcept>
#include <ostream>
#include <limits> #include <limits>
#include <ostream>
#include <stdexcept>
namespace mock namespace mock { namespace detail {
{ class invocation
namespace detail
{
class invocation : private boost::noncopyable
{ {
public: public:
invocation() {} invocation() = default;
virtual ~invocation() {} invocation(const invocation&) = delete;
invocation& operator=(const invocation&) = delete;
virtual ~invocation() = default;
virtual bool invoke() = 0; virtual bool invoke() = 0;
virtual bool verify() const = 0; virtual bool verify() const = 0;
virtual bool exhausted() const = 0; virtual bool exhausted() const = 0;
friend std::ostream& operator<<( std::ostream& s, const invocation& i ) friend std::ostream& operator<<(std::ostream& s, const invocation& i) { return i.serialize(s); }
{
return i.serialize( s );
}
private: private:
virtual std::ostream& serialize( std::ostream& s ) const = 0; virtual std::ostream& serialize(std::ostream& s) const = 0;
}; };
class between : public invocation class between : public invocation
{ {
public: public:
between( std::size_t min, std::size_t max ) between(std::size_t min, std::size_t max) : min_(min), max_(max), count_(0)
: min_( min )
, max_( max )
, count_( 0 )
{ {
if( min > max ) if(min > max)
throw std::invalid_argument( "'min' > 'max'" ); throw std::invalid_argument("'min' > 'max'");
} }
virtual bool invoke() virtual bool invoke()
{ {
if( count_ == max_ ) if(count_ == max_)
return false; return false;
++count_; ++count_;
return true; return true;
} }
virtual bool exhausted() const virtual bool exhausted() const { return count_ >= max_; }
{
return count_ >= max_;
}
virtual bool verify() const virtual bool verify() const { return min_ <= count_ && count_ <= max_; }
{
return min_ <= count_ && count_ <= max_;
}
protected: protected:
const std::size_t min_, max_; const std::size_t min_, max_;
std::size_t count_; std::size_t count_;
private: private:
virtual std::ostream& serialize( std::ostream& s ) const virtual std::ostream& serialize(std::ostream& s) const
{ {
return s << "between( " << count_ return s << "between( " << count_ << "/[" << min_ << ',' << max_ << "] )";
<< "/[" << min_ << ',' << max_ << "] )";
} }
}; };
class exactly : public between class exactly : public between
{ {
public: public:
explicit exactly( std::size_t count ) explicit exactly(std::size_t count) : between(count, count) {}
: between( count, count )
{}
private: private:
virtual std::ostream& serialize( std::ostream& s ) const virtual std::ostream& serialize(std::ostream& s) const
{ {
return s << "exactly( " << count_ << '/' << max_ << " )"; return s << "exactly( " << count_ << '/' << max_ << " )";
} }
@ -98,40 +82,28 @@ namespace detail
class never : public exactly class never : public exactly
{ {
public: public:
never() never() : exactly(0) {}
: exactly( 0 )
{}
private: private:
virtual std::ostream& serialize( std::ostream& s ) const virtual std::ostream& serialize(std::ostream& s) const { return s << "never()"; }
{
return s << "never()";
}
}; };
class once : public exactly class once : public exactly
{ {
public: public:
once() once() : exactly(1) {}
: exactly( 1 )
{}
private: private:
virtual std::ostream& serialize( std::ostream& s ) const virtual std::ostream& serialize(std::ostream& s) const { return s << "once()"; }
{
return s << "once()";
}
}; };
class at_least : public between class at_least : public between
{ {
public: public:
explicit at_least( std::size_t min ) explicit at_least(std::size_t min) : between(min, (std::numeric_limits<std::size_t>::max)()) {}
: between( min, (std::numeric_limits< std::size_t >::max)() )
{}
private: private:
virtual std::ostream& serialize( std::ostream& s ) const virtual std::ostream& serialize(std::ostream& s) const
{ {
return s << "at_least( " << count_ << '/' << min_ << " )"; return s << "at_least( " << count_ << '/' << min_ << " )";
} }
@ -140,12 +112,10 @@ namespace detail
class at_most : public between class at_most : public between
{ {
public: public:
explicit at_most( std::size_t max ) explicit at_most(std::size_t max) : between(0, max) {}
: between( 0, max )
{}
private: private:
virtual std::ostream& serialize( std::ostream& s ) const virtual std::ostream& serialize(std::ostream& s) const
{ {
return s << "at_most( " << count_ << '/' << max_ << " )"; return s << "at_most( " << count_ << '/' << max_ << " )";
} }
@ -154,17 +124,11 @@ namespace detail
class unlimited : public at_least class unlimited : public at_least
{ {
public: public:
unlimited() unlimited() : at_least(0) {}
: at_least( 0 )
{}
private: private:
virtual std::ostream& serialize( std::ostream& s ) const virtual std::ostream& serialize(std::ostream& s) const { return s << "unlimited()"; }
{
return s << "unlimited()";
}
}; };
} }} // namespace mock::detail
} // mock
#endif // MOCK_INVOCATION_HPP_INCLUDED #endif // MOCK_INVOCATION_HPP_INCLUDED

View file

@ -10,53 +10,17 @@
#define MOCK_IS_FUNCTOR_HPP_INCLUDED #define MOCK_IS_FUNCTOR_HPP_INCLUDED
#include "../config.hpp" #include "../config.hpp"
#include <boost/function_types/is_callable_builtin.hpp> #include "void_t.hpp"
#include <boost/type_traits/detail/yes_no_type.hpp> #include <type_traits>
#include <boost/utility/declval.hpp>
#include <boost/mpl/has_xxx.hpp>
#include <boost/mpl/or.hpp>
namespace mock namespace mock { namespace detail {
{ /// Trait to return true if F is a functor that can be called with a single argument Arg
namespace detail template<typename F, typename Arg, class = void>
{ struct is_functor : std::false_type
BOOST_MPL_HAS_XXX_TRAIT_DEF( result_type )
BOOST_MPL_HAS_XXX_TEMPLATE_DEF( sig )
BOOST_MPL_HAS_XXX_TEMPLATE_DEF( result )
#ifdef MOCK_DECLTYPE
template< typename F, typename P >
struct is_callable
{
typedef boost::type_traits::yes_type yes_type;
typedef boost::type_traits::no_type no_type;
template< typename T >
static yes_type check(
decltype( boost::declval< T >()( boost::declval< P >() ) )* );
template< typename T >
static no_type check( ... );
typedef boost::mpl::bool_<
sizeof( check< F >( 0 ) ) == sizeof( yes_type ) > type;
};
#endif // MOCK_DECLTYPE
template< typename T, typename P >
struct is_functor
: boost::mpl::or_<
boost::function_types::is_callable_builtin< T >,
#ifdef MOCK_DECLTYPE
is_callable< T, P >,
#endif
has_result_type< T >,
has_result< T >,
has_sig< T >
>
{}; {};
} template<typename F, typename Arg>
} // mock struct is_functor<F, Arg, void_t<decltype(std::declval<F>()(std::declval<Arg>()))>> : std::true_type
{};
}} // namespace mock::detail
#endif // MOCK_IS_FUNCTOR_HPP_INCLUDED #endif // MOCK_IS_FUNCTOR_HPP_INCLUDED

View file

@ -0,0 +1,38 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef MOCK_MATCHER_BASE_HPP_INCLUDED
#define MOCK_MATCHER_BASE_HPP_INCLUDED
#include "ref_arg.hpp"
#include <ostream>
namespace mock { namespace detail {
template<typename... Args>
class matcher_base
{
public:
matcher_base() = default;
matcher_base(const matcher_base&) = delete;
matcher_base& operator=(const matcher_base&) = delete;
virtual ~matcher_base() = default;
virtual bool operator()(ref_arg_t<Args>...) = 0;
friend std::ostream& operator<<(std::ostream& s, const matcher_base& m)
{
m.serialize(s);
return s;
}
private:
virtual void serialize(std::ostream&) const = 0;
};
}} // namespace mock::detail
#endif // MOCK_MATCHER_BASE_HPP_INCLUDED

View file

@ -1,42 +0,0 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#define MOCK_REF_ARG(z, n, d) \
typename ref_arg< T##n >::type
namespace mock
{
namespace detail
{
template< typename Signature > class matcher_base;
template<
BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, typename T) >
class matcher_base< void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) >
: boost::noncopyable
{
public:
virtual ~matcher_base() {}
virtual bool operator()(
BOOST_PP_ENUM(MOCK_NUM_ARGS, MOCK_REF_ARG, _) ) = 0;
friend std::ostream& operator<<(
std::ostream& s, const matcher_base& m )
{
m.serialize( s );
return s;
}
private:
virtual void serialize( std::ostream& ) const = 0;
};
}
} // mock
#undef MOCK_REF_ARG

View file

@ -0,0 +1,114 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2008
// Copyright 2022-2025 Alexander Grund
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef MOCK_MOCK_IMPL_HPP_INCLUDED
#define MOCK_MOCK_IMPL_HPP_INCLUDED
#include "function.hpp"
#include "functor.hpp"
#include "signature.hpp"
#include "signature_traits.hpp"
#include "type_name.hpp"
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/stringize.hpp>
#include <type_traits>
namespace mock { namespace detail {
/// Simplified trait to extract the argument type of a function signature with 1 argument
template<typename T>
struct arg_type;
template<typename T, typename U>
struct arg_type<T(U)>
{
using type = U;
};
/// Used in MOCK_PROTECT_SIGNATURE to unwrap the passed function signature
/// T is something like `void(std::map<int, float>)`
template<typename T>
using unwrap_signature_t = std::remove_pointer_t<typename arg_type<T>::type>;
}} // namespace mock::detail
#define MOCK_HELPER(t) t##_mock(mock::detail::root, BOOST_PP_STRINGIZE(t))
#define MOCK_ANONYMOUS_HELPER(t) t##_mock(mock::detail::root, "?.")
#define MOCK_METHOD_HELPER(S, t) \
mutable mock::detail::function<S> t##_mock_; \
mock::detail::function<S>& t##_mock(const mock::detail::context&, const boost::unit_test::const_string& instance) \
const \
{ \
mock::detail::configure(*this, \
t##_mock_, \
instance.substr(0, instance.rfind(BOOST_PP_STRINGIZE(t))), \
mock::detail::make_type_name(*this), \
BOOST_PP_STRINGIZE(t)); \
return t##_mock_; \
}
#define MOCK_PARAM(S, n) mock::detail::parameter_t<S, n>
#define MOCK_DECL_PARAM(z, n, S) MOCK_PARAM(S, n) p##n
#define MOCK_DECL_PARAMS(n, S) BOOST_PP_ENUM(n, MOCK_DECL_PARAM, S)
#define MOCK_DECL(name, arity, signature, qualifier) \
mock::detail::result_type_t<signature> name(MOCK_DECL_PARAMS(arity, signature)) qualifier
#define MOCK_FORWARD_PARAM(z, n, S) std::forward<MOCK_PARAM(S, n)>(p##n)
#define MOCK_FORWARD_PARAMS(n, S) BOOST_PP_ENUM(n, MOCK_FORWARD_PARAM, S)
#define MOCK_METHOD_AUX(name, arity, signature, identifier, qualifier) \
MOCK_DECL(name, arity, signature, qualifier) \
{ \
return MOCK_ANONYMOUS_HELPER(identifier)(MOCK_FORWARD_PARAMS(arity, signature)); \
}
#define MOCK_METHOD_EXT(name, arity, signature, identifier) \
MOCK_METHOD_AUX(name, arity, signature, identifier, ) \
MOCK_METHOD_AUX(name, arity, signature, identifier, const) \
MOCK_METHOD_HELPER(signature, identifier)
#define MOCK_CONST_METHOD_EXT(name, arity, signature, identifier) \
MOCK_METHOD_AUX(name, arity, signature, identifier, const) \
MOCK_METHOD_HELPER(signature, identifier)
#define MOCK_NON_CONST_METHOD_EXT(name, arity, signature, identifier) \
MOCK_METHOD_AUX(name, arity, signature, identifier, ) \
MOCK_METHOD_HELPER(signature, identifier)
#define MOCK_FUNCTION_HELPER(signature, identifier, prefix) \
prefix mock::detail::function<signature>& identifier##_mock(mock::detail::context& context, \
boost::unit_test::const_string instance) \
{ \
static mock::detail::function<signature> f; \
return f(context, instance); \
}
#define MOCK_FUNCTION_AUX(name, arity, signature, identifier, prefix) \
MOCK_FUNCTION_HELPER(signature, identifier, prefix) \
static_assert(arity == mock::detail::function_arity_t<signature>::value, "Arity mismatch"); \
prefix MOCK_DECL(name, arity, signature, ) \
{ \
return MOCK_HELPER(identifier)(MOCK_FORWARD_PARAMS(arity, signature)); \
}
#define MOCK_REPLACED_MACRO_ERROR(oldName, newName) static_assert(false, #oldName " has been replaced by " #newName)
// Replaced macros
#define MOCK_CONST_CONVERSION_OPERATOR_TPL(...) \
MOCK_REPLACED_MACRO_ERROR(MOCK_CONST_CONVERSION_OPERATOR_TPL, MOCK_CONST_CONVERSION_OPERATOR)
#define MOCK_CONST_METHOD_EXT_TPL(...) MOCK_REPLACED_MACRO_ERROR(MOCK_CONST_METHOD_EXT_TPL, MOCK_CONST_METHOD)
#define MOCK_CONST_METHOD_TPL(...) MOCK_REPLACED_MACRO_ERROR(MOCK_CONST_METHOD_TPL, MOCK_CONST_METHOD)
#define MOCK_CONVERSION_OPERATOR_TPL(...) \
MOCK_REPLACED_MACRO_ERROR(MOCK_CONVERSION_OPERATOR_TPL, MOCK_CONVERSION_OPERATOR)
#define MOCK_FUNCTOR_TPL(...) MOCK_REPLACED_MACRO_ERROR(MOCK_FUNCTOR_TPL, MOCK_FUNCTOR)
#define MOCK_METHOD_EXT_TPL(...) MOCK_REPLACED_MACRO_ERROR(MOCK_METHOD_EXT_TPL, MOCK_METHOD)
#define MOCK_METHOD_TPL(...) MOCK_REPLACED_MACRO_ERROR(MOCK_METHOD_TPL, MOCK_METHOD)
#define MOCK_NON_CONST_CONVERSION_OPERATOR_TPL(...) \
MOCK_REPLACED_MACRO_ERROR(MOCK_NON_CONST_CONVERSION_OPERATOR_TPL, MOCK_NON_CONST_CONVERSION_OPERATOR)
#define MOCK_NON_CONST_METHOD_EXT_TPL(...) \
MOCK_REPLACED_MACRO_ERROR(MOCK_NON_CONST_METHOD_EXT_TPL, MOCK_NON_CONST_METHOD)
#define MOCK_NON_CONST_METHOD_TPL(...) MOCK_REPLACED_MACRO_ERROR(MOCK_NON_CONST_METHOD_TPL, MOCK_NON_CONST_METHOD)
#define MOCK_STATIC_METHOD_TPL(...) MOCK_REPLACED_MACRO_ERROR(MOCK_STATIC_METHOD_TPL, MOCK_STATIC_METHOD)
#define MOCK_CONSTRUCTOR_TPL(...) MOCK_REPLACED_MACRO_ERROR(MOCK_CONSTRUCTOR_TPL, MOCK_CONSTRUCTOR)
#endif // MOCK_MOCK_IMPL_HPP_INCLUDED

View file

@ -1,78 +0,0 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2018
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef MOCK_MOVE_HELPER_HPP_INCLUDED
#define MOCK_MOVE_HELPER_HPP_INCLUDED
#include "../config.hpp"
#include <boost/type_traits/conditional.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/add_rvalue_reference.hpp>
#include <boost/type_traits/decay.hpp>
namespace mock
{
namespace detail
{
#ifdef MOCK_RVALUE_REFERENCES
template< typename T >
struct forward_type
{
typedef T type;
};
template< typename T >
struct ref_arg
{
typedef typename boost::conditional<
boost::is_reference< T >::value,
T,
typename boost::add_rvalue_reference< T >::type >::type type;
};
template< typename T >
inline T&& move_if_not_lvalue_reference(typename boost::remove_reference< T >::type& t)
{
return static_cast< T&& >(t);
}
template< typename T >
inline T&& move_if_not_lvalue_reference(typename boost::remove_reference< T >::type&& t)
{
return static_cast< T&& >(t);
}
#else
template< typename T >
struct forward_type
{
typedef typename boost::decay< const T >::type type;
};
template< class T>
struct forward_type< boost::rv< T > >
{
typedef T type;
};
template< typename T >
struct ref_arg
{
typedef typename boost::conditional<
boost::is_reference< T >::value,
T,
const typename boost::add_reference< T >::type >::type type;
};
template< typename T >
inline typename boost::remove_reference< T >::type& move_if_not_lvalue_reference(typename boost::remove_reference< T >::type& t)
{
return t;
}
#endif
}
}
#endif // MOCK_MOVE_HELPER_HPP_INCLUDED

View file

@ -11,156 +11,124 @@
#include "../config.hpp" #include "../config.hpp"
#include "singleton.hpp" #include "singleton.hpp"
#include <boost/move/move.hpp> #include <memory>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#ifdef MOCK_THREAD_SAFE #ifdef MOCK_THREAD_SAFE
#ifdef MOCK_HDR_MUTEX # ifdef MOCK_HDR_MUTEX
#include <mutex> # include <mutex>
#else # else
#include <boost/thread/recursive_mutex.hpp> # include <boost/thread/lock_guard.hpp>
#include <boost/thread/lock_guard.hpp> # include <boost/thread/recursive_mutex.hpp>
#endif # endif
namespace mock namespace mock { namespace detail {
{ # ifdef MOCK_HDR_MUTEX
namespace detail
{
#ifdef MOCK_HDR_MUTEX
typedef std::recursive_mutex mutex; typedef std::recursive_mutex mutex;
typedef std::lock_guard< mutex > scoped_lock; typedef std::lock_guard<mutex> scoped_lock;
#else # else
typedef boost::recursive_mutex mutex; typedef boost::recursive_mutex mutex;
typedef boost::lock_guard< mutex > scoped_lock; typedef boost::lock_guard<mutex> scoped_lock;
#endif # endif
struct lock struct lock
{ {
private:
BOOST_MOVABLE_BUT_NOT_COPYABLE(lock)
public: public:
lock( const boost::shared_ptr< mutex >& m ) lock(const std::shared_ptr<mutex>& m) : m_(m) { m_->lock(); }
: m_( m )
{
m_->lock();
}
~lock() ~lock()
{ {
if( m_ ) if(m_)
m_->unlock(); m_->unlock();
} }
lock( BOOST_RV_REF( lock ) x ) lock(const lock&) = delete;
: m_( x.m_ ) lock(lock&& x) = default;
{ lock& operator=(const lock&) = delete;
// Explicit reset to avoid unlock in destructor lock& operator=(lock&& x) = default;
x.m_.reset();
}
lock& operator=( BOOST_RV_REF( lock ) x )
{
m_ = x.m_;
x.m_.reset();
return *this;
}
private: private:
boost::shared_ptr< mutex > m_; std::shared_ptr<mutex> m_;
}; };
} }} // namespace mock::detail
} // mock
#else // MOCK_THREAD_SAFE #else // MOCK_THREAD_SAFE
namespace mock namespace mock { namespace detail {
{ struct mutex
namespace detail
{
struct mutex : boost::noncopyable
{ {
void lock() mutex() = default;
{} mutex(const mutex&) = delete;
void unlock() mutex& operator=(const mutex&) = delete;
{}
void lock() {}
void unlock() {}
}; };
// Dummy lock classes. // Dummy lock classes.
// Constructor + Destructor make it RAII classes for compilers and avoid unused variable warnings // Constructor + Destructor make it RAII classes for compilers and avoid unused variable warnings
struct scoped_lock : boost::noncopyable struct scoped_lock
{ {
scoped_lock( mutex& ) scoped_lock(const scoped_lock&) = delete;
{} scoped_lock& operator=(const scoped_lock&) = delete;
~scoped_lock()
{}
};
class lock : boost::noncopyable
{
private:
BOOST_MOVABLE_BUT_NOT_COPYABLE(lock)
public: scoped_lock(mutex&) {}
lock( const boost::shared_ptr< mutex >& ) ~scoped_lock() {}
{}
~lock()
{}
lock( BOOST_RV_REF( lock ) )
{}
lock& operator=( BOOST_RV_REF( lock ) )
{
return *this;
}
}; };
} class lock
} // mock {
public:
lock(const std::shared_ptr<mutex>&) {}
~lock() {}
lock(const lock&) = delete;
lock(lock&&) = default;
lock& operator=(const lock&) = delete;
lock& operator=(lock&&) = default;
};
}} // namespace mock::detail
#endif // MOCK_THREAD_SAFE #endif // MOCK_THREAD_SAFE
namespace mock namespace mock { namespace detail {
{ class error_mutex_t : public singleton<error_mutex_t>, public mutex
namespace detail
{
class error_mutex_t : public singleton< error_mutex_t >,
public mutex
{ {
MOCK_SINGLETON_CONS( error_mutex_t ); MOCK_SINGLETON_CONS(error_mutex_t);
}; };
MOCK_SINGLETON_INST( error_mutex ) MOCK_SINGLETON_INST(error_mutex)
#ifdef BOOST_MSVC #ifdef BOOST_MSVC
# pragma warning( push ) # pragma warning(push)
# pragma warning( disable: 4702 ) # pragma warning(disable : 4702)
#endif #endif
template< typename Result, typename Error > template<typename Result, typename Error>
struct safe_error struct safe_error
{ {
static Result abort() static Result abort()
{ {
scoped_lock _( error_mutex ); scoped_lock _(error_mutex);
return Error::abort(); return Error::abort();
} }
template< typename Context > template<typename Context>
static void fail( const char* message, const Context& context, static void fail(const char* message,
const char* file = "unknown location", int line = 0 ) const Context& context,
const char* file = "unknown location",
int line = 0)
{ {
scoped_lock _( error_mutex ); scoped_lock _(error_mutex);
Error::fail( message, context, file, line ); Error::fail(message, context, file, line);
} }
template< typename Context > template<typename Context>
static void call( const Context& context, const char* file, int line ) static void call(const Context& context, const char* file, int line)
{ {
scoped_lock _( error_mutex ); scoped_lock _(error_mutex);
Error::call( context, file, line ); Error::call(context, file, line);
} }
static void pass( const char* file, int line ) static void pass(const char* file, int line)
{ {
scoped_lock _( error_mutex ); scoped_lock _(error_mutex);
Error::pass( file, line ); Error::pass(file, line);
} }
}; };
#ifdef BOOST_MSVC #ifdef BOOST_MSVC
# pragma warning( pop ) # pragma warning(pop)
#endif #endif
} }} // namespace mock::detail
} // mock
#endif // MOCK_MUTEX_HPP_INCLUDED #endif // MOCK_MUTEX_HPP_INCLUDED

View file

@ -10,58 +10,51 @@
#define MOCK_OBJECT_IMPL_HPP_INCLUDED #define MOCK_OBJECT_IMPL_HPP_INCLUDED
#include "../config.hpp" #include "../config.hpp"
#include "root.hpp"
#include "parent.hpp"
#include "type_name.hpp"
#include "context.hpp"
#include "child.hpp" #include "child.hpp"
#include "context.hpp"
#include "mutex.hpp" #include "mutex.hpp"
#include <boost/test/utils/basic_cstring/basic_cstring.hpp> #include "parent.hpp"
#include <boost/enable_shared_from_this.hpp> #include "root.hpp"
#include <boost/make_shared.hpp> #include "type_name.hpp"
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
namespace mock namespace mock { namespace detail {
{ class object_impl : public context, public verifiable, public std::enable_shared_from_this<object_impl>
namespace detail
{
class object_impl : public context, public verifiable,
public boost::enable_shared_from_this< object_impl >
{ {
public: public:
object_impl() object_impl() : mutex_(std::make_shared<mutex>()) {}
: mutex_( boost::make_shared< mutex >() )
{}
virtual void add( const void* /*p*/, verifiable& v, virtual void add(const void* /*p*/,
boost::unit_test::const_string instance, verifiable& v,
boost::optional< type_name > type, boost::unit_test::const_string instance,
boost::unit_test::const_string name ) boost::optional<type_name> type,
boost::unit_test::const_string name)
{ {
lock _( mutex_ ); lock _(mutex_);
if( children_.empty() ) if(children_.empty())
detail::root.add( *this ); detail::root.add(*this);
children_[ &v ].update( parent_, instance, type, name ); children_[&v].update(parent_, instance, type, name);
} }
virtual void add( verifiable& v ) virtual void add(verifiable& v)
{ {
lock _( mutex_ ); lock _(mutex_);
group_.add( v ); group_.add(v);
} }
virtual void remove( verifiable& v ) virtual void remove(verifiable& v)
{ {
lock _( mutex_ ); lock _(mutex_);
group_.remove( v ); group_.remove(v);
children_.erase( &v ); children_.erase(&v);
if( children_.empty() ) if(children_.empty())
detail::root.remove( *this ); detail::root.remove(*this);
} }
virtual void serialize( std::ostream& s, const verifiable& v ) const virtual void serialize(std::ostream& s, const verifiable& v) const
{ {
lock _( mutex_ ); lock _(mutex_);
children_cit it = children_.find( &v ); const auto it = children_.find(&v);
if( it != children_.end() ) if(it != children_.end())
s << it->second; s << it->second;
else else
s << "?"; s << "?";
@ -69,26 +62,22 @@ namespace detail
virtual bool verify() const virtual bool verify() const
{ {
lock _( mutex_ ); lock _(mutex_);
return group_.verify(); return group_.verify();
} }
virtual void reset() virtual void reset()
{ {
lock _( mutex_ ); lock _(mutex_);
boost::shared_ptr< object_impl > guard = shared_from_this(); std::shared_ptr<object_impl> guard = shared_from_this();
group_.reset(); group_.reset();
} }
private: private:
typedef std::map< const verifiable*, child > children_t;
typedef children_t::const_iterator children_cit;
group group_; group group_;
parent parent_; parent parent_;
children_t children_; std::map<const verifiable*, child> children_;
const boost::shared_ptr< mutex > mutex_; const std::shared_ptr<mutex> mutex_;
}; };
} }} // namespace mock::detail
} // mock
#endif // MOCK_OBJECT_IMPL_HPP_INCLUDED #endif // MOCK_OBJECT_IMPL_HPP_INCLUDED

View file

@ -1,34 +0,0 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef MOCK_PARAMETER_HPP_INCLUDED
#define MOCK_PARAMETER_HPP_INCLUDED
#include "../config.hpp"
#include <boost/function_types/parameter_types.hpp>
#include <boost/function_types/function_arity.hpp>
#include <boost/mpl/at.hpp>
namespace mock
{
namespace detail
{
template< typename Signature, int n >
struct parameter
{
typedef typename
boost::mpl::at_c<
typename
boost::function_types::parameter_types< Signature >,
n
>::type type;
};
}
} // mock
#endif // MOCK_PARAMETER_HPP_INCLUDED

View file

@ -11,36 +11,30 @@
#include "../config.hpp" #include "../config.hpp"
#include "type_name.hpp" #include "type_name.hpp"
#include <boost/test/utils/basic_cstring/io.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/test/utils/basic_cstring/io.hpp>
#include <ostream> #include <ostream>
namespace mock namespace mock { namespace detail {
{
namespace detail
{
class parent class parent
{ {
public: public:
parent() parent() = default;
parent(boost::unit_test::const_string instance, boost::optional<type_name> type)
: instance_(instance), type_(type)
{} {}
parent( boost::unit_test::const_string instance, friend std::ostream& operator<<(std::ostream& s, const parent& p)
boost::optional< type_name > type )
: instance_( instance )
, type_( type )
{}
friend std::ostream& operator<<( std::ostream& s, const parent& p )
{ {
s << p.instance_; s << p.instance_;
if( p.type_ ) if(p.type_)
s << *p.type_ << "::"; s << *p.type_ << "::";
return s; return s;
} }
private: private:
boost::unit_test::const_string instance_; boost::unit_test::const_string instance_;
boost::optional< type_name > type_; boost::optional<type_name> type_;
}; };
} }} // namespace mock::detail
} // mock
#endif // MOCK_PARENT_HPP_INCLUDED #endif // MOCK_PARENT_HPP_INCLUDED

View file

@ -0,0 +1,22 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2018
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef MOCK_REF_ARG_HPP_INCLUDED
#define MOCK_REF_ARG_HPP_INCLUDED
#include <type_traits>
namespace mock { namespace detail {
/// Make T a reference type:
/// If T is already a reference type, return T, else return an rvalue reference to T
/// Useful to pass along arguments keeping the ability to modify them (e.g. move from them)
template<typename T>
using ref_arg_t = typename std::conditional<std::is_reference<T>::value, T, std::add_rvalue_reference_t<T>>::type;
}} // namespace mock::detail
#endif // MOCK_REF_ARG_HPP_INCLUDED

View file

@ -10,128 +10,110 @@
#define MOCK_ROOT_HPP_INCLUDED #define MOCK_ROOT_HPP_INCLUDED
#include "../config.hpp" #include "../config.hpp"
#include "parent.hpp"
#include "group.hpp"
#include "context.hpp"
#include "child.hpp" #include "child.hpp"
#include "context.hpp"
#include "group.hpp"
#include "mutex.hpp" #include "mutex.hpp"
#include "parent.hpp"
#include "singleton.hpp" #include "singleton.hpp"
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <ostream>
#include <map> #include <map>
#include <ostream>
namespace mock namespace mock { namespace detail {
{ class root_t : public singleton<root_t>, public context
namespace detail
{
class root_t : public singleton< root_t >, public context
{ {
public: public:
virtual void add( const void* p, verifiable& v, virtual void add(const void* p,
boost::unit_test::const_string instance, verifiable& v,
boost::optional< type_name > type, boost::unit_test::const_string instance,
boost::unit_test::const_string name ) boost::optional<type_name> type,
boost::unit_test::const_string name)
{ {
scoped_lock _( mutex_ ); scoped_lock _(mutex_);
children_t::iterator it = children_.lower_bound( &v ); auto it = children_.lower_bound(&v);
if( it == children_.end() || if(it == children_.end() || children_.key_comp()(&v, it->first))
children_.key_comp()( &v, it->first ) ) it = children_.insert(it, std::make_pair(&v, counter_child(parents_, p)));
it = children_.insert( it, it->second.update(instance, type, name);
std::make_pair( &v, counter_child( parents_, p ) ) );
it->second.update( instance, type, name );
} }
virtual void add( verifiable& v ) virtual void add(verifiable& v)
{ {
scoped_lock _( mutex_ ); scoped_lock _(mutex_);
group_.add( v ); group_.add(v);
} }
virtual void remove( verifiable& v ) virtual void remove(verifiable& v)
{ {
scoped_lock _( mutex_ ); scoped_lock _(mutex_);
group_.remove( v ); group_.remove(v);
children_.erase( &v ); children_.erase(&v);
} }
bool verify() const bool verify() const
{ {
scoped_lock _( mutex_ ); scoped_lock _(mutex_);
return group_.verify(); return group_.verify();
} }
void reset() void reset()
{ {
scoped_lock _( mutex_ ); scoped_lock _(mutex_);
group_.reset(); group_.reset();
} }
virtual void serialize( std::ostream& s, const verifiable& v ) const virtual void serialize(std::ostream& s, const verifiable& v) const
{ {
scoped_lock _( mutex_ ); scoped_lock _(mutex_);
children_cit it = children_.find( &v ); const auto it = children_.find(&v);
if( it != children_.end() ) if(it != children_.end())
s << it->second; s << it->second;
else else
s << "?"; s << "?";
} }
private: private:
typedef std::map< const void*, typedef std::map<const void*, std::pair<parent, std::size_t>> parents_t;
std::pair< parent, std::size_t > > parents_t;
class counter_child class counter_child
{ {
public: public:
counter_child( parents_t& parents, const void* p ) counter_child(parents_t& parents, const void* p)
: parents_( &parents ) : parents_(&parents), it_(parents.insert(std::make_pair(p, parents_t::mapped_type())).first)
, it_( parents.insert(
std::make_pair( p, parents_t::mapped_type() ) ).first )
{ {
++it_->second.second; ++it_->second.second;
} }
counter_child( const counter_child& rhs ) counter_child(const counter_child& rhs) : parents_(rhs.parents_), it_(rhs.it_), child_(rhs.child_)
: parents_( rhs.parents_ )
, it_( rhs.it_ )
, child_( rhs.child_ )
{ {
++it_->second.second; ++it_->second.second;
} }
~counter_child() ~counter_child()
{ {
if( --it_->second.second == 0 ) if(--it_->second.second == 0)
parents_->erase( it_ ); parents_->erase(it_);
} }
void update( boost::unit_test::const_string instance, void update(boost::unit_test::const_string instance,
boost::optional< type_name > type, boost::optional<type_name> type,
boost::unit_test::const_string name ) boost::unit_test::const_string name)
{ {
child_.update( it_->second.first, instance, type, name ); child_.update(it_->second.first, instance, type, name);
}
friend std::ostream& operator<<( std::ostream& s,
const counter_child& c )
{
return s << c.child_;
} }
friend std::ostream& operator<<(std::ostream& s, const counter_child& c) { return s << c.child_; }
private: private:
counter_child& operator=( const counter_child& ); counter_child& operator=(const counter_child&);
parents_t* parents_; parents_t* parents_;
parents_t::iterator it_; parents_t::iterator it_;
child child_; child child_;
}; };
typedef std::map< const verifiable*, counter_child > children_t;
typedef children_t::const_iterator children_cit;
parents_t parents_; parents_t parents_;
children_t children_; std::map<const verifiable*, counter_child> children_;
group group_; group group_;
mutable mutex mutex_; mutable mutex mutex_;
MOCK_SINGLETON_CONS( root_t ); MOCK_SINGLETON_CONS(root_t);
}; };
MOCK_SINGLETON_INST( root ) MOCK_SINGLETON_INST(root)
} }} // namespace mock::detail
} // mock
#endif // MOCK_ROOT_HPP_INCLUDED #endif // MOCK_ROOT_HPP_INCLUDED

View file

@ -11,57 +11,45 @@
#include "../config.hpp" #include "../config.hpp"
#include "mutex.hpp" #include "mutex.hpp"
#include <boost/noncopyable.hpp>
#include <boost/make_shared.hpp>
#include <algorithm> #include <algorithm>
#include <memory>
#include <vector> #include <vector>
namespace mock namespace mock { namespace detail {
{ class sequence_impl
namespace detail
{
class sequence_impl : private boost::noncopyable
{ {
public: public:
sequence_impl() sequence_impl() : mutex_(std::make_shared<mutex>()) {}
: mutex_( boost::make_shared< mutex >() )
{}
void add( void* e ) void add(void* e)
{ {
lock _( mutex_ ); lock _(mutex_);
elements_.push_back( e ); elements_.push_back(e);
} }
void remove( void* e ) void remove(void* e)
{ {
lock _( mutex_ ); lock _(mutex_);
elements_.erase( std::remove( elements_.begin(), elements_.erase(std::remove(elements_.begin(), elements_.end(), e), elements_.end());
elements_.end(), e ), elements_.end() );
} }
bool is_valid( const void* e ) const bool is_valid(const void* e) const
{ {
lock _( mutex_ ); lock _(mutex_);
return std::find( elements_.begin(), elements_.end(), e ) return std::find(elements_.begin(), elements_.end(), e) != elements_.end();
!= elements_.end();
} }
void invalidate( const void* e ) void invalidate(const void* e)
{ {
lock _( mutex_ ); lock _(mutex_);
elements_type::iterator it = const auto it = std::find(elements_.begin(), elements_.end(), e);
std::find( elements_.begin(), elements_.end(), e ); if(it != elements_.end())
if( it != elements_.end() ) elements_.erase(elements_.begin(), it);
elements_.erase( elements_.begin(), it );
} }
private: private:
typedef std::vector< void* > elements_type; std::vector<void*> elements_;
const std::shared_ptr<mutex> mutex_;
elements_type elements_;
const boost::shared_ptr< mutex > mutex_;
}; };
} }} // namespace mock::detail
} // mock
#endif // MOCK_SEQUENCE_IMPL_HPP_INCLUDED #endif // MOCK_SEQUENCE_IMPL_HPP_INCLUDED

View file

@ -10,54 +10,68 @@
#define MOCK_SIGNATURE_HPP_INCLUDED #define MOCK_SIGNATURE_HPP_INCLUDED
#include "../config.hpp" #include "../config.hpp"
#include <boost/function_types/parameter_types.hpp> #include <type_traits>
#include <boost/function_types/function_type.hpp>
#include <boost/function_types/result_type.hpp>
#include <boost/mpl/single_view.hpp>
#include <boost/mpl/joint_view.hpp>
#include <boost/mpl/pop_front.hpp>
#define BOOST_TYPEOF_SILENT
#include <boost/typeof/typeof.hpp>
namespace mock namespace mock { namespace detail {
{ #define MOCK_NOARG
namespace detail #define MOCK_STRIP_FUNCTION_QUALIFIERS(cv, ref) \
{ template<typename R, typename... Args> \
template< typename M > struct strip_function_qualifiers<R(Args...) cv ref> \
struct signature : { \
boost::function_types::function_type< using type = R(Args...); \
boost::mpl::joint_view< }; \
boost::mpl::single_view< template<typename R, typename... Args> \
typename struct strip_function_qualifiers<R(Args..., ...) cv ref> \
boost::function_types::result_type< M >::type { \
>, using type = R(Args..., ...); \
typename boost::mpl::pop_front<
typename
boost::function_types::parameter_types< M >
>::type
>
>
{};
template< typename T >
struct base
{
typedef T base_type;
}; };
// if an error is generated by the line below it means #define MOCK_STRIP_FUNCTION_QUALIFIERS_REF(cv) \
// the method is ambiguous : specify its signature to MOCK_STRIP_FUNCTION_QUALIFIERS(cv, ) \
// disambiguate MOCK_STRIP_FUNCTION_QUALIFIERS(cv, &) \
template< typename T > MOCK_STRIP_FUNCTION_QUALIFIERS(cv, &&)
T& ambiguous_method_requires_to_specify_signature( const T& );
} template<typename>
} // mock struct strip_function_qualifiers;
MOCK_STRIP_FUNCTION_QUALIFIERS_REF(MOCK_NOARG)
MOCK_STRIP_FUNCTION_QUALIFIERS_REF(const)
MOCK_STRIP_FUNCTION_QUALIFIERS_REF(volatile)
MOCK_STRIP_FUNCTION_QUALIFIERS_REF(const volatile)
#undef MOCK_NOARG
#undef MOCK_STRIP_FUNCTION_QUALIFIERS
#undef MOCK_STRIP_FUNCTION_QUALIFIERS_REF
template<typename M>
struct signature;
template<typename R, typename... Args>
struct signature<R(Args...)>
{
using type = R(Args...);
};
template<typename Sig, typename C>
struct signature<Sig(C::*)> : signature<typename strip_function_qualifiers<Sig>::type>
{};
/// Return the (non-member) function signature out of (any) signature
template<typename M>
using signature_t = typename signature<M>::type;
/// CRTP class to define the base_type typedef
template<typename T>
struct base
{
using base_type = T;
};
// If an error is generated by the line below it means the method is ambiguous.
// Specify its signature to disambiguate
template<typename T>
T ambiguous_method_requires_to_specify_signature(const T&);
}} // namespace mock::detail
#define MOCK_SIGNATURE(M) \ #define MOCK_SIGNATURE(M) \
mock::detail::signature< \ mock::detail::signature_t<decltype(mock::detail::ambiguous_method_requires_to_specify_signature(&base_type::M))>
BOOST_TYPEOF( \
mock::detail::ambiguous_method_requires_to_specify_signature( \
&base_type::M ) ) \
>::type
#endif // MOCK_SIGNATURE_HPP_INCLUDED #endif // MOCK_SIGNATURE_HPP_INCLUDED

View file

@ -0,0 +1,62 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef MOCK_SIGNATURE_TRAITS_HPP_INCLUDED
#define MOCK_SIGNATURE_TRAITS_HPP_INCLUDED
#include "../config.hpp"
#include <cstddef>
namespace mock { namespace detail {
/// Helper class to store a tuple/list of types
template<class...>
struct tuple;
/// Get the type at the given index in the tuple
template<std::size_t index, class Tuple>
struct tuple_element;
template<std::size_t I, class H, class... T>
struct tuple_element<I, tuple<H, T...>> : tuple_element<I - 1, tuple<T...>>
{};
template<class H, class... T>
struct tuple_element<0, tuple<H, T...>>
{
using type = H;
};
/// Provides information about a given function signature
/// Member types: return_type, args
/// Member constant: arity
template<typename Signature>
struct signature_traits;
template<typename R, typename... Args>
struct signature_traits<R(Args...)>
{
using return_type = R;
static constexpr std::size_t arity = sizeof...(Args);
using args = tuple<Args...>;
};
/// Return the result type of the function signature
template<typename Signature>
using result_type_t = typename signature_traits<Signature>::return_type;
/// Return the arity of the function signature
template<typename Signature>
using function_arity_t = std::integral_constant<std::size_t, signature_traits<Signature>::arity>;
/// Return the type at the given index of the function signature
template<typename Signature, std::size_t idx>
using parameter_t = typename tuple_element<idx, typename signature_traits<Signature>::args>::type;
}} // namespace mock::detail
#endif // MOCK_SIGNATURE_TRAITS_HPP_INCLUDED

Some files were not shown because too many files have changed in this diff Show more