@@ -89,4 +89,6 @@ tests/ut/MockMethodSamples.cpp
# Build install testngpp autogenerated files
tests/3rdparty/testngpp/scripts/dist/
+# .pyc
+*.pyc
new file mode 100644
@@ -0,0 +1,50 @@
+
+as a user
+=========
+ Linux(cygwin included)
+ ------
+ One way:
+ run build_install.sh . (maybe you need to modify some variable in the script first)
+
+ The other way:
+ sudo make install
+ and then use /usr/local/include/mockcpp and /usr/local/lib/libmockcpp.a.
+ if the test framework you use is not testngpp, such as cpputest, gtest etc. , you should run these commands: (there is a $xunit_home/include/gtest/gtest.h file)
+ cmake -DMOCKCPP_XUNIT=gtest -DMOCKCPP_XUNIT_HOME=$xunit_home ../mockcpp/mockcpp
+ make
+ make install
+ see also build_install4gtest.sh
+
+ if you want to specify the install dir, you should run cmake as this:
+ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/somedir ../mockcpp/mockcpp
+
+ Windows
+ -------
+ One way:
+ run build_install.ps1 . (maybe you need to modify some variable in the script first)
+
+ The other way:
+ Run cmake-gui.exe, choose the mockcpp root dir as source dir, and any other (nonexist) dir as binaries dir.
+ Then hit configure button, it will show you some variables that should be set, you can modify them or let it be default, hit configure again.
+ And then hit the generate button.
+ Note:
+ if you want to use mockcpp with other test framework, such as gtest, cpputest, etc.,
+ you must modify MOCKCPP_XUNIT's value, hit configure, and then specify the test framework home path, hit configure again, at last hit the generate button.
+
+
+as a mockcpp developer
+=======================
+ Linux(cygwin included)
+ ------
+ One way:
+ run build.sh .
+
+ The other way:
+ make all
+ it will make mockcpp and it's tests, and then run the tests.(build.sh do the same thing, and much faster.)
+
+ Windows
+ -------
+ run the PowerShell script build.ps1 .
+ maybe you should modify some variables defined in the script first, such as the path of vcbuild/cmake, etc.
+
@@ -1,21 +1,343 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 3.12...3.19)
+set(MOCKCPP_PACKAGE_NAME "mockcpp")
+set(MOCKCPP_PACKAGE_STRING "mockcpp")
+set(MOCKCPP_PACKAGE_BUGREPORT "dev.mockcpp@gmail.com")
+set(MOCKCPP_PACKAGE_URL "http://code.google.com/p/mockcpp")
+set(MOCKCPP_PACKAGE "mockcpp")
+set(MOCKCPP_VERSION "2.6")
+set(mockcpp_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-PROJECT(mockcpp)
+# set(mockcpp_xunit "testngpp" CACHE STRING "Set to gtest/cpputest/cppunit to use other testframeworks.")
+set(mockcpp_xunit "testngpp")
-INCLUDE(ProjectVar.txt)
+include(FindPythonInterp)
-ADD_SUBDIRECTORY(src)
+if (PYTHONINTERP_FOUND)
+ set(PYTHON ${PYTHON_EXECUTABLE})
+else ()
+ message(FATAL_ERROR "No Python interpreter found")
+endif (PYTHONINTERP_FOUND)
-INSTALL(DIRECTORY include/mockcpp DESTINATION include
- PATTERN ".svn" EXCLUDE)
+if (NOT DEFINED MOCKCPP_ALLOW_MI)
+ set(MOCKCPP_ALLOW_MI TRUE)
+endif (NOT DEFINED MOCKCPP_ALLOW_MI)
-INSTALL(DIRECTORY 3rdparty/fake_boost DESTINATION include
- PATTERN ".svn" EXCLUDE)
+if (NOT DEFINED mockcpp_xunit)
+ set(mockcpp_xunit STDEXCEPT)
+endif ()
+
+# Set MOCKCPP_MAX_INHERITANCE
+#
+if (MOCKCPP_ALLOW_MI)
+ set(MOCKCPP_ALLOW_MULTI_INHERITANCE 1)
+ if (NOT DEFINED MOCKCPP_MAX_INHERITANCE)
+ set(MOCKCPP_MAX_INHERITANCE 5)
+ endif (NOT DEFINED MOCKCPP_MAX_INHERITANCE)
+else (MOCKCPP_ALLOW_MI)
+ set(MOCKCPP_ALLOW_MULTI_INHERITANCE 0)
+ set(MOCKCPP_MAX_INHERITANCE 1)
+endif (MOCKCPP_ALLOW_MI)
-INSTALL(DIRECTORY 3rdparty/msinttypes DESTINATION include
- PATTERN ".svn" EXCLUDE)
+if (MOCKCPP_NO_NAMESPACE)
+ set(MOCKCPP_NO_NAMESPACE 1)
+else (MOCKCPP_NO_NAMESPACE)
+ set(MOCKCPP_NO_NAMESPACE 0)
+endif (MOCKCPP_NO_NAMESPACE)
+#
+# Set MOCKCPP_MAX_VTBL_SIZE
+#
+if (NOT MOCKCPP_MAX_VTBL_SIZE)
+ set(MOCKCPP_MAX_VTBL_SIZE 100)
+endif (NOT MOCKCPP_MAX_VTBL_SIZE)
-SET(MOCKCPP_XUNIT "testngpp" CACHE STRING "Set to gtest/cpputest/cppunit to use other testframeworks.")
+if (NOT MOCKCPP_MAX_PARAMETERS)
+ set(MOCKCPP_MAX_PARAMETERS 12)
+endif (NOT MOCKCPP_MAX_PARAMETERS)
+add_definitions(
+ -DPACKAGE_NAME=${MOCKCPP_PACKAGE_NAME}
+ -DPACKAGE_STRING=${MOCKCPP_PACKAGE_STRING}
+ -DPACKAGE_BUGREPORT=${MOCKCPP_PACKAGE_BUGREPORT}
+ -DPACKAGE_URL=${MOCKCPP_PACKAGE_URL}
+ -DPACKAGE=${MOCKCPP_PACKAGE}
+ -DVERSION=${MOCKCPP_VERSION}
+ -DMOCKCPP_NO_NAMESPACE=${MOCKCPP_NO_NAMESPACE}
+ -DMOCKCPP_ALLOW_MULTI_INHERITANCE=${MOCKCPP_ALLOW_MULTI_INHERITANCE}
+ -DMOCKCPP_MAX_INHERITANCE=${MOCKCPP_MAX_INHERITANCE}
+ -DMOCKCPP_MAX_VTBL_SIZE=${MOCKCPP_MAX_VTBL_SIZE}
+ -DMOCKCPP_MAX_PARAMETERS=${MOCKCPP_MAX_PARAMETERS}
+)
+if (MSVC)
+ add_definitions(-DMSVC_VMG_ENABLED) # /Z7)
+ add_definitions(-wd4996 -wd4100 -wd4706 -wd4702 -wd4458 -wd4127)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /vmg")
+ include_directories(BEFORE ${mockcpp_SOURCE_DIR}/3rdparty/msinttypes)
+endif (MSVC)
+
+#if (UNIX)
+#message("UNIX")
+#add_definitions(
+# -g -ggdb
+#)
+#endif (UNIX)
+
+if (UNIX AND NOT CYGWIN)
+ add_definitions(-fPIC)
+endif (UNIX AND NOT CYGWIN)
+
+if (CMAKE_CL_64)
+ add_definitions(-DWIN64)
+endif (CMAKE_CL_64)
+
+set(MOCKCPP_JMPCODE_SRCS
+ src/JmpCodeAARCH32.h
+ src/JmpCodeAARCH64.h
+ src/JmpCodeArch.h
+ src/JmpCodeX64.h
+ src/JmpCodeX86.h
+ src/JmpOnlyApiHook.h
+ src/JmpOnlyApiHook.cpp
+ src/JmpCode.cpp
+)
+
+file(GLOB_RECURSE MOCKCPP_INCS
+ include/mockcpp/*.h
+ include/mockcpp/*.tcc
+ include/mockcpp/*.hpp
+)
+
+source_group(JmpCode FILES ${MOCKCPP_JMPCODE_SRCS})
+
+set(MOCKCPP_SRCS
+ ${MOCKCPP_INCS}
+ ${MOCKCPP_JMPCODE_SRCS}
+ src/AfterMatcher.cpp
+ src/AnyBase.cpp
+ src/AnyCast.cpp
+ src/Any.cpp
+ src/Asserter.cpp
+ src/AssertionFailedError.cpp
+ src/BeforeMatcher.cpp
+ src/CallerMatcher.cpp
+ src/ChainableMockMethodContainer.cpp
+ src/ChainableMockMethodCore.cpp
+ src/ChainableMockMethodIndexKey.cpp
+ src/ChainableMockMethodNameKey.cpp
+ src/ChainableMockObjectBase.cpp
+ src/ChainableMockObject.cpp
+ src/ChainingMockHelper.cpp
+ src/ConstraintSet.cpp
+ src/DecoratedConstraint.cpp
+ src/DefaultMatcher.cpp
+ src/DefaultStub.cpp
+ src/DelegatedMethodGetter.cpp
+ src/MethodIndiceChecker.cpp
+ src/DieStub.cpp
+ src/Exception.cpp
+ src/ExpectsMatcher.cpp
+ src/Formatter.cpp
+ src/IdentityBuilder.cpp
+ src/IgnoreResultHandler.cpp
+ src/IgnoreResultHandlerFactory.cpp
+ src/IgnoreReturnStub.cpp
+ src/InterfaceInfo.cpp
+ src/Invocation.cpp
+ src/InvocationId.cpp
+ src/InvocationMockBuilderGetter.cpp
+ src/InvocationMocker.cpp
+ src/InvocationMockerSet.cpp
+ src/InvocationTimesMatcher.cpp
+ src/InvokedAtLeast.cpp
+ src/InvokedAtMost.cpp
+ src/InvokedExactly.cpp
+ src/InvokedOnce.cpp
+ src/InvokedTimesMatcher.cpp
+ src/IsAnythingHelper.cpp
+ src/IsStringContains.cpp
+ src/IsStringEndWith.cpp
+ src/IsStringStartWith.cpp
+ src/MismatchResultHandler.cpp
+ src/MismatchResultHandlerFactory.cpp
+ src/MockObjectBase.cpp
+ src/NormalResultHandler.cpp
+ src/NormalResultHandlerFactory.cpp
+ src/OutBoundPointer.cpp
+ src/PendingMatcher.cpp
+ src/ProcStub.cpp
+ src/RefAny.cpp
+ src/RepeatStub.cpp
+ src/Result.cpp
+ src/ReturnObjectList.cpp
+ src/ReturnStub.cpp
+ src/SimpleInvocationRecorder.cpp
+ src/StringConstraint.cpp
+ src/StubContainer.cpp
+ src/StubsMatcher.cpp
+ src/TestFailureMatcher.cpp
+ src/ThenStub.cpp
+ src/TypelessConstraintAdapter.cpp
+ src/TypelessStubAdapter.cpp
+ src/TypeString.cpp
+ src/VirtualTable.cpp
+ src/VirtualTableUtils.cpp
+ src/VoidResultHandler.cpp
+ src/VoidResultHandlerFactory.cpp
+ src/WillStub.cpp
+ src/HookMockObject.cpp
+ src/ApiHookKey.cpp
+ src/GlobalMockObject.cpp
+ src/JmpOnlyApiHook.cpp
+ src/JmpCode.cpp
+ src/ApiHook.cpp
+)
+
+if (${mockcpp_xunit} STREQUAL "GTEST" OR ${mockcpp_xunit} STREQUAL "gtest")
+
+ if (NOT DEFINED MOCKCPP_XUNIT_HOME)
+ message(FATAL_ERROR "Please specify MOCKCPP_XUNIT_HOME as the home path of googletest")
+ endif ()
+ find_file(GTEST_HEADER
+ gtest.h
+ PATHS ${MOCKCPP_XUNIT_HOME}/include/gtest
+ NO_DEFAULT_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ NO_CMAKE_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
+ if (NOT GTEST_HEADER)
+ message(FATAL_ERROR "gtest.h not found in ${MOCKCPP_XUNIT_HOME}/include/gtest, please specify MOCKCPP_XUNIT_HOME as the home path of googletest correctly.")
+ endif ()
+ include_directories(BEFORE ${MOCKCPP_XUNIT_HOME}/include)
+ set(MOCKCPP_SRCS ${MOCKCPP_SRCS} src/ports/failure/gtest_report_failure.cpp)
+
+elseif (${mockcpp_xunit} STREQUAL "CppUTest" OR ${mockcpp_xunit} STREQUAL "cpputest")
+
+ if (NOT DEFINED MOCKCPP_XUNIT_HOME)
+ message(FATAL_ERROR "Please specify MOCKCPP_XUNIT_HOME as the home path of googletest")
+ endif ()
+ find_file(CPPUTEST_HEADER
+ TestHarness.h
+ PATHS ${MOCKCPP_XUNIT_HOME}/include/CppUTest
+ NO_DEFAULT_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ NO_CMAKE_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
+ if (NOT CPPUTEST_HEADER)
+ message(FATAL_ERROR "TestHarness.h not found in ${MOCKCPP_XUNIT_HOME}/include/CppUTest, please specify MOCKCPP_XUNIT_HOME as the home path of CppUTest correctly.")
+ endif ()
+ include_directories(BEFORE ${MOCKCPP_XUNIT_HOME}/include ${MOCKCPP_XUNIT_HOME}/include/Platforms/VisualCpp)
+ set(MOCKCPP_SRCS ${MOCKCPP_SRCS} src/ports/failure/cpputest_report_failure.cpp)
+
+elseif (${mockcpp_xunit} STREQUAL "CPPUNIT" OR ${mockcpp_xunit} STREQUAL "cppunit")
+ if (NOT DEFINED MOCKCPP_XUNIT_HOME)
+ message(FATAL_ERROR "Please specify MOCKCPP_XUNIT_HOME as the home path of cppunit")
+ endif ()
+ find_file(CPPUNIT_HEADER Exception.h
+ PATHS ${MOCKCPP_XUNIT_HOME}/include/cppunit
+ NO_DEFAULT_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ NO_CMAKE_PATH
+ NO_SYSTEM_ENVIRONMENT_PATH
+ NO_CMAKE_SYSTEM_PATH)
+ if (NOT ${GTEST_HEADER})
+ message(FATAL_ERROR "Can't find file Exception.h, please specify MOCKCPP_XUNIT_HOME as the home path of cppunit correctly.")
+ endif ()
+ include_directories(BEFORE ${MOCKCPP_XUNIT_HOME}/include)
+ set(MOCKCPP_SRCS ${MOCKCPP_SRCS} src/ports/failure/cppunit_report_failure.cpp)
+else ()
+ set(MOCKCPP_SRCS ${MOCKCPP_SRCS} src/ports/failure/stdexcept_report_failure.cpp)
+endif ()
+
+if (MSVC)
+ set(MOCKCPP_SRCS
+ ${MOCKCPP_SRCS}
+ src/WinCodeModifier.cpp
+ )
+else (MSVC)
+ set(MOCKCPP_SRCS
+ ${MOCKCPP_SRCS}
+ src/UnixCodeModifier.cpp
+ )
+endif (MSVC)
+######################################################
+set(MOCKCPP_HEADERS_PATH ${mockcpp_SOURCE_DIR}/include/mockcpp)
+
+set(MOCKCPP_VTBL_RELATED_HEADERS
+ ${MOCKCPP_HEADERS_PATH}/DelegatedMethodGetDef.h
+ ${MOCKCPP_HEADERS_PATH}/DelegatedMethodGetByVptrDef.h
+ ${MOCKCPP_HEADERS_PATH}/DestructorAddrGetterDef.h
+ ${MOCKCPP_HEADERS_PATH}/MethodIndiceCheckerDef.h
+ ${MOCKCPP_HEADERS_PATH}/DefaultMethodAddrGetterDef.h
+)
+
+set(MOCKCPP_ARG_RELATED_HEADER_FILES
+ ${MOCKCPP_HEADERS_PATH}/DelegatedMethodDef.h
+ ${MOCKCPP_HEADERS_PATH}/ArgumentsListDef.h
+ ${MOCKCPP_HEADERS_PATH}/MethodTypeTraitsDef.h
+)
+
+if (MOCKCPP_ALLOW_MI)
+ set(ALLOW_MI yes)
+else (MOCKCPP_ALLOW_MI)
+ set(ALLOW_MI no)
+endif (MOCKCPP_ALLOW_MI)
+
+######################################################
+set(VTBL_GENERATOR ${mockcpp_SOURCE_DIR}/src/generate_vtbl_related_files.py)
+set(EXTRA_VTBL_HEADERS_DEFS
+ --allow-mi=${ALLOW_MI}
+ --max-inheritance=${MOCKCPP_MAX_INHERITANCE}
+ --max-vtbl-size=${MOCKCPP_MAX_VTBL_SIZE}
+ --include-path=${MOCKCPP_HEADERS_PATH}
+)
+foreach(HEADER ${MOCKCPP_VTBL_RELATED_HEADERS})
+ get_filename_component(HEADER_NAME ${HEADER} NAME)
+ add_custom_command(
+ OUTPUT ${HEADER}
+ COMMAND ${PYTHON} ${VTBL_GENERATOR} ${EXTRA_VTBL_HEADERS_DEFS} ${HEADER_NAME}
+ )
+endforeach()
+
+######################################################
+set(ARG_GENERATOR ${mockcpp_SOURCE_DIR}/src/generate_arg_related_files.py)
+set(EXTRA_ARG_HEADERS_DEFS
+ --max-parameters=${MOCKCPP_MAX_PARAMETERS}
+ --include-path=${MOCKCPP_HEADERS_PATH}
+)
+foreach(HEADER ${MOCKCPP_ARG_RELATED_HEADER_FILES})
+ get_filename_component(HEADER_NAME ${HEADER} NAME)
+ add_custom_command(
+ OUTPUT ${HEADER}
+ COMMAND ${PYTHON} ${ARG_GENERATOR} ${EXTRA_ARG_HEADERS_DEFS} ${HEADER_NAME}
+ )
+endforeach()
+
+######################################################
+link_directories(${mockcpp_BINARY_DIR}/src ${mockcpp_BINARY_DIR}/tests/3rdparty/testngpp/src)
+
+add_library(mockcpp STATIC ${MOCKCPP_SRCS})
+
+target_compile_definitions(mockcpp PRIVATE
+ _GLIBCXX_USE_CXX11_ABI=0
+)
+
+include_directories(BEFORE ${mockcpp_SOURCE_DIR} ${mockcpp_SOURCE_DIR}/include ${BOOST_INCLUDE_DIRS})
+
+add_custom_target(vtbl_related_headers DEPENDS ${MOCKCPP_VTBL_RELATED_HEADERS})
+add_custom_target(arg_related_headers DEPENDS ${MOCKCPP_ARG_RELATED_HEADER_FILES})
+
+add_dependencies(mockcpp vtbl_related_headers arg_related_headers)
+
+install(TARGETS mockcpp
+ ARCHIVE DESTINATION lib)
+
+install(DIRECTORY include/
+ DESTINATION include)
+
+if (MSVC)
+ install(FILES ${mockcpp_BINARY_DIR}/src/Debug/mockcpp.pdb
+ DESTINATION lib)
+ message(${mockcpp_BINARY_DIR})
+endif (MSVC)
@@ -1,54 +1,621 @@
-Apache License
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
-Version 2.0, January 2004
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
-http://www.apache.org/licenses/
+ Preamble
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
-1. Definitions.
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
-"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
-"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
-"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
-"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
-"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
-"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
-"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
-"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+ The precise terms and conditions for copying, distribution and
+modification follow.
-"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+ TERMS AND CONDITIONS
-"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+ 0. Definitions.
-2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+ "This License" refers to version 3 of the GNU General Public License.
-3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
-4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
-You must give any other recipients of the Work or Derivative Works a copy of this License; and
-You must cause any modified files to carry prominent notices stating that You changed the files; and
-You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
-If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
-You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
-5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
-6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
-7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
-8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
-9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+ 1. Source Code.
-END OF TERMS AND CONDITIONS
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
new file mode 100644
@@ -0,0 +1,267 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007 Free Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package. The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system.
+
+ Running `configure' might take a while. While running, it prints
+ some messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+ 6. Often, you can also type `make uninstall' to remove the installed
+ files again.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about. Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you can use GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory. After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug. Until the bug is fixed you can use this workaround:
+
+ CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--enable-mockcpp-namespace'
+`--disable-mockcpp-namespace'
+ Enable/disable mockcpp namespace. You can use MOCKCPP_NS as the
+ namespace in your source code to avoid the influence of this option.
+
+`--enable-multi-inheritance'
+`--disable-multi-inheritance'
+ Enable/disable multiple inheritance. If you disable this option,
+ trying to mock an interface which directly/indirectly inherits
+ from more than 1 other interfaces, an runtime error will be
+ encountered.
+
+`max_inheritance=NUMBER'
+ Specify the maximum number of interfaces that a mocked interface
+ is allowed to inherits from. If it exceeds this number, a runtime
+ error will be encountered. Its default value is now 2, and the
+ maximum allowed value is 5.
+
+`max-vtbl-size=SIZE'
+ Specify the maximum size of virtual table. If the virtual table
+ size of your mocked class is larger than this setting, a runtime
+ error will be encountered. Its default value is now 20, and the
+ maximum allowed value is 50.
+
+`max_parameters'
+ Specify the maximum number of parameters that a mocked method is
+ allow to have. If the actually parameters are more than this setting,
+ a compiling error will happen. Its default value is now 12, and the
+ maximum allowed value is 15.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
new file mode 100644
@@ -0,0 +1,18 @@
+
+ mockcpp --- A C/C++ Mock Framework
+ -------------------------------------
+ http://code.google.com/p/mockcpp
+
+
+mockcpp is a jmock-like generic C/C++ Mock Framework, which doesn't use complex template technique which will result in very heavy compiling overhead.
+
+For Unix/Linux --including cygwin -- installation notes, see INSTALL.
+
+Email to the current maintainers may be sent to
+<darwin.yuan@gmail.com>.
+
+## 瀹夎
+鎵ц sudo bash build_install.sh 锛岄粯璁ゅ畨瑁呭埌/usr/local/mockcpp鐩綍涓�
+
+## 缂栬瘧
+鎵ц bash build.sh 銆�
\ No newline at end of file
@@ -3,44 +3,40 @@
# If you use powershell the first time, excute this cmd first: set-executionpolicy remotesigned
# Build mockcpp and it's tests, and at last run all tests.
-# $args[0] --- [optional] compiler index in table $global:SUPPORTED_COMPILER in tools\build_functions.ps1
-# $args[1] --- [optional] if it is "test" then only run tests without compiling.
-$global:USER_CHOICE=$null
-$global:SUPPORTED_COMPILER=$null
+# add vcbuild path and cmake path
+# It's better to add to your computer's path environment variable, than to modify $env:path below.
+$env:path=$env:path+";C:\Program Files\Microsoft Visual Studio 9.0\VC\vcpackages"
+$env:path=$env:path+";D:\Tools\CMD\cmake-2.8.1-win32-x86\bin"
-. "$PSScriptRoot\tools\build_functions.ps1"
+# specify the Visual Studio Version, not set to use default
+$VC_VER="-G `"Visual Studio 9 2008`""
+#$VC_VER="-G `"Visual Studio 9 2008 Win64`"" # build for X64
-# If no input parameter
-if (-not $args[0]) {
- # Detect the compiler
- cmake -B build tools
- ReadUserChoice
-} else {
- $global:USER_CHOICE=$args[0]
+# build Debug only
+$env:VCBUILD_DEFAULT_CFG="Debug|Win32"
+#$env:VCBUILD_DEFAULT_CFG="Debug|x64" # build for x64
+
+function build($build_dir, $src_dir) {
+ if (!(test-path $build_dir)) { mkdir $build_dir }
+ cd $build_dir
+ Invoke-Expression "cmake $src_dir $VC_VER"
+ ls *.sln -name | vcbuild
}
-$global:MY_OS_NAME=$null
-$global:MY_CXX_COMPILER_NAME=$null
-$global:MY_CXX_COMPILER_MAJOR_VERSION=$null
-$global:CMAKE_COMPILER_PARAM=$null
-$global:MAKE_BUILD_TYPE=$null
+build ..\..\build_mockcpp ..\mockcpp\mockcpp
-InitEnviroment $global:SUPPORTED_COMPILER[$global:USER_CHOICE].name $global:SUPPORTED_COMPILER[$global:USER_CHOICE].major_ver $global:SUPPORTED_COMPILER[$global:USER_CHOICE].cmake_param
+build ..\build_testngpp ..\mockcpp\mockcpp\tests\3rdparty\testngpp
-$BUILD_DIR="build_$global:MY_CXX_COMPILER_NAME"
+build ..\build_tests ..\mockcpp\mockcpp\tests
-$OS_COMPILER="$global:MY_OS_NAME\$global:MY_CXX_COMPILER_NAME\$global:MY_CXX_COMPILER_MAJOR_VERSION"
-echo "OS_COMPILER in Powershell : $OS_COMPILER"
+#---------------------------------
+# run all tests
+cd ..\build_tests\ut\Debug
+cp ..\..\..\build_testngpp\src\listeners\Debug\testngppstdoutlistener.dll .
+$ALL_DLL=(ls *.dll -name)-replace ".dll" | where {$_ -ne "testngppstdoutlistener"}
+..\..\..\build_testngpp\src\runner\Debug\testngpp-runner.exe $ALL_DLL -L"..\..\..\build_testngpp\src\listeners\Debug" -l"testngppstdoutlistener -c -f" -s
+cd ..\..\..\mockcpp\mockcpp
-if (-not ($args[1] -eq "test")) {
-Invoke-Expression "cmake $global:CMAKE_COMPILER_PARAM -S . -B $BUILD_DIR/mockcpp"
-Invoke-Expression "cmake $global:CMAKE_COMPILER_PARAM -S tests/3rdparty/testngpp -B $BUILD_DIR/mockcpp_testngpp"
-Invoke-Expression "cmake $global:CMAKE_COMPILER_PARAM -S tests -B $BUILD_DIR/mockcpp_tests"
-CompileProject $global:MY_CXX_COMPILER_NAME $BUILD_DIR/mockcpp
-CompileProject $global:MY_CXX_COMPILER_NAME $BUILD_DIR/mockcpp_testngpp
-CompileProject $global:MY_CXX_COMPILER_NAME $BUILD_DIR/mockcpp_tests
-}
-RunTests $BUILD_DIR mockcpp_tests $global:MAKE_BUILD_TYPE mockcpp_testngpp
@@ -1,55 +1,11 @@
#!/bin/bash
# build mockcpp and it's tests, and at last run all tests.
-# $1 --- [optional] compiler name (default is GNU)
-# $2 --- [optional] compiler major version (The first part of cxx compiler version)
-
-# if you want to choose a compiler other than GNU, you can
-# uncomment the ReadUserChoice, config the CompilerArray in tools/build_functions.sh, then
-# InitEnviroment $USER_CHOOSED_COMPILER $USER_CHOOSED_COMPILER_MAJOR_VER
-
-# fast fail
-set -e
-
-. "tools/build_functions.sh"
-
-MY_OS_NAME=""
-MY_CXX_COMPILER_NAME=""
-MY_CXX_COMPILER_MAJOR_VERSION=""
-CMAKE_COMPILER_PARAM=""
-MAKE_BUILD_TYPE=""
-
-USER_CHOOSED_COMPILER=""
-USER_CHOOSED_COMPILER_MAJOR_VER=""
-
-# script usage 1: no parameter, use GNU compiler
-AUTO_COMPILER="GNU"
-AUTO_CXX_VER=`gcc -dumpversion | awk -F. '{print $1}'`
-InitEnviroment $AUTO_COMPILER $AUTO_CXX_VER
-
-# script usage 2: input the compiler name and major version
-#InitEnviroment $1 $2
-
-# script usage 3: choose the compiler and version
-#ReadUserChoice
-#InitEnviroment $USER_CHOOSED_COMPILER $USER_CHOOSED_COMPILER_MAJOR_VER
-
-BUILD_DIR="build_$MY_CXX_COMPILER_NAME"
-
-OS_COMPILER="$MY_OS_NAME/$MY_CXX_COMPILER_NAME/$MY_CXX_COMPILER_MAJOR_VERSION"
-
-echo "OS_COMPILER in Shell : $OS_COMPILER"
-
-#if [ $3 != "test" ]; then
-
-cmake -S . -B $BUILD_DIR/mockcpp
-cmake -S tests/3rdparty/testngpp -B $BUILD_DIR/mockcpp_testngpp
-cmake -S tests -B $BUILD_DIR/mockcpp_tests
-
-CompileProject $MY_CXX_COMPILER_NAME $BUILD_DIR/mockcpp
-CompileProject $MY_CXX_COMPILER_NAME $BUILD_DIR/mockcpp_testngpp
-CompileProject $MY_CXX_COMPILER_NAME $BUILD_DIR/mockcpp_tests
-
-#fi
-
-RunTests $BUILD_DIR mockcpp_tests $MAKE_BUILD_TYPE mockcpp_testngpp
+function build() {
+ mkdir $1 2>/dev/null
+ cd $1
+ cmake $2
+ make
+}
+
+build ../build_mockcpp ../mockcpp-2.7
@@ -3,56 +3,32 @@
# If you use powershell the first time, excute this cmd first: set-executionpolicy remotesigned
# Build mockcpp and it's tests, and at last run all tests.
-# $args[0] --- [optional] compiler index in table $global:SUPPORTED_COMPILER in tools\build_functions.ps1
-
-# Set the install path, should be absolute path
-$INSTALL_PATH="D:\Develop\test_tools\mockcpp-install"
-
-# Set the xxunit test framework name, default testngpp
-$XUNIT_NAME="testngpp"
-#$XUNIT_NAME="gtest"
-#$XUNIT_NAME="catch2"
-
-# testngpp: not need $XUNIT_HOME
-# gtest: there is a $XUNIT_HOME/include/gtest/gtest.h
-# catch2: there is a $XUNIT_HOME/catch2/catch_test_macros.hpp
-#$XUNIT_HOME="D:/Develop/work/googletest/googletest"
-#$XUNIT_HOME="D:/Develop/work/Catch2/src"
-
-$global:USER_CHOICE=$null
-$global:SUPPORTED_COMPILER=$null
-
-. "$PSScriptRoot\tools\build_functions.ps1"
-
-# If no input parameter
-if (-not $args[0]) {
- # Detect the compiler
- cmake -B build tools
- ReadUserChoice
-} else {
- $global:USER_CHOICE=$args[0]
+# You can change this testngpp install dir by yourself, it must be an absolute path.
+#$INSTALL_DIR="D:\Projects\Google\cpp-ut-project\cpp-ut-project\tools\mockcpp"
+$INSTALL_DIR="D:\Projects\Google\cpp-project\cpp-project\tools_pdb\mockcpp"
+
+# add vcbuild path and cmake path
+# It's better to add to your computer's path environment variable, than to modify $env:path below.
+$env:path=$env:path+";C:\Program Files\Microsoft Visual Studio 9.0\VC\vcpackages"
+$env:path=$env:path+";D:\Tools\CMD\cmake-2.8.1-win32-x86\bin"
+
+# specify the Visual Studio Version, not set to use default
+$VC_VER="-G `"Visual Studio 9 2008`""
+
+# build Debug only
+$env:VCBUILD_DEFAULT_CFG="Debug|Win32"
+
+function build($build_dir, $src_dir) {
+ if (!(test-path $build_dir)) { mkdir $build_dir }
+ cd $build_dir
+ Invoke-Expression "cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR $src_dir $VC_VER"
+ ls *.sln -name | vcbuild
+ vcbuild INSTALL.vcproj
}
-if (!(test-path $INSTALL_PATH)) { mkdir $INSTALL_PATH }
+build ..\..\build_mockcpp_to_install ..\mockcpp\mockcpp
-$global:MY_OS_NAME=$null
-$global:MY_CXX_COMPILER_NAME=$null
-$global:MY_CXX_COMPILER_MAJOR_VERSION=$null
-$global:CMAKE_COMPILER_PARAM=$null
-$global:MAKE_BUILD_TYPE=$null
+cd ..\mockcpp\mockcpp
-InitEnviroment $global:SUPPORTED_COMPILER[$global:USER_CHOICE].name $global:SUPPORTED_COMPILER[$global:USER_CHOICE].major_ver $global:SUPPORTED_COMPILER[$global:USER_CHOICE].cmake_param
-$BUILD_DIR="build_$global:MY_CXX_COMPILER_NAME"
-$OS_COMPILER="$global:MY_OS_NAME\$global:MY_CXX_COMPILER_NAME\$global:MY_CXX_COMPILER_MAJOR_VERSION"
-
-echo "OS_COMPILER in Powershell : $OS_COMPILER"
-
-$XUNIT_DEFINE=""
-if ($XUNIT_NAME -ne "testngpp") {
- $XUNIT_DEFINE="-DMOCKCPP_XUNIT=$XUNIT_NAME -DMOCKCPP_XUNIT_HOME=$XUNIT_HOME"
-}
-
-Invoke-Expression "cmake $global:CMAKE_COMPILER_PARAM -S . -B $BUILD_DIR/mockcpp-install4$XUNIT_NAME -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH $XUNIT_DEFINE"
-CompileProjectInstall $global:MY_CXX_COMPILER_NAME $BUILD_DIR/mockcpp-install4$XUNIT_NAME
@@ -1,58 +1,16 @@
#!/bin/bash
# build and install
-# $1 --- [optional] compiler name (default is GNU)
-# $2 --- [optional] compiler major version (The first part of cxx compiler version)
+install_dir=/usr/local/mockcpp
-# fast fail
-set -e
+function build() {
+ mkdir $1 2>/dev/null
+ cd $1
+ cmake -DCMAKE_INSTALL_PREFIX=$install_dir $2
+ make install
+}
-# Set the install path, should be absolute path
-INSTALL_PATH=~/test_tools/mockcpp_install
+build ../build_mockcpp_to_install ../mockcpp-2.7
-# Set the xxunit test framework name
-XUNIT_NAME=testngpp
-#XUNIT_NAME=gtest
-#XUNIT_NAME=catch2
-
-# gtest: there is a $XUNIT_HOME/include/gtest/gtest.h
-# catch2: there is a $XUNIT_HOME/include/catch2/catch_test_macros.hpp
-#XUNIT_HOME=/usr/local
-
-. "tools/build_functions.sh"
-
-MY_OS_NAME=""
-MY_CXX_COMPILER_NAME=""
-MY_CXX_COMPILER_MAJOR_VERSION=""
-CMAKE_COMPILER_PARAM=""
-MAKE_BUILD_TYPE=""
-
-USER_CHOOSED_COMPILER=""
-USER_CHOOSED_COMPILER_MAJOR_VER=""
-
-# script usage 1: no parameter, use GNU compiler
-AUTO_COMPILER="GNU"
-AUTO_CXX_VER=`gcc -dumpversion | awk -F. '{print $1}'`
-InitEnviroment $AUTO_COMPILER $AUTO_CXX_VER
-
-# script usage 2: input the compiler name and major version
-#InitEnviroment $1 $2
-
-# script usage 3: choose the compiler and version
-#ReadUserChoice
-#InitEnviroment $USER_CHOOSED_COMPILER $USER_CHOOSED_COMPILER_MAJOR_VER
-
-BUILD_DIR="build_$MY_CXX_COMPILER_NAME"
-
-OS_COMPILER="$MY_OS_NAME/$MY_CXX_COMPILER_NAME/$MY_CXX_COMPILER_MAJOR_VERSION"
-
-echo "OS_COMPILER in Shell : $OS_COMPILER"
-
-if [ "$XUNIT_NAME" == "testngpp" ];then
-cmake -S . -B $BUILD_DIR/mockcpp-install4$XUNIT_NAME -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH
-else
-cmake -S . -B $BUILD_DIR/mockcpp-install4$XUNIT_NAME -DCMAKE_INSTALL_PREFIX=$INSTALL_PATH -DMOCKCPP_XUNIT=$XUNIT_NAME -DMOCKCPP_XUNIT_HOME=$XUNIT_HOME
-fi
-
-CompileProjectInstall $MY_CXX_COMPILER_NAME $BUILD_DIR/mockcpp-install4$XUNIT_NAME
+cd ../mockcpp-2.7
new file mode 100644
@@ -0,0 +1,19 @@
+#!/bin/bash
+# build and install
+
+# there is a $xunit_home/include/gtest/gtest.h
+xunit_home=/usr/local
+
+install_dir=/home/jelly/Programming/mockcpp-samples/mockcpp4gtest/mockcpp
+
+
+function build() {
+ mkdir $1 2>/dev/null
+ cd $1
+ cmake -DCMAKE_INSTALL_PREFIX=$install_dir -DMOCKCPP_XUNIT=gtest -DMOCKCPP_XUNIT_HOME=$xunit_home $2
+ make install
+}
+
+build ../../build_mockcpp_to_install4gtest ../mockcpp/mockcpp
+
+cd ../mockcpp/mockcpp
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_AFTER_MATCH_BUILDER_H
@@ -1,3 +1,20 @@
+/***
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+***/
#include <mockcpp/InvocationMockerNamespace.h>
#include <mockcpp/InvocationMocker.h>
@@ -21,9 +38,8 @@ AfterMatchBuilder<Builder>&
AfterMatchBuilder<Builder>::after(InvocationMockerNamespace* ns, const std::string& id)
{
getMocker()->addMatcher(
- new PendingMatcher(
- new AfterMatcher(),
- ns, id, getMocker()));
+ new PendingMatcher(
+ new AfterMatcher(), ns, id, getMocker()));
return *this;
}
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_AFTER_MATCHER_H
@@ -1,19 +1,3 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
#ifndef __MOCKCPP_API_HOOK_H__
#define __MOCKCPP_API_HOOK_H__
@@ -32,7 +16,7 @@ struct ApiHook
~ApiHook();
private:
- ApiHookImpl* This;;
+ ApiHookImpl* This;
};
MOCKCPP_NS_END
@@ -1,25 +1,10 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
#ifndef __MOCKCPP_API_HOOK_FUNCTOR_H__
#define __MOCKCPP_API_HOOK_FUNCTOR_H__
#include <mockcpp/mockcpp.h>
#include <mockcpp/GlobalMockObject.h>
+#include <mockcpp/ArgumentsMacroHelpers.h>
MOCKCPP_NS_START
@@ -30,20 +15,21 @@ struct ApiHookFunctor
};
const std::string empty_caller("");
-#define __MOCKCPP_API_HOOK_FUNCTOR_DEF(n, CallingConvention) \
-template <typename R DECL_TEMPLATE_ARGS(n), unsigned int Seq> \
-struct ApiHookFunctor<R CallingConvention (DECL_ARGS(n)), Seq> \
+
+#define __MOCKCPP_C_API_HOOK_FUNCTOR_DEF(n, CallingConvention) \
+template<typename R DECL_TEMPLATE_ARGS(n), unsigned int Seq> \
+struct ApiHookFunctor<R (CallingConvention *)(DECL_ARGS(n)), Seq> \
{ \
private: \
- typedef R CallingConvention F (DECL_ARGS(n)); \
+ typedef R (CallingConvention *F) (DECL_ARGS(n)); \
\
static R CallingConvention hook(DECL_PARAMS_LIST(n)) \
{ \
- return GlobalMockObject::instance.invoke<R>(apiAddress) \
- (empty_caller DECL_REST_PARAMS(n)); \
+ return GlobalMockObject::instance.invoke<R>(apiAddress) \
+ (empty_caller, RefAny() DECL_REST_PARAMS(n)); \
} \
\
- static bool appliedBy(F* api) \
+ static bool appliedBy(F api) \
{ return apiAddress == reinterpret_cast<void*>(api); } \
\
static void* getHook() \
@@ -53,51 +39,112 @@ private: \
{ if(--refCount == 0) apiAddress = 0; } \
public: \
\
- static void* getApiHook(F* api) \
+ static void* getApiHook(F api) \
+ { \
+ if(!appliedBy(api)) return 0; \
+ ++refCount; \
+ return getHook(); \
+ } \
+ \
+ static void* applyApiHook(F api) \
+ { \
+ if(apiAddress != 0) return 0; \
+ apiAddress = reinterpret_cast<void*>(api); \
+ refCount = 1; \
+ return getHook(); \
+ } \
+ \
+ static bool freeApiHook(void* hook) \
+ { \
+ if(getHook() != hook) return false; \
+ freeHook(); \
+ return true; \
+ } \
+private: \
+ static void* apiAddress; \
+ static unsigned int refCount; \
+}; \
+template<typename R DECL_TEMPLATE_ARGS(n), unsigned int Seq> \
+void* ApiHookFunctor<R (CallingConvention *)(DECL_ARGS(n)), Seq>::apiAddress = 0; \
+template<typename R DECL_TEMPLATE_ARGS(n), unsigned int Seq> \
+unsigned int ApiHookFunctor<R (CallingConvention *)(DECL_ARGS(n)), Seq>::refCount = 0
+
+/* For C++ method */
+#define __MOCKCPP_CXX_API_HOOK_FUNCTOR_DEF(n, CallingConvention, ConstConvention) \
+template<typename C, typename R DECL_TEMPLATE_ARGS(n), unsigned int Seq> \
+struct ApiHookFunctor<R (CallingConvention C::*)(DECL_ARGS(n)) ConstConvention, Seq> \
+{ \
+private: \
+ typedef ApiHookFunctor<R (CallingConvention C::*)(DECL_ARGS(n)) ConstConvention, Seq> ThisType; \
+ typedef R (CallingConvention C::*F) (DECL_ARGS(n)) ConstConvention; \
+ \
+ R CallingConvention hook(DECL_PARAMS_LIST(n)) \
+ { \
+ C *This = reinterpret_cast<C *>(this); \
+ return GlobalMockObject::instance.invoke<R>(apiAddress) \
+ (empty_caller, This DECL_REST_PARAMS(n)); \
+ } \
+ \
+ static bool appliedBy(F api) \
+ { return apiAddress == Details::methodToAddr(api); } \
+ \
+ static void* getHook() \
+ { return Details::methodToAddr(&ThisType::hook); } \
+ \
+ static void freeHook() \
+ { if(--refCount == 0) apiAddress = 0; } \
+public: \
+ \
+ static void* getApiHook(F api) \
{ \
- if(! appliedBy(api)) return 0; \
- ++refCount; \
- return getHook(); \
+ if(!appliedBy(api)) return 0; \
+ ++refCount; \
+ return getHook(); \
} \
\
- static void* applyApiHook(F* api) \
+ static void* applyApiHook(F api) \
{ \
- if(apiAddress != 0) return 0; \
- apiAddress = reinterpret_cast<void*>(api); \
- refCount = 1; \
- return getHook(); \
+ if(apiAddress != 0) return 0; \
+ apiAddress = Details::methodToAddr(api); \
+ refCount = 1; \
+ return getHook(); \
} \
\
static bool freeApiHook(void* hook) \
{ \
- if(getHook() != hook) return false; \
- freeHook(); \
- return true; \
+ if(getHook() != hook) return false; \
+ freeHook(); \
+ return true; \
} \
private: \
static void* apiAddress; \
static unsigned int refCount; \
}; \
-template <typename R DECL_TEMPLATE_ARGS(n), unsigned int Seq> \
-void* ApiHookFunctor<R CallingConvention (DECL_ARGS(n)), Seq>::apiAddress = 0; \
-template <typename R DECL_TEMPLATE_ARGS(n), unsigned int Seq> \
-unsigned int ApiHookFunctor<R CallingConvention (DECL_ARGS(n)), Seq>::refCount = 0
+template<typename C, typename R DECL_TEMPLATE_ARGS(n), unsigned int Seq> \
+void* ApiHookFunctor<R (CallingConvention C::*)(DECL_ARGS(n)) ConstConvention, Seq>::apiAddress = 0; \
+template<typename C, typename R DECL_TEMPLATE_ARGS(n), unsigned int Seq> \
+unsigned int ApiHookFunctor<R (CallingConvention C::*)(DECL_ARGS(n)) ConstConvention, Seq>::refCount = 0
-#if defined(_MSC_VER)
-// TODO: ApiHook related tests failed on VS2019.
-// [ ERROR ] TestApiHook.h:66: hardware exception STATUS_ILLEGAL_INSTRUCTION raised in setup or running test
-// [ ERROR ] TestApiHook.h:66 : hardware exception STATUS_ACCESS_VIOLATION raised in teardown
-#if _MSC_VER >= 1920 // VS 2019
+#ifdef WIN32
+#if defined(_MSC_VER) && defined(BUILD_FOR_X86)
#define MOCKCPP_API_HOOK_FUNCTOR_DEF(n) \
-__MOCKCPP_API_HOOK_FUNCTOR_DEF(n, __stdcall)
+__MOCKCPP_C_API_HOOK_FUNCTOR_DEF(n, ); \
+__MOCKCPP_C_API_HOOK_FUNCTOR_DEF(n, __stdcall); \
+__MOCKCPP_CXX_API_HOOK_FUNCTOR_DEF(n, , ); \
+__MOCKCPP_CXX_API_HOOK_FUNCTOR_DEF(n, , const); \
+__MOCKCPP_CXX_API_HOOK_FUNCTOR_DEF(n, __stdcall, ); \
+__MOCKCPP_CXX_API_HOOK_FUNCTOR_DEF(n, __stdcall, const)
#else
#define MOCKCPP_API_HOOK_FUNCTOR_DEF(n) \
-__MOCKCPP_API_HOOK_FUNCTOR_DEF(n, ); \
-__MOCKCPP_API_HOOK_FUNCTOR_DEF(n, __stdcall)
+__MOCKCPP_C_API_HOOK_FUNCTOR_DEF(n, ); \
+__MOCKCPP_CXX_API_HOOK_FUNCTOR_DEF(n, , ); \
+__MOCKCPP_CXX_API_HOOK_FUNCTOR_DEF(n, , const)
#endif
#else
#define MOCKCPP_API_HOOK_FUNCTOR_DEF(n) \
-__MOCKCPP_API_HOOK_FUNCTOR_DEF(n, )
+__MOCKCPP_C_API_HOOK_FUNCTOR_DEF(n, ); \
+__MOCKCPP_CXX_API_HOOK_FUNCTOR_DEF(n, , ); \
+__MOCKCPP_CXX_API_HOOK_FUNCTOR_DEF(n, , const)
#endif
MOCKCPP_API_HOOK_FUNCTOR_DEF(0);
@@ -1,19 +1,3 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
#ifndef __MOCKCPP_API_HOOK_GENERATOR_H__
#define __MOCKCPP_API_HOOK_GENERATOR_H__
@@ -26,7 +10,7 @@ MOCKCPP_NS_START
template <typename F, unsigned int Seq>
struct ApiHookGenerator
{
- static void* findApiHook(F* api)
+ static void* findApiHook(F api)
{
void* hook;
@@ -36,7 +20,7 @@ struct ApiHookGenerator
return hook;
}
- static void* appyApiHook(F* api)
+ static void* appyApiHook(F api)
{
void* hook;
@@ -61,10 +45,10 @@ private:
template <typename F>
struct ApiHookGenerator<F, 0>
{
- static void* findApiHook(F* api)
+ static void* findApiHook(F api)
{ return 0; }
- static void* appyApiHook(F* api)
+ static void* appyApiHook(F api)
{
oss_t oss;
@@ -1,19 +1,3 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
#ifndef __MOCKCPP_API_HOOK_HOLDER_H__
#define __MOCKCPP_API_HOOK_HOLDER_H__
@@ -1,19 +1,3 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
#ifndef __MOCKCPP_API_HOOK_HOLDER_FACTORY_H__
#define __MOCKCPP_API_HOOK_HOLDER_FACTORY_H__
@@ -27,7 +11,7 @@ struct ApiHookHolder;
struct ApiHookHolderFactory
{
template <typename F>
- static ApiHookHolder* create(F* api)
+ static ApiHookHolder* create(F api)
{
return new ParameterizedApiHookHolder<F>(api);
}
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_API_HOOK_KEY_H__
@@ -1,19 +1,3 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
#ifndef __MOCKCPP_API_HOOK_MOCKER_H__
#define __MOCKCPP_API_HOOK_MOCKER_H__
@@ -21,18 +5,119 @@
#include <mockcpp/mockcpp.h>
#include <mockcpp/GlobalMockObject.h>
#include <mockcpp/ApiHookHolderFactory.h>
+#include <mockcpp/ArgumentsMacroHelpers.h>
+#include <mockcpp/MethodInfoReader.h>
+#include <mockcpp/DelegatedMethodGetter.h>
MOCKCPP_NS_START
-template <typename API>
-InvocationMockBuilderGetter mockAPI(const std::string& name, API* api)
+struct mockAPIauto {};
+template<typename API = mockAPIauto> struct mockAPI;
+
+template<typename API> struct mockAPI
{
+ static InvocationMockBuilderGetter get(
+ const std::string& name, const std::string& type, API api)
+ {
return MOCKCPP_NS::GlobalMockObject::instance.method
- ( name
- , reinterpret_cast<const void*>(api)
- , ApiHookHolderFactory::create(api));
-}
+ ( type.empty() ? name : name + " #" + type + "#"
+ , Details::methodToAddr(api)
+ , ApiHookHolderFactory::create(api));
+ }
+
+ template<typename C>
+ static InvocationMockBuilderGetter get_virtual(
+ const std::string& name, const std::string& type, const C *c, API api)
+ {
+ void ***vtbl = (void ***)c;
+ std::pair<unsigned int, unsigned int> indices =
+ getIndicesOfMethod<C, API>(api);
+ union { void *_addr; API _api; };
+ _addr = (*vtbl)[indices.second];
+ return MOCKCPP_NS::GlobalMockObject::instance.method
+ ( type.empty() ? name : name + " #" + type + "#"
+ , _addr
+ , ApiHookHolderFactory::create(_api));
+ }
+
+ template<typename C>
+ static InvocationMockBuilderGetter get_virtual(
+ const std::string& name, const std::string& type, const C &c, API api)
+ {
+ return get_virtual(name, type, &c, api);
+ }
+}; // struct mockAPI
+
+template<> struct mockAPI<mockAPIauto>
+{
+#define __MOCKCPP_C_API_GET_FUNCTION_DEF(n, CallingConvention) \
+ template<typename R DECL_TEMPLATE_ARGS(n)> \
+ static InvocationMockBuilderGetter get( \
+ const std::string& name, const std::string& type, R (CallingConvention *api)(DECL_ARGS(n))) \
+ { \
+ typedef R (CallingConvention *API)(DECL_ARGS(n)); \
+ return mockAPI<API>::get(name, type, api); \
+ }
+
+#define __MOCKCPP_CXX_API_GET_FUNCTION_DEF(n, CallingConvention, ConstMethod) \
+ template<typename R, typename C DECL_TEMPLATE_ARGS(n)> \
+ static InvocationMockBuilderGetter get( \
+ const std::string& name, const std::string& type, R (CallingConvention C::*api)(DECL_ARGS(n)) ConstMethod) \
+ { \
+ typedef R (CallingConvention C::*API)(DECL_ARGS(n)) ConstMethod; \
+ return mockAPI<API>::get(name, type, api); \
+ } \
+ template<typename R, typename C DECL_TEMPLATE_ARGS(n)> \
+ static InvocationMockBuilderGetter get_virtual( \
+ const std::string& name, const std::string& type, const C *c, R (CallingConvention C::*api)(DECL_ARGS(n)) ConstMethod) \
+ { \
+ typedef R (CallingConvention C::*API)(DECL_ARGS(n)) ConstMethod; \
+ return mockAPI<API>::get_virtual(name, type, c, api); \
+ } \
+ template<typename R, typename C DECL_TEMPLATE_ARGS(n)> \
+ static InvocationMockBuilderGetter get_virtual( \
+ const std::string& name, const std::string& type, const C &c, R (CallingConvention C::*api)(DECL_ARGS(n)) ConstMethod) \
+ { \
+ typedef R (CallingConvention C::*API)(DECL_ARGS(n)) ConstMethod; \
+ return mockAPI<API>::get_virtual(name, type, c, api); \
+ }
+
+#ifdef WIN32
+#if defined(_MSC_VER) && defined(BUILD_FOR_X86)
+#define MOCKCPP_API_GET_FUNCTION_DEF(n) \
+ __MOCKCPP_C_API_GET_FUNCTION_DEF(n, ); \
+ __MOCKCPP_C_API_GET_FUNCTION_DEF(n, __stdcall); \
+ __MOCKCPP_CXX_API_GET_FUNCTION_DEF(n, , ); \
+ __MOCKCPP_CXX_API_GET_FUNCTION_DEF(n, , const); \
+ __MOCKCPP_CXX_API_GET_FUNCTION_DEF(n, __stdcall, ); \
+ __MOCKCPP_CXX_API_GET_FUNCTION_DEF(n, __stdcall, const)
+#else
+#define MOCKCPP_API_GET_FUNCTION_DEF(n) \
+ __MOCKCPP_C_API_GET_FUNCTION_DEF(n, ); \
+ __MOCKCPP_CXX_API_GET_FUNCTION_DEF(n, , ); \
+ __MOCKCPP_CXX_API_GET_FUNCTION_DEF(n, , const)
+#endif
+#else
+#define MOCKCPP_API_GET_FUNCTION_DEF(n) \
+ __MOCKCPP_C_API_GET_FUNCTION_DEF(n, ); \
+ __MOCKCPP_CXX_API_GET_FUNCTION_DEF(n, , ); \
+ __MOCKCPP_CXX_API_GET_FUNCTION_DEF(n, , const)
+#endif
+ MOCKCPP_API_GET_FUNCTION_DEF(0);
+ MOCKCPP_API_GET_FUNCTION_DEF(1);
+ MOCKCPP_API_GET_FUNCTION_DEF(2);
+ MOCKCPP_API_GET_FUNCTION_DEF(3);
+ MOCKCPP_API_GET_FUNCTION_DEF(4);
+ MOCKCPP_API_GET_FUNCTION_DEF(5);
+ MOCKCPP_API_GET_FUNCTION_DEF(6);
+ MOCKCPP_API_GET_FUNCTION_DEF(7);
+ MOCKCPP_API_GET_FUNCTION_DEF(8);
+ MOCKCPP_API_GET_FUNCTION_DEF(9);
+ MOCKCPP_API_GET_FUNCTION_DEF(10);
+ MOCKCPP_API_GET_FUNCTION_DEF(11);
+ MOCKCPP_API_GET_FUNCTION_DEF(12);
+}; // struct mockAPI<mockAPIauto>
MOCKCPP_NS_END
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_ARGUMENTS_LIST_H_
@@ -26,13 +27,13 @@ MOCKCPP_NS_START
struct UselessType {};
////////////////////////////////////////////////////
-template < typename R
+template <typename R
#include <mockcpp/ArgumentsListDef.h>
>
struct ArgumentsList {};
-template < typename R
+template <typename R
#include <mockcpp/ArgumentsListDef.h>
>
struct ArgumentsListConst {};
new file mode 100644
@@ -0,0 +1 @@
+Artificial dependency for a custom command.
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_ARGUMENTS_MACRO_HELPERS_H
@@ -50,5 +51,17 @@
#define DECL_REST_ARGS(n) SIMPLE_REPEAT(n, REST_ARGS)
#define DECL_REST_PARAMS(n) SIMPLE_REPEAT(n, REST_PARAMS)
#define DECL_REST_ARG_DECL(n) SIMPLE_REPEAT(n, REST_ARG_DECL)
+
+#define MOCKER_PP_CAT(a, b) MOCKER_PP_CAT_I(a, b)
+#define MOCKER_PP_CAT_I(a, b) MOCKER_PP_CAT_II(~, a ## b)
+#define MOCKER_PP_CAT_II(p, res) res
+
+#define MOCKER_PP_VARIADIC_SIZE(...) MOCKER_PP_VARIADIC_SIZE_I(__VA_ARGS__)
+#define MOCKER_PP_VARIADIC_SIZE_I(...) MOCKER_PP_VARIADIC_SIZE_II(MOCKER_PP_VARIADIC_SIZE_S(__VA_ARGS__, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 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,))
+#define MOCKER_PP_VARIADIC_SIZE_II(res) res
+#define MOCKER_PP_VARIADIC_SIZE_S(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, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63, size, ...) size
+
+#define MOCKER_PP_OVERLOAD(prefix, ...) MOCKER_PP_CAT(prefix, MOCKER_PP_VARIADIC_SIZE(__VA_ARGS__))
+
#endif
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_ARGUMENTS_MATCH_BUILDER_H
@@ -44,8 +45,21 @@ struct ArgumentsMatchBuilder : public Builder
, const Any& c11 = any()
, const Any& c12 = any()
);
-
- Builder& which(unsigned int which1, const Any& c);
+#if 0
+ Builder& with( Constraint* c01 = any()
+ , Constraint* c02 = any()
+ , Constraint* c03 = any()
+ , Constraint* c04 = any()
+ , Constraint* c05 = any()
+ , Constraint* c06 = any()
+ , Constraint* c07 = any()
+ , Constraint* c08 = any()
+ , Constraint* c09 = any()
+ , Constraint* c10 = any()
+ , Constraint* c11 = any()
+ , Constraint* c12 = any()
+ );
+#endif
virtual ~ArgumentsMatchBuilder() {}
@@ -1,3 +1,20 @@
+/***
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+***/
#include <mockcpp/InvocationMocker.h>
#include <mockcpp/Constraint.h>
@@ -39,15 +56,6 @@ with( const Any& c01
return *this;
}
-template <typename Builder>
-Builder&
-ArgumentsMatchBuilder<Builder>::
-which(unsigned int which1, const Any& c)
-{
- getMocker()->addMatcher(new ConstraintSet(which1, c.getConstraint()));
- return *this;
-}
-
#if 0
template <typename Builder>
Builder&
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_ASSERTER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_ASSERTION_FAILED_ERROR_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_BEFORE_MATCH_BUILDER_H
@@ -26,7 +27,7 @@ MOCKCPP_NS_START
struct InvocationMockerNamespace;
struct InvocationMocker;
-template < typename Builder = DummyBuilder >
+template <typename Builder = DummyBuilder>
struct BeforeMatchBuilder : public Builder
{
BeforeMatchBuilder&
@@ -1,3 +1,20 @@
+/***
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+***/
#include <mockcpp/InvocationMockerNamespace.h>
#include <mockcpp/InvocationMocker.h>
@@ -21,9 +38,8 @@ BeforeMatchBuilder<Builder>&
BeforeMatchBuilder<Builder>::before(InvocationMockerNamespace* ns, const std::string& id)
{
getMocker()->addMatcher(
- new PendingMatcher(
- new BeforeMatcher(),
- ns , id , getMocker()));
+ new PendingMatcher(
+ new BeforeMatcher(), ns , id , getMocker()));
return *this;
}
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_BEFORE_MATCHER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_CALLER_MATCH_BUILDER_H
@@ -28,7 +29,7 @@ MOCKCPP_NS_START
struct InvocationMocker;
-template <typename Builder = DummyBuilder >
+template <typename Builder = DummyBuilder>
struct CallerMatchBuilder : public Builder
{
Builder& caller(const std::string& nameOfCaller);
@@ -1,3 +1,20 @@
+/***
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+***/
#include <mockcpp/InvocationMocker.h>
#include <mockcpp/CallerMatcher.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_CALLER_MATCHER_H
@@ -28,12 +29,12 @@ struct Invocation;
struct CallerMatcher : public Matcher
{
- CallerMatcher(const std::string& name);
+ CallerMatcher(const std::string& name);
- bool matches(const Invocation& inv) const;
- void increaseInvoked(const Invocation& inv);
- void verify() ;
- std::string toString() const ;
+ bool matches(const Invocation& inv) const;
+ void increaseInvoked(const Invocation& inv);
+ void verify() ;
+ std::string toString() const ;
private:
std::string nameOfCaller;
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_CHAINABLE_MOCK_METHOD_H
@@ -34,52 +35,52 @@ struct SelfDescribe;
template <typename RT>
struct ChainableMockMethodBase
{
- ChainableMockMethodBase(Invokable* invokable_)
- : invokable(invokable_)
- {}
-
- RT operator()( const std::string& nameOfCaller
- , const RefAny& p01 = RefAny()
- , const RefAny& p02 = RefAny()
- , const RefAny& p03 = RefAny()
- , const RefAny& p04 = RefAny()
- , const RefAny& p05 = RefAny()
- , const RefAny& p06 = RefAny()
- , const RefAny& p07 = RefAny()
- , const RefAny& p08 = RefAny()
- , const RefAny& p09 = RefAny()
- , const RefAny& p10 = RefAny()
- , const RefAny& p11 = RefAny()
- , const RefAny& p12 = RefAny()
+ ChainableMockMethodBase(Invokable* invokable_)
+ : invokable(invokable_)
+ {}
+
+ RT operator()(const std::string& nameOfCaller
+ , const RefAny& pThisPointer = RefAny()
+ , const RefAny& p01 = RefAny()
+ , const RefAny& p02 = RefAny()
+ , const RefAny& p03 = RefAny()
+ , const RefAny& p04 = RefAny()
+ , const RefAny& p05 = RefAny()
+ , const RefAny& p06 = RefAny()
+ , const RefAny& p07 = RefAny()
+ , const RefAny& p08 = RefAny()
+ , const RefAny& p09 = RefAny()
+ , const RefAny& p10 = RefAny()
+ , const RefAny& p11 = RefAny()
+ , const RefAny& p12 = RefAny()
)
+ {
+ SelfDescribe* resultProvider = 0;
+
+ try {
+ const Any& result = \
+ invokable->invoke(nameOfCaller, pThisPointer
+ , p01, p02, p03, p04, p05, p06
+ , p07, p08, p09, p10, p11, p12
+ , resultProvider);
+ return getResult(result, resultProvider);
+ } catch (std::exception& ex)
{
- SelfDescribe* resultProvider = 0;
-
- try {
- const Any& result = \
- invokable->invoke( nameOfCaller
- , p01, p02, p03, p04, p05, p06
- , p07, p08, p09, p10, p11, p12
- , resultProvider);
- return getResult(result, resultProvider);
- }
- catch(std::exception& ex)
- {
- MOCKCPP_REPORT_FAILURE(ex.what());
- }
- const Any& dummyResult = Any();
- return getResult(dummyResult, resultProvider);
+ MOCKCPP_REPORT_FAILURE(ex.what());
}
+ const Any& dummyResult = Any();
+ return getResult(dummyResult, resultProvider);
+ }
- virtual ~ChainableMockMethodBase() {}
+ virtual ~ChainableMockMethodBase() {}
protected:
- virtual RT getResult(const Any& result, SelfDescribe*) = 0;
+ virtual RT getResult(const Any& result, SelfDescribe*) = 0;
private:
- Invokable* invokable;
+ Invokable* invokable;
};
@@ -87,41 +88,41 @@ private:
template <typename RT>
struct ChainableMockMethod : public ChainableMockMethodBase<RT>
{
- RT getResult(const Any& anyResult, SelfDescribe* resultProvider)
- {
- const Any& result = \
- Result( any_castable<RT>(anyResult)
- , typeid(RT)
- , TypeString<RT>::value()
- , resultProvider).getResult(anyResult);
+ RT getResult(const Any& anyResult, SelfDescribe* resultProvider)
+ {
+ const Any& result = \
+ Result(any_castable<RT>(anyResult)
+ , typeid(RT)
+ , TypeString<RT>::value()
+ , resultProvider).getResult(anyResult);
- MOCKCPP_ASSERT_FALSE_MESSAGE(
- "The return value for a non-void method was not specified",
- result.empty());
+ MOCKCPP_ASSERT_FALSE_MESSAGE(
+ "The return value for a non-void method was not specified",
+ result.empty());
- return any_cast<RT>(result);
- }
+ return any_cast<RT>(result);
+ }
public:
- ChainableMockMethod(Invokable* invokable)
- : ChainableMockMethodBase<RT>(invokable)
- {}
+ ChainableMockMethod(Invokable* invokable)
+ : ChainableMockMethodBase<RT>(invokable)
+ {}
};
//////////////////////////////////////////////////////////////////
template <>
struct ChainableMockMethod<void> : public ChainableMockMethodBase<void>
{
- void getResult(const Any& result, SelfDescribe*)
- {
- }
+ void getResult(const Any& result, SelfDescribe*)
+ {
+ }
public:
- ChainableMockMethod(Invokable* invokable)
- : ChainableMockMethodBase<void>(invokable)
- {}
+ ChainableMockMethod(Invokable* invokable)
+ : ChainableMockMethodBase<void>(invokable)
+ {}
};
//////////////////////////////////////////////////////////////////
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_CHAINABLE_MOCK_METHOD_CONTAINER_H
#define __MOCKCPP_CHAINABLE_MOCK_METHOD_CONTAINER_H
@@ -40,6 +41,7 @@ struct ChainableMockMethodContainer
InvocationMocker* findInvocationMocker(const std::string& id) const;
void reset();
+ void reset(ChainableMockMethodKey* key);
void verify();
private:
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_CHAINABLE_MOCK_METHOD_CORE_H
@@ -46,6 +47,7 @@ public:
// Method
const Any&
invoke( const std::string& nameOfCaller
+ , const RefAny& pThisPointer
, const RefAny& p1
, const RefAny& p2
, const RefAny& p3
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_CHAINABLE_MOCK_METHOD_INDEX_KEY_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_CHAINABLE_MOCK_METHOD_KEY_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_CHAINABLE_MOCK_METHOD_NAME_KEY_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_CHAINABLE_MOCK_OBJECT_H_
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_CHAINABLE_MOCK_OBJECT_BASE_H
@@ -1,23 +1,25 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_CHAINING_MOCK_HELPER_H
#define __MOCKCPP_CHAINING_MOCK_HELPER_H
+#include <boost/typeof/typeof.hpp>
#include <mockcpp/mockcpp.h>
#include <mockcpp/IsEqual.h>
#include <mockcpp/IsNotEqual.h>
@@ -35,8 +37,6 @@
#include <mockcpp/types/Any.h>
#include <mockcpp/ProcStub.h>
-#include <memory>
-
MOCKCPP_NS_START
struct Matcher;
@@ -54,12 +54,6 @@ Constraint* eq(const T& val)
return new IsEqual<T>(val);
}
-template <typename V, typename D = std::default_delete<V>>
-Constraint* eq(const V* val)
-{
- return new IsEqual<std::unique_ptr<V, D> >(val);
-}
-
template <typename T>
Constraint* neq(const T& val)
{
@@ -106,7 +100,7 @@ struct PredictTypeTraits<bool (Predict::*)(T)>
template <typename Predict>
Constraint* checkWith(Predict pred)
{
- typedef typename PredictTypeTraits<FAKE_BOOST_TYPEOF(&Predict::operator())>::ParaType T;
+ typedef typename PredictTypeTraits<BOOST_TYPEOF(&Predict::operator())>::ParaType T;
return new CheckWith<T, Predict>(pred);
}
@@ -121,7 +115,7 @@ Constraint* checkWith(bool (*pred)(T))
template <typename Proc>
Constraint* processWith(Proc proc)
{
- typedef typename PredictTypeTraits<FAKE_BOOST_TYPEOF(&Proc::operator())>::ParaType T;
+ typedef typename PredictTypeTraits<BOOST_TYPEOF(&Proc::operator())>::ParaType T;
return new ProcessWith<T, Proc>(proc);
}
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_CHECK_WITH_H
@@ -40,7 +41,7 @@ struct CheckWith : public Constraint
std::string toString() const
{
- return std::string("checkWith(") +
+ return std::string("check(") +
MOCKCPP_NS::toTypeAndValueString(predict) +
std::string(")");
}
@@ -1,18 +1,20 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2010> <Darwin Yuan: darwin.yuan@gmail.com>
+ <Chen Guodong: sinojelly@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_CODEMODIFIER_H__
@@ -24,10 +26,10 @@ MOCKCPP_NS_START
struct CodeModifier
{
- static bool modify(void *dest, const void *src, size_t size);
+ // @TODO: 在modify里面加入Cache刷新
+ static bool modify(void *dest, const void *src, size_t size);
};
MOCKCPP_NS_END
#endif
-
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_CONSTRAINT_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_CONSTRAINT_SET_H
@@ -30,8 +31,6 @@ struct ConstraintSetImpl;
struct ConstraintSet: public StatelessMatcher
{
- ConstraintSet(unsigned int which, Constraint* p);
-
ConstraintSet( Constraint* p01 = any()
, Constraint* p02 = any()
, Constraint* p03 = any()
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_DECORATED_CONSTRAINT_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_DEFAULT_BUIDLER_H_
@@ -29,7 +30,7 @@
MOCKCPP_NS_START
///////////////////////////////////////////////
-typedef InvocationMockBuilder<
+typedef InvocationMockBuilder<
CallerMatchBuilder<
ArgumentsMatchBuilder<
StubBuilder<
@@ -38,7 +39,6 @@ typedef InvocationMockBuilder<
>
>
> DefaultBuilder;
-
///////////////////////////////////////////////
MOCKCPP_NS_END
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_DEFAULT_MATCHER_H
new file mode 100644
@@ -0,0 +1 @@
+Artificial dependency for a custom command.
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_DEFAULT_STUB_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_DELEGATED_METHOD_H
@@ -45,7 +46,7 @@ struct DelegatedMethod<VPTRIndex, VTBLIndex, ArgumentsList<R DECL_REST_ARGS(n)>
IndexInvokableGetter* getter = \
VirtualTable::getInvokableGetter(this, VPTRIndex); \
return ChainableMockMethod<R>(getter->getInvokable(VPTRIndex, VTBLIndex)) \
- ("" DECL_REST_PARAMS(n)); \
+ ("", RefAny() DECL_REST_PARAMS(n)); \
} \
}
@@ -62,7 +63,7 @@ struct DelegatedMethod<VPTRIndex, VTBLIndex, ArgumentsListConst<R DECL_REST_ARGS
IndexInvokableGetter* getter = \
VirtualTable::getInvokableGetter(this, VPTRIndex); \
return ChainableMockMethod<R>(getter->getInvokable(VPTRIndex, VTBLIndex)) \
- ("" DECL_REST_PARAMS(n)); \
+ ("", RefAny() DECL_REST_PARAMS(n)); \
} \
}
new file mode 100644
@@ -0,0 +1 @@
+Artificial dependency for a custom command.
new file mode 100644
@@ -0,0 +1 @@
+Artificial dependency for a custom command.
new file mode 100644
@@ -0,0 +1 @@
+Artificial dependency for a custom command.
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_DELEGATED_METHOD_GETTER_H
new file mode 100644
@@ -0,0 +1 @@
+Artificial dependency for a custom command.
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_DESTRUCTOR_CHECKER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_DIE_STUB_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_DUMMY_BUILDER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_EQUALITY_UTIL_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_EXCEPTION_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_EXPECTS_MATCHER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_FORMATTER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_FUNCTOR_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <algorithm>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_GLOBAL_MOCK_OBJECT_H
@@ -38,10 +39,26 @@ struct GlobalMockObject
{
static void verify();
static void reset();
+ static void reset(const void* api);
static MockObjectType instance;
};
+namespace Details {
+ template<typename Method>
+ void *methodToAddr(Method m)
+ {
+ union
+ {
+ void *addr_;
+ Method m_;
+ };
+
+ m_ = m;
+ return addr_;
+ }
+} // namespace Details
+
MOCKCPP_NS_END
#endif
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_GNU_METHOD_INDICES_CHECKER_H
#define __MOCKCPP_GNU_METHOD_INDICES_CHECKER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_GNU_METHOD_INFO_READER_H
#define __MOCKCPP_GNU_METHOD_INFO_READER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_HOOK_MOCK_OBJECT_H__
@@ -47,6 +48,7 @@ struct HookMockObject : public ChainableMockObjectBase
}
void reset();
+ void reset(const void* api);
private:
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_IDENTITY_BUILDER_H
@@ -1,24 +1,26 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_IGNORE_H
#define __MOCKCPP_IGNORE_H
#include <mockcpp/mockcpp.h>
+#include <mockcpp/types/Any.h>
MOCKCPP_NS_START
@@ -30,9 +32,13 @@ struct Ignore
}
};
-struct Any;
+const Any ignore = Any(Ignore());
-Any& getIgnore();
+inline static
+Any& getIgnore()
+{
+ return const_cast<Any&>(ignore);
+}
MOCKCPP_NS_END
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_RESULT_HANDLER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_IGNORE_RESULT_HANDLER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_IGNORE_RESULT_HANDLER_FACTORY_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_IGNORE_RETURN_STUB_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INCREAMENT_STUB_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INDEX_INVOKABLE_GETTER_H
@@ -1,19 +1,3 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
#ifndef __MOCKCPP_INTERFACE_INFO_H_
#define __MOCKCPP_INTERFACE_INFO_H_
@@ -26,7 +10,7 @@
MOCKCPP_NS_START
-#if defined(__GNUC__) && !defined(__clang__)
+#if defined(__GNUC__)
//////////////////////////////////////////////////////
unsigned int
@@ -44,9 +28,7 @@ unsigned int getNumberOfVtbls()
template <typename Interface>
unsigned int getNumberOfVtbls()
{
- // temparly comment out it to support mocking some complecated classes on VS
- // return sizeof(Interface)/sizeof(void*);
- return 2;
+ return sizeof(Interface)/sizeof(void*);
}
#endif
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOCATION_H
@@ -32,6 +33,7 @@ struct InvocationImpl;
struct Invocation
{
Invocation(const std::string nameOfCaller
+ , const RefAny& pThisPointer = RefAny()
, const RefAny& p01 = RefAny()
, const RefAny& p02 = RefAny()
, const RefAny& p03 = RefAny()
@@ -48,8 +50,15 @@ struct Invocation
virtual ~Invocation();
+ RefAny& getThisPointer(void) const;
+
+ // i is beginning with 1
RefAny& getParameter(const unsigned int i) const;
+ // return in follow order:
+ // 'this' pointer(if it is exist), p1, p2, p3, p4 ... pN
+ RefAny& getParameterWithThis(const unsigned int i) const;
+
std::string getNameOfCaller() const;
std::string toString(void) const;
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOCATION_ID_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOCATION_MOCK_BUILDER_H
@@ -29,10 +30,10 @@ struct InvocationMocker;
template <typename Builder = DummyBuilder>
struct InvocationMockBuilder : public Builder
{
- InvocationMockBuilder(InvocationMocker* mocker);
+ InvocationMockBuilder(InvocationMocker* mocker);
private:
- virtual InvocationMocker* getMocker() const;
+ virtual InvocationMocker* getMocker() const;
private:
InvocationMocker* invocationMocker;
@@ -1,3 +1,20 @@
+/***
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+***/
#include <mockcpp/InvocationMocker.h>
@@ -6,16 +23,15 @@ MOCKCPP_NS_START
//////////////////////////////////////////////////////
template <class Builder>
InvocationMockBuilder<Builder>::InvocationMockBuilder(InvocationMocker* mocker)
- : invocationMocker(mocker)
+ : invocationMocker(mocker)
{
}
//////////////////////////////////////////////////////
template <class Builder>
-InvocationMocker*
-InvocationMockBuilder<Builder>::getMocker() const
+InvocationMocker* InvocationMockBuilder<Builder>::getMocker() const
{
- return invocationMocker;
+ return invocationMocker;
}
MOCKCPP_NS_END
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOCATION_MOCK_BUILDER_GETTER_H
@@ -34,16 +35,20 @@ struct Method;
///////////////////////////////////////////////
struct InvocationMockBuilderGetter
{
- InvocationMockBuilderGetter(InvocationMockerContainer* container, Method* method);
- ~InvocationMockBuilderGetter();
+ InvocationMockBuilderGetter(
+ InvocationMockerContainer* container, Method* method, const void* addr);
+ ~InvocationMockBuilderGetter();
- StubsBuilder stubs();
- MockBuilder expects(Matcher* matcher);
- DefaultBuilder defaults();
+ StubsBuilder stubs();
+ MockBuilder expects(Matcher* matcher);
+ MockBuilder times(unsigned int n); // same as expects(exactly(n))
+ DefaultBuilder defaults();
+ InvocationMockBuilderGetter &reset();
private:
- InvocationMockerContainer* invocationMockerContainer;
- Method* method;
+ InvocationMockerContainer* invocationMockerContainer;
+ Method* method;
+ const void* addr;
};
///////////////////////////////////////////////
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOCATION_MOCKER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKPP_INVOCATION_MOCKER_CONTAINER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOCATION_MOCKER_NAMESPACE_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOCATION_MOCKER_SET_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOCATION_TIMES_MATCHER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOCATION_WITH_RETURN_TYPE_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOKABLE_H
@@ -33,24 +34,27 @@ struct SelfDescribe;
///////////////////////////////////////////////
struct Invokable
{
- virtual const Any&
- invoke( const std::string& nameOfCaller
- , const RefAny& p1
- , const RefAny& p2
- , const RefAny& p3
- , const RefAny& p4
- , const RefAny& p5
- , const RefAny& p6
- , const RefAny& p7
- , const RefAny& p8
- , const RefAny& p9
- , const RefAny& p10
- , const RefAny& p11
- , const RefAny& p12
- , SelfDescribe* &resultProvider) = 0;
-
-
- virtual ~Invokable() {}
+ // isMemberMethod used to sign the callee function is a C++ member method,
+ // if isMemberMethod is true, p01 is 'this' pointer
+ virtual const Any&
+ invoke( const std::string& nameOfCaller
+ , const RefAny& pThisPointer
+ , const RefAny& p1
+ , const RefAny& p2
+ , const RefAny& p3
+ , const RefAny& p4
+ , const RefAny& p5
+ , const RefAny& p6
+ , const RefAny& p7
+ , const RefAny& p8
+ , const RefAny& p9
+ , const RefAny& p10
+ , const RefAny& p11
+ , const RefAny& p12
+ , SelfDescribe* &resultProvider) = 0;
+
+
+ virtual ~Invokable() {}
};
///////////////////////////////////////////////
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOKED_ATLEAST_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOKED_ATMOST_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOKED_EXACTLY_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOKED_ONCE_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOKED_TIMES_MATCHER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOKED_TIMES_READER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_INVOKED_TIMES_RECORDER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_IS_ANYTHING_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_IS_ANYTHING_HELPER_H
@@ -26,7 +27,7 @@ struct Constraint;
Constraint* any();
-//static const Constraint* _ = 0;
+static const Constraint* _ = 0;
bool isAnyConstraint(Constraint* c);
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef MOCKCPP_IS_CONST_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_IS_EQUAL_H
@@ -21,7 +22,7 @@
#include <mockcpp/types/AnyCast.h>
#include <mockcpp/Constraint.h>
#include <mockcpp/Formatter.h>
-#include <memory>
+#include <string.h>
MOCKCPP_NS_START
@@ -37,7 +38,10 @@ struct IsEqual : public Constraint
bool eval(const RefAny& val) const
{
if(!any_castable<T>(val)) return false;
- return any_cast<T>(val) == expectedValue;
+ // return any_cast<T>(val) == expectedValue;
+ if(memcmp((void *)&val, (void *)&expectedValue, sizeof(T)))
+ return false;
+ return true;
}
std::string toString() const
@@ -52,36 +56,6 @@ private:
T expectedValue;
};
-template <typename V, typename D>
-struct IsEqual<std::unique_ptr<V, D> > : public Constraint
-{
- IsEqual(const V* expected)
- : expectedValue(expected)
- {}
-
- ~IsEqual() {}
-
- bool eval(const RefAny& val) const
- {
- if (val.type() != typeid(std::unique_ptr<V, D>))
- {
- return false;
- }
- return (unique_ptr_any_cast<std::unique_ptr<V, D> >(val)).get() == expectedValue;
- }
-
- std::string toString() const
- {
- return std::string("eq(unique_ptr ") +
- MOCKCPP_NS::toTypeAndValueString(expectedValue) +
- std::string(")");
- }
-
-private:
-
- const V* expectedValue;
-};
-
MOCKCPP_NS_END
#endif
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_IS_GREATER_THAN_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_IS_LESS_THAN_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_IS_MIRROR_H
@@ -157,7 +158,21 @@ public:
"parameter \"size\" of IsMirror<void*> cannot be specified as 0",
size > 0);
}
+};
+
+//////////////////////////////////////////////////////////////////////
+template <>
+struct IsMirror<const void*> : public IsMirrorBase<const void*>
+{
+public:
+ IsMirror(const void* p, size_t size)
+ : IsMirrorBase<const void*>(p, size)
+ {
+ MOCKCPP_ASSERT_TRUE_MESSAGE(
+ "parameter \"size\" of IsMirror<const void*> cannot be specified as 0",
+ size > 0);
+ }
};
MOCKCPP_NS_END
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_IS_NOT_EQUAL_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef MOCKCPP_IS_REF_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_IS_STRING_CONTAINS_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_IS_STRING_END_WITH_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_IS_STRING_START_WITH_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_JMP_CODE_H__
@@ -33,6 +34,7 @@ struct JmpCode
void* getCodeData() const;
size_t getCodeSize() const;
+ void flushCache() const;
private:
JmpCodeImpl* This;
};
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_MATCHER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_METHOD_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_METHOD_INDICE_CHECKER_H
new file mode 100644
@@ -0,0 +1 @@
+Artificial dependency for a custom command.
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_METHOD_INFO_READER_H
#define __MOCKCPP_METHOD_INFO_READER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_METHOD_TYPE_TRAITS_H
new file mode 100644
@@ -0,0 +1 @@
+Artificial dependency for a custom command.
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_MISMATCH_RESULT_HANDLER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_MISMATCH_RESULT_HANDLER_FACTORY_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_MOCK_BUILDER_H
@@ -37,7 +38,7 @@ typedef InvocationMockBuilder<
BeforeMatchBuilder<
ArgumentsMatchBuilder<
AfterMatchBuilder<
- StubBuilder<
+ StubBuilder<
MoreStubBuilder<
IdentityBuilder
>
@@ -47,7 +48,6 @@ typedef InvocationMockBuilder<
>
>
> MockBuilder;
-
///////////////////////////////////////////////
MOCKCPP_NS_END
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_MOCK_OBJECT_H
@@ -54,6 +55,16 @@ struct MockObject : public MockObjectBase
{
}
+ MockObject& getObject()
+ {
+ return *this;
+ }
+
+ Interface* getInterface()
+ {
+ return (Interface*)toPointerToInterface();
+ }
+
/////////////////////////////////////////////////////////////
operator Interface* ()
{
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_MOCK_OBJECT_BASE_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_MOCK_OBJECT_HELPER_H__
@@ -21,6 +22,7 @@
#include <mockcpp/mockcpp.h>
#include <mockcpp/MockObject.h>
+#include <boost/typeof/typeof.hpp>
MOCKCPP_NS_START
@@ -35,16 +37,10 @@ MOCKCPP_NS_END
#define METHOD(m) method(&m, #m)
#define MOCK_METHOD(obj, m) \
- obj.method(&MOCKCPP_NS::MockObjectTraits<FAKE_BOOST_TYPEOF(obj)>::TYPE::m, \
+ obj.method(&MOCKCPP_NS::MockObjectTraits<BOOST_TYPEOF(obj)>::TYPE::m, \
(MOCKCPP_NS::TypeString< \
- MOCKCPP_NS::MockObjectTraits<FAKE_BOOST_TYPEOF(obj)>::TYPE \
+ MOCKCPP_NS::MockObjectTraits<BOOST_TYPEOF(obj)>::TYPE \
>::value() + "::"#m).c_str())
-#define MOCK_OVERLOAD_METHOD(obj, type, m) \
- obj.method((type) &MOCKCPP_NS::MockObjectTraits<FAKE_BOOST_TYPEOF(obj)>::TYPE::m, \
- ("("#type")" + MOCKCPP_NS::TypeString< \
- MOCKCPP_NS::MockObjectTraits<FAKE_BOOST_TYPEOF(obj)>::TYPE \
- >::value() + "::"#m).c_str())
-
#endif
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_MORE_STUB_BUILDER_H
@@ -1,3 +1,20 @@
+/***
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+***/
#include <mockcpp/InvocationMocker.h>
#include <mockcpp/ThenStub.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_MSVC_METHOD_INFO_READER_H
#define __MOCKCPP_MSVC_METHOD_INFO_READER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_MSVC_RTTI_H_
#define __MOCKCPP_MSVC_RTTI_H_
@@ -34,7 +35,7 @@ struct PMD
struct RTTIBaseClassDescriptor
{
- std::type_info* typeInfo; //type descriptor of the class
+ std::type_info* typeInfo; //type descriptor of the class
unsigned int numContainedBases; //number of nested classes following in the Base Class Array
PMD where; //pointer-to-member displacement info
unsigned int attributes; //flags, usually 0
@@ -61,8 +62,8 @@ struct RTTICompleteObjectLocator
const std::type_info* typeInfo; //TypeDescriptor of the complete class
RTTIClassHierarchyDescriptor* pClassDescriptor; //describes inheritance hierarchy
- RTTICompleteObjectLocator(unsigned int index
- , const std::type_info& info, RTTIClassHierarchyDescriptor* desc)
+ RTTICompleteObjectLocator(unsigned int index,
+ const std::type_info& info, RTTIClassHierarchyDescriptor* desc)
: signature(0), offset(index*sizeof(void*)), cdOffset(0)
, typeInfo(&info), pClassDescriptor(desc)
{}
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_NORMAL_RESULT_HANDLER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_NORMAL_RESULT_HANDLER_FACTORY_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_OBJ_NAME_GETTER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_ORDERING_MATCHER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_OUTBOUND_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_OUTBOUND_POINTER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_OUTPUT_STRING_STREAM_H
#define __MOCKCPP_OUTPUT_STRING_STREAM_H
@@ -1,19 +1,3 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
#ifndef __MOCKCPP_PARAMETERIZED_API_HOOK_HOLDER_H__
#define __MOCKCPP_PARAMETERIZED_API_HOOK_HOLDER_H__
@@ -30,7 +14,7 @@ struct ParameterizedApiHookHolder
{
const static unsigned int maxSeq = 10;
- ParameterizedApiHookHolder(F* api)
+ ParameterizedApiHookHolder(F api)
{
(m_hook = ApiHookGenerator<F, maxSeq>::findApiHook(api)) ||
(m_hook = ApiHookGenerator<F, maxSeq>::appyApiHook(api));
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_PENDING_MATCHER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_PROC_STUB_H
@@ -57,8 +58,8 @@ std::string getParameterMismatchString(int n
#define MOCKCPP_CHECK_AND_ASSIGN_PARAMETER(N) \
MOCKCPP_ASSERT_TRUE_MESSAGE( \
getParameterMismatchString(N, TypeString<MOCKP##N>::value(), inv) \
- , any_castable<MOCKP##N>(inv.getParameter(N))); \
- MOCKP##N p##N = any_cast<MOCKP##N>(inv.getParameter(N));
+ , any_castable<MOCKP##N>(inv.getParameterWithThis(N))); \
+ MOCKP##N p##N = any_cast<MOCKP##N>(inv.getParameterWithThis(N));
#define PROC_STUB_CONS() \
ProcStub(Func f, std::string name) \
@@ -126,6 +127,8 @@ PROC_STUB_DEF(9);
PROC_STUB_DEF(10);
PROC_STUB_DEF(11);
PROC_STUB_DEF(12);
+// one more for C++ Member Method(1 'this' pointer + 12 parameters = 13)
+PROC_STUB_DEF(13);
#define VARDIC_PROC_STUB_DEF(n) \
template <typename R DECL_TEMPLATE_ARGS(n)> \
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_PROCESS_WITH_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_REPEAT_MACROS_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_REPEAT_STUB_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_REPORT_FAILURE_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_RESULT_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_RESULT_HANDLER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_RESULT_HANDLER_FACTORY_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_RETURN_OBJECT_LIST_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_RETURN_STUB_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_SELF_DESCRIBE_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_SIMPLE_INVOCATION_RECORDER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_SPY_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_STATELESS_MATCHER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_STRING_CONSTRAINT_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_STRING_PREDICT_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_STUB_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_STUB_BUILDER_H
@@ -1,3 +1,20 @@
+/***
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+***/
#include <mockcpp/InvocationMocker.h>
#include <mockcpp/WillStub.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_STUB_CONTAINER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_STUBS_BUILDER_H
@@ -35,7 +36,6 @@ typedef InvocationMockBuilder<
>
>
> StubsBuilder;
-
///////////////////////////////////////////////
MOCKCPP_NS_END
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_STUBS_MATCHER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_TEST_FAILURE_MATCHER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_THEN_STUB_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_THROW_EXCEPTION_STUB_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_TYPE_STRING_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_TYPELESS_CONSTRAINT_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_TYPELESS_CONSTRAINT_ADAPTER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_TYPELESS_STUB_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_TYPELESS_STUB_ADAPTER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_VIRTUAL_TABLE_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_VIRTUAL_TABLE_UTILS_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_VOID_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_VOID_RESULT_HANDLER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_VOID_RESULT_HANDLER_FACTORY_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_WILL_STUB_H
new file mode 100644
@@ -0,0 +1,35 @@
+/***
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2010> <Darwin Yuan: darwin.yuan@gmail.com>
+ <Chen Guodong: sinojelly@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#ifndef __MOCKCPP_WINCODEMODIFIER_H__
+#define __MOCKCPP_WINCODEMODIFIER_H__
+
+#include <mockcpp/CodeModifier.h>
+
+MOCKCPP_NS_START
+
+struct WinCodeModifier : public CodeModifier
+{
+ bool modify(void *dest, void *src, size_t size);
+};
+
+
+MOCKCPP_NS_END
+
+#endif
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_MOCKABLE_H
@@ -20,10 +21,10 @@
#if defined(__cplusplus) && defined(MOCKCPP_USE_MOCKABLE)
# include <mockcpp/Functor.h>
-# include <fake_boost/fake_boost.h>
+# include <boost/typeof/typeof.hpp>
# define MOCKABLE(function) MOCKER(function).defaults().will(invoke(function)); \
- MOCKCPP_NS::Functor<FAKE_BOOST_TYPEOF(function)> function(#function, __FUNCTION__)
-# define MCALL(function) MOCKCPP_NS::Functor<FAKE_BOOST_TYPEOF(function)>(#function, __FUNCTION__)
+ MOCKCPP_NS::Functor<BOOST_TYPEOF(function)> function(#function, __FUNCTION__)
+# define MCALL(function) MOCKCPP_NS::Functor<BOOST_TYPEOF(function)>(#function, __FUNCTION__)
#else
# define MOCKABLE(function)
# define MCALL(function) function
@@ -1,24 +1,31 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_H
#define __MOCKCPP_H
-#include <fake_boost/fake_boost.h>
+#ifdef _MSC_VER
+#define _MOCKCPP_COMPILER_MSVC _MSC_VER
+#elif defined(__GNUC__)
+#define _MOCKCPP_COMPILER_GNUC
+#else
+#error "Unknown compiler!"
+#endif
#if !defined(MOCKCPP_NO_NAMESPACE) || (MOCKCPP_NO_NAMESPACE == 0)
# define MOCKCPP_NS mockcpp
@@ -38,23 +45,48 @@
# define MOCKCPP_EXPORT
#endif
+#if ( defined (__aarch64__))
+
+#define BUILD_FOR_AARCH64
+
+#elif ( defined (__arm__))
+
+#define BUILD_FOR_AARCH32
-#if ( defined (__LP64__) \
+#elif ( defined (__LP64__) \
|| defined (__64BIT__) \
|| defined (_LP64) \
|| ((defined(__WORDSIZE)) && (__WORDSIZE == 64)) \
- || defined(WIN64))
+ || defined(_WIN64))
-#define BUILD_FOR_X64 1
-#define BUILD_FOR_X86 0
+#define BUILD_FOR_X64
-#else
+#else
-#define BUILD_FOR_X64 0
-#define BUILD_FOR_X86 1
+#define BUILD_FOR_X86
#endif
+MOCKCPP_NS_START
+
+namespace __CHECK {
+
+ template<bool condition>
+ struct STATIC_ASSERT_FAILURE;
+
+ template<> struct STATIC_ASSERT_FAILURE<true>
+ {
+ enum { value = 1 };
+ };
+
+ template<int x> struct STATIC_ASSERT_TEST;
+
+#define MOCKCPP_STATIC_ASSERT(C) \
+ typedef MOCKCPP_NS::__CHECK::STATIC_ASSERT_TEST< \
+ sizeof(MOCKCPP_NS::__CHECK::STATIC_ASSERT_FAILURE<!!(C)>)> \
+ mockcpp_static_assert_typedef
+}
+MOCKCPP_NS_END
#endif // __MOCKCPP_H
@@ -19,6 +19,7 @@
#ifndef __MOCKCPP_HPP_
#define __MOCKCPP_HPP_
+#define MSVC_VMG_ENABLED
#include <mockcpp/mockcpp.h>
#include <mockcpp/ChainingMockHelper.h>
#include <mockcpp/MockObjectHelper.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKCPP_MOKC_H
@@ -22,13 +23,26 @@
# include <mockcpp/ChainingMockHelper.h>
# include <mockcpp/ProcStub.h>
-# if defined(MOCKCPP_USE_MOCKABLE)
-# include <mockcpp/Functor.h>
-# define MOCKER(api) MOCKCPP_NS::GlobalMockObject::instance.method(#api)
-# else
-# include <mockcpp/ApiHookMocker.h>
-# define MOCKER(api) MOCKCPP_NS::mockAPI(#api, api)
-# endif
+# if defined(MOCKCPP_USE_MOCKABLE)
+# include <mockcpp/Functor.h>
+# define MOCKER(api) MOCKCPP_NS::GlobalMockObject::instance.method(#api)
+# else
+# include <mockcpp/ApiHookMocker.h>
+// @TODO : write instructions
+// @TODO : update mockcpp
+//# define __MOCKER_MODE_1(api) MOCKCPP_NS::mockAPI<>::get(#api, "", api)
+//# define __MOCKER_MODE_2(api, API) MOCKCPP_NS::mockAPI<API>::get(#api, #API, api)
+//# define __MOCKER_CPP_MODE_1(api) MOCKCPP_NS::mockAPI<>::get(#api, "", api)
+//# define __MOCKER_CPP_MODE_2(api, API) MOCKCPP_NS::mockAPI<API>::get(#api, #API, api)
+//# define __MOCKER_CPP_VIRTUAL_MODE_1(obj, api) MOCKCPP_NS::mockAPI<>::get_virtual(#api, "", obj, api)
+//# define __MOCKER_CPP_VIRTUAL_MODE_2(obj, api, API) MOCKCPP_NS::mockAPI<API>::get_virtual(#api, #API, obj, api)
+# define MOCKER(api, ...) MOCKCPP_NS::mockAPI<__VA_ARGS__>::get(#api, ""#__VA_ARGS__, api)
+# define MOCKER_CPP(api, ...) MOCKCPP_NS::mockAPI<__VA_ARGS__>::get(#api, ""#__VA_ARGS__, api)
+# define MOCKER_CPP_VIRTUAL(obj, api, ...) MOCKCPP_NS::mockAPI<__VA_ARGS__>::get_virtual(#api, ""#__VA_ARGS__, obj, api)
+// adapter for amock
+# define AMOCKER MOCKER
+# define LLT_GLOBALOBJMOCKER GlobalMockObject
+# endif
USING_MOCKCPP_NS
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKPP_ANY_H
@@ -34,6 +35,10 @@ struct Any : public AnyBase
: AnyBase(new ValueHolder<ValueType>(value))
{}
+#if 0
+ Any(const char* value);
+#endif
+
Any(const Any & other);
public:
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKPP_ANY_BASE_H
@@ -46,12 +47,12 @@ public:
std::string toTypeAndValueString() const;
- PlaceHolder* getContent() const;
-
protected:
AnyBase& swap(AnyBase& rhs);
+ PlaceHolder* getContent() const;
+
private:
PlaceHolder* content;
@@ -59,10 +60,7 @@ private:
private:
template<typename ValueType>
- friend ValueType * __type_any_cast(AnyBase *);
-
- template<typename ValueType>
- friend ValueType& __unique_ptr_any_cast(const AnyBase* operand);
+ friend ValueType * __any_cast(AnyBase *);
};
MOCKCPP_NS_END
@@ -1,28 +1,30 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKPP_ANY_CAST_H
#define __MOCKPP_ANY_CAST_H
+#include <boost/type_traits/is_enum.hpp>
+
#include <mockcpp/mockcpp.h>
#include <mockcpp/types/AnyBase.h>
#include <mockcpp/TypeTraits.h>
-#include <mockcpp/Ignore.h>
#include <assert.h>
#define MOCKCPP_ASSERT(expr) assert(expr)
@@ -30,43 +32,23 @@
MOCKCPP_NS_START
/////////////////////////////////////////////////////////////////
-
-template<typename ValueType>
-ValueType *__ignore_type_any_cast(AnyBase *operand)
-{
- static char buf[sizeof(ValueType)] = {0};
- return operand->type() == typeid(Ignore) ? reinterpret_cast<ValueType *>(buf) : 0;
-}
-
-template<typename ValueType>
-ValueType* __type_any_cast(AnyBase *operand)
+template <typename ValueType>
+ValueType* __any_cast(AnyBase* operand)
{
typedef typename TypeTraits<ValueType>::Type nonref;
typedef Holder<nonref> holder;
- if (operand->type() != typeid(ValueType))
- {
- return 0;
- }
-
- holder* p = dynamic_cast<holder*>(operand->getContent());
- return p ? &const_cast<ValueType&>(p->getValue()) : 0;
-}
-
-template <typename ValueType>
-ValueType* __any_cast(AnyBase* operand)
-{
- if (operand == 0)
+ if (operand == 0 || operand->type() != typeid(ValueType))
{
return 0;
}
- ValueType *p = __type_any_cast<ValueType>(operand);
+ holder* p = dynamic_cast<holder*>(operand->getContent());
- return p ? p : __ignore_type_any_cast<ValueType>(operand);
+ return p ? &const_cast<ValueType&>(p->getValue()) : 0;
}
-//////////////////////////////////////////////// /////////////////
+/////////////////////////////////////////////////////////////////
template <typename ValueType, bool IsEnum>
struct AnyCast
{
@@ -100,7 +82,7 @@ struct AnyCast<ValueType, true>
template <typename ValueType>
ValueType* any_cast(AnyBase* operand)
{
- return AnyCast<ValueType, FAKE_BOOST_IS_ENUM<ValueType>::value>::cast(operand);
+ return AnyCast<ValueType, boost::is_enum<ValueType>::value>::cast(operand);
}
/////////////////////////////////////////////////////////////////
@@ -177,36 +159,6 @@ bool any_castable(const AnyBase& val)
/////////////////////////////////////////////////////////////////
-template<typename ValueType>
-ValueType& __unique_ptr_any_cast(AnyBase* operand)
-{
- typedef typename TypeTraits<ValueType>::Type nonref;
- typedef Holder<nonref> holder;
-
- holder* p = dynamic_cast<holder*>(operand->getContent());
- return const_cast<ValueType&>(p->getValue());
-}
-
-template<typename ValueType>
-ValueType& __unique_ptr_any_cast(const AnyBase* operand)
-{
- typedef typename TypeTraits<ValueType>::Type nonref;
- typedef Holder<nonref> holder;
-
- holder* p = dynamic_cast<holder*>(operand->getContent());
- return const_cast<ValueType&>(p->getValue());
-}
-
-template<typename ValueType>
-ValueType& unique_ptr_any_cast(AnyBase& operand) {
- return __unique_ptr_any_cast<ValueType>(&operand);
-}
-
-template<typename ValueType>
-ValueType& unique_ptr_any_cast(const AnyBase& operand) {
- return __unique_ptr_any_cast<ValueType>(&operand);
-}
-
MOCKCPP_NS_END
#endif
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKPP_HOLDER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKPP_PLACEHOLDER_H
@@ -36,7 +37,7 @@ struct PlaceHolder
virtual std::string toString(void) const = 0;
virtual std::string toTypeString(void) const = 0;
virtual std::string toTypeAndValueString(void) const = 0;
- virtual Constraint* getConstraint() const { return 0; }
+ virtual Constraint* getConstraint() const { return NULL; }
};
MOCKCPP_NS_END
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKPP_REF_ANY_H
@@ -32,6 +33,11 @@ struct RefAny : public AnyBase
: AnyBase(new RefHolder<ValueType>(value))
{}
+#if 0
+ RefAny(const char* value);
+ RefAny(char* value);
+#endif
+
RefAny(const RefAny & other);
public:
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKPP_REFHOLDER_H
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef __MOCKPP_VALUEHOLDER_H
@@ -29,7 +30,6 @@
#include <mockcpp/IsEqual.h>
#include <mockcpp/Void.h>
#include <mockcpp/IsAnythingHelper.h>
-#include <mockcpp/Ignore.h>
MOCKCPP_NS_START
@@ -41,10 +41,6 @@ Constraint* constraint(const T& value)
return new IsEqual<T>(value);
}
-#ifndef _MSC_VER
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wunused-function"
-#endif
Constraint* constraint(Constraint* c)
{
return c == 0 ? any() : c;
@@ -54,9 +50,6 @@ Constraint* constraint(const Constraint* c)
{
return constraint(const_cast<Constraint*>(c));
}
-#ifndef _MSC_VER
-#pragma GCC diagnostic pop
-#endif
Constraint* constraint(const Void& v)
{
@@ -108,9 +101,9 @@ protected:
unsigned short us;
unsigned char uc;
Held(const unsigned long value) : ul(value) {}
- Held(const unsigned int value) : ul(value) {}
- Held(const unsigned short value) : ul(value) {}
- Held(const unsigned char value) : ul(value) {}
+ Held(const unsigned int value) : ui(value) {}
+ Held(const unsigned short value) : us(value) {}
+ Held(const unsigned char value) : uc(value) {}
} held;
public:
@@ -207,9 +200,9 @@ protected:
short ss;
char sc;
Held(const long value) : sl(value) {}
- Held(const int value) : sl(value) {}
- Held(const short value) : sl(value) {}
- Held(const char value) : sl(value) {}
+ Held(const int value) : si(value) {}
+ Held(const short value) : ss(value) {}
+ Held(const char value) : sc(value) {}
} held;
public:
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
+ <Chen Guodong: sinojelly@gmail.com>
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/AfterMatcher.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/mockcpp.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/types/AnyBase.h>
@@ -1,19 +1,3 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
#include <limits>
#include <mockcpp/types/AnyCast.h>
@@ -1,18 +1,20 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2010> <Darwin Yuan: darwin.yuan@gmail.com>
+ <Chen Guodong: sinojelly@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <inttypes.h>
@@ -1,19 +1,20 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
+/***
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+***/
#include <mockcpp/ApiHookKey.h>
#include <mockcpp/ApiHook.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/Asserter.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/AssertionFailedError.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/BeforeMatcher.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/OutputStringStream.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/ChainableMockMethodContainer.h>
@@ -49,6 +50,7 @@ struct ChainableMockMethodContainerImpl
InvocationMocker* findInvocationMocker(const std::string& id) const;
void reset();
+ void reset(ChainableMockMethodKey* key);
void verify();
bool verified;
@@ -81,17 +83,35 @@ namespace
}
}
+/////////////////////////////////////////////////////////////////////////
+namespace
+{
+ struct IsMethodKeyMatch
+ {
+ IsMethodKeyMatch(ChainableMockMethodKey* key)
+ : myKey(key)
+ {}
+
+ bool operator()(ChainableMockMethodContainerImpl::ValueType value)
+ {
+ return myKey->equals(getKey(value));
+ }
+
+ ChainableMockMethodKey* myKey;
+ };
+}
+
/////////////////////////////////////////////////////////////////////////
void
ChainableMockMethodContainerImpl::reset()
{
- //for_each(methods.begin(), methods.end(), resetMethod);
- for(Iterator i = methods.begin(); i != methods.end(); i++)
- {
- resetMethod(*i);
- }
- methods.clear();
- verified = false;
+ //for_each(methods.begin(), methods.end(), resetMethod);
+ for (Iterator i = methods.begin(); i != methods.end(); i++)
+ {
+ resetMethod(*i);
+ }
+ methods.clear();
+ verified = false;
}
/////////////////////////////////////////////////////////////////////////
@@ -114,6 +134,19 @@ ChainableMockMethodContainerImpl::verify()
for_each(methods.begin(), methods.end(), verifyMethod);
}
+void
+ChainableMockMethodContainerImpl::reset(ChainableMockMethodKey* key)
+{
+ ConstIterator i = std::find_if(methods.begin()
+ , methods.end()
+ , IsMethodKeyMatch(key));
+
+ if (i != methods.end()) {
+ resetMethod(*i);
+ methods.remove(*i);
+ }
+}
+
/////////////////////////////////////////////////////////////////////////
ChainableMockMethodContainerImpl::~ChainableMockMethodContainerImpl()
{
@@ -156,25 +189,6 @@ ChainableMockMethodContainerImpl::findInvocationMocker(const std::string& id) co
return 0;
}
-/////////////////////////////////////////////////////////////////////////
-namespace
-{
- struct IsMethodKeyMatch
- {
- IsMethodKeyMatch(ChainableMockMethodKey* key)
- : myKey(key)
- {}
-
- bool operator()(ChainableMockMethodContainerImpl::ValueType value)
- {
- return myKey->equals(getKey(value));
- }
-
- ChainableMockMethodKey* myKey;
- };
-
-}
-
/////////////////////////////////////////////////////////////////////////
ChainableMockMethodCore*
ChainableMockMethodContainerImpl::getMethod(ChainableMockMethodKey* key) const
@@ -200,7 +214,7 @@ ChainableMockMethodContainer::addMethod(ChainableMockMethodKey* key, \
{
if(getMethod(key) != 0)
{
- MOCKCPP_REPORT_FAILURE("internal error (1022), please report this bug to" PACKAGE_BUGREPORT ".");
+ MOCKCPP_REPORT_FAILURE("internal error (1022), please report this bug to dev.mockcpp@gmail.com.");
}
This->addMethod(key, method);
@@ -227,6 +241,12 @@ ChainableMockMethodContainer::verify()
This->verify();
}
+void
+ChainableMockMethodContainer::reset(ChainableMockMethodKey* key)
+{
+ This->reset(key);
+}
+
/////////////////////////////////////////////////////////////////////////
MOCKCPP_NS_END
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/types/Any.h>
@@ -149,6 +150,7 @@ ChainableMockMethodCore::getName() const
const Any&
ChainableMockMethodCore::invoke
( const std::string& nameOfCaller
+ , const RefAny& pThisPointer
, const RefAny& p1
, const RefAny& p2
, const RefAny& p3
@@ -163,7 +165,8 @@ ChainableMockMethodCore::invoke
, const RefAny& p12
, SelfDescribe* &resultProvider)
{
- Invocation inv(nameOfCaller,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12);
+ Invocation inv(nameOfCaller,pThisPointer
+ ,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12);
return This->invoke(inv, resultProvider);
}
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/ChainableMockMethodIndexKey.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/ChainableMockMethodNameKey.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/mockcpp.h>
@@ -85,7 +86,7 @@ getMethod(const std::string& name, InvocationMockerNamespace* ns)
ChainableMockObject::ChainableMockObject(const std::string& name)
: ChainableMockObjectBase(name)
{
- This = new ChainableMockObjectImpl(this->getMethodContainer());
+ This = new ChainableMockObjectImpl(this->getMethodContainer());
}
//////////////////////////////////////////////////////////////
@@ -99,7 +100,8 @@ InvocationMockBuilderGetter
ChainableMockObject::method(const std::string& name)
{
ChainableMockMethodCore* core = This->getMethod(name, this);
- return InvocationMockBuilderGetter(core, core);
+ // @TODO: how to get the 'api' ?
+ return InvocationMockBuilderGetter(core, core, NULL);
}
//////////////////////////////////////////////////////////////
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/mockcpp.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/mockcpp.h>
@@ -131,10 +132,10 @@ Stub* returnObjectList( const Any& o01
, const Any& o11
, const Any& o12)
{
- return new TypelessStubAdapter(
- new ReturnObjectList(
- o01, o02, o03, o04, o05, o06,
- o07, o08, o09, o10, o11, o12));
+ return new TypelessStubAdapter(
+ new ReturnObjectList(
+ o01, o02, o03, o04, o05, o06,
+ o07, o08, o09, o10, o11, o12));
}
MOCKCPP_EXPORT
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/ConstraintSet.h>
@@ -97,20 +98,6 @@ ConstraintSetImpl::matches(const Invocation& inv) const
////////////////////////////////////////////////////////////
#define INIT_CONSTRAINT(i) This->constraints.push_back(p##i)
-ConstraintSet::ConstraintSet(unsigned int which, Constraint* p)
- : This(new ConstraintSetImpl())
-{
- if(which >= 12 || p == 0) return;
-
- for(unsigned int i=0; i<which; i++)
- {
- This->constraints.push_back(any());
- }
-
-
- This->constraints.push_back(p);
-}
-
ConstraintSet::ConstraintSet(
Constraint* p1
, Constraint* p2
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/OutputStringStream.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/DefaultMatcher.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/OutputStringStream.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/mockcpp.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdlib.h>
@@ -1,19 +1,3 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
#include <mockcpp/CApiHook.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/Exception.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/ExpectsMatcher.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <algorithm>
@@ -32,7 +33,7 @@ std::string toPointerString(void* p)
oss << "0x";
oss.flags (std::ios::hex);
oss.fill('0'); oss.width(8);
- oss << reinterpret_cast<unsigned long long>(p);
+ oss << reinterpret_cast<unsigned long>(p);
return oss.str();
}
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/Functor.h>
@@ -47,5 +48,10 @@ void GlobalMockObject::reset()
instance.reset();
}
+void GlobalMockObject::reset(const void* api)
+{
+ instance.reset(api);
+}
+
MOCKCPP_NS_END
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/mockcpp.h>
@@ -44,6 +45,7 @@ struct HookMockObjectImpl
getMethod(const void* api);
void reset();
+ void reset(const void* api);
ChainableMockMethodContainer* container;
@@ -64,6 +66,13 @@ HookMockObjectImpl::reset()
container->reset();
}
+void
+HookMockObjectImpl::reset(const void* api)
+{
+ ApiHookKey key(api);
+ container->reset(&key);
+}
+
//////////////////////////////////////////////////////////////
ChainableMockMethodCore*
HookMockObjectImpl::
@@ -123,7 +132,7 @@ InvocationMockBuilderGetter
HookMockObject::method(const std::string& name, const void* api, ApiHookHolder* hookHolder)
{
ChainableMockMethodCore* core = This->getMethod(name, api, hookHolder, this);
- return InvocationMockBuilderGetter(core, core);
+ return InvocationMockBuilderGetter(core, core, api);
}
//////////////////////////////////////////////////////////////
@@ -144,6 +153,11 @@ void HookMockObject::reset()
This->reset();
}
+void HookMockObject::reset(const void* api)
+{
+ This->reset(api);
+}
+
//////////////////////////////////////////////////////////////
MOCKCPP_NS_END
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/IdentityBuilder.h>
@@ -1,23 +1,23 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/IgnoreResultHandler.h>
#include <mockcpp/Ignore.h>
-#include <mockcpp/types/Any.h>
#include <mockcpp/types/AnyCast.h>
MOCKCPP_NS_START
@@ -29,7 +29,7 @@ bool IgnoreResultHandler::matches(const Any& val) const
const Any& IgnoreResultHandler::getResult(const Any& val) const
{
- return val;
+ return getEmptyAny();
}
MOCKCPP_NS_END
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/IgnoreResultHandlerFactory.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/IgnoreReturnStub.h>
@@ -1,21 +1,5 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
-
-#if defined(__GNUC__) && !defined(__clang__)
+#if defined(__GNUC__)
#include <cxxabi.h>
@@ -110,13 +94,13 @@ getNumberOfBaseClassesByClassTypeInfo(const __class_type_info* info, unsigned in
const __vmi_class_type_info* vmi_base_info = dynamic_cast<const __vmi_class_type_info*>(info);
if(vmi_base_info != 0)
{
- return getNumberOfVtblsByVmi(vmi_base_info, number);
+ return getNumberOfVtblsByVmi(vmi_base_info, number);
}
const __si_class_type_info* si_base_info = dynamic_cast<const __si_class_type_info*>(info);
if(si_base_info != 0)
{
- return getNumberOfVtblsBySi(si_base_info, number);
+ return getNumberOfVtblsBySi(si_base_info, number);
}
return number + 1;
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
@@ -27,41 +28,42 @@ MOCKCPP_NS_START
////////////////////////////////////////////////////////////////
namespace
{
- const static unsigned int maxNumOfParameters = 12;
+ const static unsigned int maxNumOfParameters = 12;
};
////////////////////////////////////////////////////////////////
struct InvocationImpl
{
- std::vector<RefAny> parameters;
- std::string nameOfCaller;
+ std::vector<RefAny> parameters;
+ std::string nameOfCaller;
+ RefAny thisPointer;
- std::string toString(void) const;
+ std::string toString(void) const;
- InvocationImpl(const std::string& name);
+ InvocationImpl(const std::string& name);
};
////////////////////////////////////////////////////////////////
InvocationImpl::InvocationImpl(const std::string &name)
-: nameOfCaller(name)
+ : nameOfCaller(name)
{
}
////////////////////////////////////////////////////////////////
std::string InvocationImpl::toString() const
{
- oss_t oss;
+ oss_t oss;
- for (unsigned int i=0; i<maxNumOfParameters; i++)
- {
- if (parameters[i].empty())
- return oss.str();
+ for (unsigned int i=0; i<maxNumOfParameters; i++)
+ {
+ if (parameters[i].empty())
+ return oss.str();
- if (i > 0) oss << ", ";
+ if (i > 0) oss << ", ";
- oss << parameters[i].toTypeAndValueString();
- }
+ oss << parameters[i].toTypeAndValueString();
+ }
- return oss.str();
+ return oss.str();
}
////////////////////////////////////////////////////////////////
@@ -70,6 +72,7 @@ std::string InvocationImpl::toString() const
Invocation::Invocation(
const std::string name
+ , const RefAny& pThisPointer
, const RefAny& p1
, const RefAny& p2
, const RefAny& p3
@@ -85,48 +88,69 @@ Invocation::Invocation(
)
: This(new InvocationImpl(name))
{
- INIT_PARAMETER(1);
- INIT_PARAMETER(2);
- INIT_PARAMETER(3);
- INIT_PARAMETER(4);
- INIT_PARAMETER(5);
- INIT_PARAMETER(6);
- INIT_PARAMETER(7);
- INIT_PARAMETER(8);
- INIT_PARAMETER(9);
- INIT_PARAMETER(10);
- INIT_PARAMETER(11);
- INIT_PARAMETER(12);
+ This->thisPointer = pThisPointer;
+ INIT_PARAMETER(1);
+ INIT_PARAMETER(2);
+ INIT_PARAMETER(3);
+ INIT_PARAMETER(4);
+ INIT_PARAMETER(5);
+ INIT_PARAMETER(6);
+ INIT_PARAMETER(7);
+ INIT_PARAMETER(8);
+ INIT_PARAMETER(9);
+ INIT_PARAMETER(10);
+ INIT_PARAMETER(11);
+ INIT_PARAMETER(12);
}
////////////////////////////////////////////////////////////////
Invocation::~Invocation()
{
- delete This;
+ delete This;
}
////////////////////////////////////////////////////////////////
+RefAny& Invocation::getThisPointer(void) const
+{
+ return This->thisPointer;
+}
+
RefAny& Invocation::getParameter(const unsigned int i) const
{
- if (i < 1 || i > maxNumOfParameters )
- {
- return getEmptyRefAny();
- }
+ if (i < 1 || i > maxNumOfParameters )
+ {
+ return getEmptyRefAny();
+ }
+
+ return This->parameters[i-1];
+}
+
+RefAny& Invocation::getParameterWithThis(const unsigned int i) const
+{
+ if (This->thisPointer.empty())
+ {
+ return getParameter(i);
+ }
+
+ if (1 == i)
+ {
+ return This->thisPointer;
+ }
- return This->parameters[i-1];
+ return getParameter(i - 1);
}
////////////////////////////////////////////////////////////////
std::string Invocation::toString(void) const
{
- return std::string("(") + This->toString() + std::string(")");
+ return std::string("(") + This->toString() + std::string(")");
}
////////////////////////////////////////////////////////////////
std::string Invocation::getNameOfCaller() const
{
- return This->nameOfCaller;
+ return This->nameOfCaller;
}
////////////////////////////////////////////////////////////////
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/InvocationId.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/InvocationMockBuilderGetter.h>
@@ -26,13 +27,16 @@
#include <mockcpp/InvocationMocker.h>
#include <mockcpp/DefaultMatcher.h>
#include <mockcpp/Method.h>
+#include <mockcpp/ChainingMockHelper.h>
+#include <mockcpp/GlobalMockObject.h>
MOCKCPP_NS_START
///////////////////////////////////////////////////////////
InvocationMockBuilderGetter::
-InvocationMockBuilderGetter(InvocationMockerContainer* container, Method* m)
- : invocationMockerContainer(container), method(m)
+InvocationMockBuilderGetter(
+ InvocationMockerContainer* container, Method* _method, const void* _addr)
+ : invocationMockerContainer(container), method(_method), addr(_addr)
{
}
@@ -44,46 +48,60 @@ InvocationMockBuilderGetter::~InvocationMockBuilderGetter()
//////////////////////////////////////////////////////////
StubsBuilder InvocationMockBuilderGetter::stubs()
{
- InvocationMocker* mocker = new InvocationMocker(method);
- mocker->addMatcher(new StubsMatcher);
- mocker->addMatcher(new InvokedTimesMatcher(new SimpleInvocationRecorder));
+ InvocationMocker* mocker = new InvocationMocker(method);
+ mocker->addMatcher(new StubsMatcher);
+ mocker->addMatcher(new InvokedTimesMatcher(new SimpleInvocationRecorder));
- invocationMockerContainer->addInvocationMocker(mocker);
+ invocationMockerContainer->addInvocationMocker(mocker);
- return StubsBuilder(mocker);
+ return StubsBuilder(mocker);
}
//////////////////////////////////////////////////////////
MockBuilder InvocationMockBuilderGetter::expects(Matcher* matcher)
{
- InvocationMocker* mocker = new InvocationMocker(method);
+ InvocationMocker* mocker = new InvocationMocker(method);
- InvokedTimesRecorder* recorder = new SimpleInvocationRecorder;
- InvocationTimesMatcher* itMatcher = dynamic_cast<InvocationTimesMatcher*>(matcher);
- if (itMatcher != 0)
- {
- itMatcher->setInvokedTimesReader(recorder);
- }
+ InvokedTimesRecorder* recorder = new SimpleInvocationRecorder;
+ InvocationTimesMatcher* itMatcher = dynamic_cast<InvocationTimesMatcher*>(matcher);
+ if (itMatcher != 0)
+ {
+ itMatcher->setInvokedTimesReader(recorder);
+ }
- mocker->addMatcher(new ExpectsMatcher(matcher));
- mocker->addMatcher(new InvokedTimesMatcher(recorder));
+ mocker->addMatcher(new ExpectsMatcher(matcher));
+ mocker->addMatcher(new InvokedTimesMatcher(recorder));
- invocationMockerContainer->addInvocationMocker(mocker);
+ invocationMockerContainer->addInvocationMocker(mocker);
- return MockBuilder(mocker);
+ return MockBuilder(mocker);
+}
+
+//////////////////////////////////////////////////////////
+MockBuilder InvocationMockBuilderGetter::times(unsigned int n)
+{
+ return expects(exactly(n));
}
//////////////////////////////////////////////////////////
DefaultBuilder InvocationMockBuilderGetter::defaults()
{
- InvocationMocker* mocker = new InvocationMocker(method);
- mocker->addMatcher(new DefaultMatcher);
+ InvocationMocker* mocker = new InvocationMocker(method);
+ mocker->addMatcher(new DefaultMatcher);
- invocationMockerContainer->addDefaultInvocationMocker(mocker);
+ invocationMockerContainer->addDefaultInvocationMocker(mocker);
- return DefaultBuilder(mocker);
+ return DefaultBuilder(mocker);
}
+InvocationMockBuilderGetter &InvocationMockBuilderGetter::reset()
+{
+ if (addr) {
+ MOCKCPP_NS::GlobalMockObject::reset(addr);
+ }
+
+ return *this;
+}
//////////////////////////////////////////////////////////
MOCKCPP_NS_END
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/InvocationMocker.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <list>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/InvocationTimesMatcher.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/OutputStringStream.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/OutputStringStream.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/OutputStringStream.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/InvokedOnce.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/OutputStringStream.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/IsAnything.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/IsStringContains.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <string.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/IsStringStartWith.h>
@@ -1,25 +1,27 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <inttypes.h>
#include <string.h>
#include <mockcpp/JmpCode.h>
-#include "JmpCodeArch.h"
+#include <mockcpp/Asserter.h>
+#include "src/JmpCodeArch.h"
MOCKCPP_NS_START
@@ -27,54 +29,66 @@ MOCKCPP_NS_START
struct JmpCodeImpl
{
- ////////////////////////////////////////////////
- JmpCodeImpl(const void* from, const void* to)
- {
- ::memcpy(m_code, jmpCodeTemplate, JMP_CODE_SIZE);
- SET_JMP_CODE(m_code, from, to);
- }
-
- ////////////////////////////////////////////////
- void* getCodeData() const
- {
- return (void*) m_code;
- }
-
- ////////////////////////////////////////////////
- size_t getCodeSize() const
- {
- return JMP_CODE_SIZE;
- }
-
- ////////////////////////////////////////////////
-
- unsigned char m_code[JMP_CODE_SIZE];
+ ////////////////////////////////////////////////
+ JmpCodeImpl(const void* from, const void* to)
+ {
+ m_from = from;
+ ::memcpy(m_code, jmpCodeTemplate, JMP_CODE_SIZE);
+ SET_JMP_CODE(m_code, from, to);
+ }
+
+ ////////////////////////////////////////////////
+ void* getCodeData() const
+ {
+ return (void*) m_code;
+ }
+
+ ////////////////////////////////////////////////
+ size_t getCodeSize() const
+ {
+ return JMP_CODE_SIZE;
+ }
+
+ void flushCache() const
+ {
+ FLUSH_CACHE(m_from, JMP_CODE_SIZE);
+ }
+ ////////////////////////////////////////////////
+
+ unsigned char m_code[JMP_CODE_SIZE];
+ const void* m_from;
};
///////////////////////////////////////////////////
JmpCode::JmpCode(const void* from, const void* to)
- : This(new JmpCodeImpl(from, to))
+ : This(new JmpCodeImpl(from, to))
{
}
///////////////////////////////////////////////////
JmpCode::~JmpCode()
{
- delete This;
+ delete This;
}
///////////////////////////////////////////////////
void*
-JmpCode::getCodeData() const
+ JmpCode::getCodeData() const
{
- return This->getCodeData();
+ return This->getCodeData();
}
///////////////////////////////////////////////////
size_t
-JmpCode::getCodeSize() const
+ JmpCode::getCodeSize() const
{
- return This->getCodeSize();
+ return This->getCodeSize();
+}
+
+void
+ JmpCode::flushCache() const
+{
+ This->flushCache();
}
MOCKCPP_NS_END
new file mode 100644
@@ -0,0 +1,21 @@
+
+#ifndef __MOCKCPP_JMP_CODE_AARCH32_H__
+#define __MOCKCPP_JMP_CODE_AARCH32_H__
+
+#include <stdlib.h>
+
+const unsigned char jmpCodeTemplate[] = { 0xEA, 0x00, 0x00, 0x00 };
+
+// @TODO : make it's style be same as JmpCodeAarch64
+#define SET_JMP_CODE(base, from, to) do { \
+ int offset = (int)to - (int)from - 8; \
+ offset = (offset >> 2) & 0x00FFFFFF; \
+ int code = *(int*)(base) | offset; \
+ *(int*)(base) = changeByteOrder(code); \
+ } while(0)
+
+#define FLUSH_CACHE(from, length) do { \
+ ::system("echo 3 > /proc/sys/vm/drop_caches"); \
+} while(0)
+
+#endif
new file mode 100644
@@ -0,0 +1,66 @@
+
+#ifndef __MOCKCPP_JMP_CODE_AARCH64_H__
+#define __MOCKCPP_JMP_CODE_AARCH64_H__
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/prctl.h>
+#include <sys/syscall.h>
+#include <asm/unistd.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+
+MOCKCPP_NS_START
+
+struct l2cache_addr_range
+{
+ uintptr_t start;
+ uintptr_t end;
+};
+
+MOCKCPP_NS_END
+
+#define ADDR_ALIGN_UP(addr) ((((addr)+((4096)-1))&(~((4096)-1)))&0x00000000ffffffff)
+#define ADDR_ALIGN_DOWN(addr) (((addr)&(~((4096)-1)))&0x00000000ffffffff)
+#define OUTER_CACHE_INV_RANGE _IOWR('S', 0x00, struct l2cache_addr_range)
+#define OUTER_CACHE_CLEAN_RANGE _IOWR('S', 0x01, struct l2cache_addr_range)
+#define OUTER_CACHE_FLUSH_RANGE _IOWR('S', 0x02, struct l2cache_addr_range)
+#define L1_INV_I_CACHE _IOWR('S', 0x03, struct l2cache_addr_range)
+#define D_TO_I_CACHEFLUSH_RANGE _IOWR('S', 0x04, struct l2cache_addr_range)
+
+const unsigned char jmpCodeTemplate[] = { 0x00, 0x00, 0x00, 0x00 };
+
+#define SET_JMP_CODE(base, from, to) do { \
+ uintptr_t offset = (uintptr_t)to - (uintptr_t)from; \
+ offset = ((offset >> 2) & 0x03FFFFFF) | 0x14000000; \
+ *(uintptr_t*)(base) = changeByteOrder(offset); \
+} while(0)
+
+//#define FLUSH_CACHE(from, length) do { \
+// int fd = open("/dev/cache_ops", O_RDWR); \
+// MOCKCPP_ASSERT_TRUE_MESSAGE( \
+// "Open /dev/cache_ops failed! Make sure the cache_ops.ko had been loaded!", \
+// 0 <= fd); \
+// struct l2cache_addr_range usr_data; \
+// usr_data.start = ADDR_ALIGN_DOWN((unsigned long long)from); \
+// usr_data.end = ADDR_ALIGN_UP((unsigned long long)from) + length; \
+// printf("from = %lld, length = %lld, usr_data.start = %lld, usr_data.end = %lld\n", from, length, usr_data.start, usr_data.end); \
+// int err = ioctl(fd, OUTER_CACHE_FLUSH_RANGE, &usr_data); \
+// MOCKCPP_ASSERT_TRUE_MESSAGE("Cache flush failed!", 0 == err); \
+// close(fd); \
+//} while(0)
+
+#define FLUSH_CACHE(from, length) do { \
+ struct l2cache_addr_range usr_data; \
+ usr_data.start = ADDR_ALIGN_DOWN((unsigned long long)from); \
+ usr_data.end = ADDR_ALIGN_UP((unsigned long long)from) + length; \
+ __clear_cache((void*)usr_data.start, (void*)usr_data.end); \
+ /* printf("from = %lld, length = %lld, usr_data.start = %lld, usr_data.end = %lld\n", from, length, usr_data.start, usr_data.end); */ \
+} while(0)
+
+
+#endif
\ No newline at end of file
@@ -1,28 +1,32 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
#ifndef __MOCKCPP_JMP_CODE_ARCH_H__
#define __MOCKCPP_JMP_CODE_ARCH_H__
#include <mockcpp/mockcpp.h>
-#if BUILD_FOR_X64
-# include "JmpCodeX64.h"
-#elif BUILD_FOR_X86
-# include "JmpCodeX86.h"
+template<typename T>
+inline T changeByteOrder(const T v) {
+ enum { S = sizeof(T) };
+ T rst = v;
+ char *p = (char *)&rst;
+ char tmp = 0;
+ for (unsigned int i = 0; i < S / 2; ++i) {
+ tmp = p[i];
+ p[i] = p[S - i - 1];
+ p[S - i - 1] = tmp;
+ }
+
+ return rst;
+}
+
+#if defined(BUILD_FOR_X64)
+# include "src/JmpCodeX64.h"
+#elif defined(BUILD_FOR_X86)
+# include "src/JmpCodeX86.h"
+#elif defined(BUILD_FOR_AARCH32)
+# include "src/JmpCodeAARCH32.h"
+#elif defined(BUILD_FOR_AARCH64)
+# include "src/JmpCodeAARCH64.h"
#endif
#endif
@@ -1,19 +1,4 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
- [Chen Guodong <sinojelly@gmail.com>]
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
#ifndef __MOCKCPP_JMP_CODE_X64_H__
#define __MOCKCPP_JMP_CODE_X64_H__
@@ -27,5 +12,6 @@ const unsigned char jmpCodeTemplate[] =
*(uintptr_t *)(base + 6) = (uintptr_t)to; \
} while(0)
-#endif
+#define FLUSH_CACHE(from, length) do {} while(0)
+#endif
@@ -1,27 +1,14 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
#ifndef __MOCKCPP_JMP_CODE_X32_H__
#define __MOCKCPP_JMP_CODE_X32_H__
const unsigned char jmpCodeTemplate[] = { 0xE9, 0x00, 0x00, 0x00, 0x00 };
#define SET_JMP_CODE(base, from, to) do { \
*(unsigned long*)(base + 1) = \
- (unsigned long long)to - (unsigned long long)from - sizeof(jmpCodeTemplate); \
+ (unsigned long)to - (unsigned long)from - sizeof(jmpCodeTemplate); \
} while(0)
+#define FLUSH_CACHE(from, length) do {} while(0)
+
#endif
@@ -1,18 +1,20 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
- [Chen Guodong <sinojelly@gmail.com>]
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2010> <Darwin Yuan: darwin.yuan@gmail.com>
+ <Chen Guodong: sinojelly@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <string.h>
@@ -68,6 +70,7 @@ struct JmpOnlyApiHookImpl
void changeCode(const void* data)
{
CodeModifier::modify(const_cast<void*>(m_api), data, m_jmpCode.getCodeSize());
+ m_jmpCode.flushCache();
}
/////////////////////////////////////////////////////
@@ -1,19 +1,3 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
#ifndef __MOCKCPP_JMP_ONLY_API_HOOK_H__
#define __MOCKCPP_JMP_ONLY_API_HOOK_H__
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/MethodIndiceChecker.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/types/Any.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/MismatchResultHandlerFactory.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/MockObjectBase.h>
@@ -160,7 +161,7 @@ createInvocationMockerBuilderGetter(const std::string& name, \
ChainableMockMethodCore* method = \
This->getMethod(name, addr, vptrIndex, vtblIndex, this);
- return InvocationMockBuilderGetter(method, method);
+ return InvocationMockBuilderGetter(method, method, addr);
}
////////////////////////////////////////////////////////////////////////
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/types/Any.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/NormalResultHandlerFactory.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/OutBoundPointer.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/mockcpp.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/ProcStub.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/types/RefAny.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/RepeatStub.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/types/Any.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/OutputStringStream.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/ReturnStub.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/SimpleInvocationRecorder.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/types/AnyCast.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/StubContainer.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/StubsMatcher.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/TestFailureMatcher.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/OutputStringStream.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/mockcpp.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/TypelessConstraintAdapter.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/TypelessStubAdapter.h>
@@ -1,18 +1,20 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
- [Chen Guodong <sinojelly@gmail.com>]
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2010> <Darwin Yuan: darwin.yuan@gmail.com>
+ <Chen Guodong: sinojelly@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <string.h>
@@ -38,6 +40,7 @@ bool CodeModifier::modify(void *dest, const void *src, size_t size)
}
::memcpy(dest, src, size);
+ ::msync(dest, size, MS_SYNC);
#if 0
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <typeinfo>
@@ -69,8 +70,7 @@ VirtualTableImpl::validateVptr(void** pVptr)
{
if(pVptr != fakeObject->vptr)
{
- MOCKCPP_REPORT_FAILURE( PACKAGE " internal error(1018). please report this bug to "
- PACKAGE_BUGREPORT ".");
+ MOCKCPP_REPORT_FAILURE( "mockcpp internal error(1018). please report this bug to dev.mockcpp@gmail.com.");
}
}
/////////////////////////////////////////////////////////////////
@@ -86,9 +86,9 @@ VirtualTableImpl::validateNumberOfVptr()
<< numberOfVptr
<< "), or it's not a pure virtual class. "
<< "Here are some hints for you: \n"
- << "1. " PACKAGE " only supports mocking pure virtual class; \n"
+ << "1. mockcpp only supports mocking pure virtual class; \n"
<< "2. you can change the MOCKCPP_MAX_INHERITANCE setting to "
- "maximun 7, then rebuild " PACKAGE "; \n"
+ "maximun 7, then rebuild mockcpp; \n"
<< "3. you can refine your design to make it simpler.";
MOCKCPP_REPORT_FAILURE(oss.str());
@@ -120,7 +120,7 @@ VirtualTableImpl::validateIndexOfVptr(unsigned int index)
{
if(index >= numberOfVptr)
{
- MOCKCPP_REPORT_FAILURE(PACKAGE " internal error. please report it to " PACKAGE_BUGREPORT ".");
+ MOCKCPP_REPORT_FAILURE("mockcpp internal error. please report it to dev.mockcpp@gmail.com.");
}
}
@@ -1,19 +1,3 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
#include <typeinfo>
#include <string.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/types/Any.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/VoidResultHandlerFactory.h>
@@ -1,18 +1,19 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- http://www.apache.org/licenses/LICENSE-2.0
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <mockcpp/OutputStringStream.h>
@@ -1,18 +1,20 @@
/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
- [Chen Guodong <sinojelly@gmail.com>]
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ mockcpp is a generic C/C++ mock framework.
+ Copyright (C) <2010> <Darwin Yuan: darwin.yuan@gmail.com>
+ <Chen Guodong: sinojelly@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#include <Windows.h>
@@ -26,13 +26,13 @@ def getUsageString(longOpts):
return " ".join([i.toUsage() for i in longOpts])
def usage(longOpts):
- print(sys.argv[0], getUsageString(longOpts))
+ print sys.argv[0], getUsageString(longOpts)
def getOpt(longOpts):
try:
return getopt.getopt(sys.argv[1:], '', getAssignableOptStrings(longOpts))
- except (getopt.GetoptError, err):
- print(str(err), file=sys.stderr)
+ except getopt.GetoptError, err:
+ print >> sys.stderr, str(err)
usage(longOpts)
sys.exit(2)
@@ -1,19 +1,3 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
/***
mockcpp is a generic C/C++ mock framework.
Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
@@ -1,19 +1,3 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
/***
mockcpp is a generic C/C++ mock framework.
Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
@@ -1,19 +1,3 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
/***
mockcpp is a generic C/C++ mock framework.
Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
@@ -1,19 +1,3 @@
-/***
- mockcpp is a C/C++ mock framework.
- Copyright [2008] [Darwin Yuan <darwin.yuan@gmail.com>]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-***/
/***
mockcpp is a generic C/C++ mock framework.
Copyright (C) <2009> <Darwin Yuan: darwin.yuan@gmail.com>
@@ -1,11 +1,10 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 3.12...3.19)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(testngpp)
INCLUDE(ProjectVar.txt)
-IF(NOT WIN32)
FIND_LIBRARY(DL_LIBRARY NAMES dl)
IF(DL_LIBRARY)
SET(TESTNGPP_USE_DLOPEN TRUE)
@@ -19,16 +18,12 @@ IF(LTDL_LIBRARY)
ELSE(LTDL_LIBRARY)
SET(TESTNGPP_USE_LTDL FALSE)
ENDIF(LTDL_LIBRARY)
-ELSE(NOT WIN32)
- SET(TESTNGPP_USE_DLOPEN FALSE)
- SET(TESTNGPP_USE_LTDL FALSE)
-ENDIF(NOT WIN32)
-IF(MSVC OR MINGW)
+IF(MSVC)
SET(TESTNGPP_USE_LOADLIBRARY TRUE)
-ELSE(MSVC OR MINGW)
+ELSE(MSVC)
SET(TESTNGPP_USE_LOADLIBRARY FALSE)
-ENDIF(MSVC OR MINGW)
+ENDIF(MSVC)
IF(CMAKE_CL_64)
ADD_DEFINITIONS(-DWIN64)
@@ -53,8 +48,14 @@ INSTALL(DIRECTORY include/testngpp DESTINATION include
INSTALL(FILES include/testngpp/runner/loaders/ModuleLoader.h
DESTINATION include/testngpp/runner/loaders)
-INSTALL(DIRECTORY include/mem_checker DESTINATION include
+INSTALL(DIRECTORY 3rdparty/mem_checker DESTINATION 3rdparty
+ PATTERN ".svn" EXCLUDE)
+
+IF(MSVC)
+INSTALL(DIRECTORY 3rdparty/boost DESTINATION 3rdparty
PATTERN ".svn" EXCLUDE)
+
+ENDIF(MSVC)
IF(USING_AS_TESTCPP)
INSTALL(DIRECTORY include/testcpp DESTINATION include
@@ -4,4 +4,4 @@ SET(PACKAGE_STRING \"testngpp\")
SET(PACKAGE_BUGREPORT \"arthur.ii.yuan@gmail.com\")
SET(PACKAGE_URL \"http://code.google.com/p/test-ng-pp\")
SET(PACKAGE \"testngpp\")
-SET(VERSION \"1.1\")
+SET(VERSION \"0.5\")
@@ -29,7 +29,7 @@
" 0x" \
<< std::hex << std::setiosflags(std::ios::uppercase) \
<< std::setw(8) << std::setfill('0') \
- << (unsigned long long)(pointer) \
+ << (unsigned long)(pointer) \
<< std::dec << std::resetiosflags(std::ios::uppercase)
#define FILE_LINE(file, line) \
@@ -76,7 +76,7 @@ struct SrcAddr
file = last_info;
if (!print_position_from_addr(_instruction, line, last_info, sizeof(last_info))) // fail to get source location
{
- sprintf(last_info, "instruction 0x%016lX", (unsigned long long)_instruction);
+ sprintf(last_info, "instruction 0x%016lX", (unsigned long)_instruction);
}
}
}
@@ -25,11 +25,12 @@
#include <testngpp/testngpp.h>
#include <testngpp/utils/Formatter.h>
+
#if defined(__GNUC__)
-#define TESTNGPP_TYPEOF(expr) __typeof(expr)
+#define TESTNGPP_TYPEOF(expr) typeof(expr)
#else
-#include <fake_boost/fake_boost.h>
-#define TESTNGPP_TYPEOF(expr) FAKE_BOOST_TYPEOF(expr)
+#include <boost/typeof/typeof.hpp>
+#define TESTNGPP_TYPEOF(expr) BOOST_TYPEOF(expr)
#endif
TESTNGPP_NS_START
@@ -27,11 +27,10 @@ TESTNGPP_NS_START
struct TestCaseInfoReader;
struct TestCaseResultCollector;
-struct MemChecker;
struct TestFixture
{
- TestFixture() : testcase(0), collector(0), memLeakCollector(0) {}
+ TestFixture() : testcase(0), collector(0) {}
virtual void setUp() {}
virtual void tearDown() {}
@@ -44,22 +43,13 @@ struct TestFixture
void reportFailure(const char* file, unsigned int line, const std::string& failure, bool throwException=true);
//////////////////////////////////////////////
- void reportMemLeakInfo(const char* file, unsigned int line, const std::string& info);
- void reportMemLeakFailure(const char* file, unsigned int line, const std::string& failure, bool throwException=true);
-
- //////////////////////////////////////////////
- void setCurrentTestCase(const TestCaseInfoReader*, TestCaseResultCollector*, TestCaseResultCollector*, MemChecker*);
-
- //////////////////////////////////////////////
- void startMemChecker();
- void verifyMemChecker();
+ void setCurrentTestCase(const TestCaseInfoReader*, TestCaseResultCollector*);
+ TestFixture *clone();
private:
const TestCaseInfoReader* testcase;
TestCaseResultCollector* collector;
- TestCaseResultCollector* memLeakCollector;
- MemChecker* memChecker;
};
TESTNGPP_NS_END
@@ -43,9 +43,10 @@ struct TestCase
, depends(testcase)
, fileName(file)
, lineOfFile(line)
+ , fixtureCloneAsReporter(0)
{}
- virtual ~TestCase() { }
+ virtual ~TestCase() { delete fixtureCloneAsReporter; }
const std::string& getName() const
{ return name; }
@@ -71,7 +72,7 @@ struct TestCase
void setUp()
{
- getFixture()->startMemChecker();
+ startMemChecker();
getFixture()->setUp();
}
@@ -79,7 +80,8 @@ struct TestCase
{
TestFixture * fixture = getFixture();
fixture->tearDown();
- getFixture()->verifyMemChecker();
+ delete fixture;
+ verifyMemChecker();
}
void run()
@@ -98,20 +100,19 @@ struct TestCase
return tags;
}
- virtual const char* getMemCheckSwitch() const
- {
- static const char* memCheckSwitch = "none";
- return memCheckSwitch;
- }
-
void setModuleLoader(ModuleLoader* _loader)
{
loader = _loader;
}
- ModuleLoader *getLoader()
- {
- return loader;
+private:
+ void startMemChecker();
+public:
+ void verifyMemChecker()
+ {
+ typedef void (*verify_t)(void);
+ verify_t verifier = (verify_t)loader->findSymbol("verifyMemChecker");
+ verifier();
}
private:
@@ -133,6 +134,7 @@ private:
std::string fileName;
unsigned int lineOfFile;
ModuleLoader* loader;
+ TestFixture *fixtureCloneAsReporter;
};
TESTNGPP_NS_END
@@ -14,7 +14,7 @@ struct DLModuleLoader : public ModuleLoader
DLModuleLoader();
~DLModuleLoader();
- void load( const StringList& searchingPaths \
+ void load( const StringList& searchingPaths \
, const std::string& modulePath);
void unload();
@@ -4,6 +4,8 @@
#include <testngpp/testngpp.h>
#include <testngpp/runner/loaders/ModuleLoader.h>
+#include <testngpp/runner/SearchingPaths.h>
+
TESTNGPP_NS_START
@@ -11,12 +13,12 @@ struct LTModuleLoaderImpl;
struct LTModuleLoader : public ModuleLoader
{
- LTModuleLoader();
+ LTModuleLoader(const SearchingPaths* searchingPaths);
~LTModuleLoader();
- void load( const StringList& searchingPaths \
- , const std::string& modulePath);
+ void load(const std::string& modulePath);
+
void unload();
void* findSymbol(const std::string& symbol);
@@ -2,6 +2,6 @@
#ifndef __TESTNGPP_INTERNAL_ERROR_H
#define __TESTNGPP_INTERNAL_ERROR_H
-#define TESTNGPP_INTERNAL_ERROR(code) "testngpp internal error(" #code "), please report bug to " PACKAGE_BUGREPORT
+#define TESTNGPP_INTERNAL_ERROR(code) "testngpp internal error(" #code "), please report bug to dev.mockcpp@gmail.com"
#endif
@@ -1,11 +1,11 @@
-find_package (Python3 COMPONENTS Interpreter)
+INCLUDE(FindPythonInterp)
-IF(Python3_FOUND)
- SET(PYTHON ${Python3_EXECUTABLE})
-ELSE()
- MESSAGE(FATAL_ERROR "No Python interpreter found")
-ENDIF(Python3_FOUND)
+IF(PYTHONINTERP_FOUND)
+ SET(PYTHON ${PYTHON_EXECUTABLE})
+ELSE(PYTHONINTERP_FOUND)
+ MESSAGE(FATAL_ERROR "No Python interpreter found")
+ENDIF(PYTHONINTERP_FOUND)
IF(MSVC)
SET(RM del)
@@ -49,8 +49,8 @@ SET(PYC_FILES
FILE(REMOVE ${PYC_FILES})
-INSTALL(DIRECTORY . DESTINATION generator
- FILES_MATCHING PATTERN "*.py"
+INSTALL(DIRECTORY . DESTINATION testngpp/generator
+ FILES_MATCHING PATTERN "*.pyc"
PATTERN "CMakeFiles" EXCLUDE
PATTERN ".svn" EXCLUDE
- PATTERN ".pyc" EXCLUDE)
+ PATTERN ".py" EXCLUDE)
@@ -1,11 +1 @@
-
-newaction {
- trigger = "install",
- description = "Install the software",
- execute = function ()
- os.execute("D:/Users/jelly/Anaconda3/python.exe setup.py py2exe")
- end
-}
+-- use py2exe to build all the python files into an exe file.
-- please install py2exe first. http://www.py2exe.org/
-- usage: premake4 install
newaction {
trigger = "install",
description = "Install the software",
execute = function ()
os.execute("C:/Python26/python.exe setup.py py2exe")
end
}
\ No newline at end of file
@@ -1,8 +1,8 @@
import re
-from .Message import *
-from .Phase1Result import Tag
+from Message import *
+from Phase1Result import Tag
blank_re = re.compile( r'^\s*$', re.UNICODE)
@@ -1,8 +1,8 @@
#!/usr/bin/python
-from .Message import *
-from .Phase1Result import *
-from .Useless import Useless
+from Message import *
+from Phase1Result import *
+from Useless import Useless
##########################################################
class ClassDeclParser:
@@ -1,8 +1,8 @@
#!/usr/bin/python
-from .Message import *
-from .Phase1Result import *
-from .DataProvider import DataProvider
+from Message import *
+from Phase1Result import *
+from DataProvider import DataProvider
import re
##########################################################
@@ -1,12 +1,12 @@
#!/usr/bin/python
-from .PreprocessScope import PreprocessScope
-from .PreprocessScopeParser import PreprocessScopeParser
-from .Useless import Useless
+from PreprocessScope import PreprocessScope
+from PreprocessScopeParser import PreprocessScopeParser
+from Useless import Useless
-from .Phase1Result import *
+from Phase1Result import *
-from .Message import *
+from Message import *
class ElemParser:
#######################################################
@@ -3,10 +3,10 @@
import sys
import re
-from .TestScope import TestScope
-from .AnnotationParser import AnnotationParser
-from .TagsParser import TagsParser
-from .Name import *
+from TestScope import TestScope
+from AnnotationParser import AnnotationParser
+from TagsParser import TagsParser
+from Name import *
###########################################
class Fixture:
@@ -24,7 +24,7 @@ class Fixture:
if len(annotations) > 0 :
annotation = annotations[0]
- self.annotations = AnnotationParser(annotation, {"memcheck":None, "tags":[]}).parse()
+ self.annotations = AnnotationParser(annotation, {"tags":[]}).parse()
self.annotations['tags'] = TagsParser(self.annotations['tags']).parse()
########################################
@@ -35,14 +35,10 @@ class Fixture:
def get_tags(self):
return self.annotations['tags']
- ########################################
- def get_memcheck_switch(self):
- return self.annotations['memcheck']
-
########################################
def show(self):
content = "FIXTURE("+self.get_name()+")"
- print(content.encode('utf-8'))
+ print content.encode('utf-8')
self.scope.show()
########################################
@@ -5,17 +5,17 @@ import re
import os
import codecs
-from .Phase1Result import *
+from Phase1Result import *
-from .PreprocessScope import *
-from .Fixture import Fixture
+from PreprocessScope import *
+from Fixture import Fixture
-from .TestCaseParser import TestCaseParser
-from .PreprocessScopeParser import *
-from .ClassDeclParser import ClassDeclParser
-from .DataProviderParser import DataProviderParser
+from TestCaseParser import TestCaseParser
+from PreprocessScopeParser import *
+from ClassDeclParser import ClassDeclParser
+from DataProviderParser import DataProviderParser
-from .Message import *
+from Message import *
##########################################################
@@ -3,9 +3,9 @@
import getopt, sys
import os
-from .Process import process
+from Process import process
-from .Output import output,output2null,output2file
+import Output
##########################################################
class LongOptString:
@@ -37,21 +37,21 @@ def getUsageString(longOpts):
def getOpt(longOpts, argv):
try:
return getopt.getopt(argv, 'i:e:o:d:', getAssignableOptStrings(longOpts))
- except (getopt.GetoptError, err):
- print(str(err), file=sys.stderr)
+ except getopt.GetoptError, err:
+ print >> sys.stderr, str(err)
usage()
sys.exit(2)
##########################################################
def usage():
- print("Usage:")
- print(" testngppgen", \
+ print "Usage:"
+ print " testngppgen", \
getUsageString(longOpts), \
- "[-e encoding] -o target testcase1 testcase2 ...")
- print(" or")
- print(" testngppgen", \
+ "[-e encoding] -o target testcase1 testcase2 ..."
+ print " or"
+ print " testngppgen", \
getUsageString(longOpts), \
- "[-e encoding] -d target_dir testcase1 testcase2 ...")
+ "[-e encoding] -d target_dir testcase1 testcase2 ..."
##########################################################
longOpts = []
@@ -115,7 +115,7 @@ def generate(argv):
elif o == "-e":
encoding = a
elif o == "-d":
- target_dir = a
+ target_dir = a
inputEncoding = encoding
@@ -138,9 +138,9 @@ def generate(argv):
cpp_file_path = processEndFile(target_dir, cpp_file, theEnd)
if newerThan(cpp_file_path, h_file_path) and (not theEnd):
- output = output2null # output nothing, but record fixtureDescs.
+ Output.output = Output.output2null # output nothing, but record fixtureDescs.
else :
- output = output2file
+ Output.output = Output.output2file
process(cpp_file_path, absFixtures, inputEncoding, encoding, not theEnd)
return
@@ -3,26 +3,18 @@
class LogicalLine:
def __init__(self, first_phys_line, line_number):
self.line_number = line_number
- self.num_of_phys_lines = 0
self.content = ""
self.add_line(first_phys_line)
def add_line(self, phys_line):
- self.content += self.remove_extra_heading_blanks(phys_line)
- self.num_of_phys_lines += 1
+ self.content += phys_line
if len(self.content) > 0:
if self.content[-1] == "\\":
self.content = self.content[:-2]
def get_line_number(self):
- return self.line_number + self.num_of_phys_lines - 1
-
- def remove_extra_heading_blanks(self, phys_line):
- if len(phys_line) > 0 and phys_line[0] in [' ','/t','/n','/r']:
- return " " + phys_line.lstrip()
-
- return phys_line
+ return self.line_number
def get_content(self):
return self.content
@@ -2,7 +2,7 @@
import sys
import os
-from .Phase1Result import *
+from Phase1Result import *
####################################################################
def message(file, line_number, type, msg):
@@ -10,7 +10,7 @@ def message(file, line_number, type, msg):
####################################################################
def raw_fatal(file, line_number, error):
- print(message(file, line_number, "error", error), file=sys.stderr)
+ print >> sys.stderr, message(file, line_number, "error", error)
sys.exit(1)
####################################################################
@@ -19,11 +19,11 @@ def fatal(file, line, error):
####################################################################
def warning(file, line, msg):
- print(message(file, line.get_line_number(), "warning", msg), file=sys.stderr)
+ print >> sys.stderr, message(file, line.get_line_number(), "warning", msg)
####################################################################
def info(file, line, msg):
- print(message(file, line.get_line_number(), "info", msg), file=sys.stdout)
+ print >> sys.stdout, message(file, line.get_line_number(), "info", msg)
####################################################################
def report_expect_char(file, line, expected_char, unexpected_char):
@@ -9,11 +9,7 @@ def output2file(content, file):
return
lines = content + "\n"
- try:
- file.writelines(lines)
- except:
- print("Some exception raised, maybe you tried to output some path with chinese or other non-ascii characters.")
- raise
+ file.writelines(lines)
################################################
def output2null(content, file):
@@ -2,8 +2,8 @@
import sys
-from .LogicalLine import *
-from .Message import raw_fatal
+from LogicalLine import *
+from Message import raw_fatal
#######################################################
class Phase0Parser:
@@ -5,8 +5,8 @@ import re
import os
import codecs
-from .Phase1Result import *
-from .LogicalLine import *
+from Phase1Result import *
+from LogicalLine import *
##########################################################
blank_slc_re = re.compile( r'^\s*//.*$', re.UNICODE)
@@ -27,7 +27,7 @@ class Tag(Line):
return self.value
def show(self):
- print(self.line_number, "tag", self.tag, self.value, file=sys.stdout)
+ print >> sys.stdout, self.line_number, "tag", self.tag, self.value
##########################################################
class Unknown(Line):
@@ -39,5 +39,5 @@ class Unknown(Line):
return self.content
def show(self):
- print(self.line_number, self.content, file=sys.stdout)
+ print >> sys.stdout, self.line_number, self.content
@@ -5,11 +5,11 @@ import re
import os
import codecs
-from .Phase1Result import *
+from Phase1Result import *
-from .PreprocessScope import *
+from PreprocessScope import *
-from .Message import *
+from Message import *
cpp_re = re.compile( r'^\s*#\s*(?P<instruction>\w+)(\s+(?P<rest>.*))?$', re.UNICODE)
macro_re = re.compile( r'^\s*[A-Za-z_][A-Za-z0-9_]*\s*$', re.UNICODE)
@@ -228,9 +228,8 @@ class IfScope(ConditionScope):
self.one = None
value = is_number(file, line, rest)
- if value is not None:
- if value == 0: self.zero = True
- elif value > 0: self.one = True
+ if value == 0: self.zero = True
+ elif value > 0: self.one = True
ConditionScope.__init__(self, file, line, parent, root, getIfName(isElif), rest)
@@ -3,13 +3,13 @@
import re
import codecs
-from .Phase1Result import *
-from .PreprocessScopeParser import *
-from .ElemParser import ElemParser
+from Phase1Result import *
+from PreprocessScopeParser import *
+from ElemParser import ElemParser
-from .FixtureParser import FixtureParser
+from FixtureParser import FixtureParser
-from .Message import *
+from Message import *
fixture_re1 = re.compile( \
r'''^\s*FIXTURE\s*\(\s*(?P<fixtureId>[A-Za-z_][A-Za-z0-9_]*)\s*(,\s*(?P<fixtureName>.+))?\s*\)\s*''', \
@@ -2,14 +2,14 @@
import os
import codecs
-from .Message import *
+from Message import *
-from .Phase1Result import *
-from .TestCase import TestCase
-from .Fixture import Fixture
-from .Name import *
-from .Utils import rm_dup
-from .Output import output, output2file, output2null
+from Phase1Result import *
+from TestCase import TestCase
+from Fixture import Fixture
+from Name import *
+
+import Output
################################################
@@ -59,25 +59,12 @@ def get_fixture_id(fixture):
return fixture.get_id()
def get_testcase_tags(testcase, fixture):
- #tags = list(set(testcase.get_tags()) | set(fixture.get_tags()))
- tags = rm_dup(fixture.get_tags() + testcase.get_tags()) # fixture's tags + testcase's tags
+ tags = list(set(testcase.get_tags()) | set(fixture.get_tags()))
result = ",".join(tags)
if result == "":
return "0"
return result
-def get_testcase_memcheck_switch(testcase, fixture):
- testcase_switch = testcase.get_memcheck_switch()
- fixture_switch = fixture.get_memcheck_switch()
-
- if testcase_switch == "on" or testcase_switch == "off" : # testcase first
- return testcase_switch
-
- if fixture_switch == "on" or fixture_switch == "off" :
- return fixture_switch
-
- return "none"
-
################################################
testcase_template = '''
static struct %s
@@ -126,12 +113,6 @@ static struct %s
return tags;
}
- const char* getMemCheckSwitch() const
- {
- static const char* memCheckSwitch = "%s";
- return memCheckSwitch;
- }
-
private:
%s* belongedFixture;
} %s ;
@@ -182,11 +163,10 @@ class TestCaseDefGenerator:
test_invocation, \
len(self.testcase.get_tags() + self.fixture.get_tags()), \
get_testcase_tags(self.testcase, self.fixture), \
- get_testcase_memcheck_switch(self.testcase, self.fixture), \
get_fixture_id(self.fixture), \
get_testcase_instance_name(self.fixture, self.testcase, name, index) \
)
- output(testcase_def, self.file)
+ Output.output(testcase_def, self.file)
#############################################
def __generate_p_tests(self):
@@ -243,7 +223,7 @@ class TestCaseArrayGenerator:
#############################################
def __generate(self, name=None, index=None):
testcase_in_array = '''&%s,''' % (get_testcase_instance_name(self.fixture, self.testcase, name, index))
- output(testcase_in_array, self.file)
+ Output.output(testcase_in_array, self.file)
#############################################
def generate(self):
@@ -322,11 +302,11 @@ class FixtureGenerator:
def generate_testcase_array(self):
begin = testcase_array_template_begin % (get_testcase_array_var(self.fixture))
- output(begin, self.file)
+ Output.output(begin, self.file)
self.generate_testcase_array_content()
- output(array_template_end, self.file)
+ Output.output(array_template_end, self.file)
#############################################
def generate(self):
@@ -361,7 +341,7 @@ class FixtureDescGenerator:
get_testcase_array_var(self.fixture), \
get_testcase_array_var(self.fixture) )
- output(fixture_desc_def, self.file)
+ Output.output(fixture_desc_def, self.file)
if self.recordFixture :
global fixtureDescs
@@ -375,7 +355,7 @@ class FixtureDescArrayGenerator:
self.file = file
def generate(self):
- output("&" + get_fixture_desc_var(self.fixture) + ",", self.file)
+ Output.output("&" + get_fixture_desc_var(self.fixture) + ",", self.file)
################################################
################################################
@@ -391,12 +371,12 @@ class ScopeGenerator:
def generate_begin(self):
inst = self.scope.get_inst()
if inst != "::":
- output("#" + inst, self.file)
+ Output.output("#" + inst, self.file)
#############################################
def generate_end(self):
if self.scope.is_root_scope():
- output("#endif // #" + self.scope.get_inst(), self.file)
+ Output.output("#endif // #" + self.scope.get_inst(), self.file)
#############################################
def generate_scopes(self, scopes):
@@ -482,13 +462,12 @@ extern "C" DLL_EXPORT TESTNGPP_NS::TestSuiteDesc* %s() {
################################################
class SuiteGenerator:
#############################################
- def __init__(self, scopes, file, target, fixture_files, recordFixture = False):
+ def __init__(self, scopes, file, suite, fixture_files, recordFixture = False):
self.scopes = scopes
- self.suite = get_base_name(target)
+ self.suite = suite
self.file = file
self.fixture_files = fixture_files
self.recordFixture = recordFixture
- self.target = target
#############################################
def generate_fixtures(self):
@@ -510,15 +489,15 @@ class SuiteGenerator:
global fixtureDescs
if not self.recordFixture :
for fixtureDesc in fixtureDescs :
- output("extern TESTNGPP_NS::TestFixtureDesc "+fixtureDesc+";", self.file)
+ Output.output("extern TESTNGPP_NS::TestFixtureDesc "+fixtureDesc+";", self.file)
fixture_array_def = fixture_array_template_begin % (get_fixture_array_name(self.suite))
- output(fixture_array_def, self.file)
+ Output.output(fixture_array_def, self.file)
self.generate_fixture_desc_array()
if not self.recordFixture :
# output recorded fixture descs
for fixtureDesc in fixtureDescs :
- output("&"+fixtureDesc+",", self.file)
- output(array_template_end, self.file)
+ Output.output("&"+fixtureDesc+",", self.file)
+ Output.output(array_template_end, self.file)
#############################################
def generate_suite_desc(self):
@@ -529,25 +508,25 @@ class SuiteGenerator:
get_fixture_array_name(self.suite), \
get_fixture_array_name(self.suite) )
- output(suite_def, self.file)
+ Output.output(suite_def, self.file)
#############################################
def generate_suite_getter(self):
suite_getter = suite_getter_template % ( get_suite_getter_name(), get_suite_desc_name(self.suite))
- output(suite_getter, self.file)
+ Output.output(suite_getter, self.file)
#############################################
def generate_dep_headers(self):
for header in dep_headers:
- output("#include <testngpp/" + header + ">", self.file)
+ Output.output("#include <testngpp/" + header + ">", self.file)
#############################################
def generate_headers(self):
self.generate_dep_headers()
for header in self.fixture_files:
- output("#include \"" + os.path.relpath(header, os.path.dirname(os.path.abspath(self.target))) + "\"", self.file)
+ Output.output("#include <" + header + ">", self.file)
#############################################
def generate(self):
@@ -570,18 +549,18 @@ def phase4(fixture_files, target, scopes, encoding, recordFixture = False):
file = None
- if output == output2file :
+ if Output.output == Output.output2file :
try:
#file = open(target, "w")
file = codecs.open(target, mode="w", encoding=encoding)
except IOError:
- print("open", target, "failed", file=sys.stderr)
+ print >> sys.stderr, "open", target, "failed"
sys.exit(1)
global output_encoding
output_encoding = encoding
- SuiteGenerator(scopes, file, target, fixture_files, recordFixture).generate()
+ SuiteGenerator(scopes, file, get_base_name(target), fixture_files, recordFixture).generate()
if file != None :
file.close()
@@ -26,7 +26,7 @@ class PreprocessScope:
##################################
def show(self):
- print("#" + self.inst, self.expr)
+ print "#" + self.inst, self.expr
for line in self.lines:
line.show()
@@ -1,8 +1,8 @@
#!/usr/bin/python
-from .Phase1Result import *
+from Phase1Result import *
-from .TestScope import TestScope
+from TestScope import TestScope
##########################################################
class PreprocessScopeParser:
@@ -5,11 +5,11 @@ import re
import os
import codecs
-from .Phase0 import phase0
-from .Phase1 import phase1
-from .Phase2 import phase2
-from .Phase3 import phase3
-from .Phase4 import phase4
+from Phase0 import phase0
+from Phase1 import phase1
+from Phase2 import phase2
+from Phase3 import phase3
+from Phase4 import phase4
##########################################################
def trimCrlf(line):
@@ -40,7 +40,7 @@ def processTestFixtureFile(file, encoding):
def checkFixtureExistence(fixtureFiles):
for fixtureFile in fixtureFiles:
if not os.path.exists(fixtureFile):
- print(fixtureFile, "does not exist", file=sys.stderr)
+ print >> sys.stderr, fixtureFile, "does not exist"
sys.exit(1)
@@ -1,8 +1,8 @@
import re
-from .Message import *
-from .AnnotationParser import AnnotationParser
+from Message import *
+from AnnotationParser import AnnotationParser
tags_re1 = re.compile( r'^\"(?P<tags>[A-Za-z0-9_\s]*)\"$', re.UNICODE)
tags_re2 = re.compile( r'^(?P<tags>[A-Za-z0-9_\s]*)$', re.UNICODE)
@@ -1,10 +1,10 @@
import re
-from .Message import *
-from .AnnotationParser import AnnotationParser
-from .TagsParser import TagsParser
-from .Name import *
+from Message import *
+from AnnotationParser import AnnotationParser
+from TagsParser import TagsParser
+from Name import *
##########################################
class TestCase:
@@ -14,15 +14,15 @@ class TestCase:
self.name = name[1]
self.p_test = name[2]
if self.name != None:
- self.name = escape_name("".join(filter(lambda x : x != "\"", self.name)))
+ self.name = escape_name(self.name)
self.scope = scope
self.file = file
self.line = line
annotation = None
if len(annotations) > 0:
annotation = annotations[0]
-
- self.annotations = AnnotationParser(annotation, {"id":None, "depends":None, "memcheck":None, "data":None, "tags":[]}).parse()
+
+ self.annotations = AnnotationParser(annotation, {"id":None, "depends":None, "data":None, "tags":[]}).parse()
if self.p_test and self.annotations["data"] == None:
raw_fatal(file, line, "parameterized test should have data provider")
@@ -42,11 +42,7 @@ class TestCase:
########################################
def get_tags(self):
return self.annotations['tags']
-
- ########################################
- def get_memcheck_switch(self):
- return self.annotations['memcheck']
-
+
########################################
def set_scope(self, scope):
self.scope = scope
@@ -93,7 +89,7 @@ class TestCase:
########################################
def show(self):
content = "TEST(" + self.get_name() + ")"
- print(content.encode('utf-8'))
+ print content.encode('utf-8')
########################################
def get_name(self):
@@ -1,10 +1,10 @@
#!/usr/bin/python
-from .Phase1Result import *
-from .TestCase import *
-from .PreprocessScope import *
+from Phase1Result import *
+from TestCase import *
+from PreprocessScope import *
-from .Message import *
+from Message import *
##########################################################
class TestCaseParser:
@@ -1,8 +1,8 @@
import sys
-from .TestCase import TestCase
-from .DataProvider import DataProvider
+from TestCase import TestCase
+from DataProvider import DataProvider
############################################
class TestScope:
@@ -36,7 +36,7 @@ class TestScope:
#########################################
def show(self):
- print("#" + self.inst, self.expr)
+ print "#" + self.inst, self.expr
for elem in self.elements:
elem.show()
@@ -1,4 +1,3 @@
-INCLUDE(${PROJECT_SOURCE_DIR}/../../../tools/testngpp.cmake)
IF(MSVC)
ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
@@ -11,8 +10,8 @@ SET(TESTNGPP_SRCS
TestSuiteDesc.cpp
TypeString.cpp
Formatter.cpp
- MemChecker.cpp
TestCase.cpp
+ runner/ResourceCheckPoint.cpp
mem_checker/bool_array.cpp
mem_checker/mem_pool_base.cpp
mem_checker/debug_new.cpp
@@ -23,28 +22,22 @@ SET(TESTNGPP_SRCS
mem_checker/NoThrowsReporter.cpp
)
-IF (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- # using regular Clang or AppleClang
- SET(TESTNGPP_SRCS ${TESTNGPP_SRCS} runner/ResourceCheckPoint.cpp)
-ENDIF()
-
# include debug info in testngpp.lib
-#IF(MSVC)
-# ADD_DEFINITIONS( /Z7 )
-#ENDIF(MSVC)
+IF(MSVC)
+ ADD_DEFINITIONS( /Z7 )
+ENDIF(MSVC)
IF(WIN32)
- ADD_LIBRARY(testngpp-static STATIC ${TESTNGPP_SRCS})
+ ADD_LIBRARY(testngpp STATIC ${TESTNGPP_SRCS})
ELSE(WIN32)
ADD_LIBRARY(testngpp SHARED ${TESTNGPP_SRCS})
- ADD_LIBRARY(testngpp-static STATIC ${TESTNGPP_SRCS})
ENDIF(WIN32)
-IF(UNIX OR MINGW)
+IF(UNIX)
ADD_DEFINITIONS(
-g -ggdb
)
-ENDIF(UNIX OR MINGW)
+ENDIF(UNIX)
IF(UNIX AND NOT CYGWIN)
ADD_DEFINITIONS(
@@ -65,10 +58,14 @@ ENDIF(MSVC)
IF(WIN32)
INSTALL(
- TARGETS testngpp-static
- ARCHIVE DESTINATION binary/${TESTNGPP_OS_COMPILER}/testngpp/lib)
+ TARGETS testngpp
+ ARCHIVE DESTINATION lib)
ELSE(WIN32)
INSTALL(
- TARGETS testngpp-static
- ARCHIVE DESTINATION binary/${TESTNGPP_OS_COMPILER}/testngpp/lib)
+ TARGETS testngpp
+ LIBRARY DESTINATION lib)
ENDIF(WIN32)
+
+
+
+
@@ -33,7 +33,7 @@ std::string toPointerString(void* p)
ss << "0x";
ss.flags (std::ios::hex);
ss.fill('0'); ss.width(8);
- ss << reinterpret_cast<unsigned long long>(p);
+ ss << reinterpret_cast<unsigned long>(p);
return ss.str();
}
@@ -43,18 +43,18 @@ struct FailureReporter : public Reporter
}
-// void TestCase::startMemChecker()
-// {
-// typedef void (*start_t)(mem_checker::Reporter *, mem_checker::Reporter *);
-// start_t starter = (start_t)loader->findSymbol("startMemChecker");
-
-// if (fixtureCloneAsReporter == 0)
-// {
-// fixtureCloneAsReporter = getFixture()->clone();
-// }
-// starter( mem_checker::createReporter(InfoReporter(fixtureCloneAsReporter))
-// , mem_checker::createReporter(FailureReporter(fixtureCloneAsReporter))); // TODO: Reporter is new in runner.exe, and used in .dll. is this ok?
-// }
+void TestCase::startMemChecker()
+{
+ typedef void (*start_t)(mem_checker::Reporter *, mem_checker::Reporter *);
+ start_t starter = (start_t)loader->findSymbol("startMemChecker");
+
+ if (fixtureCloneAsReporter == 0)
+ {
+ fixtureCloneAsReporter = getFixture()->clone();
+ }
+ starter( mem_checker::createReporter(InfoReporter(fixtureCloneAsReporter))
+ , mem_checker::createReporter(FailureReporter(fixtureCloneAsReporter))); // TODO: Reporter is new in runner.exe, and used in .dll. is this ok?
+}
//void TestCase::verifyMemChecker()
//{
@@ -3,7 +3,6 @@
#include <testngpp/internal/TestCaseInfoReader.h>
#include <testngpp/internal/Warning.h>
#include <testngpp/internal/Info.h>
-#include <testngpp/internal/MemChecker.h>
#include <testngpp/listener/TestCaseResultCollector.h>
@@ -44,53 +43,19 @@ reportFailure(const char* file, unsigned int line, const std::string& what, bool
}
//////////////////////////////////////////////////////////////////////////
void TestFixture::
-reportMemLeakInfo
- ( const char* file
- , unsigned int line
- , const std::string& info)
-{
- if(memLeakCollector == 0 || testcase == 0) return;
- memLeakCollector->addCaseInfo(testcase, Info(file, line, info));
-}
-
-void TestFixture::
-reportMemLeakFailure(const char* file, unsigned int line, const std::string& what, bool throwException)
-{
- if(memLeakCollector == 0 || testcase == 0) return;
-
- AssertionFailure failure(file, line, what);
-
- memLeakCollector->addCaseFailure(testcase, failure);
-
- if(throwException) throw failure;
-}
-
-
-
-//////////////////////////////////////////////////////////////////////////
-void TestFixture::
-setCurrentTestCase( const TestCaseInfoReader* currentCase
- , TestCaseResultCollector* resultCollector
- , TestCaseResultCollector* memLeakCollector
- , MemChecker* memChecker)
+setCurrentTestCase(const TestCaseInfoReader* currentCase, TestCaseResultCollector* resultCollector)
{
- this->testcase = currentCase;
- this->collector = resultCollector;
- this->memLeakCollector = memLeakCollector;
- this->memChecker = memChecker;
+ testcase = currentCase;
+ collector = resultCollector;
}
//////////////////////////////////////////////////////////////////////////
-void TestFixture::
-startMemChecker()
-{
- memChecker->start();
-}
-
-void TestFixture::
-verifyMemChecker()
+TestFixture *TestFixture::
+clone()
{
- memChecker->verify();
+ TestFixture *tempFixture = new TestFixture;
+ tempFixture->setCurrentTestCase(testcase, collector);
+ return tempFixture;
}
@@ -14,12 +14,6 @@ ADD_DEFINITIONS(
)
ENDIF(UNIX AND NOT CYGWIN)
-IF(UNIX OR MINGW)
-ADD_DEFINITIONS(
- -g -ggdb
-)
-ENDIF(UNIX OR MINGW)
-
ADD_LIBRARY(testngpp-except STATIC ${TESTNGPP_SRCS})
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/include)
@@ -1,4 +1,3 @@
-INCLUDE(${PROJECT_SOURCE_DIR}/../../../tools/testngpp.cmake)
ADD_DEFINITIONS(
-DPACKAGE_NAME=${PACKAGE_NAME}
@@ -26,17 +25,11 @@ SET(XMLLISTENER_SRCS
XMLBuilder.cpp
)
-IF(UNIX AND NOT CYGWIN)
-ADD_DEFINITIONS(
- -fPIC
-)
-ENDIF(UNIX AND NOT CYGWIN)
-
-IF(UNIX OR MINGW)
+IF(UNIX)
ADD_DEFINITIONS(
-g -ggdb
)
-ENDIF(UNIX OR MINGW)
+ENDIF(UNIX)
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/src/utils ${CMAKE_BINARY_DIR}/src/mem_checker)
@@ -48,23 +41,17 @@ TARGET_LINK_LIBRARIES(testngppxmllistener-fortest ${TESTNGPP_LIBRARY})
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/include .)
-IF(NOT MSVC AND NOT MINGW)
+IF(NOT MSVC)
SET_TARGET_PROPERTIES(
testngppstdoutlistener
testngppxmllistener
PROPERTIES SUFFIX ".so")
-ENDIF(NOT MSVC AND NOT MINGW)
+ENDIF(NOT MSVC)
TARGET_LINK_LIBRARIES(testngppstdoutlistener ${TESTNGPP_LIBRARY})
TARGET_LINK_LIBRARIES(testngppxmllistener ${TESTNGPP_LIBRARY})
INSTALL(
TARGETS testngppstdoutlistener testngppxmllistener
- LIBRARY DESTINATION binary/${TESTNGPP_OS_COMPILER}/testngpp/listener)
-
-IF(MSVC)
- INSTALL(
- FILES ${CMAKE_BINARY_DIR}/src/listeners/Debug/testngppstdoutlistener.pdb ${CMAKE_BINARY_DIR}/src/listeners/Debug/testngppxmllistener.pdb
- DESTINATION binary/${TESTNGPP_OS_COMPILER}/testngpp/listener)
-ENDIF(MSVC)
+ LIBRARY DESTINATION testngpp/listener)
@@ -25,12 +25,6 @@ ADD_DEFINITIONS(
)
ENDIF(UNIX AND NOT CYGWIN)
-IF(UNIX OR MINGW)
-ADD_DEFINITIONS(
- -g -ggdb
-)
-ENDIF(UNIX OR MINGW)
-
ADD_LIBRARY(mem-checker STATIC ${TESTNGPP_SRCS})
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/3rdparty)
@@ -31,7 +31,7 @@ unsigned int nullCheckStatus()
void initCheckStatus()
{
- srand( (unsigned int)time(NULL) ); // use random number to avoid report the mem leaks of previous testcase.
+ srand( time(NULL) ); // use random number to avoid report the mem leaks of previous testcase.
unsigned int temp = rand();
check_status = (temp == 0) ? 1 : temp;
}
@@ -314,7 +314,7 @@ const char * get_file_name(const char * file, unsigned int line)
}
const char * p = strrchr(file, '\\');
const char * q = strrchr(file, '/');
- unsigned long max_ptr = ((unsigned long long)p) > ((unsigned long long)q) ? (unsigned long long)p : (unsigned long long)q;
+ unsigned long max_ptr = ((unsigned long)p) > ((unsigned long)q) ? (unsigned long)p : (unsigned long)q;
if (max_ptr > 0)
{
@@ -827,9 +827,7 @@ int check_mem_corruption()
corrupt_cnt);
return corrupt_cnt;
}
-#if defined(__MINGW32__) // TODO: temporay close memchecker for MinGW, or else it throws exception on delete.
-#define NOT_USE_MEM_CHECKER
-#endif
+//#define NOT_USE_MEM_CHECKER
#ifndef NOT_USE_MEM_CHECKER
void __debug_new_recorder::_M_process(void* pointer)
{
@@ -22,8 +22,6 @@ extern int check_leaks();
static bool report_to_xunit = true; // user can stop/open mem checker reporter to xunit
-
-// when stoped mem checker, it will report nothing to xunit, but it outputs to stderr.
extern "C" void stopMemChecker()
{
pauseCheckStatus(); // the following new/malloc info will not be checked in check_leaks
@@ -1,4 +1,3 @@
-INCLUDE(${PROJECT_SOURCE_DIR}/../../../tools/testngpp.cmake)
IF(MSVC)
ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS )
@@ -33,11 +32,7 @@ ADD_DEFINITIONS(
-DVERSION=${VERSION}
)
-IF (MSVC)
-SET(TESTNGPP_LIBRARY testngpp-static testngpp-utils)
-ELSE (MSVC)
-SET(TESTNGPP_LIBRARY testngpp-static testngpp-utils)
-ENDIF(MSVC)
+SET(TESTNGPP_LIBRARY testngpp testngpp-utils)
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/include)
ADD_DEFINITIONS(-D__STDC_FORMAT_MACROS)
@@ -119,45 +114,30 @@ SET(TESTNGRUNNER_LIB_SRCS
TestRunner.cpp
)
-IF (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- # using regular Clang or AppleClang
- SET(TESTNGPP_DISABLE_RC TRUE)
-ENDIF()
-
IF(NOT TESTNGPP_DISABLE_RC)
- SET(TESTNGRUNNER_LIB_SRCS ${TESTNGRUNNER_LIB_SRCS} ${RC_SRCS})
+ SET(TESTNGRUNNER_LIB_SRCS ${TESTNGRUNNER_LIB_SRCS} ${RC_SRCS})
ENDIF(NOT TESTNGPP_DISABLE_RC)
IF(NOT TESTNGPP_DISABLE_SANDBOX)
- IF(MSVC OR MINGW)
+ IF(MSVC)
SET(TESTNGRUNNER_LIB_SRCS
${TESTNGRUNNER_LIB_SRCS}
${WIN32_SANDBOX_SRCS}
)
- ELSE(MSVC OR MINGW)
+ ELSE(MSVC)
SET(TESTNGRUNNER_LIB_SRCS
${TESTNGRUNNER_LIB_SRCS}
${SANDBOX_SRCS}
)
- ENDIF(MSVC OR MINGW)
+ ENDIF(MSVC)
ENDIF(NOT TESTNGPP_DISABLE_SANDBOX)
-IF(MSVC OR MINGW)
+IF(MSVC)
SET(TESTNGRUNNER_LIB_SRCS
${TESTNGRUNNER_LIB_SRCS}
filters/Win32Fnmatch.c
)
-ENDIF(MSVC OR MINGW)
-
-IF(CYGWIN)
-SET(TESTNGRUNNER_LIB_SRCS
- ${TESTNGRUNNER_LIB_SRCS}
- ../TestSuiteDesc.cpp
- ../TestFixture.cpp
- ../MemChecker.cpp
- )
-INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/3rdparty)
-ENDIF(CYGWIN)
+ENDIF(MSVC)
IF(TESTNGPP_USE_DLOPEN)
SET(TESTNGRUNNER_LIB_SRCS ${TESTNGRUNNER_LIB_SRCS}
@@ -178,37 +158,25 @@ ELSE(TESTNGPP_USE_DLOPEN)
MESSAGE(FATAL_ERROR "No module loader found")
ENDIF(TESTNGPP_USE_DLOPEN)
-IF(UNIX AND NOT CYGWIN)
-ADD_DEFINITIONS(
- -fPIC
-)
-ENDIF(UNIX AND NOT CYGWIN)
-
-IF(UNIX OR MINGW)
+IF(UNIX)
ADD_DEFINITIONS(
-g -ggdb
)
-ENDIF(UNIX OR MINGW)
+ENDIF(UNIX)
ADD_LIBRARY(testngpp-runner-lib STATIC ${TESTNGRUNNER_LIB_SRCS})
TARGET_LINK_LIBRARIES(testngpp-runner-lib ${TESTNGPP_LIBRARY})
-IF(UNIX)
-ADD_EXECUTABLE(testngpp-runner TestRunnerMain.cpp ../MemChecker.cpp ../TestFixture.cpp)
-ENDIF(UNIX)
-
-IF(NOT UNIX)
ADD_EXECUTABLE(testngpp-runner TestRunnerMain.cpp)
-ENDIF(NOT UNIX)
-IF(MSVC OR MINGW)
+IF(MSVC)
ADD_EXECUTABLE(testngpp-win32-testcase-runner win32/TestCaseSandboxRunnerMain.cpp)
TARGET_LINK_LIBRARIES(testngpp-win32-testcase-runner ${TESTNGPP_LIBRARY} testngpp-runner-lib)
INSTALL(TARGETS testngpp-win32-testcase-runner
- RUNTIME DESTINATION binary/${TESTNGPP_OS_COMPILER}/testngpp/bin)
-ENDIF(MSVC OR MINGW)
+ RUNTIME DESTINATION bin)
+ENDIF(MSVC)
# -Wl,--export-dynamic
ADD_DEPENDENCIES(testngpp-runner testngpp-runner-lib)
@@ -225,10 +193,5 @@ ENDIF(TESTNGPP_USE_DLOPEN)
INSTALL(
TARGETS testngpp-runner
- RUNTIME DESTINATION binary/${TESTNGPP_OS_COMPILER}/testngpp/bin)
+ RUNTIME DESTINATION bin)
-IF(MSVC)
- INSTALL(
- FILES ${CMAKE_BINARY_DIR}/src/runner/Debug/testngpp-runner.pdb ${CMAKE_BINARY_DIR}/src/runner/Debug/testngpp-win32-testcase-runner.pdb
- DESTINATION binary/${TESTNGPP_OS_COMPILER}/testngpp/bin)
-ENDIF(MSVC)
@@ -52,7 +52,7 @@ namespace
unsigned int getNumberOfOpenFiles()
{
-#if defined(_MSC_VER) || defined(__MINGW32__)
+#if defined(_MSC_VER)
return 0;
#else
unsigned int maxNumberOfOpenFiles = ::getdtablesize();
@@ -161,7 +161,7 @@ static void freeMemory(void* p)
if(header->magic != magicNumber)
{
char buf[100];
- snprintf(buf, sizeof(buf), "memory corruption occurred at %#" PRIxPTR, (uintptr_t) p);
+ snprintf(buf, sizeof(buf), "memory corruption occurred at %#"PRIxPTR, (uintptr_t) p);
throw Error(buf);
}
@@ -9,8 +9,6 @@
#include <testngpp/runner/ResourceCheckPoint.h>
#include <testngpp/comm/ExceptionKeywords.h>
-#include <testngpp/internal/MemChecker.h>
-
USING_TESTNGPP_NS
////////////////////////////////////////////////////////////
@@ -33,8 +31,6 @@ void usage(const char * program)
<< std::endl
<< " -s using sandbox runner"
<< std::endl
- << " -m not checking memory leakage"
- << std::endl
<< std::endl;
exit(1);
}
@@ -151,20 +147,13 @@ bool useSandbox(OptionList& options)
return getFlagOption("s", options);
}
-////////////////////////////////////////////////////////////
-static
-bool useMemChecker(OptionList& options)
-{
- return !getFlagOption("m", options);
-}
-
////////////////////////////////////////////////////////////
int real_main(int argc, char* argv[])
{
OptionList options;
- options.parse(argc, argv, "f:L:l:c:t:s:m");
+ options.parse(argc, argv, "f:L:l:c:t:s");
if(options.args.size() == 0)
{
@@ -180,9 +169,7 @@ int real_main(int argc, char* argv[])
getSearchingPathsOfListeners(searchingPathsOfListeners, options);
StringList fixtures;
- getSpecifiedFixtures(fixtures, options);
-
- MemChecker::setGlobalOpen(useMemChecker(options));
+ getSpecifiedFixtures(fixtures, options);
bool usesSandbox = useSandbox(options);
@@ -200,18 +187,14 @@ int real_main(int argc, char* argv[])
int main(int argc, char* argv[])
{
- #ifndef __clang__
TESTNGPP_RCP rcp = TESTNGPP_SET_RESOURCE_CHECK_POINT();
- #endif
int code = 0;
try
{
code = real_main(argc, argv);
- #ifndef __clang__
TESTNGPP_VERIFY_RESOURCE_CHECK_POINT(rcp);
- #endif
}
catch(std::exception& error)
{
@@ -224,4 +207,3 @@ int main(int argc, char* argv[])
return code;
}
-
@@ -2,10 +2,10 @@
#include <iostream>
-#if defined(_MSC_VER) || defined(__MINGW32__)
-#include "Win32Fnmatch.h"
-#else
+#ifndef _MSC_VER
#include <fnmatch.h>
+#else
+#include "Win32Fnmatch.h"
#endif
#include <testngpp/runner/PosixFNMatcher.h>
@@ -1,11 +1,12 @@
-#include <string>
#include <ltdl.h>
-#include <testngpp/internal/Error.h>
+#include <testngpp/Error.h>
#include <testngpp/comm/ExceptionKeywords.h>
-#include <testngpp/runner/loaders/LTModuleLoader.h>
+#include <testngpp/runner/LTModuleLoader.h>
+
+
TESTNGPP_NS_START
@@ -17,10 +18,12 @@ struct LTModuleLoaderImpl
void init();
- const char* addSearchingPaths(const StringList& searchingPaths);
+ const char* addSearchingPaths(
+ const std::list<std::string>& searchingPaths);
+
void load(const std::string& modulePath);
- void loadInSearchingPaths( \
- const StringList& searchingPaths, \
+ void loadUnderPaths( \
+ const std::list<std::string>& searchingPaths, \
const std::string& modulePath);
void unload();
@@ -71,14 +74,12 @@ LTModuleLoaderImpl::init()
/////////////////////////////////////////////////////////////////
const char*
LTModuleLoaderImpl::
-addSearchingPaths(const StringList& searchingPaths)
+addSearchingPaths(const std::list<std::string>& searchingPaths)
{
const char* origSearchingPath = ::lt_dlgetsearchpath();
const char* p = origSearchingPath;
-
- StringList::Type::const_iterator i = \
- searchingPaths.get().begin();
- for(; i != searchingPaths.get().end(); i++)
+ std::list<std::string>::const_iterator i = searchingPaths.begin();
+ for(; i != searchingPaths.end(); i++)
{
::lt_dlinsertsearchdir(p, (*i).c_str());
p = ::lt_dlgetsearchpath();
@@ -100,8 +101,8 @@ LTModuleLoaderImpl::load(const std::string& modulePath)
////////////////////////////////////////////////////////
void
-LTModuleLoaderImpl::loadInSearchingPaths( \
- const StringList& searchingPaths, \
+LTModuleLoaderImpl::loadUnderPaths( \
+ const std::list<std::string>& searchingPaths, \
const std::string& modulePath)
{
const char* originalSearchingPath = \
@@ -160,10 +161,20 @@ LTModuleLoader::~LTModuleLoader()
////////////////////////////////////////////////////////
void
-LTModuleLoader::load( const StringList& searchingPaths, const std::string& modulePath)
+LTModuleLoader::load(const std::string& modulePath)
+{
+ This->init();
+ This->load(modulePath);
+}
+
+////////////////////////////////////////////////////////
+void
+LTModuleLoader::loadUnderPaths( \
+ const std::list<std::string>& searchingPaths, \
+ const std::string& modulePath)
{
This->init();
- This->loadInSearchingPaths(searchingPaths, modulePath);
+ This->loadUnderPaths(searchingPaths, modulePath);
}
////////////////////////////////////////////////////////
@@ -1,8 +1,8 @@
-#include <testngpp/runner/loaders/ModuleLoader.h>
-#include <testngpp/runner/loaders/ModuleLoaderFactory.h>
+#include <testngpp/runner/ModuleLoader.h>
+#include <testngpp/runner/ModuleLoaderFactory.h>
-#include <testngpp/runner/loaders/LTModuleLoader.h>
+#include <testngpp/runner/LTModuleLoader.h>
TESTNGPP_NS_START
@@ -11,10 +11,8 @@
#include <testngpp/internal/TestCase.h>
#include <testngpp/internal/TestFixtureDesc.h>
-#include <testngpp/internal/MemChecker.h>
#include <testngpp/listener/TestCaseResultCollector.h>
-#include <testngpp/listener/MemLeakCountCollector.h>
#include <testngpp/runner/SimpleTestCaseRunner.h>
#include <testngpp/runner/SmartTestCaseResultCollector.h>
@@ -199,16 +197,8 @@ bool SimpleTestCaseRunner::run
TestCaseResultCollector* smartCollector =
new SmartTestCaseResultCollector(collector, reportSuccess);
- TestCaseResultCollector* memLeakCountCollector =
- new MemLeakCountCollector();
-
- TestCaseResultCollector* emptyCollector =
- new EmptyCollector();
-
- MemChecker* memChecker = new MemChecker(testcase);
-
testcase->setFixture();
- testcase->getFixture()->setCurrentTestCase(testcase, smartCollector, memLeakCountCollector, memChecker);
+ testcase->getFixture()->setCurrentTestCase(testcase, smartCollector);
smartCollector->startTestCase(testcase);
@@ -219,24 +209,13 @@ bool SimpleTestCaseRunner::run
timer.start();
success = doRun(testcase, smartCollector);
- if ((dynamic_cast<MemLeakCountCollector*>(memLeakCountCollector))->getMemLeakCount() > 0)
- {
- testcase->getFixture()->setCurrentTestCase(testcase, emptyCollector, smartCollector, memChecker);
-
- timer.start();
- success = doRun(testcase, smartCollector);
- }
-
__TESTNGPP_CLEANUP
- testcase->getFixture()->verifyMemChecker(); // avoid affecting the following testcase. maybe some testcase's teardown not run.
+ testcase->verifyMemChecker(); // avoid affecting the following testcase.
timeval e = timer.stop();
smartCollector->endTestCase(testcase, e.tv_sec, e.tv_usec);
delete smartCollector;
- delete memLeakCountCollector;
- delete emptyCollector;
- delete memChecker;
- delete testcase->getFixture();
+ //delete testcase->getFixture(); // when test case run finish, there is a delete in tearDown, this is duplicate.
__TESTNGPP_DONE
@@ -5,7 +5,7 @@
#include <testngpp/runner/TestFixtureRunnerFactory.h>
#if !defined(TESTNGPP_DISABLE_SANDBOX) || !TESTNGPP_DISABLE_SANDBOX
-#if defined(_MSC_VER) || defined(__MINGW32__)
+#if defined(_MSC_VER)
#include <testngpp/win32/Win32TestHierarchySandboxRunner.h>
#else
#include <testngpp/runner/TestHierarchySandboxRunner.h>
@@ -27,7 +27,7 @@ namespace
}
return new TestFixtureRunner(
-#if defined(_MSC_VER) || defined(__MINGW32__)
+#if defined(_MSC_VER)
new Win32TestHierarchySandboxRunner(
#else
new TestHierarchySandboxRunner(
@@ -1,12 +1,6 @@
#include <vector>
-#ifdef _MSC_VER
-#include <direct.h>
-#else
-#include <unistd.h>
-#endif
-
#include <testngpp/comm/ExceptionKeywords.h>
#include <testngpp/utils/InternalError.h>
@@ -27,7 +21,6 @@
TESTNGPP_NS_START
-
/////////////////////////////////////////////////////////////////
namespace
{
@@ -147,22 +140,12 @@ unloadFixtures()
fixtures.clear();
}
-/////////////////////////////////////////////////////////////////
-std::string current_working_directory()
-{
- char* cwd = getcwd( 0, 0 );
- std::string working_directory(cwd);
- std::free(cwd);
- return working_directory;
-}
-
/////////////////////////////////////////////////////////////////
void
TestSuiteContextImpl::
load( const std::string& path )
{
- StringList searchingPaths;
- searchingPaths.add(current_working_directory());
+ const StringList searchingPaths;
__TESTNGPP_TRY
{
@@ -1,5 +1,5 @@
-#if defined(_MSC_VER) || defined(__MINGW32__)
+#if defined(_MSC_VER)
#include <windows.h>
#include <testngpp/internal/Error.h>
@@ -184,8 +184,8 @@ namespace
<< " " << suite
<< " \"" << escape(fixture)
<< "\" \"" << escape(testcase)
- << "\" " << (unsigned long long)hWrite
- << " " << (unsigned long long)hSemphore;
+ << "\" " << (DWORD)hWrite
+ << " " << (DWORD)hSemphore;
STARTUPINFO startInfo;
GetStartupInfo(&startInfo);
@@ -44,7 +44,7 @@ struct Win32TestCaseSandboxImpl
void tryToDecodeOnDead() TESTNGPP_THROW(Error);
- void handleDeadSandbox() TESTNGPP_THROW(Error);
+ void handleDeadSandbox();
void die()
{
@@ -16,12 +16,6 @@ ADD_DEFINITIONS(
)
ENDIF(UNIX AND NOT CYGWIN)
-IF(MINGW)
-ADD_DEFINITIONS(
- -g -ggdb
-)
-ENDIF(MINGW)
-
IF(MSVC)
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src
@@ -200,7 +200,7 @@ ChainableMockMethodContainer::addMethod(ChainableMockMethodKey* key, \
{
if(getMethod(key) != 0)
{
- MOCKCPP_REPORT_FAILURE("internal error (1022), please report this bug to" PACKAGE_BUGREPORT ".");
+ MOCKCPP_REPORT_FAILURE("internal error (1022), please report this bug to dev.mockcpp@gmail.com.");
}
This->addMethod(key, method);
@@ -69,8 +69,7 @@ VirtualTableImpl::validateVptr(void** pVptr)
{
if(pVptr != fakeObject->vptr)
{
- MOCKCPP_REPORT_FAILURE( PACKAGE " internal error(1018). please report this bug to "
- PACKAGE_BUGREPORT ".");
+ MOCKCPP_REPORT_FAILURE( "mockcpp internal error(1018). please report this bug to dev.mockcpp@gmail.com.");
}
}
/////////////////////////////////////////////////////////////////
@@ -86,9 +85,9 @@ VirtualTableImpl::validateNumberOfVptr()
<< numberOfVptr
<< "), or it's not a pure virtual class. "
<< "Here are some hints for you: \n"
- << "1. " PACKAGE " only supports mocking pure virtual class; \n"
+ << "1. mockcpp only supports mocking pure virtual class; \n"
<< "2. you can change the MOCKCPP_MAX_INHERITANCE setting to "
- "maximun 7, then rebuild " PACKAGE "; \n"
+ "maximun 7, then rebuild mockcpp; \n"
<< "3. you can refine your design to make it simpler.";
MOCKCPP_REPORT_FAILURE(oss.str());
@@ -120,7 +119,7 @@ VirtualTableImpl::validateIndexOfVptr(unsigned int index)
{
if(index >= numberOfVptr)
{
- MOCKCPP_REPORT_FAILURE(PACKAGE " internal error. please report it to " PACKAGE_BUGREPORT ".");
+ MOCKCPP_REPORT_FAILURE("mockcpp internal error. please report it to dev.mockcpp@gmail.com.");
}
}
@@ -2,6 +2,6 @@
#ifndef __TESTNGPPST_INTERNAL_ERROR_H
#define __TESTNGPPST_INTERNAL_ERROR_H
-#define TESTNGPPST_INTERNAL_ERROR(code) "testngppst internal error(" #code "), please report bug to " PACKAGE_BUGREPORT
+#define TESTNGPPST_INTERNAL_ERROR(code) "testngppst internal error(" #code "), please report bug to dev.mockcpp@gmail.com"
#endif
@@ -1,5 +1,5 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 3.12...3.19)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(mockcpp-tests)
@@ -1,11 +1,11 @@
-find_package (Python3 COMPONENTS Interpreter)
+INCLUDE(FindPythonInterp)
-IF(Python3_FOUND)
- SET(PYTHON ${Python3_EXECUTABLE})
-ELSE()
- MESSAGE(FATAL_ERROR "No Python interpreter found")
-ENDIF(Python3_FOUND)
+IF(PYTHONINTERP_FOUND)
+ SET(PYTHON ${PYTHON_EXECUTABLE})
+ELSE(PYTHONINTERP_FOUND)
+ MESSAGE(FATAL_ERROR "No Python interpreter found")
+ENDIF(PYTHONINTERP_FOUND)
ADD_DEFINITIONS(
-DPACKAGE_NAME=${PACKAGE_NAME}
@@ -46,8 +46,6 @@ SET(UT_CASES
#TestNonvirtualMethodMocker.h
TestMockcppSample.h
TestApiHookBase.h
- TestSmartPointerChecker.h
- MockMethodSamples.h
)
IF(UNIX)
@@ -69,15 +67,11 @@ IF(CMAKE_CL_64)
ADD_DEFINITIONS(-DWIN64)
ENDIF(CMAKE_CL_64)
-IF(MSVC)
-LINK_DIRECTORIES(
- ${CMAKE_CURRENT_BINARY_DIR}/../../mockcpp/src/Debug
- ${CMAKE_CURRENT_BINARY_DIR}/../../mockcpp_testngpp/src/Debug)
-ELSE(MSVC)
LINK_DIRECTORIES(
- ${CMAKE_CURRENT_BINARY_DIR}/../../mockcpp/src
- ${CMAKE_CURRENT_BINARY_DIR}/../../mockcpp_testngpp/src)
-ENDIF(MSVC)
+ ${PROJECT_HOME}/../../build_mockcpp/src/Debug
+ ${PROJECT_HOME}/../../build_testngpp/src/Debug
+ ${PROJECT_HOME}/../../build_mockcpp/src
+ ${PROJECT_HOME}/../../build_testngpp/src)
INCLUDE_DIRECTORIES(BEFORE
.
@@ -92,17 +86,13 @@ SET(TESTCASE_PREFIX mockcpp-ut)
IF(MSVC)
ADD_DEFINITIONS(-DMSVC_VMG_ENABLED)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /vmg")
- ADD_DEFINITIONS(
- /source-charset:utf-8 /execution-charset:utf-8 )
-ELSE(MSVC)
- ADD_DEFINITIONS(-std=c++14)
ENDIF(MSVC)
-IF(UNIX OR MINGW)
+IF(UNIX)
ADD_DEFINITIONS(
-g -ggdb
)
-ENDIF(UNIX OR MINGW)
+ENDIF(UNIX)
IF(UNIX AND NOT CYGWIN)
ADD_DEFINITIONS(
@@ -110,18 +100,6 @@ ADD_DEFINITIONS(
)
ENDIF(UNIX AND NOT CYGWIN)
-FIND_FILE(BOOST_HEADER
- typeof.hpp
- PATHS ${PROJECT_HOME}/3rdparty/boost/typeof
- NO_DEFAULT_PATH
- NO_CMAKE_ENVIRONMENT_PATH
- NO_CMAKE_PATH
- NO_SYSTEM_ENVIRONMENT_PATH
- NO_CMAKE_SYSTEM_PATH)
-IF(NOT EXISTS ${BOOST_HEADER})
-ADD_DEFINITIONS(-DNO_BOOST=1)
-ENDIF()
-
FOREACH(CASE ${UT_CASES})
GET_FILENAME_COMPONENT(CASE_NAME ${CASE} NAME_WE)
SET(CASE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/${CASE_NAME}.cpp)
@@ -133,14 +111,16 @@ FOREACH(CASE ${UT_CASES})
ADD_LIBRARY(${CASE_MODULE} MODULE ${CASE_SRC})
TARGET_LINK_LIBRARIES(${CASE_MODULE}
- testngpp-static
+ testngpp
mockcpp)
ADD_CUSTOM_COMMAND(
OUTPUT ${CASE_SRC}
- COMMAND ${PYTHON} ${TEST_GENERATOR} -e utf-8 -o ${CASE_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/${CASE}
+ COMMAND ${PYTHON} ${TEST_GENERATOR} -e gb2312 -o ${CASE_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/${CASE}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${CASE}
)
ADD_DEPENDENCIES(${CASE_MODULE} ${CASE_NAME})
ENDFOREACH()
+
+
@@ -120,7 +120,7 @@ public:
//void testShouldBeAbleReturnValueIncrementallyWithinAScope()
// repeat()
- TEST(repeat(num, times)鍦ㄩ噸澶嶈繑鍥瀗um杈惧埌鎸囧畾娆℃暟times涔嬪悗锛屽鏋滄湁鎸囧畾鐨勫悗缁涓猴紝鍒欐墽琛屽悗缁涓�)
+ TEST(repeat(num, times)在重复返回num达到指定次数times之后,如果有指定的后续行为,则执行后续行为)
{
MockObject<Interface> mock;
@@ -133,7 +133,7 @@ public:
}
// repeat()
- TEST(repeat(num, times)鍦ㄩ噸澶嶈繑鍥瀗um杈惧埌鎸囧畾鐨勬鏁皌imes涔嬪悗锛屽鏋滄棤鎸囧畾鍚庣画琛屼负锛屽啀娆¤皟鐢ㄥ皢鎶涘嚭寮傚父)
+ TEST(repeat(num, times)在重复返回num达到指定的次数times之后,如果无指定后续行为,再次调用将抛出异常)
{
MockObject<Interface> mock;
@@ -146,7 +146,7 @@ public:
}
// increase()
- TEST(increase(num, times)鍦ㄩ噸澶嶈繑鍥瀗um+invoke times-1杈惧埌鎸囧畾娆℃暟times涔嬪悗锛屽鏋滄湁鎸囧畾鐨勫悗缁涓猴紝鍒欐墽琛屽悗缁涓�)
+ TEST(increase(num, times)在重复返回num+invoke times-1达到指定次数times之后,如果有指定的后续行为,则执行后续行为)
{
MockObject<Interface> mock;
@@ -32,7 +32,7 @@ class TestMockObject2 : public TESTCPP_NS::TestFixture
{
virtual int base00() = 0;
virtual bool base01(long) const = 0;
- virtual ~Base0() noexcept(false) {}
+ virtual ~Base0() {}
};
struct Base1
@@ -41,7 +41,7 @@ class TestMockObject2 : public TESTCPP_NS::TestFixture
virtual long base11(const std::string&) const = 0;
virtual int base12() const = 0;
- virtual ~Base1() noexcept(false) {}
+ virtual ~Base1() {}
};
struct Interface: public Base0, public Base1
@@ -245,12 +245,9 @@ public:
// willKeepAlive
void testShouldBeAbleToSpecifyAnObjectShouldKeepAlive()
{
-// TODO: Temporary disable this case on MinGW : mockcpp::Exception: what(): trying to delete an object expected keeping alive.
-#if !defined(__MINGW32__)
MockObject<Interface> mock;
mock.willKeepAlive();
TS_ASSERT_THROWS(delete (Interface*) mock, Exception);
-#endif
}
// willKeepAlive
@@ -1,10 +1,6 @@
#include <testngpp/testngpp.hpp>
#include <mockcpp/mokc.h>
#include <mockcpp/mockcpp.hpp>
-#include <iostream>
-#include <vector>
-#include <memory>
-using namespace std;
struct Interface
{
@@ -18,45 +14,6 @@ int func_stub()
return 1000;
}
-struct Interface2
-{
- virtual ~Interface2(){}
- virtual int method1() {
- return 1;
- }
- int method2() {
- return 2;
- }
-};
-
-int func_client(Interface2* intf)
-{
- return intf->method2();
-}
-
-template <typename T>
-int template_func(T &t)
-{
- return 1;
-}
-
-class Base
-{
-public:
- virtual ~Base(){}
- virtual int method1(int a) { return 0; }
- int method2(float b) { return 1; }
- int member;
- int member2;
- int member3;
-};
-
-class Derived : public Base {
-public:
- virtual ~Derived(){}
- virtual int method1(int a) { return 10; }
-};
-
FIXTURE(mockcpp_sample, mockcpp samples)
{
TEST(test_method_mocker)
@@ -85,42 +42,5 @@ FIXTURE(mockcpp_sample, mockcpp samples)
.will(invoke(func_stub));
ASSERT_EQ(1000, Interface::func());
GlobalMockObject::verify();
- }
-
- // mock鐨勭被涓嶅叏鏄櫄鏂规硶, 濡傛灉璋冪敤鍒伴潪铏氭柟娉曪紝鍒檓ock妗嗘灦涓嶄細鎶ラ敊锛岃�屾槸璋冪敤鐪熸鐨勯潪铏氭柟娉曪紝鍙兘鍑虹幇鍐呭瓨闈炴硶璁块棶銆�
- // 浠庤璁¤В鑰︾殑瑙掑害璁诧紝搴斿敖鍙兘闈㈠悜鎺ュ彛缂栫▼锛岃�岄渶瑕乵ock鐨勪篃閮芥槸鎺ュ彛銆傛帴鍙i噷闈㈢殑鏂规硶鍏ㄦ槸铏氭柟娉曘�傛墍浠ヤ笉瀛樺湪杩欑鎯呭喌銆�
- // 濡傛灉瀹為檯浣跨敤涓紝鐢ㄦ潵mock甯︽湁闈炶櫄鏂规硶锛岀敋鑷冲惈鏈夋垚鍛樺彉閲忕殑绫伙紝鍒欏彲鑳藉嚭鐜伴棶棰樸�傞渶瑕佸皬蹇冦��
- TEST(call a method not mocked)
- {
- MockObject<Interface2> mocker;
- MOCK_METHOD(mocker, method1)
- .defaults()
- .will(returnValue(100));
- ASSERT_EQ(2, func_client(mocker));
-
- }
-
- TEST(mock a Derived class with a non-pure-virtual base class)
- {
- MockObject<Derived> mocker;
- MOCK_METHOD(mocker, method1)
- .defaults()
- .will(returnValue(100));
- ASSERT_EQ(100, mocker->method1(10));
- ASSERT_EQ(24, sizeof(Derived));
- ASSERT_EQ(8, sizeof(void*));
- }
-
-#if 0
- // if not use MOCKCPP_USE_MOCKABLE, compile error
- // if use MOCKCPP_USE_MOCKABLE, compile pass, but maybe all the MOCKER tests failed.
- TEST(mock a template function)
- {
- MOCKER(template_func)
- .defaults()
- .will(returnValue(100));
- struct A {}a;
- ASSERT_EQ(100, template_func(a));
- }
-#endif
+ }
};
@@ -65,8 +65,8 @@ FIXTURE(TestNonvirtualMemberMocker, mock nonvirtual nonstatic member method)
GlobalMockObject::instance.method
( "CUT::normal_method"
, getAddrOfMethod(&CUT::normal_method)
- , (const void *)CApiHookFunctor<FAKE_BOOST_TYPEOF(CUT::static_method)>::hook
- , ThunkCodeProvider<FAKE_BOOST_TYPEOF(CUT::static_method)>()())
+ , (const void *)CApiHookFunctor<BOOST_TYPEOF(CUT::static_method)>::hook
+ , ThunkCodeProvider<BOOST_TYPEOF(CUT::static_method)>()())
.stubs()
.will(returnValue(100));
CUT cut;
@@ -81,8 +81,8 @@ FIXTURE(TestNonvirtualMemberMocker, mock nonvirtual nonstatic member method)
GlobalMockObject::instance.method
( "CUT::normal_method_1"
, getAddrOfMethod(&CUT::normal_method_1)
- , (const void *)CApiHookFunctor<FAKE_BOOST_TYPEOF(CUT::static_method_2)>::hook
- , ThunkCodeProvider<FAKE_BOOST_TYPEOF(CUT::static_method_2)>()())
+ , (const void *)CApiHookFunctor<BOOST_TYPEOF(CUT::static_method_2)>::hook
+ , ThunkCodeProvider<BOOST_TYPEOF(CUT::static_method_2)>()())
.stubs()
.with(any(), eq(2))
.will(returnValue(101));
@@ -52,7 +52,7 @@ class TestVirtualTable: public TESTCPP_NS::TestFixture
{
virtual int base00() = 0;
virtual bool base01(int) const = 0;
- virtual ~Base0() noexcept(false) {}
+ virtual ~Base0() {}
};
struct Base1
@@ -60,7 +60,7 @@ class TestVirtualTable: public TESTCPP_NS::TestFixture
virtual void base10() = 0;
virtual long base11(bool) const = 0;
- virtual ~Base1() noexcept(false) {}
+ virtual ~Base1() {}
};
struct Interface: public Base0, public Base1
@@ -33,7 +33,7 @@ public:
def checkFileExistance(filename):
if os.path.exists(filename):
- print("file", filename, "exists, please make sure you wanna overwrite it", file=sys.stderr)
+ print >> sys.stderr, "file", filename, "exists, please make sure you wanna overwrite it"
sys.exit(1)
def generate(name, filename):
@@ -48,7 +48,7 @@ def generateTestFixture(name):
generate(name, filename)
def usage(prog):
- print("Usage:", prog, "class_name_under_test")
+ print "Usage:", prog, "class_name_under_test"
if __name__ == "__main__":
if len(sys.argv) < 2: