Merge pull request #2 from mat007/build-with-b2

Build with b2
This commit is contained in:
Mathieu Champlon 2015-03-30 09:04:28 +02:00
commit df20ff111f
126 changed files with 15627 additions and 15564 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
bin
out

85
.travis.yml Normal file
View file

@ -0,0 +1,85 @@
# 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.
#
os:
- linux
env:
- CXX_STANDARD=c++98
- CXX_STANDARD=c++0x
before_install:
# 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))
# Autodetect Boost branch by using the following code: - BRANCH_TO_TEST=`git rev-parse --abbrev-ref HEAD`
# or by - BRANCH_TO_TEST=$TRAVIS_BRANCH or just directly specify it
- BRANCH_TO_TEST=master
# Files, which coverage results must be ignored (files from other projects). Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/path.cpp'
- IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/path.cpp */numeric/conversion/converter_policies.hpp'
# From this point and below code is same for all the Boost libs
# Cloning Boost libraries (fast nondeep cloning)
- PROJECT_DIR=`pwd`
- BOOST=$HOME/boost-local
- git init $BOOST
- cd $BOOST
- git remote add --no-tags -t $BRANCH_TO_TEST origin https://github.com/boostorg/boost.git
- git fetch --depth=1
- git checkout $BRANCH_TO_TEST
- git submodule update --init --merge
- git remote set-branches --add origin $BRANCH_TO_TEST
- git pull --recurse-submodules
- git submodule update --init
- git checkout $BRANCH_TO_TEST
- git submodule foreach "git reset --quiet --hard; git clean -fxd"
- git reset --hard; git clean -fxd
- git status
- ./bootstrap.sh
- ./b2 headers
- sudo apt-get install -qq xsltproc
script:
- if [ "$CCFLAGS" != "" ]; then FLAGS="cxxflags=\"$CCFLAGS\" linkflags=\"$LINKFLAGS\""; else FLAGS=""; fi
- cd $PROJECT_DIR/build
# `--coverage` flags required to generate coverage info for Coveralls
# ../../../b2 -q cxxflags="--coverage -std=$CXX_STANDARD" linkflags="--coverage"
- export BOOST_ROOT=$BOOST
- ./build.sh cxxflags="--coverage -std=$CXX_STANDARD" 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
# ... changind data format to a readable one
- lcov --directory $COVERALS_DIR --base-directory ./ --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
# ... erasing data that is not related to this project directly
- OTHER_LIBS=`grep "submodule .*" .gitmodules | sed 's/\[submodule\ "\(.*\)"\]/"\*\/boost\/\1\.hpp" "\*\/boost\/\1\/\*"/g'| sed "/\"\*\/boost\/$PROJECT_TO_TEST\/\*\"/d" | sed ':a;N;$!ba;s/\n/ /g'`
- echo $OTHER_LIBS
- eval "lcov --remove $COVERALS_DIR/coverage.info $OTHER_LIBS -o $COVERALS_DIR/coverage.info"
# Sending data to Coveralls
- cd $PROJECT_DIR
- gem install coveralls-lcov
- coveralls-lcov coverals/coverage.info

View file

@ -1,3 +1,8 @@
# 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)
import modules ; import modules ;

13
README.md Normal file
View file

