mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Compare commits
No commits in common. "main" and "v1.3.1" have entirely different histories.
163 changed files with 14767 additions and 10129 deletions
152
.clang-format
152
.clang-format
|
|
@ -1,152 +0,0 @@
|
||||||
---
|
|
||||||
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
211
.github/workflows/ci.yml
vendored
|
|
@ -1,211 +0,0 @@
|
||||||
# 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
63
.github/workflows/release.yml
vendored
|
|
@ -1,63 +0,0 @@
|
||||||
# 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
|
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,5 +1,4 @@
|
||||||
.vscode
|
.vscode
|
||||||
bin
|
bin
|
||||||
out
|
out
|
||||||
/build
|
build/xsl
|
||||||
__build
|
|
||||||
|
|
|
||||||
99
.travis.yml
Normal file
99
.travis.yml
Normal file
|
|
@ -0,0 +1,99 @@
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
sudo: false
|
||||||
|
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++98 BRANCH_TO_TEST=boost-1.58.0
|
||||||
|
- CXX_STANDARD=c++11 BRANCH_TO_TEST=boost-1.59.0
|
||||||
|
- CXX_STANDARD=c++98 BRANCH_TO_TEST=boost-1.59.0
|
||||||
|
- CXX_STANDARD=c++11 BRANCH_TO_TEST=boost-1.67.0
|
||||||
|
- CXX_STANDARD=c++98 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"
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- COVERALS_DIR=$PROJECT_DIR/coverals
|
||||||
|
|
||||||
|
# Copying Coveralls data to a separate folder
|
||||||
|
- mkdir -p $COVERALS_DIR
|
||||||
|
- find ../test/bin/ -name "*.gcda" -exec cp "{}" $COVERALS_DIR/ \;
|
||||||
|
- find ../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 /home/travis/build/mat007/turtle/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
|
||||||
|
|
||||||
|
# Sending data to Coveralls
|
||||||
|
- cd $PROJECT_DIR
|
||||||
|
- gem install coveralls-lcov
|
||||||
|
- coveralls-lcov coverals/coverage.info
|
||||||
|
|
@ -1,83 +0,0 @@
|
||||||
# Copyright 2019-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
|
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.16..3.20)
|
|
||||||
project(turtle VERSION 2.0.0 LANGUAGES CXX)
|
|
||||||
|
|
||||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|
||||||
set(IS_ROOT_PROJECT ON)
|
|
||||||
include(CTest)
|
|
||||||
else()
|
|
||||||
set(IS_ROOT_PROJECT OFF)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
option(TURTLE_INSTALL "Enable to add install target" ${IS_ROOT_PROJECT})
|
|
||||||
|
|
||||||
# Default boost libs are static on windows and dynamic on linux
|
|
||||||
if(WIN32 AND NOT DEFINED Boost_USE_STATIC_LIBS)
|
|
||||||
set(Boost_USE_STATIC_LIBS ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# 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(_turtleVersionFile ${CMAKE_CURRENT_BINARY_DIR}/include/turtle/version.hpp)
|
|
||||||
configure_file(version.hpp.cmake ${_turtleVersionFile} @ONLY)
|
|
||||||
|
|
||||||
add_library(turtle INTERFACE)
|
|
||||||
add_library(turtle::turtle ALIAS turtle)
|
|
||||||
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)
|
|
||||||
|
|
||||||
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()
|
|
||||||
|
|
||||||
if(BUILD_TESTING)
|
|
||||||
add_subdirectory(test)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TURTLE_INSTALL)
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
include(CMakePackageConfigHelpers)
|
|
||||||
|
|
||||||
target_include_directories(turtle INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
|
||||||
|
|
||||||
install(TARGETS turtle
|
|
||||||
EXPORT ${PROJECT_NAME}Targets
|
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
)
|
|
||||||
install(DIRECTORY include/ ${CMAKE_CURRENT_BINARY_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
||||||
|
|
||||||
set(configFile ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake)
|
|
||||||
set(versionFile ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake)
|
|
||||||
set(configInstallDestination lib/cmake/${PROJECT_NAME})
|
|
||||||
|
|
||||||
configure_package_config_file(
|
|
||||||
${PROJECT_SOURCE_DIR}/Config.cmake.in
|
|
||||||
${configFile}
|
|
||||||
INSTALL_DESTINATION ${configInstallDestination}
|
|
||||||
)
|
|
||||||
|
|
||||||
write_basic_package_version_file(${versionFile} COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT)
|
|
||||||
|
|
||||||
install(FILES ${configFile} ${versionFile} DESTINATION ${configInstallDestination})
|
|
||||||
|
|
||||||
install(
|
|
||||||
EXPORT ${PROJECT_NAME}Targets
|
|
||||||
NAMESPACE "turtle::"
|
|
||||||
DESTINATION ${configInstallDestination}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
@PACKAGE_INIT@
|
|
||||||
|
|
||||||
include(CMakeFindDependencyMacro)
|
|
||||||
find_dependency(Boost 1.58)
|
|
||||||
|
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
|
|
||||||
|
|
||||||
check_required_components("@PROJECT_NAME@")
|
|
||||||
28
Jamfile.v2
Normal file
28
Jamfile.v2
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
# 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) ;
|
||||||
|
}
|
||||||
10
Jamroot.jam
10
Jamroot.jam
|
|
@ -6,11 +6,9 @@
|
||||||
|
|
||||||
import modules ;
|
import modules ;
|
||||||
|
|
||||||
if BOOST_ROOT
|
local boost = [ modules.peek : BOOST ] ;
|
||||||
{
|
|
||||||
local boost = [ modules.peek : BOOST_ROOT ] ;
|
|
||||||
|
|
||||||
project mock : requirements <include>$(boost) ;
|
project mock : requirements <include>$(boost) <include>. ;
|
||||||
|
|
||||||
#use-project /boost : $(boost) ;
|
# This seems to prevent some Boost.Build errors that otherwise occur :-(
|
||||||
}
|
use-project /boost : $(boost) ;
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,6 @@
|
||||||
|
|
||||||
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).
|
||||||
|
|
||||||
[](https://github.com/mat007/turtle/actions/workflows/ci.yml)
|
[](https://travis-ci.org/mat007/turtle)
|
||||||
[](https://ci.appveyor.com/project/mat007/turtle)
|
[](https://ci.appveyor.com/project/mat007/turtle)
|
||||||
[](https://coveralls.io/r/mat007/turtle)
|
[](https://coveralls.io/r/mat007/turtle)
|
||||||
|
|
||||||
Boost and a C++14 compatible compiler is required.
|
|
||||||
|
|
||||||
More information in the [documentation](http://turtle.sourceforge.net).
|
|
||||||
|
|
|
||||||
88
appveyor.yml
88
appveyor.yml
|
|
@ -2,97 +2,53 @@
|
||||||
# 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 2015 Mathieu Champlon
|
# Copyright Mathieu Champlon 2015.
|
||||||
# Copyright 2020-2025 Alexander Grund
|
|
||||||
|
|
||||||
skip_branch_with_pr: true
|
skip_branch_with_pr: true
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- main
|
- master
|
||||||
|
|
||||||
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_65_1
|
BOOST: 1_60_0
|
||||||
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_69_0
|
BOOST: 1_67_0
|
||||||
TOOLSET: msvc-14.1
|
TOOLSET: msvc-14.1
|
||||||
CXX_STANDARD: 14,17
|
CXX_STANDARD: 14
|
||||||
ADDRESS_MODEL: 64
|
# CXX_STANDARD: 17
|
||||||
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
|
platform:
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
- 32
|
||||||
BOOST: 1_65_1
|
- 64
|
||||||
CMAKE: true
|
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
configuration:
|
||||||
BOOST: 1_83_0
|
- debug
|
||||||
CMAKE: true
|
- release
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
|
|
||||||
BOOST: 1_86_0
|
|
||||||
CMAKE: true
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- appveyor-retry powershell Invoke-WebRequest http://www.oasis-open.org/docbook/xml/4.2/docbook-xml-4.2.zip -OutFile docbook-xml.zip
|
- cd C:\projects\turtle\doc
|
||||||
- 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
|
- appveyor-retry powershell Invoke-WebRequest ftp://ftp.zlatkovic.com/libxml/iconv-1.9.2.win32.zip -OutFile iconv.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 https://www.zlatkovic.com/pub/libxml/libxml2-2.7.8.win32.zip -OutFile libxml2.zip
|
- appveyor-retry powershell Invoke-WebRequest ftp://ftp.zlatkovic.com/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 https://www.zlatkovic.com/pub/libxml/libxslt-1.1.26.win32.zip -OutFile libxslt.zip
|
- appveyor-retry powershell Invoke-WebRequest ftp://ftp.zlatkovic.com/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 https://www.zlatkovic.com/pub/libxml/zlib-1.2.5.win32.zip -OutFile zlib.zip
|
- appveyor-retry powershell Invoke-WebRequest ftp://ftp.zlatkovic.com/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%
|
- cd C:\projects\turtle\build
|
||||||
- if NOT "%CXX_STANDARD%"=="" set CXX_FLAGS=cxxstd=%CXX_STANDARD%
|
- if NOT "%CXX_STANDARD%"=="" set CXX_FLAGS=cxxflags=/std:c++%CXX_STANDARD%
|
||||||
- set BUILD_ARGS=address-model=%ADDRESS_MODEL% variant=%VARIANT%
|
- call build.bat --toolset=%TOOLSET% address-model=%PLATFORM% %CXX_FLAGS% --build-type=complete %CONFIGURATION%
|
||||||
- set BOOST_TEST_LOG_LEVEL=all
|
|
||||||
- call scripts\build.bat --toolset=%TOOLSET% %CXX_FLAGS% -j3
|
|
||||||
|
|
||||||
for:
|
|
||||||
- matrix:
|
|
||||||
only: [CMAKE: true]
|
|
||||||
install: true
|
|
||||||
build_script:
|
|
||||||
- set BOOST_ROOT=C:\Libraries\boost_%BOOST%
|
|
||||||
- cd %APPVEYOR_BUILD_FOLDER%
|
|
||||||
- mkdir build && cd build
|
|
||||||
- cmake .. -DCMAKE_BUILD_TYPE=Debug
|
|
||||||
- cmake --build . --config Debug
|
|
||||||
- ctest --output-on-failure --build-config Debug
|
|
||||||
|
|
|
||||||
29
build/build.bat
Normal file
29
build/build.bat
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
@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 %*
|
||||||
|
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%
|
||||||
1
build/build.properties
Normal file
1
build/build.properties
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
extensions = headers,check,run
|
||||||
32
build/build.sh
Executable file
32
build/build.sh
Executable file
|
|
@ -0,0 +1,32 @@
|
||||||
|
#!/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
|
||||||
115
build/build.xml
Normal file
115
build/build.xml
Normal file
|
|
@ -0,0 +1,115 @@
|
||||||
|
<!--
|
||||||
|
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="<boost/mock/\1>" flags="g">
|
||||||
|
<fileset dir="${boost-mock.dir}/include" includes="**/*.hpp" excludes="**/detail/*.hpp"/>
|
||||||
|
</replaceregexp>
|
||||||
|
<replaceregexp match='"\.\./([^"]+\.hpp)"' replace="<boost/mock/\1>" flags="g">
|
||||||
|
<fileset dir="${boost-mock.dir}/include" includes="**/*.hpp"/>
|
||||||
|
</replaceregexp>
|
||||||
|
<replaceregexp match='"([^"]+\.hpp)"' replace="<boost/mock/detail/\1>" flags="g">
|
||||||
|
<fileset dir="${boost-mock.dir}/include" includes="**/detail/*.hpp"/>
|
||||||
|
</replaceregexp>
|
||||||
|
<replaceregexp match="<turtle/([^>]+)" replace="<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>
|
||||||
17
build/clang/Dockerfile
Normal file
17
build/clang/Dockerfile
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
# $ 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"
|
||||||
9
build/gcc/Dockerfile
Normal file
9
build/gcc/Dockerfile
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
# $ 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"
|
||||||
7
build/vc100/.gitignore
vendored
Normal file
7
build/vc100/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
.vs
|
||||||
|
*.db
|
||||||
|
*.ipch
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.suo
|
||||||
35
build/vc100/turtle.sln
Normal file
35
build/vc100/turtle.sln
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
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
|
||||||
196
build/vc100/turtle.vcxproj
Normal file
196
build/vc100/turtle.vcxproj
Normal file
|
|
@ -0,0 +1,196 @@
|
||||||
|
<?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>
|
||||||
131
build/vc100/turtle.vcxproj.filters
Normal file
131
build/vc100/turtle.vcxproj.filters
Normal file
|
|
@ -0,0 +1,131 @@
|
||||||
|
<?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>
|
||||||
3
build/vc100/turtle.vcxproj.user
Normal file
3
build/vc100/turtle.vcxproj.user
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
</Project>
|
||||||
192
build/vc100/turtle_bench.vcxproj
Normal file
192
build/vc100/turtle_bench.vcxproj
Normal file
|
|
@ -0,0 +1,192 @@
|
||||||
|
<?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>
|
||||||
38
build/vc100/turtle_bench.vcxproj.filters
Normal file
38
build/vc100/turtle_bench.vcxproj.filters
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?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>
|
||||||
3
build/vc100/turtle_bench.vcxproj.user
Normal file
3
build/vc100/turtle_bench.vcxproj.user
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
</Project>
|
||||||
238
build/vc100/turtle_test.vcxproj
Normal file
238
build/vc100/turtle_test.vcxproj
Normal file
|
|
@ -0,0 +1,238 @@
|
||||||
|
<?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>
|
||||||
79
build/vc100/turtle_test.vcxproj.filters
Normal file
79
build/vc100/turtle_test.vcxproj.filters
Normal file
|
|
@ -0,0 +1,79 @@
|
||||||
|
<?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>
|
||||||
3
build/vc100/turtle_test.vcxproj.user
Normal file
3
build/vc100/turtle_test.vcxproj.user
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
</Project>
|
||||||
7
build/vc140/.gitignore
vendored
Normal file
7
build/vc140/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
.vs
|
||||||
|
*.db
|
||||||
|
*.ipch
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.suo
|
||||||
35
build/vc140/turtle.sln
Normal file
35
build/vc140/turtle.sln
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
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
|
||||||
196
build/vc140/turtle.vcxproj
Normal file
196
build/vc140/turtle.vcxproj
Normal file
|
|
@ -0,0 +1,196 @@
|
||||||
|
<?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>
|
||||||
131
build/vc140/turtle.vcxproj.filters
Normal file
131
build/vc140/turtle.vcxproj.filters
Normal file
|
|
@ -0,0 +1,131 @@
|
||||||
|
<?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>
|
||||||
3
build/vc140/turtle.vcxproj.user
Normal file
3
build/vc140/turtle.vcxproj.user
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
</Project>
|
||||||
192
build/vc140/turtle_bench.vcxproj
Normal file
192
build/vc140/turtle_bench.vcxproj
Normal file
|
|
@ -0,0 +1,192 @@
|
||||||
|
<?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>
|
||||||
38
build/vc140/turtle_bench.vcxproj.filters
Normal file
38
build/vc140/turtle_bench.vcxproj.filters
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?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>
|
||||||
3
build/vc140/turtle_bench.vcxproj.user
Normal file
3
build/vc140/turtle_bench.vcxproj.user
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
</Project>
|
||||||
241
build/vc140/turtle_test.vcxproj
Normal file
241
build/vc140/turtle_test.vcxproj
Normal file
|
|
@ -0,0 +1,241 @@
|
||||||
|
<?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>
|
||||||
79
build/vc140/turtle_test.vcxproj.filters
Normal file
79
build/vc140/turtle_test.vcxproj.filters
Normal file
|
|
@ -0,0 +1,79 @@
|
||||||
|
<?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>
|
||||||
3
build/vc140/turtle_test.vcxproj.user
Normal file
3
build/vc140/turtle_test.vcxproj.user
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
</Project>
|
||||||
|
|
@ -7,4 +7,3 @@
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
#define MOCK_VERSION @MOCK_VERSION@
|
#define MOCK_VERSION @MOCK_VERSION@
|
||||||
#define TURTLE_VERSION "@turtle_VERSION@"
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# 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
|
||||||
|
|
@ -44,15 +46,7 @@ project example
|
||||||
|
|
||||||
rule compile-examples
|
rule compile-examples
|
||||||
{
|
{
|
||||||
local examples ;
|
for name in [ glob example/*.cpp ] { compile $(name) ; }
|
||||||
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 ;
|
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,6 @@
|
||||||
|
|
||||||
[section Acknowledgements]
|
[section Acknowledgements]
|
||||||
|
|
||||||
Many thanks to:
|
Many thanks to Adrien Gervaise, Silvin Lubecki, Takatoshi Kondo and Ovanes Markarian !
|
||||||
* Adrien Gervaise
|
|
||||||
* Silvin Lubecki
|
|
||||||
* Takatoshi Kondo
|
|
||||||
* Ovanes Markarian
|
|
||||||
* Alexander Grund
|
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
|
||||||
|
|
@ -7,29 +7,8 @@
|
||||||
|
|
||||||
[section Changelog]
|
[section Changelog]
|
||||||
|
|
||||||
[section 2.0.0]
|
[section unreleased]
|
||||||
Released 29 September 2024
|
Not yet released
|
||||||
|
|
||||||
* 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]
|
|
||||||
Released 19 June 2020
|
|
||||||
|
|
||||||
* Removed boost deprecation warnings
|
|
||||||
* Fixed various compiler warnings
|
|
||||||
* Added CMake build files
|
|
||||||
|
|
||||||
[endsect]
|
|
||||||
|
|
||||||
[section 1.3.1]
|
|
||||||
Released 7 March 2019
|
|
||||||
|
|
||||||
* Fixed mocking of a function returning a reference for gcc 4.1
|
* Fixed mocking of a function returning a reference for gcc 4.1
|
||||||
* Added MOCK_NO_AUTO_PTR to deactivate std::auto_ptr support
|
* Added MOCK_NO_AUTO_PTR to deactivate std::auto_ptr support
|
||||||
|
|
|
||||||
|
|
@ -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 mock::unwrap_ref provides support for passing arguments as references with std::ref and std::cref and delaying their initialization, for instance :
|
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 :
|
||||||
|
|
||||||
[near_constraint_cref_test]
|
[near_constraint_cref_test]
|
||||||
|
|
||||||
|
|
@ -110,6 +110,24 @@ 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. :
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,15 @@
|
||||||
#ifndef CALCULATOR
|
#ifndef CALCULATOR
|
||||||
#define CALCULATOR
|
#define CALCULATOR
|
||||||
|
|
||||||
#include "view.hpp"
|
class view;
|
||||||
|
|
||||||
//[ calculator
|
//[ calculator
|
||||||
class calculator
|
class calculator
|
||||||
{
|
{
|
||||||
view& v;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
calculator(view& v) : v(v) {}
|
calculator( view& v );
|
||||||
|
|
||||||
void add(int a, int b) { v.display(a + b); } // the result will be sent to the view 'v'
|
void add( int a, int b ); // the result will be sent to the view 'v'
|
||||||
};
|
};
|
||||||
//]
|
//]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,146 +12,137 @@
|
||||||
//]
|
//]
|
||||||
#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
|
|
||||||
{};
|
|
||||||
|
|
||||||
inline mock::stream& operator<<(mock::stream& s, const user_type&)
|
|
||||||
{
|
{
|
||||||
|
struct 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_free_function)
|
BOOST_AUTO_TEST_CASE( forty_one_plus_one_is_forty_two )
|
||||||
{
|
{
|
||||||
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&) { return actual == 42; }
|
friend bool operator==( int actual, const custom_constraint& )
|
||||||
|
{
|
||||||
|
return actual == 42;
|
||||||
|
}
|
||||||
|
|
||||||
friend std::ostream& operator<<(std::ostream& s, const custom_constraint&) { return s << "_ == 42"; }
|
friend std::ostream& operator<<( std::ostream& s, const custom_constraint& )
|
||||||
|
{
|
||||||
|
return s << "_ == 42";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
//]
|
//]
|
||||||
|
|
||||||
//[ custom_constraint_functor_test
|
//[ custom_constraint_functor_test
|
||||||
BOOST_AUTO_TEST_CASE(forty_one_plus_one_is_forty_two_custom_constraint)
|
BOOST_AUTO_TEST_CASE( forty_one_plus_one_is_forty_two )
|
||||||
{
|
{
|
||||||
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) : expected_(expected), threshold_(threshold) {}
|
near_constraint( Expected expected, Expected 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 - mock::unwrap_ref(expected_)) <= mock::unwrap_ref(threshold_);
|
return std::abs( actual - boost::unwrap_ref( expected_ ) )
|
||||||
|
< 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_) << ", " << mock::format(c.threshold_) << " )";
|
return s << "near( " << mock::format( c.expected_ )
|
||||||
|
<< ", " << 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_near)
|
BOOST_AUTO_TEST_CASE( forty_one_plus_one_is_forty_two_plus_or_minus_one )
|
||||||
{
|
{
|
||||||
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_near_cref)
|
BOOST_AUTO_TEST_CASE( forty_one_plus_one_is_forty_two_plus_or_minus_one )
|
||||||
{
|
{
|
||||||
mock_view v;
|
mock_view v;
|
||||||
calculator c(v);
|
calculator c( v );
|
||||||
int expected = 0, threshold = 0;
|
int expected, threshold;
|
||||||
MOCK_EXPECT(v.display).with(near(std::cref(expected), std::cref(threshold)));
|
MOCK_EXPECT( v.display ).with( near( boost::cref( expected ), boost::cref( threshold ) ) );
|
||||||
expected = 42;
|
expected = 42;
|
||||||
threshold = 1;
|
threshold = 1;
|
||||||
c.add(41, 1);
|
c.add( 41, 1 );
|
||||||
}
|
}
|
||||||
//]
|
//]
|
||||||
|
|
||||||
// Example of a "strong type" float
|
|
||||||
struct float_wrapper
|
|
||||||
{
|
|
||||||
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__)
|
#undef MOCK_MAX_ARGS
|
||||||
# pragma GCC diagnostic push
|
//[ max_args
|
||||||
# pragma GCC diagnostic ignored "-Wunused-parameter"
|
#define MOCK_MAX_ARGS 20
|
||||||
#endif
|
#include <turtle/mock.hpp>
|
||||||
|
//]
|
||||||
|
|
||||||
//[ custom_policy
|
//[ custom_policy
|
||||||
template<typename Result>
|
template< typename Result >
|
||||||
struct custom_policy
|
struct custom_policy
|
||||||
{
|
{
|
||||||
static Result abort()
|
static Result abort()
|
||||||
|
|
@ -159,27 +150,23 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -6,203 +6,124 @@
|
||||||
// (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"
|
||||||
|
|
||||||
struct Fixture
|
namespace phases
|
||||||
{
|
{
|
||||||
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_reset)
|
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
|
||||||
{
|
{
|
||||||
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_expect)
|
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
|
||||||
{
|
{
|
||||||
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_then_1_plus_0_is_1)
|
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
|
||||||
{
|
{
|
||||||
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(add_several_numbers_in_sequences)
|
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
|
||||||
{
|
{
|
||||||
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
|
||||||
{
|
{
|
||||||
view& v;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
calculator(view& v) : v(v) {}
|
calculator( view& v );
|
||||||
|
|
||||||
void add(int a, int b) { v.display(a + b); }
|
void add( int a, int b );
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CatchFailureFixture : Fixture
|
|
||||||
{
|
|
||||||
static bool aborted;
|
|
||||||
static std::string fail_msg;
|
|
||||||
|
|
||||||
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
|
//[ action_test
|
||||||
BOOST_AUTO_TEST_CASE(zero_plus_zero_is_zero_with_action)
|
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
|
||||||
{
|
{
|
||||||
mock_view v;
|
mock_view v;
|
||||||
calculator c(v);
|
calculator c( v );
|
||||||
MOCK_EXPECT(v.display).once().with(0); // missing returns( true )
|
MOCK_EXPECT( v.display ).once().with( 0 ); // missing returns( true )
|
||||||
c.add(0, 0);
|
c.add( 0, 0 );
|
||||||
}
|
}
|
||||||
//]
|
//]
|
||||||
} // namespace action
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
|
||||||
|
|
|
||||||
48
doc/example/limitations_comma_in_macro.cpp
Normal file
48
doc/example/limitations_comma_in_macro.cpp
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
// 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
|
||||||
|
{};
|
||||||
|
//]
|
||||||
|
}
|
||||||
|
|
@ -6,46 +6,45 @@
|
||||||
// (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:
|
public:
|
||||||
virtual void method(const int) = 0;
|
virtual void method( const int ) = 0;
|
||||||
};
|
};
|
||||||
|
//]
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace limitations_const_parameter_warning_explanation
|
||||||
|
{
|
||||||
|
//[ limitations_const_parameter_warning_explanation
|
||||||
|
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
|
||||||
|
MOCK_BASE_CLASS( mock_base, base )
|
||||||
|
{
|
||||||
|
void method( const int i )
|
||||||
|
{
|
||||||
|
method_stub( i );
|
||||||
|
}
|
||||||
|
MOCK_METHOD( method_stub, 1, void( int ), method )
|
||||||
|
};
|
||||||
//]
|
//]
|
||||||
} // namespace
|
|
||||||
|
|
||||||
namespace limitations_const_parameter_warning_explanation {
|
|
||||||
//[ limitations_const_parameter_warning_explanation
|
|
||||||
class derived : public base
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual void method(const int);
|
|
||||||
};
|
|
||||||
|
|
||||||
void derived::method(int) {}
|
|
||||||
//]
|
|
||||||
} // 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);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,34 +6,38 @@
|
||||||
// (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 );
|
||||||
//]
|
//]
|
||||||
//[ limitations_literal_zero_solution_3
|
#ifdef MOCK_NULLPTR
|
||||||
MOCK_EXPECT(m.method).with(nullptr);
|
//[ limitations_literal_zero_solution_3
|
||||||
//]
|
MOCK_EXPECT( m.method ).with( nullptr );
|
||||||
|
//]
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,9 @@
|
||||||
// (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
|
||||||
|
|
@ -19,15 +20,8 @@ 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
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -6,41 +6,27 @@
|
||||||
// (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
|
|
||||||
class base
|
|
||||||
{
|
{
|
||||||
public:
|
//[ limitations_protected_private_method_problem
|
||||||
void call()
|
class base
|
||||||
{
|
{
|
||||||
method_1();
|
private:
|
||||||
method_2();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void method_1() = 0;
|
virtual void method_1() = 0;
|
||||||
|
private:
|
||||||
private:
|
|
||||||
virtual void method_2() = 0;
|
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();
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,33 +6,29 @@
|
||||||
// (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
|
|
||||||
template<typename T>
|
|
||||||
class base
|
|
||||||
{
|
{
|
||||||
public:
|
//[ limitations_template_base_class_method_problem
|
||||||
virtual ~base() = default;
|
template< typename T >
|
||||||
|
class base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~base()
|
||||||
|
{}
|
||||||
|
|
||||||
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, 0, void())
|
MOCK_METHOD( method, 1, 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();
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,90 +6,78 @@
|
||||||
// (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
|
class concept
|
||||||
{
|
{
|
||||||
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 )
|
||||||
};
|
};
|
||||||
//]
|
//]
|
||||||
|
|
||||||
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 {
|
namespace limitations_template_method_problem_2
|
||||||
|
{
|
||||||
//[ limitations_template_method_problem_2
|
//[ limitations_template_method_problem_2
|
||||||
class concept_class
|
class concept
|
||||||
{
|
{
|
||||||
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
|
|
||||||
|
|
|
||||||
|
|
@ -6,31 +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)
|
||||||
|
|
||||||
|
#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
|
|
||||||
struct base_class
|
|
||||||
{
|
{
|
||||||
virtual ~base_class() = default;
|
//[ limitations_throw_specifier_problem
|
||||||
|
struct base_class
|
||||||
|
{
|
||||||
|
virtual ~base_class()
|
||||||
|
{}
|
||||||
|
|
||||||
virtual void method() throw() = 0;
|
virtual void method() throw ();
|
||||||
};
|
};
|
||||||
//]
|
//]
|
||||||
|
|
||||||
//[ 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() override { method_proxy(); }
|
void method() throw ()
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,14 @@
|
||||||
#ifndef MOCK_VIEW
|
#ifndef MOCK_VIEW
|
||||||
#define MOCK_VIEW
|
#define MOCK_VIEW
|
||||||
|
|
||||||
#include "view.hpp"
|
|
||||||
#include <turtle/mock.hpp>
|
#include <turtle/mock.hpp>
|
||||||
|
#include "view.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
|
||||||
|
|
|
||||||
|
|
@ -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 );
|
||||||
};
|
};
|
||||||
//]
|
//]
|
||||||
|
|
||||||
int calculator::add(int a, int b)
|
|
||||||
{
|
|
||||||
return a + b;
|
|
||||||
}
|
|
||||||
|
|
||||||
//[ simple_zero_plus_zero_is_zero
|
//[ simple_zero_plus_zero_is_zero
|
||||||
BOOST_AUTO_TEST_CASE(zero_plus_zero_is_zero)
|
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
|
||||||
{
|
{
|
||||||
calculator c;
|
calculator c;
|
||||||
BOOST_CHECK_EQUAL(0, c.add(0, 0));
|
BOOST_CHECK_EQUAL( 0, c.add( 0, 0 ) );
|
||||||
}
|
}
|
||||||
//]
|
//]
|
||||||
} // namespace simple
|
}
|
||||||
|
|
||||||
namespace without_mock_object {
|
namespace without_mock_object
|
||||||
|
{
|
||||||
//[ my_view
|
//[ my_view
|
||||||
class my_view : public view
|
class my_view : public view
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
my_view() : called(false) {}
|
my_view()
|
||||||
virtual void display(int result)
|
: called( false )
|
||||||
|
{}
|
||||||
|
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_without_mock_object)
|
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
|
||||||
{
|
{
|
||||||
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_with_mock_object)
|
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
|
||||||
{
|
{
|
||||||
mock_view v;
|
mock_view v;
|
||||||
calculator c(v);
|
calculator c( v );
|
||||||
MOCK_EXPECT(v.display).once().with(
|
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
|
||||||
0); // expect the 'display' method to be called once (and only once) with a parameter value equal to 0
|
c.add( 0, 0 );
|
||||||
c.add(0, 0);
|
|
||||||
}
|
}
|
||||||
//]
|
//]
|
||||||
} // namespace with_mock_object
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,66 +7,67 @@
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
//[ async_call_problem
|
//[ async_call_problem
|
||||||
namespace mock_test {
|
namespace
|
||||||
class base_class
|
|
||||||
{
|
{
|
||||||
public:
|
class base_class
|
||||||
|
{
|
||||||
|
public:
|
||||||
virtual void method() = 0;
|
virtual void method() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class my_class
|
class my_class
|
||||||
{
|
{
|
||||||
base_class& b;
|
public:
|
||||||
|
explicit my_class( base_class& );
|
||||||
public:
|
|
||||||
explicit my_class(base_class&);
|
|
||||||
|
|
||||||
void flush(); // repetitively calling this method will in turn call base_class::method at some point
|
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
|
||||||
#include <turtle/mock.hpp>
|
#define BOOST_AUTO_TEST_MAIN
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/auto_unit_test.hpp>
|
||||||
|
#include <boost/lambda/lambda.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
#include <turtle/mock.hpp>
|
||||||
|
|
||||||
namespace mock_test {
|
namespace
|
||||||
template<typename F>
|
|
||||||
void check(bool& condition, F flush, int attempts = 100, int sleep = 100)
|
|
||||||
{
|
{
|
||||||
while(!condition && attempts > 0)
|
template< typename F >
|
||||||
|
void check( bool& condition, F flush, int attempts = 100, int sleep = 100 )
|
||||||
|
{
|
||||||
|
while( !condition && attempts > 0 )
|
||||||
{
|
{
|
||||||
--attempts;
|
--attempts;
|
||||||
boost::this_thread::sleep(boost::posix_time::milliseconds(sleep));
|
boost::this_thread::sleep( boost::posix_time::milliseconds( sleep ) );
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MOCK_BASE_CLASS( mock_base_class, base_class )
|
||||||
|
{
|
||||||
|
MOCK_METHOD( method, 0 )
|
||||||
|
};
|
||||||
|
void set_bool(bool& b)
|
||||||
|
{
|
||||||
|
b = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MOCK_BASE_CLASS(mock_base_class, base_class)
|
BOOST_AUTO_TEST_CASE( method_is_called )
|
||||||
{
|
|
||||||
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;
|
||||||
MOCK_EXPECT(m.method).once().calls([&done]() { done = true; });
|
// when method is called it will set done to true
|
||||||
check(done, [&c]() { c.flush(); }); // just wait on done, flushing from time to time
|
// Note: Boost 1.57 introduced a bug preventing usage of the lambda with clang in C++98
|
||||||
|
// 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
|
|
||||||
|
|
||||||
//]
|
//]
|
||||||
|
|
|
||||||
|
|
@ -6,61 +6,39 @@
|
||||||
// (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 <functional>
|
#include <boost/function.hpp>
|
||||||
|
|
||||||
class base_class
|
namespace
|
||||||
{
|
{
|
||||||
public:
|
class base_class
|
||||||
virtual void method(const std::function<void(int)>& functor) = 0;
|
{
|
||||||
};
|
public:
|
||||||
|
virtual void method( const boost::function< void( int ) >& functor ) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
// the function will call 'method' with a functor to be applied
|
void function( base_class& ); // 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_METHOD(method, 1)
|
MOCK_BASE_CLASS( mock_class, base_class )
|
||||||
};
|
{
|
||||||
} // namespace
|
MOCK_METHOD( method, 1 )
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
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([](const auto& functor) {
|
MOCK_EXPECT( mock.method ).calls( boost::bind( boost::apply< void >(), _1, 42 ) ); // whenever 'method' is called, invoke the functor with 42
|
||||||
functor(42);
|
function( mock );
|
||||||
}); // whenever 'method' is called, invoke the functor with 42
|
|
||||||
function(mock);
|
|
||||||
}
|
}
|
||||||
//]
|
//]
|
||||||
|
|
|
||||||
|
|
@ -7,50 +7,49 @@
|
||||||
// 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
|
|
||||||
{
|
{
|
||||||
public:
|
class my_class
|
||||||
explicit my_class(int data) : data_(data) {}
|
{
|
||||||
|
public:
|
||||||
|
explicit my_class( int data )
|
||||||
|
: data_( data )
|
||||||
|
{}
|
||||||
int 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_CLASS( my_mock )
|
||||||
{
|
{
|
||||||
MOCK_METHOD(method, 1, void(const my_class&)) // how to simply write a custom constraint ?
|
MOCK_METHOD( method, 1, void( const my_class& ) ) // how to simply write a custom constraint ?
|
||||||
};
|
};
|
||||||
} // namespace
|
}
|
||||||
//]
|
//]
|
||||||
|
|
||||||
//[ quick_constraint_solution
|
//[ quick_constraint_solution
|
||||||
#include <sstream>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
namespace // in the same namespace as 'my_class'
|
namespace // in the same namespace as 'my_class'
|
||||||
{
|
{
|
||||||
bool operator==(const my_class& actual,
|
bool operator==( const my_class& actual, const std::string& expected ) // the first part of the trick is to compare to a string
|
||||||
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;
|
}
|
||||||
s << actual;
|
} // mock
|
||||||
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)
|
MOCK_EXPECT( mock.method ).once().with( "my_class( 42 )" ); // the second part of the trick is to express the constraint as a string
|
||||||
.once()
|
mock.method( my_class( 42 ) );
|
||||||
.with("my_class( 42 )"); // the second part of the trick is to express the constraint as a string
|
|
||||||
mock.method(my_class(42));
|
|
||||||
}
|
}
|
||||||
//]
|
//]
|
||||||
|
|
|
||||||
|
|
@ -7,59 +7,44 @@
|
||||||
// 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
|
|
||||||
{
|
{
|
||||||
public:
|
class base_class
|
||||||
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
|
void process(); // the processing will call 'method' two times with the same value, but we don't know what value beforehand
|
||||||
// beforehand
|
};
|
||||||
};
|
}
|
||||||
} // namespace
|
|
||||||
//]
|
//]
|
||||||
|
|
||||||
namespace {
|
|
||||||
static base_class* global_b = nullptr;
|
|
||||||
my_class::my_class(base_class& b)
|
|
||||||
{
|
|
||||||
global_b = &b;
|
|
||||||
}
|
|
||||||
void my_class::process()
|
|
||||||
{
|
|
||||||
int secret_value = 42;
|
|
||||||
global_b->method(secret_value);
|
|
||||||
global_b->method(secret_value);
|
|
||||||
}
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
//[ retrieve_cref_solution
|
//[ retrieve_cref_solution
|
||||||
|
#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
|
||||||
MOCK_BASE_CLASS(mock_base_class, base_class)
|
|
||||||
{
|
{
|
||||||
MOCK_METHOD(method, 1)
|
MOCK_BASE_CLASS( mock_base_class, base_class )
|
||||||
};
|
{
|
||||||
} // namespace
|
MOCK_METHOD( method, 1 )
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(method_is_called_two_times_with_the_same_value)
|
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
|
MOCK_EXPECT( mock.method ).once().with( mock::retrieve( value ) ); // on first call retrieve the value, this expectation takes precedence because it can never fail
|
||||||
// takes precedence because it can never fail
|
MOCK_EXPECT( mock.method ).once().with( boost::cref( value ) ); // on second call compare the previously retrieved value with the newly received one
|
||||||
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();
|
||||||
}
|
}
|
||||||
//]
|
//]
|
||||||
|
|
|
||||||
|
|
@ -6,42 +6,35 @@
|
||||||
// (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
|
|
||||||
{
|
{
|
||||||
my_class(int i) : i_(i) {}
|
struct my_class
|
||||||
|
{
|
||||||
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
MOCK_FUNCTION(f, 1, void(my_class*)) // being static 'f' outlives the test case
|
BOOST_AUTO_TEST_CASE( static_objects_problem )
|
||||||
} // namespace
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(static_objects_problem)
|
|
||||||
{
|
{
|
||||||
my_class c(42);
|
my_class c( 42 );
|
||||||
MOCK_EXPECT(f).once().with(
|
MOCK_EXPECT( f ).once().with( &c ); // the set expectation will also outlive the test case and leak into other test cases using 'f'
|
||||||
&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
|
||||||
//]
|
//]
|
||||||
|
|
||||||
|
|
@ -50,28 +43,25 @@ struct fixture
|
||||||
{
|
{
|
||||||
~fixture()
|
~fixture()
|
||||||
{
|
{
|
||||||
mock::reset(); // the use of a fixture ensures the reset will prevent the expectations from leaking into other
|
mock::reset(); // the use of a fixture ensures the reset will prevent the expectations from leaking into other test cases
|
||||||
// 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(
|
BOOST_FIXTURE_TEST_CASE( static_objects_solution, mock::cleanup ) // actually the library includes a ready to use fixture just like the one described
|
||||||
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();
|
||||||
}
|
}
|
||||||
//]
|
//]
|
||||||
|
|
|
||||||
|
|
@ -6,30 +6,15 @@
|
||||||
// (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
|
|
@ -13,7 +13,7 @@
|
||||||
class view
|
class view
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void display(int result) = 0;
|
virtual void display( int result ) = 0;
|
||||||
};
|
};
|
||||||
//]
|
//]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
[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.
|
||||||
|
|
@ -75,7 +76,7 @@ Given :
|
||||||
|
|
||||||
[limitations_template_method_problem]
|
[limitations_template_method_problem]
|
||||||
|
|
||||||
writing a mock object modeling the 'concept class' requires to list all the possible versions of 'method' :
|
writing a mock object modeling 'concept' requires to list all the possible versions of 'method' :
|
||||||
|
|
||||||
[limitations_template_method_solution]
|
[limitations_template_method_solution]
|
||||||
|
|
||||||
|
|
@ -111,7 +112,7 @@ A workaround would be to add the signature to MOCK_METHOD :
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
[section Protected and private virtual methods cannot be mocked without specifying the signature]
|
[section Private virtual methods cannot be mocked without specifying the signature]
|
||||||
|
|
||||||
Given :
|
Given :
|
||||||
|
|
||||||
|
|
@ -150,6 +151,43 @@ 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 :
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@
|
||||||
|
|
||||||
[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].
|
||||||
|
|
@ -15,6 +16,8 @@
|
||||||
[/ [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]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,21 +91,31 @@ Synopsis :
|
||||||
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 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 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 [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( [calling convention] name, arity, signature, identifier ) // generates both const and non-const methods
|
MOCK_METHOD_EXT( [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_EXT( [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_EXT( [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 :
|
||||||
|
|
||||||
|
|
@ -151,10 +161,14 @@ 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]
|
||||||
|
|
@ -179,6 +193,8 @@ 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 :
|
||||||
|
|
@ -229,6 +245,10 @@ 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]
|
||||||
|
|
@ -257,6 +277,8 @@ 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]
|
||||||
|
|
@ -277,6 +299,8 @@ 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]
|
||||||
|
|
@ -391,13 +415,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 callable (function, function pointer, functor, ...); mock::equal is implied for anything else.]
|
[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.]
|
||||||
|
|
||||||
[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 std::ref and std::cref in order to delay initialization.]
|
[note All constraints accepting a parameter support the use of boost::ref and boost::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.]
|
||||||
|
|
||||||
|
|
@ -413,7 +437,7 @@ Example using a standard library functor :
|
||||||
|
|
||||||
[constraints_example_3]
|
[constraints_example_3]
|
||||||
|
|
||||||
Example using std::bind :
|
Example using [@http://www.boost.org/libs/bind Boost.Bind] :
|
||||||
|
|
||||||
[constraints_example_4]
|
[constraints_example_4]
|
||||||
|
|
||||||
|
|
@ -449,7 +473,10 @@ 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 basically unlimited.
|
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 :
|
||||||
|
|
||||||
|
#define MOCK_MAX_SEQUENCES 12
|
||||||
|
#include <turtle/mock.hpp>
|
||||||
|
|
||||||
Example :
|
Example :
|
||||||
|
|
||||||
|
|
@ -464,13 +491,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/move
|
MOCK_EXPECT( identifier ).moves( value ); // stored internally by copy
|
||||||
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, std::ref and std::cref can however be used to turn the copies into references.]
|
[note Actions are captured by copy, boost::ref and boost::cref can however be used to turn the copies into references.]
|
||||||
|
|
||||||
Example :
|
Example :
|
||||||
|
|
||||||
|
|
@ -554,18 +581,38 @@ 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]
|
||||||
|
|
|
||||||
|
|
@ -11,33 +11,34 @@
|
||||||
|
|
||||||
#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,
|
static void fail( const char* message, const Context& context,
|
||||||
const Context& context,
|
const char* file = "file://unknown-location", int line = 0 )
|
||||||
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
|
||||||
|
|
|
||||||
|
|
@ -10,25 +10,30 @@
|
||||||
#define MOCK_CLEANUP_HPP_INCLUDED
|
#define MOCK_CLEANUP_HPP_INCLUDED
|
||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "reset.hpp"
|
|
||||||
#include "verify.hpp"
|
#include "verify.hpp"
|
||||||
|
#include "reset.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
|
|
||||||
{
|
{
|
||||||
~cleanup() { mock::reset(); }
|
struct cleanup
|
||||||
};
|
{
|
||||||
|
~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
|
||||||
|
|
||||||
} // namespace mock
|
} // mock
|
||||||
|
|
||||||
|
|
||||||
#endif // MOCK_CLEANUP_HPP_INCLUDED
|
#endif // MOCK_CLEANUP_HPP_INCLUDED
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
// 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
|
||||||
|
|
@ -13,36 +12,93 @@
|
||||||
#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
|
#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
|
||||||
|
|
||||||
#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
|
||||||
|
|
||||||
#ifndef MOCK_NO_UNCAUGHT_EXCEPTIONS
|
#if !defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_LAMBDAS)
|
||||||
# if(defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411) || \
|
# ifndef MOCK_NO_LAMBDAS
|
||||||
(defined(_MSC_VER) && _MSC_VER >= 1900)
|
# define MOCK_LAMBDAS
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_AUTO_PTR)
|
||||||
|
# ifndef MOCK_NO_AUTO_PTR
|
||||||
|
# define MOCK_AUTO_PTR
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__cpp_lib_uncaught_exceptions) || \
|
||||||
|
defined(_MSC_VER) && (_MSC_VER >= 1900)
|
||||||
|
# ifndef MOCK_NO_UNCAUGHT_EXCEPTIONS
|
||||||
# define MOCK_UNCAUGHT_EXCEPTIONS
|
# define MOCK_UNCAUGHT_EXCEPTIONS
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BOOST_VERSION >= 107700
|
|
||||||
# define MOCK_CXX_VERSION BOOST_CXX_VERSION
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
# ifdef _MSVC_LANG
|
|
||||||
# define MOCK_CXX_VERSION _MSVC_LANG
|
|
||||||
# elif defined(_HAS_CXX17)
|
|
||||||
# define MOCK_CXX_VERSION 201703L
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#ifndef MOCK_CXX_VERSION
|
|
||||||
# define MOCK_CXX_VERSION __cplusplus
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // MOCK_CONFIG_HPP_INCLUDED
|
#endif // MOCK_CONFIG_HPP_INCLUDED
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
// 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
|
||||||
|
|
@ -12,179 +11,249 @@
|
||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "log.hpp"
|
#include "log.hpp"
|
||||||
#include "unwrap_reference.hpp"
|
#include <boost/ref.hpp>
|
||||||
#include <boost/preprocessor/array.hpp>
|
#include <boost/preprocessor/stringize.hpp>
|
||||||
#include <boost/preprocessor/control/if.hpp>
|
#include <boost/preprocessor/control/if.hpp>
|
||||||
#include <boost/preprocessor/repetition/enum.hpp>
|
#include <boost/preprocessor/variadic/to_array.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/repeat.hpp>
|
#include <boost/preprocessor/repetition/enum.hpp>
|
||||||
#include <boost/preprocessor/stringize.hpp>
|
#include <boost/preprocessor/array.hpp>
|
||||||
#include <boost/preprocessor/variadic/size.hpp>
|
#include <boost/move/move.hpp>
|
||||||
#include <functional>
|
#include <boost/type_traits/decay.hpp>
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
namespace mock {
|
namespace mock
|
||||||
template<typename Constraint>
|
|
||||||
struct constraint
|
|
||||||
{
|
{
|
||||||
constraint() {}
|
template< typename Constraint >
|
||||||
constraint(const Constraint& c) : c_(c) {}
|
struct constraint
|
||||||
|
{
|
||||||
|
constraint()
|
||||||
|
{}
|
||||||
|
constraint( const Constraint& c )
|
||||||
|
: c_( c )
|
||||||
|
{}
|
||||||
Constraint 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) : lhs_(lhs), rhs_(rhs) {}
|
and_( const Lhs& lhs, const Rhs& rhs )
|
||||||
template<typename Actual>
|
: lhs_( lhs )
|
||||||
bool operator()(const Actual& actual) const
|
, rhs_( rhs )
|
||||||
|
{}
|
||||||
|
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_) << " && " << mock::format(a.rhs_) << " )";
|
return s << "( " << mock::format( a.lhs_ )
|
||||||
|
<< " && " << 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) : lhs_(lhs), rhs_(rhs) {}
|
or_( const Lhs& lhs, const Rhs& rhs )
|
||||||
template<typename Actual>
|
: lhs_( lhs )
|
||||||
bool operator()(const Actual& actual) const
|
, rhs_( rhs )
|
||||||
|
{}
|
||||||
|
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_) << " || " << mock::format(o.rhs_) << " )";
|
return s << "( " << mock::format( o.lhs_ )
|
||||||
|
<< " || " << 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) : c_(c) {}
|
explicit not_( const Constraint& c )
|
||||||
template<typename Actual>
|
: c_( c )
|
||||||
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::and_<Lhs, Rhs>> operator&&(const constraint<Lhs>& lhs, const constraint<Rhs>& rhs)
|
const constraint< detail::or_< Lhs, Rhs > >
|
||||||
{
|
operator||( const constraint< Lhs >& lhs,
|
||||||
return detail::and_<Lhs, Rhs>(lhs.c_, rhs.c_);
|
const constraint< Rhs >& rhs )
|
||||||
}
|
{
|
||||||
|
return detail::or_< Lhs, Rhs >( lhs.c_, rhs.c_ );
|
||||||
|
}
|
||||||
|
|
||||||
template<typename Constraint>
|
template< typename Lhs, typename Rhs >
|
||||||
const constraint<detail::not_<Constraint>> operator!(const constraint<Constraint>& c)
|
const constraint< detail::and_< Lhs, Rhs > >
|
||||||
{
|
operator&&( const constraint< Lhs >& lhs,
|
||||||
return detail::not_<Constraint>(c.c_);
|
const constraint< Rhs >& rhs )
|
||||||
}
|
{
|
||||||
} // namespace mock
|
return detail::and_< Lhs, Rhs >( lhs.c_, rhs.c_ );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename Constraint >
|
||||||
|
const constraint< detail::not_< Constraint > >
|
||||||
|
operator!( const constraint< Constraint >& c )
|
||||||
|
{
|
||||||
|
return detail::not_< Constraint >( c.c_ );
|
||||||
|
}
|
||||||
|
} // mock
|
||||||
|
|
||||||
#define MOCK_UNARY_CONSTRAINT(Name, n, Args, Expr) \
|
#define MOCK_UNARY_CONSTRAINT(Name, n, Args, Expr) \
|
||||||
namespace detail { \
|
namespace detail \
|
||||||
|
{ \
|
||||||
struct Name \
|
struct Name \
|
||||||
{ \
|
{ \
|
||||||
template<typename Actual> \
|
template< typename Actual > \
|
||||||
bool operator()(const Actual& actual) const \
|
bool operator()( const Actual& actual ) const \
|
||||||
{ \
|
{ \
|
||||||
(void)actual; \
|
|
||||||
return Expr; \
|
return Expr; \
|
||||||
} \
|
} \
|
||||||
friend std::ostream& operator<<(std::ostream& s, const Name&) { return s << BOOST_STRINGIZE(Name); } \
|
friend std::ostream& operator<<( std::ostream& s, const Name& ) \
|
||||||
|
{ \
|
||||||
|
return s << BOOST_STRINGIZE(Name); \
|
||||||
|
} \
|
||||||
}; \
|
}; \
|
||||||
} \
|
} \
|
||||||
const mock::constraint<detail::Name> Name;
|
const mock::constraint< detail::Name > Name;
|
||||||
|
|
||||||
#define MOCK_CONSTRAINT_ASSIGN(z, n, d) expected##n(std::forward<T##n>(e##n))
|
#define MOCK_CONSTRAINT_ASSIGN(z, n, d) \
|
||||||
|
expected##n( boost::forward< T##n >(e##n) )
|
||||||
|
|
||||||
#define MOCK_CONSTRAINT_UNWRAP_REF(z, n, d) mock::unwrap_ref(expected##n)
|
#define MOCK_CONSTRAINT_UNWRAP_REF(z, n, d) \
|
||||||
|
boost::unwrap_ref( expected##n )
|
||||||
|
|
||||||
#define MOCK_CONSTRAINT_FORMAT(z, n, d) BOOST_PP_IF(n, << ", " <<, ) mock::format(c.expected##n)
|
#define MOCK_CONSTRAINT_FORMAT(z, n, d) \
|
||||||
|
BOOST_PP_IF(n, << ", " <<,) mock::format( c.expected##n )
|
||||||
|
|
||||||
#define MOCK_CONSTRAINT_MEMBER(z, n, d) Expected_##n expected##n;
|
#define MOCK_CONSTRAINT_MEMBER(z, n, d) \
|
||||||
|
Expected_##n expected##n;
|
||||||
|
|
||||||
#define MOCK_CONSTRAINT_TPL_TYPE(z, n, d) std::decay_t<const T##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 mock::unwrap_reference_t<Expected_##n>& BOOST_PP_ARRAY_ELEM(n, Args)
|
const typename boost::unwrap_reference< Expected_##n >::type& \
|
||||||
|
BOOST_PP_ARRAY_ELEM(n, Args)
|
||||||
|
|
||||||
#define MOCK_CONSTRAINT_ARG(z, n, Args) T##n&& BOOST_PP_ARRAY_ELEM(n, Args)
|
#define MOCK_CONSTRAINT_ARG(z, n, Args) \
|
||||||
|
BOOST_FWD_REF(T##n) BOOST_PP_ARRAY_ELEM(n, Args)
|
||||||
|
|
||||||
#define MOCK_CONSTRAINT_ARGS(z, n, Args) T##n&& e##n
|
#define MOCK_CONSTRAINT_ARGS(z, n, Args) \
|
||||||
|
BOOST_FWD_REF(T##n) e##n
|
||||||
|
|
||||||
#define MOCK_CONSTRAINT_PARAM(z, n, Args) std::forward<T##n>(BOOST_PP_ARRAY_ELEM(n, Args))
|
#define MOCK_CONSTRAINT_PARAM(z, 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, _) ) \
|
||||||
|
: BOOST_PP_ENUM(n, MOCK_CONSTRAINT_ASSIGN, _) \
|
||||||
{} \
|
{} \
|
||||||
template<typename Actual> \
|
template< typename Actual > \
|
||||||
bool operator()(const Actual& actual) const \
|
bool operator()( const Actual& actual ) const \
|
||||||
{ \
|
{ \
|
||||||
return test(actual, BOOST_PP_ENUM(n, MOCK_CONSTRAINT_UNWRAP_REF, _)); \
|
return test( actual, \
|
||||||
|
BOOST_PP_ENUM(n, MOCK_CONSTRAINT_UNWRAP_REF, _) ); \
|
||||||
} \
|
} \
|
||||||
template<typename Actual> \
|
template< typename Actual > \
|
||||||
bool test(const Actual& actual, BOOST_PP_ENUM(n, MOCK_CONSTRAINT_CREF_PARAM, (n, Args))) const \
|
bool test( const Actual& actual, \
|
||||||
|
BOOST_PP_ENUM(n, \
|
||||||
|
MOCK_CONSTRAINT_CREF_PARAM, (n, Args)) ) const \
|
||||||
{ \
|
{ \
|
||||||
return Expr; \
|
return Expr; \
|
||||||
} \
|
} \
|
||||||
friend std::ostream& operator<<(std::ostream& s, const Name& c) \
|
friend std::ostream& operator<<( std::ostream& s, const Name& c ) \
|
||||||
{ \
|
{ \
|
||||||
return s << BOOST_STRINGIZE(Name) << "( " << BOOST_PP_REPEAT(n, MOCK_CONSTRAINT_FORMAT, _) << " )"; \
|
return s << BOOST_STRINGIZE(Name) << "( " \
|
||||||
|
<< BOOST_PP_REPEAT(n, MOCK_CONSTRAINT_FORMAT, _) \
|
||||||
|
<< " )"; \
|
||||||
} \
|
} \
|
||||||
BOOST_PP_REPEAT(n, MOCK_CONSTRAINT_MEMBER, _) \
|
BOOST_PP_REPEAT(n, MOCK_CONSTRAINT_MEMBER, _) \
|
||||||
}; \
|
}; \
|
||||||
} \
|
} \
|
||||||
template<BOOST_PP_ENUM_PARAMS(n, typename T)> \
|
template< BOOST_PP_ENUM_PARAMS(n, typename T) > \
|
||||||
mock::constraint<detail::Name<BOOST_PP_ENUM(n, MOCK_CONSTRAINT_TPL_TYPE, _)>> Name( \
|
mock::constraint< \
|
||||||
BOOST_PP_ENUM(n, MOCK_CONSTRAINT_ARG, (n, Args))) \
|
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, _)>( \
|
return detail::Name< BOOST_PP_ENUM(n, MOCK_CONSTRAINT_TPL_TYPE, _) >( \
|
||||||
BOOST_PP_ENUM(n, MOCK_CONSTRAINT_PARAM, (n, Args))); \
|
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, MOCK_NARY_CONSTRAINT, MOCK_UNARY_CONSTRAINT)(Name, n, Args, Expr)
|
BOOST_PP_IF(n, \
|
||||||
|
MOCK_NARY_CONSTRAINT, \
|
||||||
|
MOCK_UNARY_CONSTRAINT)(Name, n, Args, Expr)
|
||||||
|
|
||||||
|
#ifdef MOCK_VARIADIC_MACROS
|
||||||
|
|
||||||
|
#if 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(Name, n, BOOST_PP_ARRAY_TO_TUPLE(BOOST_PP_ARRAY_POP_BACK(Array)), BOOST_PP_ARRAY_ELEM(n, Array))
|
MOCK_CONSTRAINT_EXT( \
|
||||||
|
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) MOCK_CONSTRAINT_AUX_AUX(Name, BOOST_PP_DEC(Size), (Size, Tuple))
|
#define MOCK_CONSTRAINT_AUX(Name, Size, Tuple) \
|
||||||
|
MOCK_CONSTRAINT_AUX_AUX(Name, BOOST_PP_DEC(Size), (Size,Tuple))
|
||||||
|
|
||||||
#define MOCK_CONSTRAINT(Name, ...) MOCK_CONSTRAINT_AUX(Name, BOOST_PP_VARIADIC_SIZE(__VA_ARGS__), (__VA_ARGS__))
|
#define MOCK_CONSTRAINT(Name, ...) \
|
||||||
|
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
|
||||||
|
|
|
||||||
|
|
@ -11,243 +11,298 @@
|
||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "constraint.hpp"
|
#include "constraint.hpp"
|
||||||
#include "detail/void_t.hpp"
|
#include "detail/addressof.hpp"
|
||||||
#include "unwrap_reference.hpp"
|
#include "detail/move_helper.hpp"
|
||||||
|
#include <boost/ref.hpp>
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
#if BOOST_VERSION >= 107000
|
#include <boost/utility/enable_if.hpp>
|
||||||
# include <boost/test/tools/floating_point_comparison.hpp>
|
#include <boost/type_traits/common_type.hpp>
|
||||||
#else
|
#include <boost/type_traits/is_convertible.hpp>
|
||||||
# include <boost/test/floating_point_comparison.hpp>
|
#include <boost/type_traits/has_equal_to.hpp>
|
||||||
#endif
|
#include <boost/test/floating_point_comparison.hpp>
|
||||||
#include <functional>
|
|
||||||
#include <memory>
|
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
namespace mock {
|
namespace mock
|
||||||
MOCK_UNARY_CONSTRAINT(any, 0, , ((void)actual, true))
|
{
|
||||||
MOCK_UNARY_CONSTRAINT(affirm, 0, , !!actual)
|
MOCK_UNARY_CONSTRAINT( any, 0,, ((void)actual, true) )
|
||||||
MOCK_UNARY_CONSTRAINT(negate, 0, , !actual)
|
MOCK_UNARY_CONSTRAINT( affirm, 0,, !! actual )
|
||||||
MOCK_UNARY_CONSTRAINT(evaluate, 0, , actual())
|
MOCK_UNARY_CONSTRAINT( negate, 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() boost::test_tools::check_is_small(actual, tolerance)
|
# define MOCK_SMALL() \
|
||||||
|
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( \
|
||||||
|
actual, \
|
||||||
|
expected, \
|
||||||
|
boost::test_tools::percent_tolerance( tolerance ) )
|
||||||
# define MOCK_FRACTION_TOLERANCE() \
|
# define MOCK_FRACTION_TOLERANCE() \
|
||||||
boost::test_tools::check_is_close(actual, expected, boost::test_tools::fraction_tolerance(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>
|
{
|
||||||
bool is_small(const T& t, const Tolerance& tolerance)
|
template< typename T, typename 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 std::common_type_t<T1, T2> common_type;
|
typedef typename boost::common_type< T1, T2 >::type common_type;
|
||||||
return boost::math::fpc::close_at_tolerance<common_type>(tolerance, boost::math::fpc::FPC_STRONG)(t1, t2);
|
return boost::math::fpc::close_at_tolerance< common_type >(
|
||||||
|
tolerance, boost::math::fpc::FPC_STRONG )( t1, t2 );
|
||||||
}
|
}
|
||||||
} // namespace detail
|
}
|
||||||
|
|
||||||
# define MOCK_SMALL() detail::is_small(actual, tolerance)
|
# define MOCK_SMALL() \
|
||||||
# define MOCK_PERCENT_TOLERANCE() detail::is_close(actual, expected, boost::math::fpc::percent_tolerance(tolerance))
|
detail::is_small( actual, tolerance )
|
||||||
# define MOCK_FRACTION_TOLERANCE() detail::is_close(actual, expected, tolerance)
|
# define MOCK_PERCENT_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_SMALL()))
|
MOCK_NARY_CONSTRAINT( small, 1, ( tolerance ),
|
||||||
|
( 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_PERCENT_TOLERANCE()))
|
MOCK_NARY_CONSTRAINT( close, 2, ( expected, tolerance ),
|
||||||
|
( MOCK_PERCENT_TOLERANCE() ) )
|
||||||
|
|
||||||
MOCK_NARY_CONSTRAINT(close_fraction, 2, (expected, tolerance), (MOCK_FRACTION_TOLERANCE()))
|
MOCK_NARY_CONSTRAINT( close_fraction, 2, ( expected, 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), std::abs(actual - expected) <= tolerance)
|
MOCK_NARY_CONSTRAINT( near, 2, ( 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>
|
{
|
||||||
struct has_equal_to : std::false_type
|
template< typename Expected >
|
||||||
{};
|
|
||||||
|
|
||||||
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) : expected_(expected) {}
|
explicit equal( Expected expected )
|
||||||
template<typename Actual>
|
: expected_( expected )
|
||||||
bool operator()(const Actual& actual,
|
{}
|
||||||
std::enable_if_t<has_equal_to<Actual, unwrap_reference_t<Expected>>::value>* = 0) const
|
template< typename Actual >
|
||||||
|
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 == unwrap_ref(expected_);
|
return actual == boost::unwrap_ref( expected_ );
|
||||||
}
|
}
|
||||||
template<typename Actual>
|
template< typename Actual >
|
||||||
bool operator()(const Actual& actual,
|
bool operator()( const Actual& actual,
|
||||||
std::enable_if_t<!has_equal_to<Actual, unwrap_reference_t<Expected>>::value>* = 0) const
|
typename boost::disable_if<
|
||||||
|
boost::has_equal_to<
|
||||||
|
Actual,
|
||||||
|
typename
|
||||||
|
boost::unwrap_reference< Expected >::type
|
||||||
|
>
|
||||||
|
>::type* = 0 ) const
|
||||||
{
|
{
|
||||||
return actual && *actual == unwrap_ref(expected_);
|
return actual && *actual == boost::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) : expected_(std::addressof(unwrap_ref(expected))) {}
|
explicit same( const Expected& expected )
|
||||||
template<typename Actual>
|
: expected_( detail::addressof( boost::unwrap_ref( expected ) ) )
|
||||||
bool operator()(const Actual& actual) const
|
{}
|
||||||
|
template< typename Actual >
|
||||||
|
bool operator()( const Actual& actual ) const
|
||||||
{
|
{
|
||||||
return std::addressof(actual) == expected_;
|
return detail::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 unwrap_reference_t<Expected>* expected_;
|
const typename
|
||||||
|
boost::unwrap_reference< Expected >::type* expected_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Expected>
|
template< typename Expected >
|
||||||
struct retrieve
|
struct retrieve
|
||||||
{
|
{
|
||||||
explicit retrieve(Expected& expected) : expected_(std::addressof(unwrap_ref(expected))) {}
|
explicit retrieve( Expected& expected )
|
||||||
template<typename Actual>
|
: expected_( detail::addressof( boost::unwrap_ref( expected ) ) )
|
||||||
bool operator()(
|
{}
|
||||||
const Actual& actual,
|
template< typename Actual >
|
||||||
std::enable_if_t<!std::is_convertible<const Actual*, unwrap_reference_t<Expected>>::value>* = 0) const
|
bool operator()( const Actual& actual,
|
||||||
|
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()(
|
bool operator()( BOOST_RV_REF(Actual) actual,
|
||||||
Actual&& actual,
|
typename boost::disable_if<
|
||||||
std::enable_if_t<!std::is_convertible<const Actual*, unwrap_reference_t<Expected>>::value>* = 0) const
|
boost::is_convertible<
|
||||||
|
const Actual*,
|
||||||
|
typename
|
||||||
|
boost::unwrap_reference< Expected >::type
|
||||||
|
>
|
||||||
|
>::type* = 0 ) const
|
||||||
{
|
{
|
||||||
*expected_ = std::move(actual);
|
*expected_ = boost::move( actual );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
template<typename Actual>
|
template< typename Actual >
|
||||||
bool operator()(Actual& actual,
|
bool operator()( Actual& actual,
|
||||||
std::enable_if_t<std::is_convertible<Actual*, unwrap_reference_t<Expected>>::value>* = 0) const
|
typename boost::enable_if<
|
||||||
|
boost::is_convertible< Actual*,
|
||||||
|
typename
|
||||||
|
boost::unwrap_reference< Expected >::type
|
||||||
|
>
|
||||||
|
>::type* = 0 ) const
|
||||||
{
|
{
|
||||||
*expected_ = std::addressof(actual);
|
*expected_ = detail::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_ ) << " )";
|
||||||
}
|
}
|
||||||
unwrap_reference_t<Expected>* expected_;
|
typename
|
||||||
|
boost::unwrap_reference< Expected >::type* expected_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Expected>
|
template< typename Expected >
|
||||||
struct assign
|
struct assign
|
||||||
{
|
{
|
||||||
explicit assign(const Expected& expected) : expected_(expected) {}
|
explicit assign( const Expected& expected )
|
||||||
template<typename Actual>
|
: expected_( expected )
|
||||||
bool operator()(Actual& actual) const
|
{}
|
||||||
|
template< typename Actual >
|
||||||
|
bool operator()( Actual& actual ) const
|
||||||
{
|
{
|
||||||
actual = unwrap_ref(expected_);
|
actual = boost::unwrap_ref( expected_ );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
template<typename Actual>
|
template< typename Actual >
|
||||||
bool operator()(Actual* actual,
|
bool operator()( Actual* actual,
|
||||||
std::enable_if_t<std::is_convertible<unwrap_reference_t<Expected>, Actual>::value>* = 0) const
|
typename boost::enable_if<
|
||||||
|
boost::is_convertible<
|
||||||
|
typename
|
||||||
|
boost::unwrap_reference< Expected >::type,
|
||||||
|
Actual
|
||||||
|
>
|
||||||
|
>::type* = 0 ) const
|
||||||
{
|
{
|
||||||
if(!actual)
|
if( ! actual )
|
||||||
return false;
|
return false;
|
||||||
*actual = unwrap_ref(expected_);
|
*actual = boost::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) : expected_(expected) {}
|
explicit contain( const Expected& expected )
|
||||||
bool operator()(const std::string& actual) const
|
: expected_( expected )
|
||||||
|
{}
|
||||||
|
bool operator()( const std::string& actual ) const
|
||||||
{
|
{
|
||||||
return actual.find(unwrap_ref(expected_)) != std::string::npos;
|
return actual.find( boost::unwrap_ref( expected_ ) )
|
||||||
|
!= 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::same<T>> same(T& t)
|
constraint< detail::equal< typename detail::forward_type< T >::type > > equal( BOOST_FWD_REF(T) t )
|
||||||
{
|
{
|
||||||
return detail::same<T>(t);
|
return detail::equal< typename detail::forward_type< T >::type >( boost::forward< 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<T> call(T t)
|
constraint< detail::same< T > > same( T& t )
|
||||||
{
|
{
|
||||||
return constraint<T>(t);
|
return detail::same< T >( t );
|
||||||
}
|
}
|
||||||
} // namespace mock
|
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 >
|
||||||
|
constraint< T > call( T t )
|
||||||
|
{
|
||||||
|
return constraint< T >( t );
|
||||||
|
}
|
||||||
|
} // mock
|
||||||
|
|
||||||
#endif // MOCK_CONSTRAINTS_HPP_INCLUDED
|
#endif // MOCK_CONSTRAINTS_HPP_INCLUDED
|
||||||
|
|
|
||||||
|
|
@ -10,128 +10,217 @@
|
||||||
#define MOCK_ACTION_HPP_INCLUDED
|
#define MOCK_ACTION_HPP_INCLUDED
|
||||||
|
|
||||||
#include "../config.hpp"
|
#include "../config.hpp"
|
||||||
#include <functional>
|
#include <boost/type_traits/remove_reference.hpp>
|
||||||
#include <memory>
|
#include <boost/type_traits/remove_const.hpp>
|
||||||
#include <type_traits>
|
#include <boost/noncopyable.hpp>
|
||||||
|
#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 detail {
|
namespace mock
|
||||||
template<typename Result, typename Signature>
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template< typename Result, typename Signature >
|
||||||
class action_base
|
class action_base
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef std::function<Signature> functor_type;
|
#ifdef MOCK_HDR_FUNCTIONAL
|
||||||
typedef std::function<Result()> action_type;
|
typedef std::function< Signature > functor_type;
|
||||||
|
typedef std::function< Result() > action_type;
|
||||||
protected:
|
#else
|
||||||
// Meant to be subclassed and not be directly used
|
typedef boost::function< Signature > functor_type;
|
||||||
// Non-relocatable (contained functions may wrap references/pointers which could be invalidated)
|
typedef boost::function< Result() > action_type;
|
||||||
action_base() = default;
|
#endif
|
||||||
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 { return f_; }
|
const functor_type& functor() const
|
||||||
bool valid() const { return f_ || a_; }
|
|
||||||
Result trigger() const { return a_(); }
|
|
||||||
|
|
||||||
void calls(const functor_type& f)
|
|
||||||
{
|
{
|
||||||
if(!f)
|
return f_;
|
||||||
throw std::invalid_argument("null functor");
|
}
|
||||||
|
bool valid() const
|
||||||
|
{
|
||||||
|
return f_ || a_;
|
||||||
|
}
|
||||||
|
Result trigger() const
|
||||||
|
{
|
||||||
|
return a_();
|
||||||
|
}
|
||||||
|
|
||||||
|
void calls( const functor_type& f )
|
||||||
|
{
|
||||||
|
if( ! f )
|
||||||
|
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_ = [e]() -> Result { throw e; };
|
a_ = boost::bind( &do_throw< Exception >, e );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void set(const action_type& a) { a_ = a; }
|
void set( const action_type& a )
|
||||||
template<typename Y>
|
|
||||||
void set(const std::reference_wrapper<Y>& r)
|
|
||||||
{
|
{
|
||||||
a_ = [r]() -> Result { return r.get(); };
|
a_ = a;
|
||||||
|
}
|
||||||
|
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_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Type erased value storage
|
template< typename Result, typename Signature >
|
||||||
struct value
|
class action : public action_base< Result, Signature >
|
||||||
{
|
|
||||||
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(std::ref(store(v)));
|
this->set( boost::ref( store( v ) ) );
|
||||||
}
|
}
|
||||||
template<typename Y>
|
template< typename Y >
|
||||||
void returns(const std::reference_wrapper<Y>& r)
|
void returns( const boost::reference_wrapper< Y >& r )
|
||||||
{
|
{
|
||||||
this->set(r);
|
this->set( r );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Value>
|
template< typename Value >
|
||||||
void moves(Value&& v)
|
void moves( BOOST_RV_REF(Value) v )
|
||||||
{
|
{
|
||||||
auto vRef = std::ref(store(std::move(v)));
|
this->set(
|
||||||
this->set([vRef]() { return std::move(vRef.get()); });
|
boost::bind(
|
||||||
|
&move< typename boost::remove_reference< Value >::type >,
|
||||||
|
boost::ref( store( boost::move( v ) ) ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<typename T>
|
template< typename Value >
|
||||||
typename value_imp<T>::type& store(T&& t)
|
static BOOST_RV_REF(Value) move( Value& t )
|
||||||
{
|
{
|
||||||
v_ = std::make_unique<value_imp<T>>(std::forward<T>(t));
|
return boost::move( t );
|
||||||
return static_cast<value_imp<T>&>(*v_).t_;
|
|
||||||
}
|
}
|
||||||
template<typename T>
|
struct value : boost::noncopyable
|
||||||
std::remove_reference_t<Result>& store(T* t)
|
|
||||||
{
|
{
|
||||||
v_ = std::make_unique<value_imp<Result>>(t);
|
virtual ~value()
|
||||||
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;
|
||||||
|
|
||||||
std::unique_ptr<value> v_;
|
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 Signature>
|
template< typename T >
|
||||||
class action<void, Signature> : public action_base<void, Signature>
|
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_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template< typename Signature >
|
||||||
|
class action< void, Signature > : public action_base< void, Signature >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
action()
|
action()
|
||||||
{
|
{
|
||||||
this->set([]() {});
|
this->set( boost::bind( &do_nothing ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void do_nothing()
|
||||||
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
}} // namespace mock::detail
|
#ifdef MOCK_AUTO_PTR
|
||||||
|
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
|
||||||
|
|
|
||||||
36
include/turtle/detail/addressof.hpp
Normal file
36
include/turtle/detail/addressof.hpp
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
// 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
|
||||||
|
|
@ -10,38 +10,43 @@
|
||||||
#define MOCK_CHILD_HPP_INCLUDED
|
#define MOCK_CHILD_HPP_INCLUDED
|
||||||
|
|
||||||
#include "../config.hpp"
|
#include "../config.hpp"
|
||||||
#include "parent.hpp"
|
|
||||||
#include "type_name.hpp"
|
#include "type_name.hpp"
|
||||||
#include <boost/optional.hpp>
|
#include "parent.hpp"
|
||||||
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
||||||
|
#include <boost/optional.hpp>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
namespace mock { namespace detail {
|
namespace mock
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
class child
|
class child
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
child() : parent_(0) {}
|
child()
|
||||||
void update(parent& p,
|
: parent_( 0 )
|
||||||
|
{}
|
||||||
|
void update( parent& p,
|
||||||
boost::unit_test::const_string instance,
|
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 )
|
||||||
{
|
{
|
||||||
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
|
||||||
|
|
|
||||||
|
|
@ -11,32 +11,34 @@
|
||||||
|
|
||||||
#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 detail {
|
namespace mock
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
class verifiable;
|
class verifiable;
|
||||||
|
|
||||||
class context
|
class context : boost::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
context() = default;
|
context() {}
|
||||||
context(const context&) = delete;
|
virtual ~context() {}
|
||||||
context& operator=(const context&) = delete;
|
|
||||||
|
|
||||||
virtual ~context() = default;
|
virtual void add( const void* p, verifiable& v,
|
||||||
|
|
||||||
virtual void add(const void* p,
|
|
||||||
verifiable& v,
|
|
||||||
boost::unit_test::const_string instance,
|
boost::unit_test::const_string instance,
|
||||||
boost::optional<type_name> type,
|
boost::optional< type_name > type,
|
||||||
boost::unit_test::const_string name) = 0;
|
boost::unit_test::const_string name ) = 0;
|
||||||
virtual void add(verifiable& v) = 0;
|
virtual void add( verifiable& v ) = 0;
|
||||||
virtual void remove(verifiable& v) = 0;
|
virtual void remove( verifiable& v ) = 0;
|
||||||
|
|
||||||
virtual void serialize(std::ostream& s, const verifiable& v) const = 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
|
||||||
|
|
|
||||||
|
|
@ -1,183 +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_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
|
|
||||||
272
include/turtle/detail/expectation_template.hpp
Normal file
272
include/turtle/detail/expectation_template.hpp
Normal file
|
|
@ -0,0 +1,272 @@
|
||||||
|
// 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
|
||||||
|
|
||||||
|
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, _) )
|
||||||
|
{
|
||||||
|
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_RV_REF
|
||||||
|
|
@ -11,31 +11,40 @@
|
||||||
|
|
||||||
#include "../config.hpp"
|
#include "../config.hpp"
|
||||||
#include "../stream.hpp"
|
#include "../stream.hpp"
|
||||||
#include <memory>
|
#include "addressof.hpp"
|
||||||
|
|
||||||
namespace mock { namespace detail {
|
namespace mock
|
||||||
template<typename T>
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template< typename T >
|
||||||
struct formatter
|
struct formatter
|
||||||
{
|
{
|
||||||
explicit formatter(const T& t) : t_(std::addressof(t)) {}
|
explicit formatter( const T& t )
|
||||||
void serialize(stream& s) const { detail::serialize(s, *t_); }
|
: t_( detail::addressof( 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
|
||||||
|
|
|
||||||
|
|
@ -10,72 +10,106 @@
|
||||||
#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 "context.hpp"
|
#include "../matcher.hpp"
|
||||||
#include "function_impl.hpp"
|
#include "action.hpp"
|
||||||
|
#include "verifiable.hpp"
|
||||||
|
#include "invocation.hpp"
|
||||||
#include "type_name.hpp"
|
#include "type_name.hpp"
|
||||||
#include <boost/optional.hpp>
|
#include "context.hpp"
|
||||||
|
#include "mutex.hpp"
|
||||||
|
#include "move_helper.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/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 <ostream>
|
#include <ostream>
|
||||||
|
#include <vector>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
namespace mock { namespace detail {
|
namespace mock
|
||||||
template<typename Signature>
|
{
|
||||||
class function;
|
namespace detail
|
||||||
|
{
|
||||||
template<typename R, typename... Ts>
|
template< typename R, typename E >
|
||||||
class function<R(Ts...)>
|
struct wrapper_base
|
||||||
{
|
{
|
||||||
private:
|
wrapper_base( E& e )
|
||||||
typedef function_impl<R(Ts...)> impl_type;
|
: e_( &e )
|
||||||
typedef typename impl_type::wrapper_type expectation_type;
|
{}
|
||||||
typedef typename impl_type::error_type error_type;
|
|
||||||
|
|
||||||
public:
|
template< typename T >
|
||||||
function() : impl_(std::make_shared<impl_type>()) {}
|
void returns( T t )
|
||||||
|
|
||||||
bool verify() const { return impl_->verify(); }
|
|
||||||
bool verify(const char* file, int line) const
|
|
||||||
{
|
{
|
||||||
error_type::pass(file, line);
|
e_->returns( t );
|
||||||
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)
|
E* e_;
|
||||||
{
|
|
||||||
error_type::pass(file, line);
|
|
||||||
return impl_->expect(file, line);
|
|
||||||
}
|
|
||||||
expectation_type expect() { return impl_->expect(); }
|
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
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:
|
|
||||||
std::shared_ptr<impl_type> impl_;
|
|
||||||
};
|
};
|
||||||
}} // namespace mock::detail
|
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 boost::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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // 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
|
||||||
|
|
|
||||||
|
|
@ -1,362 +0,0 @@
|
||||||
// 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
|
|
||||||
329
include/turtle/detail/function_impl_template.hpp
Normal file
329
include/turtle/detail/function_impl_template.hpp
Normal file
|
|
@ -0,0 +1,329 @@
|
||||||
|
// 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
|
||||||
11
include/turtle/detail/function_iterate.hpp
Normal file
11
include/turtle/detail/function_iterate.hpp
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// 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
|
||||||
106
include/turtle/detail/function_template.hpp
Normal file
106
include/turtle/detail/function_template.hpp
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
// 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
|
||||||
|
|
@ -14,41 +14,39 @@
|
||||||
#include "mutex.hpp"
|
#include "mutex.hpp"
|
||||||
#include "singleton.hpp"
|
#include "singleton.hpp"
|
||||||
|
|
||||||
namespace mock { namespace detail {
|
namespace mock
|
||||||
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 );
|
||||||
// MOCK_FUNCTOR creates 2 functor objects:
|
static functor* f = 0;
|
||||||
// The user-usable one with the passed name and a 2nd used by MOCK_EXPECT with a suffixed name
|
if( f )
|
||||||
// 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)
|
|
||||||
{
|
{
|
||||||
// Release the lock from the first call (see below) so other threads can create functors again
|
|
||||||
// after the function exits (the scoped_lock still holds the mutex)
|
|
||||||
functor_mutex.unlock();
|
|
||||||
// Copy the first functor to the current (2nd) one
|
|
||||||
*this = *f;
|
*this = *f;
|
||||||
f = nullptr;
|
f = 0;
|
||||||
} else
|
functor_mutex.unlock();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// This is the first object, store its pointer
|
|
||||||
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();
|
functor_mutex.lock();
|
||||||
|
f = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}} // namespace mock::detail
|
}
|
||||||
|
} // mock
|
||||||
|
|
||||||
#endif // MOCK_FUNCTOR_HPP_INCLUDED
|
#endif // MOCK_FUNCTOR_HPP_INCLUDED
|
||||||
|
|
|
||||||
|
|
@ -11,39 +11,54 @@
|
||||||
|
|
||||||
#include "../config.hpp"
|
#include "../config.hpp"
|
||||||
#include "verifiable.hpp"
|
#include "verifiable.hpp"
|
||||||
#include <algorithm>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace mock { namespace detail {
|
namespace mock
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
class group
|
class group
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void add(verifiable& v) { verifiables_.push_back(&v); }
|
void add( verifiable& v )
|
||||||
void remove(verifiable& v)
|
|
||||||
{
|
{
|
||||||
verifiables_.erase(std::remove(verifiables_.begin(), verifiables_.end(), &v), verifiables_.end());
|
verifiables_.push_back( &v );
|
||||||
|
}
|
||||||
|
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(const auto* verifiable : verifiables_)
|
for( verifiables_cit it = verifiables_.begin();
|
||||||
if(!verifiable->verify())
|
it != verifiables_.end(); ++it )
|
||||||
|
if( ! (*it)->verify() )
|
||||||
valid = false;
|
valid = false;
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
const auto verifiables = verifiables_;
|
const verifiables_t verifiables = verifiables_;
|
||||||
for(auto* verifiable : verifiables)
|
for( verifiables_cit it = verifiables.begin();
|
||||||
if(std::find(verifiables_.begin(), verifiables_.end(), verifiable) != verifiables_.end())
|
it != verifiables.end(); ++it )
|
||||||
verifiable->reset();
|
if( std::find( verifiables_.begin(), verifiables_.end(), *it )
|
||||||
|
!= verifiables_.end() )
|
||||||
|
(*it)->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<verifiable*> verifiables_;
|
typedef std::vector< verifiable* > verifiables_t;
|
||||||
|
typedef verifiables_t::const_iterator verifiables_cit;
|
||||||
|
|
||||||
|
verifiables_t verifiables_;
|
||||||
};
|
};
|
||||||
}} // namespace mock::detail
|
}
|
||||||
|
} // mock
|
||||||
|
|
||||||
#endif // MOCK_GROUP_HPP_INCLUDED
|
#endif // MOCK_GROUP_HPP_INCLUDED
|
||||||
|
|
|
||||||
|
|
@ -10,70 +10,86 @@
|
||||||
#define MOCK_INVOCATION_HPP_INCLUDED
|
#define MOCK_INVOCATION_HPP_INCLUDED
|
||||||
|
|
||||||
#include "../config.hpp"
|
#include "../config.hpp"
|
||||||
#include <limits>
|
#include <boost/noncopyable.hpp>
|
||||||
#include <ostream>
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <ostream>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace mock { namespace detail {
|
namespace mock
|
||||||
class invocation
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
class invocation : private boost::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
invocation() = default;
|
invocation() {}
|
||||||
invocation(const invocation&) = delete;
|
virtual ~invocation() {}
|
||||||
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) { return i.serialize(s); }
|
friend std::ostream& operator<<( std::ostream& s, const invocation& i )
|
||||||
|
{
|
||||||
|
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) : min_(min), max_(max), count_(0)
|
between( std::size_t min, std::size_t max )
|
||||||
|
: 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 { return count_ >= max_; }
|
virtual bool exhausted() const
|
||||||
|
{
|
||||||
|
return count_ >= max_;
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool verify() const { return min_ <= count_ && count_ <= max_; }
|
virtual bool verify() const
|
||||||
|
{
|
||||||
|
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_ << "/[" << min_ << ',' << max_ << "] )";
|
return s << "between( " << count_
|
||||||
|
<< "/[" << min_ << ',' << max_ << "] )";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class exactly : public between
|
class exactly : public between
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit exactly(std::size_t count) : between(count, count) {}
|
explicit exactly( std::size_t 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_ << " )";
|
||||||
}
|
}
|
||||||
|
|
@ -82,28 +98,40 @@ namespace mock { namespace detail {
|
||||||
class never : public exactly
|
class never : public exactly
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
never() : exactly(0) {}
|
never()
|
||||||
|
: exactly( 0 )
|
||||||
|
{}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual std::ostream& serialize(std::ostream& s) const { return s << "never()"; }
|
virtual std::ostream& serialize( std::ostream& s ) const
|
||||||
|
{
|
||||||
|
return s << "never()";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class once : public exactly
|
class once : public exactly
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
once() : exactly(1) {}
|
once()
|
||||||
|
: exactly( 1 )
|
||||||
|
{}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual std::ostream& serialize(std::ostream& s) const { return s << "once()"; }
|
virtual std::ostream& serialize( std::ostream& s ) const
|
||||||
|
{
|
||||||
|
return s << "once()";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class at_least : public between
|
class at_least : public between
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit at_least(std::size_t min) : between(min, (std::numeric_limits<std::size_t>::max)()) {}
|
explicit at_least( std::size_t min )
|
||||||
|
: 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_ << " )";
|
||||||
}
|
}
|
||||||
|
|
@ -112,10 +140,12 @@ namespace mock { namespace detail {
|
||||||
class at_most : public between
|
class at_most : public between
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit at_most(std::size_t max) : between(0, max) {}
|
explicit at_most( std::size_t 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_ << " )";
|
||||||
}
|
}
|
||||||
|
|
@ -124,11 +154,17 @@ namespace mock { namespace detail {
|
||||||
class unlimited : public at_least
|
class unlimited : public at_least
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
unlimited() : at_least(0) {}
|
unlimited()
|
||||||
|
: at_least( 0 )
|
||||||
|
{}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual std::ostream& serialize(std::ostream& s) const { return s << "unlimited()"; }
|
virtual std::ostream& serialize( std::ostream& s ) const
|
||||||
|
{
|
||||||
|
return s << "unlimited()";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}} // namespace mock::detail
|
}
|
||||||
|
} // mock
|
||||||
|
|
||||||
#endif // MOCK_INVOCATION_HPP_INCLUDED
|
#endif // MOCK_INVOCATION_HPP_INCLUDED
|
||||||
|
|
|
||||||
|
|
@ -10,17 +10,53 @@
|
||||||
#define MOCK_IS_FUNCTOR_HPP_INCLUDED
|
#define MOCK_IS_FUNCTOR_HPP_INCLUDED
|
||||||
|
|
||||||
#include "../config.hpp"
|
#include "../config.hpp"
|
||||||
#include "void_t.hpp"
|
#include <boost/function_types/is_callable_builtin.hpp>
|
||||||
#include <type_traits>
|
#include <boost/type_traits/detail/yes_no_type.hpp>
|
||||||
|
#include <boost/utility/declval.hpp>
|
||||||
|
#include <boost/mpl/has_xxx.hpp>
|
||||||
|
#include <boost/mpl/or.hpp>
|
||||||
|
|
||||||
namespace mock { namespace detail {
|
namespace mock
|
||||||
/// Trait to return true if F is a functor that can be called with a single argument Arg
|
{
|
||||||
template<typename F, typename Arg, class = void>
|
namespace detail
|
||||||
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>
|
}
|
||||||
struct is_functor<F, Arg, void_t<decltype(std::declval<F>()(std::declval<Arg>()))>> : std::true_type
|
} // mock
|
||||||
{};
|
|
||||||
}} // namespace mock::detail
|
|
||||||
|
|
||||||
#endif // MOCK_IS_FUNCTOR_HPP_INCLUDED
|
#endif // MOCK_IS_FUNCTOR_HPP_INCLUDED
|
||||||
|
|
|
||||||
|
|
@ -1,38 +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_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
|
|
||||||
42
include/turtle/detail/matcher_base_template.hpp
Normal file
42
include/turtle/detail/matcher_base_template.hpp
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
// 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
|
||||||
|
|
@ -1,114 +0,0 @@
|
||||||
// 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
|
|
||||||
78
include/turtle/detail/move_helper.hpp
Normal file
78
include/turtle/detail/move_helper.hpp
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
// 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
|
||||||
|
|
@ -11,124 +11,156 @@
|
||||||
|
|
||||||
#include "../config.hpp"
|
#include "../config.hpp"
|
||||||
#include "singleton.hpp"
|
#include "singleton.hpp"
|
||||||
#include <memory>
|
#include <boost/move/move.hpp>
|
||||||
|
#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/lock_guard.hpp>
|
#include <boost/thread/recursive_mutex.hpp>
|
||||||
# include <boost/thread/recursive_mutex.hpp>
|
#include <boost/thread/lock_guard.hpp>
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
namespace mock { namespace detail {
|
namespace mock
|
||||||
# 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 std::shared_ptr<mutex>& m) : m_(m) { m_->lock(); }
|
lock( const boost::shared_ptr< mutex >& m )
|
||||||
|
: m_( m )
|
||||||
|
{
|
||||||
|
m_->lock();
|
||||||
|
}
|
||||||
~lock()
|
~lock()
|
||||||
{
|
{
|
||||||
if(m_)
|
if( m_ )
|
||||||
m_->unlock();
|
m_->unlock();
|
||||||
}
|
}
|
||||||
lock(const lock&) = delete;
|
lock( BOOST_RV_REF( lock ) x )
|
||||||
lock(lock&& x) = default;
|
: m_( x.m_ )
|
||||||
lock& operator=(const lock&) = delete;
|
{
|
||||||
lock& operator=(lock&& x) = default;
|
// Explicit reset to avoid unlock in destructor
|
||||||
|
x.m_.reset();
|
||||||
|
}
|
||||||
|
lock& operator=( BOOST_RV_REF( lock ) x )
|
||||||
|
{
|
||||||
|
m_ = x.m_;
|
||||||
|
x.m_.reset();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<mutex> m_;
|
boost::shared_ptr< mutex > m_;
|
||||||
};
|
};
|
||||||
}} // namespace mock::detail
|
}
|
||||||
|
} // mock
|
||||||
|
|
||||||
#else // MOCK_THREAD_SAFE
|
#else // MOCK_THREAD_SAFE
|
||||||
|
|
||||||
namespace mock { namespace detail {
|
namespace mock
|
||||||
struct mutex
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
struct mutex : boost::noncopyable
|
||||||
{
|
{
|
||||||
mutex() = default;
|
void lock()
|
||||||
mutex(const mutex&) = delete;
|
{}
|
||||||
mutex& operator=(const mutex&) = delete;
|
void unlock()
|
||||||
|
{}
|
||||||
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
|
struct scoped_lock : boost::noncopyable
|
||||||
{
|
{
|
||||||
scoped_lock(const scoped_lock&) = delete;
|
scoped_lock( mutex& )
|
||||||
scoped_lock& operator=(const scoped_lock&) = delete;
|
{}
|
||||||
|
~scoped_lock()
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
class lock : boost::noncopyable
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
BOOST_MOVABLE_BUT_NOT_COPYABLE(lock)
|
||||||
|
|
||||||
scoped_lock(mutex&) {}
|
|
||||||
~scoped_lock() {}
|
|
||||||
};
|
|
||||||
class lock
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
lock(const std::shared_ptr<mutex>&) {}
|
lock( const boost::shared_ptr< mutex >& )
|
||||||
~lock() {}
|
{}
|
||||||
lock(const lock&) = delete;
|
~lock()
|
||||||
lock(lock&&) = default;
|
{}
|
||||||
lock& operator=(const lock&) = delete;
|
lock( BOOST_RV_REF( lock ) x )
|
||||||
lock& operator=(lock&&) = default;
|
{}
|
||||||
|
lock& operator=( BOOST_RV_REF( lock ) x )
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}} // namespace mock::detail
|
}
|
||||||
|
} // mock
|
||||||
|
|
||||||
#endif // MOCK_THREAD_SAFE
|
#endif // MOCK_THREAD_SAFE
|
||||||
|
|
||||||
namespace mock { namespace detail {
|
namespace mock
|
||||||
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,
|
static void fail( const char* message, const Context& context,
|
||||||
const Context& context,
|
const char* file = "unknown location", int line = 0 )
|
||||||
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
|
||||||
|
|
|
||||||
|
|
@ -10,51 +10,58 @@
|
||||||
#define MOCK_OBJECT_IMPL_HPP_INCLUDED
|
#define MOCK_OBJECT_IMPL_HPP_INCLUDED
|
||||||
|
|
||||||
#include "../config.hpp"
|
#include "../config.hpp"
|
||||||
#include "child.hpp"
|
|
||||||
#include "context.hpp"
|
|
||||||
#include "mutex.hpp"
|
|
||||||
#include "parent.hpp"
|
|
||||||
#include "root.hpp"
|
#include "root.hpp"
|
||||||
|
#include "parent.hpp"
|
||||||
#include "type_name.hpp"
|
#include "type_name.hpp"
|
||||||
#include <boost/optional.hpp>
|
#include "context.hpp"
|
||||||
|
#include "child.hpp"
|
||||||
|
#include "mutex.hpp"
|
||||||
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
||||||
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
|
#include <boost/make_shared.hpp>
|
||||||
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
namespace mock { namespace detail {
|
namespace mock
|
||||||
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() : mutex_(std::make_shared<mutex>()) {}
|
object_impl()
|
||||||
|
: mutex_( boost::make_shared< mutex >() )
|
||||||
|
{}
|
||||||
|
|
||||||
virtual void add(const void* /*p*/,
|
virtual void add( const void* /*p*/, verifiable& v,
|
||||||
verifiable& v,
|
|
||||||
boost::unit_test::const_string instance,
|
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 )
|
||||||
{
|
{
|
||||||
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_ );
|
||||||
const auto it = children_.find(&v);
|
children_cit it = children_.find( &v );
|
||||||
if(it != children_.end())
|
if( it != children_.end() )
|
||||||
s << it->second;
|
s << it->second;
|
||||||
else
|
else
|
||||||
s << "?";
|
s << "?";
|
||||||
|
|
@ -62,22 +69,26 @@ namespace mock { 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_ );
|
||||||
std::shared_ptr<object_impl> guard = shared_from_this();
|
boost::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_;
|
||||||
std::map<const verifiable*, child> children_;
|
children_t children_;
|
||||||
const std::shared_ptr<mutex> mutex_;
|
const boost::shared_ptr< mutex > mutex_;
|
||||||
};
|
};
|
||||||
}} // namespace mock::detail
|
}
|
||||||
|
} // mock
|
||||||
|
|
||||||
#endif // MOCK_OBJECT_IMPL_HPP_INCLUDED
|
#endif // MOCK_OBJECT_IMPL_HPP_INCLUDED
|
||||||
|
|
|
||||||
34
include/turtle/detail/parameter.hpp
Normal file
34
include/turtle/detail/parameter.hpp
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
// 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
|
||||||
|
|
@ -11,30 +11,36 @@
|
||||||
|
|
||||||
#include "../config.hpp"
|
#include "../config.hpp"
|
||||||
#include "type_name.hpp"
|
#include "type_name.hpp"
|
||||||
#include <boost/optional.hpp>
|
|
||||||
#include <boost/test/utils/basic_cstring/io.hpp>
|
#include <boost/test/utils/basic_cstring/io.hpp>
|
||||||
|
#include <boost/optional.hpp>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
namespace mock { namespace detail {
|
namespace mock
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
class parent
|
class parent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
parent() = default;
|
parent()
|
||||||
parent(boost::unit_test::const_string instance, boost::optional<type_name> type)
|
|
||||||
: instance_(instance), type_(type)
|
|
||||||
{}
|
{}
|
||||||
friend std::ostream& operator<<(std::ostream& s, const parent& p)
|
parent( boost::unit_test::const_string instance,
|
||||||
|
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
|
||||||
|
|
|
||||||
|
|
@ -1,22 +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_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
|
|
||||||
|
|
@ -10,110 +10,128 @@
|
||||||
#define MOCK_ROOT_HPP_INCLUDED
|
#define MOCK_ROOT_HPP_INCLUDED
|
||||||
|
|
||||||
#include "../config.hpp"
|
#include "../config.hpp"
|
||||||
#include "child.hpp"
|
|
||||||
#include "context.hpp"
|
|
||||||
#include "group.hpp"
|
|
||||||
#include "mutex.hpp"
|
|
||||||
#include "parent.hpp"
|
#include "parent.hpp"
|
||||||
|
#include "group.hpp"
|
||||||
|
#include "context.hpp"
|
||||||
|
#include "child.hpp"
|
||||||
|
#include "mutex.hpp"
|
||||||
#include "singleton.hpp"
|
#include "singleton.hpp"
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include <map>
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
namespace mock { namespace detail {
|
namespace mock
|
||||||
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,
|
virtual void add( const void* p, verifiable& v,
|
||||||
verifiable& v,
|
|
||||||
boost::unit_test::const_string instance,
|
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 )
|
||||||
{
|
{
|
||||||
scoped_lock _(mutex_);
|
scoped_lock _( mutex_ );
|
||||||
auto it = children_.lower_bound(&v);
|
children_t::iterator it = children_.lower_bound( &v );
|
||||||
if(it == children_.end() || children_.key_comp()(&v, it->first))
|
if( it == children_.end() ||
|
||||||
it = children_.insert(it, std::make_pair(&v, counter_child(parents_, p)));
|
children_.key_comp()( &v, it->first ) )
|
||||||
it->second.update(instance, type, name);
|
it = children_.insert( it,
|
||||||
|
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_ );
|
||||||
const auto it = children_.find(&v);
|
children_cit 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*, std::pair<parent, std::size_t>> parents_t;
|
typedef std::map< const void*,
|
||||||
|
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), it_(parents.insert(std::make_pair(p, parents_t::mapped_type())).first)
|
: parents_( &parents )
|
||||||
|
, it_( parents.insert(
|
||||||
|
std::make_pair( p, parents_t::mapped_type() ) ).first )
|
||||||
{
|
{
|
||||||
++it_->second.second;
|
++it_->second.second;
|
||||||
}
|
}
|
||||||
counter_child(const counter_child& rhs) : parents_(rhs.parents_), it_(rhs.it_), child_(rhs.child_)
|
counter_child( const counter_child& rhs )
|
||||||
|
: 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_;
|
||||||
std::map<const verifiable*, counter_child> children_;
|
children_t 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
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue