From 4a128a022126b6c77dad42909cfcb9597ee9a103 Mon Sep 17 00:00:00 2001 From: mat007 Date: Sun, 22 Jul 2012 06:51:19 +0000 Subject: [PATCH] Moved some components into a detail sub-directory git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@478 860be788-9bd5-4423-9f1e-828f051e677b --- build/boost/test/Jamfile.jam | 2 +- build/build.xml | 3 ++ build/vc100/turtle.vcxproj | 21 ++++---- build/vc100/turtle.vcxproj.filters | 66 ++++++++++++++----------- build/vc100/turtle_bench.vcxproj | 8 +-- build/vc100/turtle_test.vcxproj | 13 ++--- build/vc100/turtle_test.vcxproj.filters | 16 ++++-- test/{ => detail}/test_args.cpp | 2 +- test/detail/test_signature.cpp | 27 ++++++++++ test/{ => detail}/test_type_name.cpp | 0 test/test_mock.cpp | 20 -------- turtle/action.hpp | 2 +- turtle/cleanup.hpp | 2 +- turtle/{ => detail}/args.hpp | 0 turtle/{ => detail}/child.hpp | 4 +- turtle/{ => detail}/context.hpp | 2 +- turtle/{ => detail}/group.hpp | 2 +- turtle/{ => detail}/lambda.hpp | 2 +- turtle/{ => detail}/parent.hpp | 2 +- turtle/{ => detail}/root.hpp | 9 ++-- turtle/detail/signature.hpp | 62 +++++++++++++++++++++++ turtle/{ => detail}/type_name.hpp | 0 turtle/{ => detail}/verifiable.hpp | 0 turtle/{ => detail}/yes_no_type.hpp | 0 turtle/function.hpp | 8 +-- turtle/is_functor.hpp | 2 +- turtle/mock.hpp | 48 ++---------------- turtle/object.hpp | 10 ++-- 28 files changed, 188 insertions(+), 145 deletions(-) rename test/{ => detail}/test_args.cpp (95%) create mode 100644 test/detail/test_signature.cpp rename test/{ => detail}/test_type_name.cpp (100%) rename turtle/{ => detail}/args.hpp (100%) rename turtle/{ => detail}/child.hpp (91%) rename turtle/{ => detail}/context.hpp (93%) rename turtle/{ => detail}/group.hpp (94%) rename turtle/{ => detail}/lambda.hpp (94%) rename turtle/{ => detail}/parent.hpp (93%) rename turtle/{ => detail}/root.hpp (93%) create mode 100644 turtle/detail/signature.hpp rename turtle/{ => detail}/type_name.hpp (100%) rename turtle/{ => detail}/verifiable.hpp (100%) rename turtle/{ => detail}/yes_no_type.hpp (100%) diff --git a/build/boost/test/Jamfile.jam b/build/boost/test/Jamfile.jam index 4b64855..6e0e747 100644 --- a/build/boost/test/Jamfile.jam +++ b/build/boost/test/Jamfile.jam @@ -8,7 +8,7 @@ import testing ; -run [ glob test_*.cpp ] /boost//unit_test_framework ; +run [ glob test_*.cpp detail/test_*.cpp ] /boost//unit_test_framework ; compile-fail fail_ambiguous_mock_method.cpp ; compile-fail fail_constraint_functor_not_compatible.cpp ; diff --git a/build/build.xml b/build/build.xml index e1457cc..cab6e14 100644 --- a/build/build.xml +++ b/build/build.xml @@ -141,6 +141,9 @@ + + + diff --git a/build/vc100/turtle.vcxproj b/build/vc100/turtle.vcxproj index 0d0fc7b..adfe01d 100644 --- a/build/vc100/turtle.vcxproj +++ b/build/vc100/turtle.vcxproj @@ -20,33 +20,34 @@ - - - + + + + + + + + + + + - - - - - - - {831F2DEE-1E35-4533-A3B2-12C01BA8DA1D} diff --git a/build/vc100/turtle.vcxproj.filters b/build/vc100/turtle.vcxproj.filters index 070304a..4bc1207 100644 --- a/build/vc100/turtle.vcxproj.filters +++ b/build/vc100/turtle.vcxproj.filters @@ -5,6 +5,9 @@ {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + {b9cb2ff2-1351-456d-985e-cb0dd3f4e12d} + @@ -16,9 +19,6 @@ Source Files - - Source Files - Source Files @@ -31,18 +31,12 @@ Source Files - - Source Files - Source Files Source Files - - Source Files - Source Files @@ -55,41 +49,53 @@ Source Files - - Source Files - - - Source Files - Source Files - - Source Files - - - Source Files - - - Source Files - Source Files - - Source Files - Source Files Source Files - - Source Files - Source Files + + Source Files\detail + + + Source Files\detail + + + Source Files\detail + + + Source Files\detail + + + Source Files\detail + + + Source Files\detail + + + Source Files\detail + + + Source Files\detail + + + Source Files\detail + + + Source Files\detail + + + Source Files\detail + \ No newline at end of file diff --git a/build/vc100/turtle_bench.vcxproj b/build/vc100/turtle_bench.vcxproj index cade182..c6f73fd 100644 --- a/build/vc100/turtle_bench.vcxproj +++ b/build/vc100/turtle_bench.vcxproj @@ -79,7 +79,7 @@ Disabled - ../../../..; ../../include;%(AdditionalIncludeDirectories) + ../..; ../../include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL @@ -106,7 +106,7 @@ Disabled - ../../../..; ../../include;%(AdditionalIncludeDirectories) + ../..; ../../include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL @@ -133,7 +133,7 @@ MaxSpeed - ../../../..; ../../include;%(AdditionalIncludeDirectories) + ../..; ../../include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) Default MultiThreadedDLL @@ -161,7 +161,7 @@ MaxSpeed - ../../../..; ../../include;%(AdditionalIncludeDirectories) + ../..; ../../include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) Default MultiThreadedDLL diff --git a/build/vc100/turtle_test.vcxproj b/build/vc100/turtle_test.vcxproj index f4433c0..943af8b 100644 --- a/build/vc100/turtle_test.vcxproj +++ b/build/vc100/turtle_test.vcxproj @@ -22,7 +22,9 @@ - + + + @@ -34,7 +36,6 @@ - {74810A2A-33D8-47D6-9A50-71261F1683F5} @@ -84,7 +85,7 @@ /Zm172 %(AdditionalOptions) Disabled - ../../../..; ../../include;%(AdditionalIncludeDirectories) + ../..; ../../include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL @@ -117,7 +118,7 @@ /Zm172 %(AdditionalOptions) Disabled - ../../../..; ../../include;%(AdditionalIncludeDirectories) + ../..; ../../include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL @@ -150,7 +151,7 @@ /Zm162 %(AdditionalOptions) MaxSpeed - ../../../..; ../../include;%(AdditionalIncludeDirectories) + ../..; ../../include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) Default MultiThreadedDLL @@ -183,7 +184,7 @@ /Zm162 %(AdditionalOptions) MaxSpeed - ../../../..; ../../include;%(AdditionalIncludeDirectories) + ../..; ../../include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) Default MultiThreadedDLL diff --git a/build/vc100/turtle_test.vcxproj.filters b/build/vc100/turtle_test.vcxproj.filters index bafd93d..04dbbf0 100644 --- a/build/vc100/turtle_test.vcxproj.filters +++ b/build/vc100/turtle_test.vcxproj.filters @@ -5,6 +5,9 @@ {7b7d91a4-7b1e-441a-ac3f-2f93e73ae2ac} cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx;h;hpp;hxx;hm;inl;inc;xsd + + {214599f8-6837-4d60-96ae-b913798819ae} + @@ -12,9 +15,6 @@ - - Source Files - Source Files @@ -48,8 +48,14 @@ Source Files - - Source Files + + Source Files\detail + + + Source Files\detail + + + Source Files\detail \ No newline at end of file diff --git a/test/test_args.cpp b/test/detail/test_args.cpp similarity index 95% rename from test/test_args.cpp rename to test/detail/test_args.cpp index dac6dbd..e19232b 100644 --- a/test/test_args.cpp +++ b/test/detail/test_args.cpp @@ -6,7 +6,7 @@ // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -#include +#include #include #include diff --git a/test/detail/test_signature.cpp b/test/detail/test_signature.cpp new file mode 100644 index 0000000..fa23d9b --- /dev/null +++ b/test/detail/test_signature.cpp @@ -0,0 +1,27 @@ +// 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 +#include +#include + +namespace +{ + struct base + { + void method_1(); + float method_2( int ) const; + }; + + typedef base base_type; + + BOOST_MPL_ASSERT(( + boost::is_same< void(), MOCK_SIGNATURE( method_1 ) > )); + BOOST_MPL_ASSERT(( + boost::is_same< float( int ), MOCK_SIGNATURE( method_2 ) > )); +} diff --git a/test/test_type_name.cpp b/test/detail/test_type_name.cpp similarity index 100% rename from test/test_type_name.cpp rename to test/detail/test_type_name.cpp diff --git a/test/test_mock.cpp b/test/test_mock.cpp index deeab7f..3005691 100644 --- a/test/test_mock.cpp +++ b/test/test_mock.cpp @@ -12,26 +12,6 @@ #include #include -namespace -{ - struct s - { - void m1(); - float m2( int ); - }; - - BOOST_MPL_ASSERT(( - boost::is_same< - void(), - mock::detail::signature< BOOST_TYPEOF( &s::m1 ) >::type - > )); - BOOST_MPL_ASSERT(( - boost::is_same< - float( int ), - mock::detail::signature< BOOST_TYPEOF( &s::m2 ) >::type - > )); -} - namespace { template< typename T > diff --git a/turtle/action.hpp b/turtle/action.hpp index abd3780..9b3c7e8 100644 --- a/turtle/action.hpp +++ b/turtle/action.hpp @@ -9,7 +9,7 @@ #ifndef MOCK_ACTION_HPP_INCLUDED #define MOCK_ACTION_HPP_INCLUDED -#include "lambda.hpp" +#include "detail/lambda.hpp" #include #include #include diff --git a/turtle/cleanup.hpp b/turtle/cleanup.hpp index def66dc..226e655 100644 --- a/turtle/cleanup.hpp +++ b/turtle/cleanup.hpp @@ -13,7 +13,7 @@ #ifdef MOCK_USE_BOOST_TEST -#include "root.hpp" +#include "detail/root.hpp" #include namespace mock diff --git a/turtle/args.hpp b/turtle/detail/args.hpp similarity index 100% rename from turtle/args.hpp rename to turtle/detail/args.hpp diff --git a/turtle/child.hpp b/turtle/detail/child.hpp similarity index 91% rename from turtle/child.hpp rename to turtle/detail/child.hpp index e49814d..ae2bdca 100644 --- a/turtle/child.hpp +++ b/turtle/detail/child.hpp @@ -9,8 +9,8 @@ #ifndef MOCK_CHILD_HPP_INCLUDED #define MOCK_CHILD_HPP_INCLUDED -#include "parent.hpp" -#include "type_name.hpp" +#include "detail/type_name.hpp" +#include "detail/parent.hpp" #include #include #include diff --git a/turtle/context.hpp b/turtle/detail/context.hpp similarity index 93% rename from turtle/context.hpp rename to turtle/detail/context.hpp index 0fd6511..3e559e3 100644 --- a/turtle/context.hpp +++ b/turtle/detail/context.hpp @@ -9,7 +9,7 @@ #ifndef MOCK_CONTEXT_HPP_INCLUDED #define MOCK_CONTEXT_HPP_INCLUDED -#include "type_name.hpp" +#include "detail/type_name.hpp" #include #include #include diff --git a/turtle/group.hpp b/turtle/detail/group.hpp similarity index 94% rename from turtle/group.hpp rename to turtle/detail/group.hpp index ff4b269..9cb9d00 100644 --- a/turtle/group.hpp +++ b/turtle/detail/group.hpp @@ -9,7 +9,7 @@ #ifndef MOCK_GROUP_HPP_INCLUDED #define MOCK_GROUP_HPP_INCLUDED -#include "verifiable.hpp" +#include "detail/verifiable.hpp" #include #include #include diff --git a/turtle/lambda.hpp b/turtle/detail/lambda.hpp similarity index 94% rename from turtle/lambda.hpp rename to turtle/detail/lambda.hpp index 2402056..c8a95e8 100644 --- a/turtle/lambda.hpp +++ b/turtle/detail/lambda.hpp @@ -9,7 +9,7 @@ #ifndef MOCK_LAMBDA_HPP_INCLUDED #define MOCK_LAMBDA_HPP_INCLUDED -#include "config.hpp" +#include "../config.hpp" #ifdef MOCK_USE_BOOST_PHOENIX #include #else diff --git a/turtle/parent.hpp b/turtle/detail/parent.hpp similarity index 93% rename from turtle/parent.hpp rename to turtle/detail/parent.hpp index 96a6c8f..400e509 100644 --- a/turtle/parent.hpp +++ b/turtle/detail/parent.hpp @@ -9,7 +9,7 @@ #ifndef MOCK_PARENT_HPP_INCLUDED #define MOCK_PARENT_HPP_INCLUDED -#include "type_name.hpp" +#include "detail/type_name.hpp" #include #include #include diff --git a/turtle/root.hpp b/turtle/detail/root.hpp similarity index 93% rename from turtle/root.hpp rename to turtle/detail/root.hpp index 0b5a7f5..cea6c35 100644 --- a/turtle/root.hpp +++ b/turtle/detail/root.hpp @@ -9,11 +9,10 @@ #ifndef MOCK_ROOT_HPP_INCLUDED #define MOCK_ROOT_HPP_INCLUDED -#include "group.hpp" -#include "context.hpp" -#include "parent.hpp" -#include "child.hpp" -#include "function.hpp" +#include "detail/parent.hpp" +#include "detail/group.hpp" +#include "detail/context.hpp" +#include "detail/child.hpp" #include #include #include diff --git a/turtle/detail/signature.hpp b/turtle/detail/signature.hpp new file mode 100644 index 0000000..bc900e7 --- /dev/null +++ b/turtle/detail/signature.hpp @@ -0,0 +1,62 @@ +// http://turtle.sourceforge.net +// +// Copyright Mathieu Champlon 2012 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef MOCK_SIGNATURE_HPP_INCLUDED +#define MOCK_SIGNATURE_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#define BOOST_TYPEOF_SILENT +#include + +namespace mock +{ +namespace detail +{ + template< typename M > + struct signature : + boost::function_types::function_type< + boost::mpl::joint_view< + boost::mpl::single_view< + BOOST_DEDUCED_TYPENAME + boost::function_types::result_type< M >::type + >, + BOOST_DEDUCED_TYPENAME boost::mpl::pop_front< + BOOST_DEDUCED_TYPENAME + boost::function_types::parameter_types< M > + >::type + > + > + {}; + + template< typename T > + struct base + { + typedef T base_type; + }; +} + + // if an error is generated by the line below it means + // the method is ambiguous : use MOCK_METHOD_EXT instead + template< typename T > + T& ambiguous_method_name_use_MOCK_METHOD_EXT_instead( const T& ); + +} // mock + +#define MOCK_SIGNATURE(M) \ + mock::detail::signature< \ + BOOST_TYPEOF( \ + mock::ambiguous_method_name_use_MOCK_METHOD_EXT_instead( \ + &base_type::M ) ) \ + >::type + +#endif // MOCK_SIGNATURE_HPP_INCLUDED diff --git a/turtle/type_name.hpp b/turtle/detail/type_name.hpp similarity index 100% rename from turtle/type_name.hpp rename to turtle/detail/type_name.hpp diff --git a/turtle/verifiable.hpp b/turtle/detail/verifiable.hpp similarity index 100% rename from turtle/verifiable.hpp rename to turtle/detail/verifiable.hpp diff --git a/turtle/yes_no_type.hpp b/turtle/detail/yes_no_type.hpp similarity index 100% rename from turtle/yes_no_type.hpp rename to turtle/detail/yes_no_type.hpp diff --git a/turtle/function.hpp b/turtle/function.hpp index 0e994e4..9a637fb 100644 --- a/turtle/function.hpp +++ b/turtle/function.hpp @@ -11,12 +11,12 @@ #include "config.hpp" #include "error.hpp" -#include "context.hpp" #include "expectation.hpp" -#include "verifiable.hpp" #include "log.hpp" -#include "args.hpp" -#include "type_name.hpp" +#include "detail/verifiable.hpp" +#include "detail/type_name.hpp" +#include "detail/context.hpp" +#include "detail/args.hpp" #include #include #include diff --git a/turtle/is_functor.hpp b/turtle/is_functor.hpp index 7a4d6f4..5f54c6a 100644 --- a/turtle/is_functor.hpp +++ b/turtle/is_functor.hpp @@ -9,7 +9,7 @@ #ifndef MOCK_IS_FUNCTOR_HPP_INCLUDED #define MOCK_IS_FUNCTOR_HPP_INCLUDED -#include "yes_no_type.hpp" +#include "detail/yes_no_type.hpp" #include #include #include diff --git a/turtle/mock.hpp b/turtle/mock.hpp index 2e23eb5..1a51167 100644 --- a/turtle/mock.hpp +++ b/turtle/mock.hpp @@ -13,46 +13,16 @@ #include "cleanup.hpp" #include "object.hpp" #include "function.hpp" -#include "args.hpp" -#include "type_name.hpp" +#include "detail/type_name.hpp" +#include "detail/args.hpp" +#include "detail/signature.hpp" #include #include -#include -#include -#include -#include -#include -#include -#define BOOST_TYPEOF_SILENT -#include -#include namespace mock { namespace detail { - template< typename M > - struct signature : - boost::function_types::function_type< - boost::mpl::joint_view< - boost::mpl::single_view< - BOOST_DEDUCED_TYPENAME - boost::function_types::result_type< M >::type - >, - BOOST_DEDUCED_TYPENAME boost::mpl::pop_front< - BOOST_DEDUCED_TYPENAME - boost::function_types::parameter_types< M > - >::type - > - > - {}; - - template< typename T > - struct base - { - typedef T base_type; - }; - template< typename S > struct functor : mock::function< S > { @@ -69,11 +39,6 @@ namespace detail } }; } - - // if an error is generated by the line below it means - // the method is ambiguous : use MOCK_METHOD_EXT instead - template< typename T > - T& ambiguous_method_name_use_MOCK_METHOD_EXT_instead( const T& ); } // mock #define MOCK_BASE_CLASS(T, I) \ @@ -101,13 +66,6 @@ namespace detail return t##_mock_; \ } -#define MOCK_SIGNATURE(M) \ - mock::detail::signature< \ - BOOST_TYPEOF( \ - mock::ambiguous_method_name_use_MOCK_METHOD_EXT_instead( \ - &base_type::M ) ) \ - >::type - #define MOCK_METHOD_AUX(M, n, S, t, c, tpn) \ MOCK_DECL(M, n, S, c, tpn) \ { \ diff --git a/turtle/object.hpp b/turtle/object.hpp index 063b199..c375d6a 100644 --- a/turtle/object.hpp +++ b/turtle/object.hpp @@ -9,11 +9,11 @@ #ifndef MOCK_OBJECT_HPP_INCLUDED #define MOCK_OBJECT_HPP_INCLUDED -#include "root.hpp" -#include "context.hpp" -#include "parent.hpp" -#include "child.hpp" -#include "type_name.hpp" +#include "detail/root.hpp" +#include "detail/parent.hpp" +#include "detail/type_name.hpp" +#include "detail/context.hpp" +#include "detail/child.hpp" #include #include #include