@ -0,0 +1,13 @@
#[Turtle](http://turtle.sourceforge.net)
Turtle is a C++ mock object library based on Boost with a focus on usability, simplicity and flexibility.
### Test results
[![Build Status](https://travis-ci.org/mat007/turtle.svg)](https://travis-ci.org/mat007/turtle)
[![Coverage Status](https://coveralls.io/repos/mat007/turtle/badge.png)](https://coveralls.io/r/mat007/turtle)
[Open Issues](https://sourceforge.net/p/turtle/tickets)
### License
Distributed under the [Boost Software License, Version 1.0](http://boost.org/LICENSE_1_0.txt).

37
build/build.bat Normal file
View file

@ -0,0 +1,37 @@
@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
goto Start
:Error
color 00
goto :eof
:Start
rem error if BOOST_ROOT not set
set BOOST=%BOOST_ROOT%
pushd ..\test
%BOOST%\b2 -q %*
popd
if errorlevel 1 goto Error
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 goto Error
pushd ..\doc
%BOOST%\b2 -q %*
popd
:End

View file

@ -1,5 +1 @@
extensions = svn,headers,check extensions = headers,check,run
src.dir = ${root.dir}
tests.dir = ${root.dir}
libraries.dir = ${root.dir}
boost.dir = ${out.dir}/../boost

40
build/build.sh Executable file
View file

@ -0,0 +1,40 @@
#!/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)
run()
{
echo $@
$@
r=$?
if test $r -ne 0 ; then
exit $r
fi
}
copy()
{
for dir; do true; done
run mkdir -p $dir
run cp $@
}
run export BOOST=$BOOST_ROOT
run cd ../test
run $BOOST/b2 -q "$@"
run cd ../build
run export BOOSTBOOK_DIR=../bin/turtle/boostbook
run copy -r "$BOOST"/tools/boostbook/xsl $BOOSTBOOK_DIR
run copy -r "$BOOST"/tools/boostbook/dtd $BOOSTBOOK_DIR
run copy -r boostbook/* $BOOSTBOOK_DIR
run copy "$BOOST"/doc/src/boostbook.css ../doc/html
run copy "$BOOST"/doc/src/images/*.png ../doc/html/images
run copy "$BOOST"/doc/src/images/callouts/*.png ../doc/html/images/callouts
run cd ../doc
run $BOOST/b2 -q "$@"
run cd ../build

View file

@ -1,173 +1,60 @@
<!--
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"> <project name="turtle" default="all">
<property environment="env"/> <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"/>
<import file="${env.PONEY_HOME}/poney.xml"/> <import file="${env.PONEY_HOME}/poney.xml"/>
<property name="boost.root" value="${env.BOOST_ROOT}"/>
<property name="boost.dir" value="${out.dir}/../boost"/>
<property name="boostbook.dir" value="${out.dir}/boostbook"/>
<property name="boost-mock.dir" value="${boost.dir}/libs/mock"/>
<target name="clean" description="clean intermediate build artifacts">
<delete dir="${out.dir}"/>
</target>
<target name="configure" description="update external libraries">
<update name="boost"/>
</target>
<presetdef name="build-turtle-test">
<build-test input="test" depends="boost" mode="all" excludes="bench_*,fail_*">
<compilerarg value="-Wno-uninitialized" location="mid" if="is-cygwin"/>
<compilerarg value="-Wno-strict-aliasing" location="mid" if="is-gcc"/>
<compilerarg value="/wd4505" if="is-msvc"/>
</build-test>
</presetdef>
<target name="test" description="run unit tests">
<delete dir="${tests.dir}/test/bin"/>
<build-turtle-test name="turtle"/>
<build-turtle-test name="turtle_max_args">
<defineset>
<define name="MOCK_MAX_ARGS" value="21"/>
</defineset>
</build-turtle-test>
<build-turtle-test name="turtle_use_conversions">
<defineset define="MOCK_USE_CONVERSIONS"/>
</build-turtle-test>
<build-turtle-test name="turtle_no_decltype">
<defineset define="MOCK_NO_DECLTYPE"/>
</build-turtle-test>
<build-turtle-test name="turtle_no_variadic_macros">
<defineset define="MOCK_NO_VARIADIC_MACROS"/>
</build-turtle-test>
<build-turtle-test name="turtle_thread_safe">
<defineset define="MOCK_THREAD_SAFE"/>
</build-turtle-test>
</target>
<target name="analyse" description="run errors analyser">
<quiet>
<mkdir dir="${reports.dir}"/>
<delete file="${reports.dir}/errors-${platform}.log"/>
<touch file="${reports.dir}/errors-${platform}.log"/>
</quiet>
<for param="file">
<fileset dir="${tests.dir}/test" includes="fail*.cpp"/>
<sequential>
<record name="${reports.dir}/errors-${platform}.log" action="start" append="true"/>
<ant target="-analyse">
<property name="file" value="@{file}"/>
</ant>
<record name="${reports.dir}/errors-${platform}.log" action="stop"/>
</sequential>
</for>
</target>
<target name="-analyse">
<trycatch>
<try>
<echo>${file}</echo>
<compile name="errors" input="${tests.dir}/errors_test" outdir="${out.dir}/errors_test" excludes="**">
<includepath path="${libraries.dir}"/>
<fileset file="${file}"/>
</compile>
</try>
</trycatch>
</target>
<target name="bench" description="run compilation benchmark">
<mkdir dir="${reports.dir}"/>
<quiet>
<delete file="${reports.dir}/benchmark-${platform}.log"/>
<touch file="${reports.dir}/benchmark-${platform}.log"/>
<delete dir="${out.dir}/bench_test"/>
<delete dir="${tests.dir}/test/bin"/>
</quiet>
<for param="file">
<fileset dir="${tests.dir}/test" includes="bench_*.cpp"/>
<sequential>
<record name="${reports.dir}/benchmark-${platform}.log" action="start" append="true"/>
<ant target="-bench">
<property name="file" value="@{file}"/>
</ant>
<record name="${reports.dir}/benchmark-${platform}.log" action="stop"/>
</sequential>
</for>
</target>
<target name="-bench">
<echo>${file}</echo>
<stopwatch name="bench"/>
<quiet>
<compile name="bench" input="${tests.dir}/test" outdir="${out.dir}/bench_test" excludes="**">
<includepath path="${libraries.dir}"/>
<fileset file="${file}"/>
</compile>
</quiet>
<stopwatch name="bench" action="total"/>
</target>
<target name="reports" description="generate code analysis reports"> <target name="reports" description="generate code analysis reports">
<headers name="turtle" excludes="**/*_iterate.hpp,**/*_template.hpp"/> <headers name="turtle" excludes="**/*_iterate.hpp,**/*_template.hpp"/>
<check name="turtle"/> <check name="turtle"/>
</target> </target>
<target name="export" description="export distribution"> <target name="build" description="build tests and documentation">
<sync todir="${dist.dir}/include"> <run dir="." script="build"/>
<fileset dir="${libraries.dir}" includes="turtle/**"/>
</sync>
<info version="svn rev ${svn.revision}" todir="${dist.dir}"/>
</target> </target>
<target name="package" depends="export" description="package distribution"> <target name="release" depends="build" description="produce release packages">
<mkdir dir="${dist.dir}"/> <fail unless="version" message="missing version property"/>
<zip destfile="${dist.dir}/${ant.project.name}.zip"> <copy file="version.hpp" tofile="${out.dir}/version.hpp">
<filterset>
<filter token="MOCK_VERSION" value="${version}"/>
</filterset>
</copy>
<zip destfile="${dist.dir}/${ant.project.name}-${version}.zip">
<fileset dir="${dist.dir}" includes="include/**"/> <fileset dir="${dist.dir}" includes="include/**"/>
<zipfileset dir="${doc.dir}/html" prefix="doc"/>
<zipfileset dir="${out.dir}" includes="version.hpp" prefix="include/turtle"/>
</zip> </zip>
<tar destfile="${dist.dir}/${ant.project.name}.tar.bz2" compression="bzip2"> <tar destfile="${dist.dir}/${ant.project.name}-${version}.tar.bz2" compression="bzip2">
<fileset dir="${dist.dir}" includes="include/**"/> <fileset dir="${dist.dir}" includes="include/**"/>
<zipfileset dir="${doc.dir}/html" prefix="doc"/>
<zipfileset dir="${out.dir}" includes="version.hpp" prefix="include/turtle"/>
</tar> </tar>
</target> </target>
<condition property="b2.toolset" value="--toolset=${boost.toolset}" else=""> <target name="all" depends="build,reports,release" description="build documentation, run tests and package distribution"/>
<isset property="boost.toolset"/>
</condition>
<condition property="b2" value="b2.exe" else="b2">
<os family="windows"/>
</condition>
<presetdef name="b2">
<exec taskname="b2" failonerror="true" executable="${boost.root}/${b2}">
<arg value="-q"/>
<arg value="${b2.toolset}"/>
</exec>
</presetdef>
<target name="boost.generate" description="generate boost.mock into ${boost.dir}"> <target name="boost.convert" description="convert Boost.Mock">
<delete dir="${boost-mock.dir}"/> <delete dir="${boost-mock.dir}"/>
<copy todir="${boost-mock.dir}/include/turtle"> <copy todir="${boost-mock.dir}">
<fileset dir="${libraries.dir}/turtle"/> <fileset dir="${root.dir}"/>
</copy> </copy>
<copy todir="${boostbook.dir}">
<fileset dir="${boost.root}/tools/boostbook" includes="xsl/**,dtd/**"/>
</copy>
<copy todir="${boostbook.dir}" overwrite="true">
<fileset dir="boostbook"/>
</copy>
<copy todir="${boost-mock.dir}/doc/html">
<fileset dir="${boost.root}/doc/src" includes="**/boostbook.css,**/**.png"/>
<fileset dir="boost/doc" includes="images/*.png"/>
</copy>
<copy todir="${boost-mock.dir}" overwrite="true">
<fileset dir="${tests.dir}" includes="test/**"/>
<fileset dir="boost" includes="test/**,doc/**,index.html"/>
</copy>
<copy todir="${boost.dir}">
<fileset dir="boost" includes="LICENSE_1_0.txt,Jamroot.jam,Jamfile.v2"/>
</copy>
</target>
<target name="boost.convert" description="convert boost.mock in ${boost.dir}">
<move file="${boost-mock.dir}/include/turtle" tofile="${boost-mock.dir}/include/boost/mock"/> <move file="${boost-mock.dir}/include/turtle" tofile="${boost-mock.dir}/include/boost/mock"/>
<replaceregexp match="MOCK" replace="BOOST_MOCK" flags="g"> <replaceregexp match="MOCK" replace="BOOST_MOCK" flags="g">
<fileset dir="${boost-mock.dir}" includes="**/*.cpp,**/*.hpp,**/*.qbk"/> <fileset dir="${boost-mock.dir}" includes="**/*.cpp,**/*.hpp,**/*.qbk"/>
@ -214,55 +101,23 @@
<replaceregexp match="\[include changelog.qbk\]" replace="" flags="g"> <replaceregexp match="\[include changelog.qbk\]" replace="" flags="g">
<fileset dir="${boost-mock.dir}" includes="**/mock.qbk"/> <fileset dir="${boost-mock.dir}" includes="**/mock.qbk"/>
</replaceregexp> </replaceregexp>
<copy todir="${boostbook.dir}" overwrite="true">
<fileset dir="${boost.root}/tools/boostbook" includes="xsl/**,dtd/**"/>
</copy>
</target> </target>
<target name="boost.test" description="run boost.mock tests in ${boost.dir}"> <target name="boost.build" depends="boost.convert" description="build Boost.Mock tests and documentation">
<b2 dir="${boost-mock.dir}/test"/> <run dir="${boost-mock.dir}/build" script="build"/>
</target> </target>
<target name="boost.doc" description="generate boost.mock documentation in ${boost.dir}"> <target name="boost.package" depends="boost.build" description="package Boost.Mock">
<b2 dir="${boost-mock.dir}/doc">
<env key="BOOSTBOOK_DIR" value="${boostbook.dir}"/>
</b2>
</target>
<target name="boost.package" description="package boost.mock">
<zip destfile="${out.dir}/boost-mock.zip"> <zip destfile="${out.dir}/boost-mock.zip">
<fileset dir="${boost.dir}" includes="libs/mock/**" excludes="**/bin/**"/> <fileset dir="${boost-mock.dir}" includes="libs/mock/**" excludes="**/bin/**"/>
<fileset dir="${boost.dir}" includes="LICENSE_1_0.txt"/> <fileset dir="${boost-mock.dir}" includes="LICENSE_1_0.txt"/>
</zip> </zip>
<tar destfile="${out.dir}/boost-mock.tar.bz2" compression="bzip2"> <tar destfile="${out.dir}/boost-mock.tar.bz2" compression="bzip2">
<fileset dir="${boost.dir}" includes="libs/mock/**" excludes="**/bin/**"/> <fileset dir="${boost-mock.dir}" includes="libs/mock/**" excludes="**/bin/**"/>
<fileset dir="${boost.dir}" includes="LICENSE_1_0.txt"/> <fileset dir="${boost-mock.dir}" includes="LICENSE_1_0.txt"/>
</tar> </tar>
</target> </target>
<target name="documentation" depends="boost.generate,boost.doc" description="generate documentation"/> <target name="boost" depends="boost.convert,boost.build,boost.package" description="convert to boost with documentation and tests"/>
<target name="boost" depends="boost.generate,boost.convert,boost.doc,boost.test,boost.package" description="convert to boost with documentation and tests"/>
<target name="release" depends="documentation,package" description="produce release packages">
<fail unless="version" message="missing version property"/>
<copy file="version.hpp" tofile="${out.dir}/version.hpp">
<filterset>
<filter token="MOCK_VERSION" value="${version}"/>
</filterset>
</copy>
<zip destfile="${dist.dir}/${ant.project.name}-${version}.zip">
<fileset dir="${dist.dir}" includes="include/**"/>
<zipfileset dir="${boost-mock.dir}/doc/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="${dist.dir}" includes="include/**"/>
<zipfileset dir="${boost-mock.dir}/doc/html" prefix="doc"/>
<zipfileset dir="${out.dir}" includes="version.hpp" prefix="include/turtle"/>
</tar>
</target>
<target name="all" depends="configure,test,bench,reports,export,package" description="configure, build and run tests and benchmark, export and package distribution"/>
</project> </project>

3
build/vc100/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
/*.opensdf
/*.sdf
/*.suo

View file

@ -19,45 +19,45 @@
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\turtle\config.hpp" /> <ClInclude Include="..\..\include\turtle\config.hpp" />
<ClInclude Include="..\..\turtle\constraint.hpp" /> <ClInclude Include="..\..\include\turtle\constraint.hpp" />
<ClInclude Include="..\..\turtle\constraints.hpp" /> <ClInclude Include="..\..\include\turtle\constraints.hpp" />
<ClInclude Include="..\..\turtle\detail\action.hpp" /> <ClInclude Include="..\..\include\turtle\detail\action.hpp" />
<ClInclude Include="..\..\turtle\detail\addressof.hpp" /> <ClInclude Include="..\..\include\turtle\detail\addressof.hpp" />
<ClInclude Include="..\..\turtle\detail\child.hpp" /> <ClInclude Include="..\..\include\turtle\detail\child.hpp" />
<ClInclude Include="..\..\turtle\detail\cleanup.hpp" /> <ClInclude Include="..\..\include\turtle\detail\cleanup.hpp" />
<ClInclude Include="..\..\turtle\detail\context.hpp" /> <ClInclude Include="..\..\include\turtle\detail\context.hpp" />
<ClInclude Include="..\..\turtle\detail\expectation_template.hpp" /> <ClInclude Include="..\..\include\turtle\detail\expectation_template.hpp" />
<ClInclude Include="..\..\turtle\detail\formatter.hpp" /> <ClInclude Include="..\..\include\turtle\detail\formatter.hpp" />
<ClInclude Include="..\..\turtle\detail\function.hpp" /> <ClInclude Include="..\..\include\turtle\detail\function.hpp" />
<ClInclude Include="..\..\turtle\detail\function_impl_template.hpp" /> <ClInclude Include="..\..\include\turtle\detail\function_impl_template.hpp" />
<ClInclude Include="..\..\turtle\detail\function_iterate.hpp" /> <ClInclude Include="..\..\include\turtle\detail\function_iterate.hpp" />
<ClInclude Include="..\..\turtle\detail\function_template.hpp" /> <ClInclude Include="..\..\include\turtle\detail\function_template.hpp" />
<ClInclude Include="..\..\turtle\detail\functor.hpp" /> <ClInclude Include="..\..\include\turtle\detail\functor.hpp" />
<ClInclude Include="..\..\turtle\detail\group.hpp" /> <ClInclude Include="..\..\include\turtle\detail\group.hpp" />
<ClInclude Include="..\..\turtle\detail\invocation.hpp" /> <ClInclude Include="..\..\include\turtle\detail\invocation.hpp" />
<ClInclude Include="..\..\turtle\detail\is_functor.hpp" /> <ClInclude Include="..\..\include\turtle\detail\is_functor.hpp" />
<ClInclude Include="..\..\turtle\detail\matcher_base_template.hpp" /> <ClInclude Include="..\..\include\turtle\detail\matcher_base_template.hpp" />
<ClInclude Include="..\..\turtle\detail\mutex.hpp" /> <ClInclude Include="..\..\include\turtle\detail\mutex.hpp" />
<ClInclude Include="..\..\turtle\detail\object_impl.hpp" /> <ClInclude Include="..\..\include\turtle\detail\object_impl.hpp" />
<ClInclude Include="..\..\turtle\detail\parameter.hpp" /> <ClInclude Include="..\..\include\turtle\detail\parameter.hpp" />
<ClInclude Include="..\..\turtle\detail\parent.hpp" /> <ClInclude Include="..\..\include\turtle\detail\parent.hpp" />
<ClInclude Include="..\..\turtle\detail\root.hpp" /> <ClInclude Include="..\..\include\turtle\detail\root.hpp" />
<ClInclude Include="..\..\turtle\detail\sequence_impl.hpp" /> <ClInclude Include="..\..\include\turtle\detail\sequence_impl.hpp" />
<ClInclude Include="..\..\turtle\detail\signature.hpp" /> <ClInclude Include="..\..\include\turtle\detail\signature.hpp" />
<ClInclude Include="..\..\turtle\detail\type_name.hpp" /> <ClInclude Include="..\..\include\turtle\detail\type_name.hpp" />
<ClInclude Include="..\..\turtle\detail\verifiable.hpp" /> <ClInclude Include="..\..\include\turtle\detail\verifiable.hpp" />
<ClInclude Include="..\..\turtle\error.hpp" /> <ClInclude Include="..\..\include\turtle\error.hpp" />
<ClInclude Include="..\..\turtle\exception.hpp" /> <ClInclude Include="..\..\include\turtle\exception.hpp" />
<ClInclude Include="..\..\turtle\format.hpp" /> <ClInclude Include="..\..\include\turtle\format.hpp" />
<ClInclude Include="..\..\turtle\log.hpp" /> <ClInclude Include="..\..\include\turtle\log.hpp" />
<ClInclude Include="..\..\turtle\matcher.hpp" /> <ClInclude Include="..\..\include\turtle\matcher.hpp" />
<ClInclude Include="..\..\turtle\mock.hpp" /> <ClInclude Include="..\..\include\turtle\mock.hpp" />
<ClInclude Include="..\..\turtle\object.hpp" /> <ClInclude Include="..\..\include\turtle\object.hpp" />
<ClInclude Include="..\..\turtle\reset.hpp" /> <ClInclude Include="..\..\include\turtle\reset.hpp" />
<ClInclude Include="..\..\turtle\sequence.hpp" /> <ClInclude Include="..\..\include\turtle\sequence.hpp" />
<ClInclude Include="..\..\turtle\stream.hpp" /> <ClInclude Include="..\..\include\turtle\stream.hpp" />
<ClInclude Include="..\..\turtle\verify.hpp" /> <ClInclude Include="..\..\include\turtle\verify.hpp" />
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}</ProjectGuid> <ProjectGuid>{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}</ProjectGuid>

View file

@ -10,121 +10,121 @@
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\turtle\config.hpp"> <ClInclude Include="..\..\include\turtle\config.hpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\turtle\constraint.hpp"> <ClInclude Include="..\..\include\turtle\constraint.hpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\turtle\constraints.hpp"> <ClInclude Include="..\..\include\turtle\constraints.hpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\turtle\error.hpp"> <ClInclude Include="..\..\include\turtle\error.hpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\turtle\log.hpp"> <ClInclude Include="..\..\include\turtle\exception.hpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\turtle\mock.hpp"> <ClInclude Include="..\..\include\turtle\format.hpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\turtle\object.hpp"> <ClInclude Include="..\..\include\turtle\log.hpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\turtle\sequence.hpp"> <ClInclude Include="..\..\include\turtle\matcher.hpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\turtle\detail\signature.hpp"> <ClInclude Include="..\..\include\turtle\mock.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\child.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\group.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\context.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\parent.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\root.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\type_name.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\verifiable.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\action.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\expectation_template.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\function.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\function_iterate.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\function_template.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\invocation.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\object_impl.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\function_impl_template.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\is_functor.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\stream.hpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\turtle\format.hpp"> <ClInclude Include="..\..\include\turtle\object.hpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\turtle\verify.hpp"> <ClInclude Include="..\..\include\turtle\reset.hpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\turtle\reset.hpp"> <ClInclude Include="..\..\include\turtle\sequence.hpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\turtle\detail\functor.hpp"> <ClInclude Include="..\..\include\turtle\stream.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\parameter.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\sequence_impl.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\formatter.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\detail\cleanup.hpp">
<Filter>Source Files\detail</Filter>
</ClInclude>
<ClInclude Include="..\..\turtle\matcher.hpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\turtle\exception.hpp"> <ClInclude Include="..\..\include\turtle\verify.hpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\turtle\detail\addressof.hpp"> <ClInclude Include="..\..\include\turtle\detail\function.hpp">
<Filter>Source Files\detail</Filter> <Filter>Source Files\detail</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\turtle\detail\mutex.hpp"> <ClInclude Include="..\..\include\turtle\detail\function_impl_template.hpp">
<Filter>Source Files\detail</Filter> <Filter>Source Files\detail</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\turtle\detail\matcher_base_template.hpp"> <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\cleanup.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> <Filter>Source Files\detail</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>

View file

@ -7,7 +7,7 @@
[section Changelog] [section Changelog]
[section trunk] [section unreleased]
Not yet released Not yet released
* Dropped support for obsolete Boost.Phoenix V2 * Dropped support for obsolete Boost.Phoenix V2

View file

@ -54,8 +54,8 @@ public:
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.create< int >(); t.template create< int >();
t.create< std::string >(); t.template create< std::string >();
} }
//] //]
@ -65,19 +65,19 @@ MOCK_CLASS( mock_concept )
template< typename T > template< typename T >
T create(); T create();
template<>
int create< int >()
{
return create_int();
}
template<>
std::string create< std::string >()
{
return create_string();
}
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<>
int mock_concept::create< int >()
{
return create_int();
}
template<>
std::string mock_concept::create< std::string >()
{
return create_string();
}
//] //]
} }

View file

@ -8,7 +8,7 @@
#define BOOST_AUTO_TEST_MAIN #define BOOST_AUTO_TEST_MAIN
#include <boost/test/auto_unit_test.hpp> #include <boost/test/auto_unit_test.hpp>
#include <boost/mock/mock.hpp> #include <turtle/mock.hpp>
#include "calculator.hpp" #include "calculator.hpp"
#include "mock_view.hpp" #include "mock_view.hpp"

View file

@ -35,15 +35,16 @@ namespace
namespace namespace
{ {
template< typename F > template< typename F >
void wait( bool& condition, F flush, int timeout = 100, int sleep = 100 ) void check( bool& condition, F flush, int attempts = 100, int sleep = 100 )
{ {
while( !condition && timeout > 0 ) while( !condition && attempts > 0 )
{ {
--timeout; --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_BASE_CLASS( mock_base_class, base_class )
{ {
MOCK_METHOD( method, 0 ) MOCK_METHOD( method, 0 )
@ -52,10 +53,10 @@ namespace
BOOST_AUTO_TEST_CASE( method_is_called ) BOOST_AUTO_TEST_CASE( method_is_called )
{ {
mock_base_class mock; mock_base_class m;
my_class c( mock ); my_class c( m );
bool done = false; bool done = false;
MOCK_EXPECT( mock.method ).once().calls( boost::lambda::var( done ) = true ); // when method is called it will set done to true MOCK_EXPECT( m.method ).once().calls( boost::lambda::var( done ) = true ); // when method is called it will set done to true
wait( done, boost::bind( &my_class::flush, &c ) ); // just wait on done, flushing from time to time check( done, boost::bind( &my_class::flush, &c ) ); // just wait on done, flushing from time to time
} }
//] //]

View file

@ -109,9 +109,9 @@ struct base
{}; {};
template< typename T > template< typename T >
struct mock : base< T >, mock::object struct name : base< T >, mock::object
{ {
typedef typename base< T > base_type; typedef base< T > base_type;
}; };
//] //]
} }
@ -321,7 +321,7 @@ template< typename T >
MOCK_CLASS( mock_class ) MOCK_CLASS( mock_class )
{ {
MOCK_CONSTRUCTOR( mock_class, 2, ( int, const std::string& ), identifier ) MOCK_CONSTRUCTOR( mock_class, 2, ( int, const std::string& ), identifier )
MOCK_CONSTRUCTOR_TPL( mock_class, 2, ( T, const std::string& ), identifier ) MOCK_CONSTRUCTOR_TPL( mock_class, 2, ( T, const std::string& ), identifier_2 )
}; };
//] //]
} }
@ -747,6 +747,8 @@ BOOST_AUTO_TEST_CASE( demonstrates_enforcing_several_expectation_orders )
//] //]
} }
#ifdef MOCK_LAMBDAS
namespace action_example_1 namespace action_example_1
{ {
//[ action_example_1 //[ action_example_1
@ -773,6 +775,8 @@ BOOST_AUTO_TEST_CASE( demonstrates_configuring_actions )
//] //]
} }
#endif
namespace verification_example_1 namespace verification_example_1
{ {
//[ verification_example_1 //[ verification_example_1

4
doc/html/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
*.css
*.html
*.png
standalone_HTML.manifest

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before After
Before After

View file

@ -165,22 +165,22 @@ namespace detail
expectation& with( expectation& with(
BOOST_PP_ENUM_BINARY_PARAMS(MOCK_NUM_ARGS, Constraint_, c) ) BOOST_PP_ENUM_BINARY_PARAMS(MOCK_NUM_ARGS, Constraint_, c) )
{ {
matcher_ = matcher_.reset(
boost::make_shared< single_matcher< new single_matcher<
void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, Constraint_) ), void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, Constraint_) ),
void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) )
> >( >( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, c) ) );
BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, c) );
return *this; return *this;
} }
#if MOCK_NUM_ARGS > 1 #if MOCK_NUM_ARGS > 1
template< typename Constraint > template< typename Constraint >
expectation& with( const Constraint& c ) expectation& with( const Constraint& c )
{ {
matcher_ = matcher_.reset(
boost::make_shared< multi_matcher< new multi_matcher<
Constraint, Constraint,
void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) > >( c ); void( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) )
>( c ) );
return *this; return *this;
} }
#endif #endif

View file

@ -110,22 +110,26 @@ namespace detail
} }
wrapper exactly( std::size_t count ) wrapper exactly( std::size_t count )
{ {
this->e_->invoke( boost::make_shared< detail::exactly >( count ) ); this->e_->invoke(
boost::make_shared< detail::exactly >( count ) );
return *this; return *this;
} }
wrapper at_least( std::size_t min ) wrapper at_least( std::size_t min )
{ {
this->e_->invoke( boost::make_shared< detail::at_least >( min ) ); this->e_->invoke(
boost::make_shared< detail::at_least >( min ) );
return *this; return *this;
} }
wrapper at_most( std::size_t max ) wrapper at_most( std::size_t max )
{ {
this->e_->invoke( boost::make_shared< detail::at_most >( max ) ); this->e_->invoke(
boost::make_shared< detail::at_most >( max ) );
return *this; return *this;
} }
wrapper between( std::size_t min, std::size_t max ) wrapper between( std::size_t min, std::size_t max )
{ {
this->e_->invoke( boost::make_shared< detail::between >( min, max ) ); this->e_->invoke(
boost::make_shared< detail::between >( min, max ) );
return *this; return *this;
} }

View file

@ -1,3 +1,4 @@
<!-- boost-no-inspect -->
<html> <html>
<head> <head>
<meta http-equiv="refresh" content="0; URL=doc/html/index.html"> <meta http-equiv="refresh" content="0; URL=doc/html/index.html">

View file

@ -30,7 +30,7 @@ rule run-test ( name )
run $(name) undefined.cpp /boost//unit_test_framework : : : <define>MOCK_USE_CONVERSIONS : $(name)_use_conversions ; run $(name) undefined.cpp /boost//unit_test_framework : : : <define>MOCK_USE_CONVERSIONS : $(name)_use_conversions ;
run $(name) undefined.cpp /boost//unit_test_framework : : : <define>MOCK_NO_DECLTYPE : $(name)_no_decltype ; run $(name) undefined.cpp /boost//unit_test_framework : : : <define>MOCK_NO_DECLTYPE : $(name)_no_decltype ;
run $(name) undefined.cpp /boost//unit_test_framework : : : <define>MOCK_NO_VARIADIC_MACROS : $(name)_no_variadic_macros ; run $(name) undefined.cpp /boost//unit_test_framework : : : <define>MOCK_NO_VARIADIC_MACROS : $(name)_no_variadic_macros ;
run $(name) undefined.cpp /boost//unit_test_framework : : : <define>MOCK_THREAD_SAFE : $(name)_thread_safe ; run $(name) undefined.cpp /boost//unit_test_framework /boost//thread : : : <define>MOCK_THREAD_SAFE <define>BOOST_THREAD_USES_MOVE : $(name)_thread_safe ;
} }
rule run-tests rule run-tests

View file

@ -6,7 +6,6 @@
// (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 "../mock_error.hpp" #include "../mock_error.hpp"
#include "../undefined.hpp" #include "../undefined.hpp"
#include <turtle/detail/function.hpp> #include <turtle/detail/function.hpp>

View file

@ -26,3 +26,17 @@ BOOST_AUTO_TEST_CASE( mock_constraint_is_supported_by_compilers_with_variadic_ma
} }
#endif // MOCK_VARIADIC_MACROS #endif // MOCK_VARIADIC_MACROS
namespace
{
MOCK_CONSTRAINT_EXT( constraint_0_ext, 0,, actual == 0 )
MOCK_CONSTRAINT_EXT( constraint_1_ext, 1, ( expected ), actual == expected )
MOCK_CONSTRAINT_EXT( constraint_2_ext, 2, ( expected_0, expected_1 ), actual == expected_0 || actual == expected_1 )
}
BOOST_AUTO_TEST_CASE( mock_constraint_ext_is_supported_by_all_compilers )
{
BOOST_CHECK( constraint_0_ext.c_( 0 ) );
BOOST_CHECK( constraint_1_ext( 0 ).c_( 0 ) );
BOOST_CHECK( constraint_2_ext( 0, 0 ).c_( 0 ) );
}