Merge branch 'master' into issue_1735
This commit is contained in:
commit
6de39826aa
11
.gitignore
vendored
11
.gitignore
vendored
|
@ -41,3 +41,14 @@ googletest/fused-src/
|
||||||
|
|
||||||
# macOS files
|
# macOS files
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
# Ignore cmake generated directories and files.
|
||||||
|
CMakeFiles
|
||||||
|
CTestTestfile.cmake
|
||||||
|
Makefile
|
||||||
|
cmake_install.cmake
|
||||||
|
googlemock/CMakeFiles
|
||||||
|
googlemock/CTestTestfile.cmake
|
||||||
|
googlemock/Makefile
|
||||||
|
googlemock/cmake_install.cmake
|
||||||
|
googlemock/gtest
|
||||||
|
|
|
@ -1,33 +1,23 @@
|
||||||
cmake_minimum_required(VERSION 2.6.4)
|
cmake_minimum_required(VERSION 2.8.8)
|
||||||
|
|
||||||
if (POLICY CMP0048)
|
if (POLICY CMP0048)
|
||||||
cmake_policy(SET CMP0048 NEW)
|
cmake_policy(SET CMP0048 NEW)
|
||||||
endif (POLICY CMP0048)
|
endif (POLICY CMP0048)
|
||||||
|
|
||||||
project( googletest-distribution )
|
project(googletest-distribution)
|
||||||
|
set(GOOGLETEST_VERSION 1.9.0)
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
include(CMakeDependentOption)
|
include(CMakeDependentOption)
|
||||||
if (CMAKE_VERSION VERSION_LESS 2.8.5)
|
include(GNUInstallDirs)
|
||||||
set(CMAKE_INSTALL_BINDIR "bin" CACHE STRING "User executables (bin)")
|
|
||||||
set(CMAKE_INSTALL_LIBDIR "lib${LIB_SUFFIX}" CACHE STRING "Object code libraries (lib)")
|
|
||||||
set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE STRING "C header files (include)")
|
|
||||||
mark_as_advanced(CMAKE_INSTALL_BINDIR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR)
|
|
||||||
else()
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
option(BUILD_GTEST "Builds the googletest subproject" OFF)
|
|
||||||
|
|
||||||
#Note that googlemock target already builds googletest
|
#Note that googlemock target already builds googletest
|
||||||
option(BUILD_GMOCK "Builds the googlemock subproject" ON)
|
option(BUILD_GMOCK "Builds the googlemock subproject" ON)
|
||||||
|
option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON)
|
||||||
cmake_dependent_option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON "BUILD_GTEST OR BUILD_GMOCK" OFF)
|
|
||||||
cmake_dependent_option(INSTALL_GMOCK "Enable installation of googlemock. (Projects embedding googlemock may want to turn this OFF.)" ON "BUILD_GMOCK" OFF)
|
|
||||||
|
|
||||||
if(BUILD_GMOCK)
|
if(BUILD_GMOCK)
|
||||||
add_subdirectory( googlemock )
|
add_subdirectory( googlemock )
|
||||||
elseif(BUILD_GTEST)
|
else()
|
||||||
add_subdirectory( googletest )
|
add_subdirectory( googletest )
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -19,6 +19,11 @@ Follow either of the two links above to access the appropriate CLA and
|
||||||
instructions for how to sign and return it. Once we receive it, we'll be able to
|
instructions for how to sign and return it. Once we receive it, we'll be able to
|
||||||
accept your pull requests.
|
accept your pull requests.
|
||||||
|
|
||||||
|
## Are you a Googler?
|
||||||
|
If you are a Googler, please create an internal change and
|
||||||
|
have it reviewed and submitted. The maintainers will normally be in position to upstream the changes.
|
||||||
|
|
||||||
|
|
||||||
## Contributing A Patch
|
## Contributing A Patch
|
||||||
|
|
||||||
1. Submit an issue describing your proposed change to the
|
1. Submit an issue describing your proposed change to the
|
||||||
|
@ -39,10 +44,6 @@ accept your pull requests.
|
||||||
1. Ensure that your code has an appropriate set of unit tests which all pass.
|
1. Ensure that your code has an appropriate set of unit tests which all pass.
|
||||||
1. Submit a pull request.
|
1. Submit a pull request.
|
||||||
|
|
||||||
If you are a Googler, it is preferable to first create an internal change and
|
|
||||||
have it reviewed and submitted, and then create an upstreaming pull
|
|
||||||
request here.
|
|
||||||
|
|
||||||
## The Google Test and Google Mock Communities ##
|
## The Google Test and Google Mock Communities ##
|
||||||
|
|
||||||
The Google Test community exists primarily through the
|
The Google Test community exists primarily through the
|
||||||
|
|
|
@ -5,10 +5,6 @@
|
||||||
# ctest. You can select which tests to run using 'ctest -R regex'.
|
# ctest. You can select which tests to run using 'ctest -R regex'.
|
||||||
# For more options, run 'ctest --help'.
|
# For more options, run 'ctest --help'.
|
||||||
|
|
||||||
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
|
|
||||||
# make it prominent in the GUI.
|
|
||||||
option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
|
|
||||||
|
|
||||||
option(gmock_build_tests "Build all of Google Mock's own tests." OFF)
|
option(gmock_build_tests "Build all of Google Mock's own tests." OFF)
|
||||||
|
|
||||||
# A directory to find Google Test sources.
|
# A directory to find Google Test sources.
|
||||||
|
@ -41,7 +37,7 @@ if (CMAKE_VERSION VERSION_LESS 3.0)
|
||||||
project(gmock CXX C)
|
project(gmock CXX C)
|
||||||
else()
|
else()
|
||||||
cmake_policy(SET CMP0048 NEW)
|
cmake_policy(SET CMP0048 NEW)
|
||||||
project(gmock VERSION 1.9.0 LANGUAGES CXX C)
|
project(gmock VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C)
|
||||||
endif()
|
endif()
|
||||||
cmake_minimum_required(VERSION 2.6.4)
|
cmake_minimum_required(VERSION 2.6.4)
|
||||||
|
|
||||||
|
@ -55,18 +51,29 @@ endif()
|
||||||
# if they are the same (the default).
|
# if they are the same (the default).
|
||||||
add_subdirectory("${gtest_dir}" "${gmock_BINARY_DIR}/gtest")
|
add_subdirectory("${gtest_dir}" "${gmock_BINARY_DIR}/gtest")
|
||||||
|
|
||||||
|
|
||||||
|
# These commands only run if this is the main project
|
||||||
|
if(CMAKE_PROJECT_NAME STREQUAL "gmock" OR CMAKE_PROJECT_NAME STREQUAL "googletest-distribution")
|
||||||
|
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
|
||||||
|
# make it prominent in the GUI.
|
||||||
|
option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
|
||||||
|
else()
|
||||||
|
mark_as_advanced(gmock_build_tests)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Although Google Test's CMakeLists.txt calls this function, the
|
# Although Google Test's CMakeLists.txt calls this function, the
|
||||||
# changes there don't affect the current scope. Therefore we have to
|
# changes there don't affect the current scope. Therefore we have to
|
||||||
# call it again here.
|
# call it again here.
|
||||||
config_compiler_and_linker() # from ${gtest_dir}/cmake/internal_utils.cmake
|
config_compiler_and_linker() # from ${gtest_dir}/cmake/internal_utils.cmake
|
||||||
|
|
||||||
# Adds Google Mock's and Google Test's header directories to the search path.
|
# Adds Google Mock's and Google Test's header directories to the search path.
|
||||||
include_directories("${gmock_SOURCE_DIR}/include"
|
set(gmock_build_include_dirs
|
||||||
"${gmock_SOURCE_DIR}"
|
"${gmock_SOURCE_DIR}/include"
|
||||||
"${gtest_SOURCE_DIR}/include"
|
"${gmock_SOURCE_DIR}"
|
||||||
# This directory is needed to build directly from Google
|
"${gtest_SOURCE_DIR}/include"
|
||||||
# Test sources.
|
# This directory is needed to build directly from Google Test sources.
|
||||||
"${gtest_SOURCE_DIR}")
|
"${gtest_SOURCE_DIR}")
|
||||||
|
include_directories(${gmock_build_include_dirs})
|
||||||
|
|
||||||
# Summary of tuple support for Microsoft Visual Studio:
|
# Summary of tuple support for Microsoft Visual Studio:
|
||||||
# Compiler version(MS) version(cmake) Support
|
# Compiler version(MS) version(cmake) Support
|
||||||
|
@ -101,42 +108,26 @@ if (MSVC)
|
||||||
src/gmock_main.cc)
|
src/gmock_main.cc)
|
||||||
else()
|
else()
|
||||||
cxx_library(gmock "${cxx_strict}" src/gmock-all.cc)
|
cxx_library(gmock "${cxx_strict}" src/gmock-all.cc)
|
||||||
target_link_libraries(gmock gtest)
|
target_link_libraries(gmock PUBLIC gtest)
|
||||||
cxx_library(gmock_main "${cxx_strict}" src/gmock_main.cc)
|
cxx_library(gmock_main "${cxx_strict}" src/gmock_main.cc)
|
||||||
target_link_libraries(gmock_main gmock)
|
target_link_libraries(gmock_main PUBLIC gmock)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# If the CMake version supports it, attach header directory information
|
# If the CMake version supports it, attach header directory information
|
||||||
# to the targets for when we are part of a parent build (ie being pulled
|
# to the targets for when we are part of a parent build (ie being pulled
|
||||||
# in via add_subdirectory() rather than being a standalone build).
|
# in via add_subdirectory() rather than being a standalone build).
|
||||||
if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
|
if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
|
||||||
target_include_directories(gmock SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include")
|
target_include_directories(gmock SYSTEM INTERFACE
|
||||||
target_include_directories(gmock_main SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include")
|
"$<BUILD_INTERFACE:${gmock_build_include_dirs}>"
|
||||||
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||||
|
target_include_directories(gmock_main SYSTEM INTERFACE
|
||||||
|
"$<BUILD_INTERFACE:${gmock_build_include_dirs}>"
|
||||||
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
#
|
#
|
||||||
# Install rules
|
# Install rules
|
||||||
if(INSTALL_GMOCK)
|
install_project(gmock gmock_main)
|
||||||
install(TARGETS gmock gmock_main
|
|
||||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
|
||||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
||||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
|
||||||
install(DIRECTORY "${gmock_SOURCE_DIR}/include/gmock"
|
|
||||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
|
||||||
|
|
||||||
# configure and install pkgconfig files
|
|
||||||
configure_file(
|
|
||||||
cmake/gmock.pc.in
|
|
||||||
"${CMAKE_BINARY_DIR}/gmock.pc"
|
|
||||||
@ONLY)
|
|
||||||
configure_file(
|
|
||||||
cmake/gmock_main.pc.in
|
|
||||||
"${CMAKE_BINARY_DIR}/gmock_main.pc"
|
|
||||||
@ONLY)
|
|
||||||
install(FILES "${CMAKE_BINARY_DIR}/gmock.pc" "${CMAKE_BINARY_DIR}/gmock_main.pc"
|
|
||||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
#
|
#
|
||||||
|
@ -203,13 +194,13 @@ if (gmock_build_tests)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
cxx_library(gmock_main_no_exception "${cxx_no_exception}" src/gmock_main.cc)
|
cxx_library(gmock_main_no_exception "${cxx_no_exception}" src/gmock_main.cc)
|
||||||
target_link_libraries(gmock_main_no_exception gmock)
|
target_link_libraries(gmock_main_no_exception PUBLIC gmock)
|
||||||
|
|
||||||
cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" src/gmock_main.cc)
|
cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" src/gmock_main.cc)
|
||||||
target_link_libraries(gmock_main_no_rtti gmock)
|
target_link_libraries(gmock_main_no_rtti PUBLIC gmock)
|
||||||
|
|
||||||
cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}" src/gmock_main.cc)
|
cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}" src/gmock_main.cc)
|
||||||
target_link_libraries(gmock_main_use_own_tuple gmock)
|
target_link_libraries(gmock_main_use_own_tuple PUBLIC gmock)
|
||||||
endif()
|
endif()
|
||||||
cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}"
|
cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}"
|
||||||
gmock_main_no_exception test/gmock-more-actions_test.cc)
|
gmock_main_no_exception test/gmock-more-actions_test.cc)
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
@ -45,6 +44,9 @@
|
||||||
#include "gmock/internal/gmock-port.h"
|
#include "gmock/internal/gmock-port.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
||||||
|
/* class A needs to have dll-interface to be used by clients of class B */)
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
// To implement a cardinality Foo, define:
|
// To implement a cardinality Foo, define:
|
||||||
|
@ -146,4 +148,6 @@ inline Cardinality MakeCardinality(const CardinalityInterface* c) {
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
||||||
|
|
||||||
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
|
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
|
||||||
|
|
|
@ -30,8 +30,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
@ -215,8 +214,7 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6> > {
|
||||||
get<2>(args), get<3>(args), get<4>(args), get<5>(args));
|
get<2>(args), get<3>(args), get<4>(args), get<5>(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
// There is no InvokeCallback() for 6-tuples, as google3 callbacks
|
// There is no InvokeCallback() for 6-tuples
|
||||||
// support 5 arguments at most.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
||||||
|
@ -240,8 +238,7 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > {
|
||||||
get<6>(args));
|
get<6>(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
// There is no InvokeCallback() for 7-tuples, as google3 callbacks
|
// There is no InvokeCallback() for 7-tuples
|
||||||
// support 5 arguments at most.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
||||||
|
@ -266,8 +263,7 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
|
||||||
get<6>(args), get<7>(args));
|
get<6>(args), get<7>(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
// There is no InvokeCallback() for 8-tuples, as google3 callbacks
|
// There is no InvokeCallback() for 8-tuples
|
||||||
// support 5 arguments at most.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
||||||
|
@ -292,8 +288,7 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
|
||||||
get<6>(args), get<7>(args), get<8>(args));
|
get<6>(args), get<7>(args), get<8>(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
// There is no InvokeCallback() for 9-tuples, as google3 callbacks
|
// There is no InvokeCallback() for 9-tuples
|
||||||
// support 5 arguments at most.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
template <typename R, typename A1, typename A2, typename A3, typename A4,
|
||||||
|
@ -320,8 +315,7 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
|
||||||
get<6>(args), get<7>(args), get<8>(args), get<9>(args));
|
get<6>(args), get<7>(args), get<8>(args), get<9>(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
// There is no InvokeCallback() for 10-tuples, as google3 callbacks
|
// There is no InvokeCallback() for 10-tuples
|
||||||
// support 5 arguments at most.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implements the Invoke(callback) action.
|
// Implements the Invoke(callback) action.
|
||||||
|
|
|
@ -32,8 +32,7 @@ $$}} This meta comment fixes auto-indentation in editors.
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
@ -88,8 +87,7 @@ $if i <= max_callback_arity [[
|
||||||
return callback->Run($gets);
|
return callback->Run($gets);
|
||||||
}
|
}
|
||||||
]] $else [[
|
]] $else [[
|
||||||
// There is no InvokeCallback() for $i-tuples, as google3 callbacks
|
// There is no InvokeCallback() for $i-tuples
|
||||||
// support $max_callback_arity arguments at most.
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,8 +30,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -31,8 +31,7 @@ $var n = 10 $$ The maximum arity we support.
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -30,8 +30,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Implements class templates NiceMock, NaggyMock, and StrictMock.
|
// Implements class templates NiceMock, NaggyMock, and StrictMock.
|
||||||
//
|
//
|
||||||
|
|
|
@ -31,8 +31,7 @@ $var n = 10 $$ The maximum arity we support.
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Implements class templates NiceMock, NaggyMock, and StrictMock.
|
// Implements class templates NiceMock, NaggyMock, and StrictMock.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
@ -57,6 +56,9 @@
|
||||||
# include <initializer_list> // NOLINT -- must be after gtest.h
|
# include <initializer_list> // NOLINT -- must be after gtest.h
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
||||||
|
/* class A needs to have dll-interface to be used by clients of class B */)
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
// To implement a matcher Foo for type T, define:
|
// To implement a matcher Foo for type T, define:
|
||||||
|
@ -74,7 +76,7 @@ namespace testing {
|
||||||
// MatchResultListener is an abstract class. Its << operator can be
|
// MatchResultListener is an abstract class. Its << operator can be
|
||||||
// used by a matcher to explain why a value matches or doesn't match.
|
// used by a matcher to explain why a value matches or doesn't match.
|
||||||
//
|
//
|
||||||
// TODO(wan@google.com): add method
|
// FIXME: add method
|
||||||
// bool InterestedInWhy(bool result) const;
|
// bool InterestedInWhy(bool result) const;
|
||||||
// to indicate whether the listener is interested in why the match
|
// to indicate whether the listener is interested in why the match
|
||||||
// result is 'result'.
|
// result is 'result'.
|
||||||
|
@ -923,7 +925,7 @@ class TuplePrefix {
|
||||||
GTEST_REFERENCE_TO_CONST_(Value) value = get<N - 1>(values);
|
GTEST_REFERENCE_TO_CONST_(Value) value = get<N - 1>(values);
|
||||||
StringMatchResultListener listener;
|
StringMatchResultListener listener;
|
||||||
if (!matcher.MatchAndExplain(value, &listener)) {
|
if (!matcher.MatchAndExplain(value, &listener)) {
|
||||||
// TODO(wan): include in the message the name of the parameter
|
// FIXME: include in the message the name of the parameter
|
||||||
// as used in MOCK_METHOD*() when possible.
|
// as used in MOCK_METHOD*() when possible.
|
||||||
*os << " Expected arg #" << N - 1 << ": ";
|
*os << " Expected arg #" << N - 1 << ": ";
|
||||||
get<N - 1>(matchers).DescribeTo(os);
|
get<N - 1>(matchers).DescribeTo(os);
|
||||||
|
@ -2421,7 +2423,7 @@ class WhenDynamicCastToMatcher : public WhenDynamicCastToMatcherBase<To> {
|
||||||
|
|
||||||
template <typename From>
|
template <typename From>
|
||||||
bool MatchAndExplain(From from, MatchResultListener* listener) const {
|
bool MatchAndExplain(From from, MatchResultListener* listener) const {
|
||||||
// TODO(sbenza): Add more detail on failures. ie did the dyn_cast fail?
|
// FIXME: Add more detail on failures. ie did the dyn_cast fail?
|
||||||
To to = dynamic_cast<To>(from);
|
To to = dynamic_cast<To>(from);
|
||||||
return MatchPrintAndExplain(to, this->matcher_, listener);
|
return MatchPrintAndExplain(to, this->matcher_, listener);
|
||||||
}
|
}
|
||||||
|
@ -5267,6 +5269,8 @@ PolymorphicMatcher<internal::variant_matcher::VariantMatcher<T> > VariantWith(
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
||||||
|
|
||||||
// Include any custom callback matchers added by the local installation.
|
// Include any custom callback matchers added by the local installation.
|
||||||
// We must include this header at the end to make sure it can use the
|
// We must include this header at the end to make sure it can use the
|
||||||
// declarations from this file.
|
// declarations from this file.
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: marcus.boerger@google.com (Marcus Boerger)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
@ -38,8 +37,8 @@
|
||||||
|
|
||||||
// GOOGLETEST_CM0002 DO NOT DELETE
|
// GOOGLETEST_CM0002 DO NOT DELETE
|
||||||
|
|
||||||
#ifndef GMOCK_GMOCK_MORE_MATCHERS_H_
|
#ifndef GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_
|
||||||
#define GMOCK_GMOCK_MORE_MATCHERS_H_
|
#define GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_
|
||||||
|
|
||||||
#include "gmock/gmock-generated-matchers.h"
|
#include "gmock/gmock-generated-matchers.h"
|
||||||
|
|
||||||
|
@ -90,4 +89,4 @@ MATCHER(IsFalse, negation ? "is true" : "is false") {
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
#endif // GMOCK_GMOCK_MORE_MATCHERS_H_
|
#endif // GMOCK_INCLUDE_GMOCK_MORE_MATCHERS_H_
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
@ -78,6 +77,9 @@
|
||||||
# include <stdexcept> // NOLINT
|
# include <stdexcept> // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
||||||
|
/* class A needs to have dll-interface to be used by clients of class B */)
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
// An abstract handle of an expectation.
|
// An abstract handle of an expectation.
|
||||||
|
@ -185,7 +187,7 @@ class GTEST_API_ UntypedFunctionMockerBase {
|
||||||
// this information in the global mock registry. Will be called
|
// this information in the global mock registry. Will be called
|
||||||
// whenever an EXPECT_CALL() or ON_CALL() is executed on this mock
|
// whenever an EXPECT_CALL() or ON_CALL() is executed on this mock
|
||||||
// method.
|
// method.
|
||||||
// TODO(wan@google.com): rename to SetAndRegisterOwner().
|
// FIXME: rename to SetAndRegisterOwner().
|
||||||
void RegisterOwner(const void* mock_obj)
|
void RegisterOwner(const void* mock_obj)
|
||||||
GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
|
GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
|
||||||
|
|
||||||
|
@ -1208,7 +1210,7 @@ class TypedExpectation : public ExpectationBase {
|
||||||
mocker->DescribeDefaultActionTo(args, what);
|
mocker->DescribeDefaultActionTo(args, what);
|
||||||
DescribeCallCountTo(why);
|
DescribeCallCountTo(why);
|
||||||
|
|
||||||
// TODO(wan@google.com): allow the user to control whether
|
// FIXME: allow the user to control whether
|
||||||
// unexpected calls should fail immediately or continue using a
|
// unexpected calls should fail immediately or continue using a
|
||||||
// flag --gmock_unexpected_calls_are_fatal.
|
// flag --gmock_unexpected_calls_are_fatal.
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1358,11 +1360,7 @@ class ReferenceOrValueWrapper<T&> {
|
||||||
// we need to temporarily disable the warning. We have to do it for
|
// we need to temporarily disable the warning. We have to do it for
|
||||||
// the entire class to suppress the warning, even though it's about
|
// the entire class to suppress the warning, even though it's about
|
||||||
// the constructor only.
|
// the constructor only.
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4355)
|
||||||
#ifdef _MSC_VER
|
|
||||||
# pragma warning(push) // Saves the current warning state.
|
|
||||||
# pragma warning(disable:4355) // Temporarily disables warning 4355.
|
|
||||||
#endif // _MSV_VER
|
|
||||||
|
|
||||||
// C++ treats the void type specially. For example, you cannot define
|
// C++ treats the void type specially. For example, you cannot define
|
||||||
// a void-typed variable or pass a void value to a function.
|
// a void-typed variable or pass a void value to a function.
|
||||||
|
@ -1798,9 +1796,7 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(FunctionMockerBase);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(FunctionMockerBase);
|
||||||
}; // class FunctionMockerBase
|
}; // class FunctionMockerBase
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4355
|
||||||
# pragma warning(pop) // Restores the warning state.
|
|
||||||
#endif // _MSV_VER
|
|
||||||
|
|
||||||
// Implements methods of FunctionMockerBase.
|
// Implements methods of FunctionMockerBase.
|
||||||
|
|
||||||
|
@ -1845,6 +1841,8 @@ inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
||||||
|
|
||||||
// Implementation for ON_CALL and EXPECT_CALL macros. A separate macro is
|
// Implementation for ON_CALL and EXPECT_CALL macros. A separate macro is
|
||||||
// required to avoid compile errors when the name of the method used in call is
|
// required to avoid compile errors when the name of the method used in call is
|
||||||
// a result of macro expansion. See CompilesWithMethodNameExpandedFromMacro
|
// a result of macro expansion. See CompilesWithMethodNameExpandedFromMacro
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
16
googlemock/include/gmock/internal/custom/README.md
Normal file
16
googlemock/include/gmock/internal/custom/README.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Customization Points
|
||||||
|
|
||||||
|
The custom directory is an injection point for custom user configurations.
|
||||||
|
|
||||||
|
## Header `gmock-port.h`
|
||||||
|
|
||||||
|
The following macros can be defined:
|
||||||
|
|
||||||
|
### Flag related macros:
|
||||||
|
|
||||||
|
* `GMOCK_DECLARE_bool_(name)`
|
||||||
|
* `GMOCK_DECLARE_int32_(name)`
|
||||||
|
* `GMOCK_DECLARE_string_(name)`
|
||||||
|
* `GMOCK_DEFINE_bool_(name, default_val, doc)`
|
||||||
|
* `GMOCK_DEFINE_int32_(name, default_val, doc)`
|
||||||
|
* `GMOCK_DEFINE_string_(name, default_val, doc)`
|
|
@ -27,9 +27,7 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// ============================================================
|
// Injection point for custom user configurations. See README for details
|
||||||
// An installation-specific extension point for gmock-matchers.h.
|
|
||||||
// ============================================================
|
|
||||||
//
|
//
|
||||||
// GOOGLETEST_CM0002 DO NOT DELETE
|
// GOOGLETEST_CM0002 DO NOT DELETE
|
||||||
|
|
||||||
|
|
|
@ -27,16 +27,7 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// Injection point for custom user configurations.
|
// Injection point for custom user configurations. See README for details
|
||||||
// The following macros can be defined:
|
|
||||||
//
|
|
||||||
// Flag related macros:
|
|
||||||
// GMOCK_DECLARE_bool_(name)
|
|
||||||
// GMOCK_DECLARE_int32_(name)
|
|
||||||
// GMOCK_DECLARE_string_(name)
|
|
||||||
// GMOCK_DEFINE_bool_(name, default_val, doc)
|
|
||||||
// GMOCK_DEFINE_int32_(name, default_val, doc)
|
|
||||||
// GMOCK_DEFINE_string_(name, default_val, doc)
|
|
||||||
//
|
//
|
||||||
// ** Custom implementation starts here **
|
// ** Custom implementation starts here **
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -31,8 +31,7 @@ $var n = 10 $$ The maximum arity we support.
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
@ -361,7 +360,7 @@ class WithoutMatchers {
|
||||||
// Internal use only: access the singleton instance of WithoutMatchers.
|
// Internal use only: access the singleton instance of WithoutMatchers.
|
||||||
GTEST_API_ WithoutMatchers GetWithoutMatchers();
|
GTEST_API_ WithoutMatchers GetWithoutMatchers();
|
||||||
|
|
||||||
// TODO(wan@google.com): group all type utilities together.
|
// FIXME: group all type utilities together.
|
||||||
|
|
||||||
// Type traits.
|
// Type traits.
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: vadimb@google.com (Vadim Berman)
|
|
||||||
//
|
//
|
||||||
// Low-level types and utilities for porting Google Mock to various
|
// Low-level types and utilities for porting Google Mock to various
|
||||||
// platforms. All macros ending with _ and symbols defined in an
|
// platforms. All macros ending with _ and symbols defined in an
|
||||||
|
|
|
@ -1264,6 +1264,9 @@ class AstBuilder(object):
|
||||||
return self._GetNestedType(Union)
|
return self._GetNestedType(Union)
|
||||||
|
|
||||||
def handle_enum(self):
|
def handle_enum(self):
|
||||||
|
token = self._GetNextToken()
|
||||||
|
if not (token.token_type == tokenize.NAME and token.name == 'class'):
|
||||||
|
self._AddBackToken(token)
|
||||||
return self._GetNestedType(Enum)
|
return self._GetNestedType(Enum)
|
||||||
|
|
||||||
def handle_auto(self):
|
def handle_auto(self):
|
||||||
|
|
|
@ -440,6 +440,24 @@ public:
|
||||||
MOCK_METHOD1(Bar,
|
MOCK_METHOD1(Bar,
|
||||||
void(const FooType& test_arg));
|
void(const FooType& test_arg));
|
||||||
};
|
};
|
||||||
|
"""
|
||||||
|
self.assertEqualIgnoreLeadingWhitespace(
|
||||||
|
expected, self.GenerateMocks(source))
|
||||||
|
|
||||||
|
def testEnumClass(self):
|
||||||
|
source = """
|
||||||
|
class Test {
|
||||||
|
public:
|
||||||
|
enum class Baz { BAZINGA };
|
||||||
|
virtual void Bar(const FooType& test_arg);
|
||||||
|
};
|
||||||
|
"""
|
||||||
|
expected = """\
|
||||||
|
class MockTest : public Test {
|
||||||
|
public:
|
||||||
|
MOCK_METHOD1(Bar,
|
||||||
|
void(const FooType& test_arg));
|
||||||
|
};
|
||||||
"""
|
"""
|
||||||
self.assertEqualIgnoreLeadingWhitespace(
|
self.assertEqualIgnoreLeadingWhitespace(
|
||||||
expected, self.GenerateMocks(source))
|
expected, self.GenerateMocks(source))
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
//
|
//
|
||||||
// Google C++ Mocking Framework (Google Mock)
|
// Google C++ Mocking Framework (Google Mock)
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
@ -607,7 +606,7 @@ class MockObjectRegistry {
|
||||||
if (it->second.leakable) // The user said it's fine to leak this object.
|
if (it->second.leakable) // The user said it's fine to leak this object.
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// TODO(wan@google.com): Print the type of the leaked object.
|
// FIXME: Print the type of the leaked object.
|
||||||
// This can help the user identify the leaked object.
|
// This can help the user identify the leaked object.
|
||||||
std::cout << "\n";
|
std::cout << "\n";
|
||||||
const MockObjectState& state = it->second;
|
const MockObjectState& state = it->second;
|
||||||
|
@ -783,7 +782,7 @@ void Mock::RegisterUseByOnCallOrExpectCall(const void* mock_obj,
|
||||||
const TestInfo* const test_info =
|
const TestInfo* const test_info =
|
||||||
UnitTest::GetInstance()->current_test_info();
|
UnitTest::GetInstance()->current_test_info();
|
||||||
if (test_info != NULL) {
|
if (test_info != NULL) {
|
||||||
// TODO(wan@google.com): record the test case name when the
|
// FIXME: record the test case name when the
|
||||||
// ON_CALL or EXPECT_CALL is invoked from SetUpTestCase() or
|
// ON_CALL or EXPECT_CALL is invoked from SetUpTestCase() or
|
||||||
// TearDownTestCase().
|
// TearDownTestCase().
|
||||||
state.first_used_test_case = test_info->test_case_name();
|
state.first_used_test_case = test_info->test_case_name();
|
||||||
|
|
|
@ -26,15 +26,14 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
#include "gmock/internal/gmock-port.h"
|
#include "gmock/internal/gmock-port.h"
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
// TODO(wan@google.com): support using environment variables to
|
// FIXME: support using environment variables to
|
||||||
// control the flag values, like what Google Test does.
|
// control the flag values, like what Google Test does.
|
||||||
|
|
||||||
GMOCK_DEFINE_bool_(catch_leaked_mocks, true,
|
GMOCK_DEFINE_bool_(catch_leaked_mocks, true,
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
@ -1344,7 +1343,7 @@ TEST(FunctorActionTest, UnusedArguments) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that basic built-in actions work with move-only arguments.
|
// Test that basic built-in actions work with move-only arguments.
|
||||||
// TODO(rburny): Currently, almost all ActionInterface-based actions will not
|
// FIXME: Currently, almost all ActionInterface-based actions will not
|
||||||
// work, even if they only try to use other, copyable arguments. Implement them
|
// work, even if they only try to use other, copyable arguments. Implement them
|
||||||
// if necessary (but note that DoAll cannot work on non-copyable types anyway -
|
// if necessary (but note that DoAll cannot work on non-copyable types anyway -
|
||||||
// so maybe it's better to make users use lambdas instead.
|
// so maybe it's better to make users use lambdas instead.
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
#include "gmock/gmock-generated-nice-strict.h"
|
#include "gmock/gmock-generated-nice-strict.h"
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: vladl@google.com (Vlad Losev)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
@ -1176,7 +1175,7 @@ TEST(UnexpectedCallTest, UnsatisifiedPrerequisites) {
|
||||||
TEST(UndefinedReturnValueTest,
|
TEST(UndefinedReturnValueTest,
|
||||||
ReturnValueIsMandatoryWhenNotDefaultConstructible) {
|
ReturnValueIsMandatoryWhenNotDefaultConstructible) {
|
||||||
MockA a;
|
MockA a;
|
||||||
// TODO(wan@google.com): We should really verify the output message,
|
// FIXME: We should really verify the output message,
|
||||||
// but we cannot yet due to that EXPECT_DEATH only captures stderr
|
// but we cannot yet due to that EXPECT_DEATH only captures stderr
|
||||||
// while Google Mock logs to stdout.
|
// while Google Mock logs to stdout.
|
||||||
#if GTEST_HAS_EXCEPTIONS
|
#if GTEST_HAS_EXCEPTIONS
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
//
|
//
|
||||||
// Tests for Google C++ Mocking Framework (Google Mock)
|
// Tests for Google C++ Mocking Framework (Google Mock)
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Tests Google Mock's functionality that depends on exceptions.
|
// Tests Google Mock's functionality that depends on exceptions.
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,6 @@
|
||||||
|
|
||||||
"""Tests that leaked mock objects can be caught be Google Mock."""
|
"""Tests that leaked mock objects can be caught be Google Mock."""
|
||||||
|
|
||||||
__author__ = 'wan@google.com (Zhanyong Wan)'
|
|
||||||
|
|
||||||
import gmock_test_utils
|
import gmock_test_utils
|
||||||
|
|
||||||
PROGRAM_PATH = gmock_test_utils.GetTestExecutablePath('gmock_leak_test_')
|
PROGRAM_PATH = gmock_test_utils.GetTestExecutablePath('gmock_leak_test_')
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan), vladl@google.com (Vlad Losev)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: vladl@google.com (Vlad Losev)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -39,8 +39,6 @@ gmock_output_test.py
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = 'wan@google.com (Zhanyong Wan)'
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Tests Google Mock's output in various scenarios. This ensures that
|
// Tests Google Mock's output in various scenarios. This ensures that
|
||||||
// Google Mock's messages are readable and useful.
|
// Google Mock's messages are readable and useful.
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Tests that Google Mock constructs can be used in a large number of
|
// Tests that Google Mock constructs can be used in a large number of
|
||||||
// threads concurrently.
|
// threads concurrently.
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Mock - a framework for writing C++ mock classes.
|
// Google Mock - a framework for writing C++ mock classes.
|
||||||
//
|
//
|
||||||
|
|
|
@ -29,8 +29,6 @@
|
||||||
|
|
||||||
"""Unit test utilities for Google C++ Mocking Framework."""
|
"""Unit test utilities for Google C++ Mocking Framework."""
|
||||||
|
|
||||||
__author__ = 'wan@google.com (Zhanyong Wan)'
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,6 @@
|
||||||
# ctest. You can select which tests to run using 'ctest -R regex'.
|
# ctest. You can select which tests to run using 'ctest -R regex'.
|
||||||
# For more options, run 'ctest --help'.
|
# For more options, run 'ctest --help'.
|
||||||
|
|
||||||
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
|
|
||||||
# make it prominent in the GUI.
|
|
||||||
option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
|
|
||||||
|
|
||||||
# When other libraries are using a shared version of runtime libraries,
|
# When other libraries are using a shared version of runtime libraries,
|
||||||
# Google Test also has to use one.
|
# Google Test also has to use one.
|
||||||
option(
|
option(
|
||||||
|
@ -48,7 +44,7 @@ if (CMAKE_VERSION VERSION_LESS 3.0)
|
||||||
project(gtest CXX C)
|
project(gtest CXX C)
|
||||||
else()
|
else()
|
||||||
cmake_policy(SET CMP0048 NEW)
|
cmake_policy(SET CMP0048 NEW)
|
||||||
project(gtest VERSION 1.9.0 LANGUAGES CXX C)
|
project(gtest VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C)
|
||||||
endif()
|
endif()
|
||||||
cmake_minimum_required(VERSION 2.6.4)
|
cmake_minimum_required(VERSION 2.6.4)
|
||||||
|
|
||||||
|
@ -60,6 +56,25 @@ if (COMMAND set_up_hermetic_build)
|
||||||
set_up_hermetic_build()
|
set_up_hermetic_build()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# These commands only run if this is the main project
|
||||||
|
if(CMAKE_PROJECT_NAME STREQUAL "gtest" OR CMAKE_PROJECT_NAME STREQUAL "googletest-distribution")
|
||||||
|
|
||||||
|
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
|
||||||
|
# make it prominent in the GUI.
|
||||||
|
option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
gtest_force_shared_crt
|
||||||
|
gtest_build_tests
|
||||||
|
gtest_build_samples
|
||||||
|
gtest_disable_pthreads
|
||||||
|
gtest_hide_internal_symbols)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if (gtest_hide_internal_symbols)
|
if (gtest_hide_internal_symbols)
|
||||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
|
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
|
||||||
|
@ -70,10 +85,30 @@ include(cmake/internal_utils.cmake)
|
||||||
|
|
||||||
config_compiler_and_linker() # Defined in internal_utils.cmake.
|
config_compiler_and_linker() # Defined in internal_utils.cmake.
|
||||||
|
|
||||||
|
# Create the CMake package file descriptors.
|
||||||
|
if (INSTALL_GTEST)
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
set(cmake_package_name GTest)
|
||||||
|
set(targets_export_name ${cmake_package_name}Targets CACHE INTERNAL "")
|
||||||
|
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated" CACHE INTERNAL "")
|
||||||
|
set(cmake_files_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${cmake_package_name}")
|
||||||
|
set(version_file "${generated_dir}/${cmake_package_name}ConfigVersion.cmake")
|
||||||
|
write_basic_package_version_file(${version_file} COMPATIBILITY AnyNewerVersion)
|
||||||
|
install(EXPORT ${targets_export_name}
|
||||||
|
NAMESPACE ${cmake_package_name}::
|
||||||
|
DESTINATION ${cmake_files_install_dir})
|
||||||
|
set(config_file "${generated_dir}/${cmake_package_name}Config.cmake")
|
||||||
|
configure_package_config_file("${gtest_SOURCE_DIR}/cmake/Config.cmake.in"
|
||||||
|
"${config_file}" INSTALL_DESTINATION ${cmake_files_install_dir})
|
||||||
|
install(FILES ${version_file} ${config_file}
|
||||||
|
DESTINATION ${cmake_files_install_dir})
|
||||||
|
endif()
|
||||||
|
|
||||||
# Where Google Test's .h files can be found.
|
# Where Google Test's .h files can be found.
|
||||||
include_directories(
|
set(gtest_build_include_dirs
|
||||||
"${gtest_SOURCE_DIR}/include"
|
"${gtest_SOURCE_DIR}/include"
|
||||||
"${gtest_SOURCE_DIR}")
|
"${gtest_SOURCE_DIR}")
|
||||||
|
include_directories(${gtest_build_include_dirs})
|
||||||
|
|
||||||
# Summary of tuple support for Microsoft Visual Studio:
|
# Summary of tuple support for Microsoft Visual Studio:
|
||||||
# Compiler version(MS) version(cmake) Support
|
# Compiler version(MS) version(cmake) Support
|
||||||
|
@ -97,39 +132,23 @@ endif()
|
||||||
# aggressive about warnings.
|
# aggressive about warnings.
|
||||||
cxx_library(gtest "${cxx_strict}" src/gtest-all.cc)
|
cxx_library(gtest "${cxx_strict}" src/gtest-all.cc)
|
||||||
cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc)
|
cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc)
|
||||||
target_link_libraries(gtest_main gtest)
|
|
||||||
|
|
||||||
# If the CMake version supports it, attach header directory information
|
# If the CMake version supports it, attach header directory information
|
||||||
# to the targets for when we are part of a parent build (ie being pulled
|
# to the targets for when we are part of a parent build (ie being pulled
|
||||||
# in via add_subdirectory() rather than being a standalone build).
|
# in via add_subdirectory() rather than being a standalone build).
|
||||||
if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
|
if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
|
||||||
target_include_directories(gtest SYSTEM INTERFACE "${gtest_SOURCE_DIR}/include")
|
target_include_directories(gtest SYSTEM INTERFACE
|
||||||
target_include_directories(gtest_main SYSTEM INTERFACE "${gtest_SOURCE_DIR}/include")
|
"$<BUILD_INTERFACE:${gtest_build_include_dirs}>"
|
||||||
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||||
|
target_include_directories(gtest_main SYSTEM INTERFACE
|
||||||
|
"$<BUILD_INTERFACE:${gtest_build_include_dirs}>"
|
||||||
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||||
endif()
|
endif()
|
||||||
|
target_link_libraries(gtest_main PUBLIC gtest)
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
#
|
#
|
||||||
# Install rules
|
# Install rules
|
||||||
if(INSTALL_GTEST)
|
install_project(gtest gtest_main)
|
||||||
install(TARGETS gtest gtest_main
|
|
||||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
|
||||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
||||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
|
||||||
install(DIRECTORY "${gtest_SOURCE_DIR}/include/gtest"
|
|
||||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
|
||||||
|
|
||||||
# configure and install pkgconfig files
|
|
||||||
configure_file(
|
|
||||||
cmake/gtest.pc.in
|
|
||||||
"${CMAKE_BINARY_DIR}/gtest.pc"
|
|
||||||
@ONLY)
|
|
||||||
configure_file(
|
|
||||||
cmake/gtest_main.pc.in
|
|
||||||
"${CMAKE_BINARY_DIR}/gtest_main.pc"
|
|
||||||
@ONLY)
|
|
||||||
install(FILES "${CMAKE_BINARY_DIR}/gtest.pc" "${CMAKE_BINARY_DIR}/gtest_main.pc"
|
|
||||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
#
|
#
|
||||||
|
|
9
googletest/cmake/Config.cmake.in
Normal file
9
googletest/cmake/Config.cmake.in
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
@PACKAGE_INIT@
|
||||||
|
include(CMakeFindDependencyMacro)
|
||||||
|
if (@GTEST_HAS_PTHREAD@)
|
||||||
|
set(THREADS_PREFER_PTHREAD_FLAG @THREADS_PREFER_PTHREAD_FLAG@)
|
||||||
|
find_dependency(Threads)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")
|
||||||
|
check_required_components("@project_name@")
|
|
@ -38,6 +38,11 @@ macro(fix_default_compiler_settings_)
|
||||||
# We prefer more strict warning checking for building Google Test.
|
# We prefer more strict warning checking for building Google Test.
|
||||||
# Replaces /W3 with /W4 in defaults.
|
# Replaces /W3 with /W4 in defaults.
|
||||||
string(REPLACE "/W3" "/W4" ${flag_var} "${${flag_var}}")
|
string(REPLACE "/W3" "/W4" ${flag_var} "${${flag_var}}")
|
||||||
|
|
||||||
|
# Prevent D9025 warning for targets that have exception handling
|
||||||
|
# turned off (/EHs-c- flag). Where required, exceptions are explicitly
|
||||||
|
# re-enabled using the cxx_exception_flags variable.
|
||||||
|
string(REPLACE "/EHsc" "" ${flag_var} "${${flag_var}}")
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
@ -166,9 +171,18 @@ function(cxx_library_with_type name type cxx_flags)
|
||||||
set_target_properties(${name}
|
set_target_properties(${name}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1")
|
COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1")
|
||||||
|
if (NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
|
||||||
|
target_compile_definitions(${name} INTERFACE
|
||||||
|
$<INSTALL_INTERFACE:GTEST_LINKED_AS_SHARED_LIBRARY=1>)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if (DEFINED GTEST_HAS_PTHREAD)
|
if (DEFINED GTEST_HAS_PTHREAD)
|
||||||
target_link_libraries(${name} ${CMAKE_THREAD_LIBS_INIT})
|
if ("${CMAKE_VERSION}" VERSION_LESS "3.1.0")
|
||||||
|
set(threads_spec ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
else()
|
||||||
|
set(threads_spec Threads::Threads)
|
||||||
|
endif()
|
||||||
|
target_link_libraries(${name} PUBLIC ${threads_spec})
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
@ -278,3 +292,27 @@ function(py_test name)
|
||||||
endif (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
|
endif (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
|
||||||
endif(PYTHONINTERP_FOUND)
|
endif(PYTHONINTERP_FOUND)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# install_project(targets...)
|
||||||
|
#
|
||||||
|
# Installs the specified targets and configures the associated pkgconfig files.
|
||||||
|
function(install_project)
|
||||||
|
if(INSTALL_GTEST)
|
||||||
|
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
|
# Install the project targets.
|
||||||
|
install(TARGETS ${ARGN}
|
||||||
|
EXPORT ${targets_export_name}
|
||||||
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||||
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
# Configure and install pkgconfig files.
|
||||||
|
foreach(t ${ARGN})
|
||||||
|
set(configured_pc "${generated_dir}/${t}.pc")
|
||||||
|
configure_file("${PROJECT_SOURCE_DIR}/cmake/${t}.pc.in"
|
||||||
|
"${configured_pc}" @ONLY)
|
||||||
|
install(FILES "${configured_pc}"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
|
@ -572,7 +572,7 @@ namespace foo {
|
||||||
class Bar { // We want googletest to be able to print instances of this.
|
class Bar { // We want googletest to be able to print instances of this.
|
||||||
...
|
...
|
||||||
// Create a free inline friend function.
|
// Create a free inline friend function.
|
||||||
friend ::std::ostream& operator<<(::std::ostream& os, const Bar& bar) {
|
friend std::ostream& operator<<(std::ostream& os, const Bar& bar) {
|
||||||
return os << bar.DebugString(); // whatever needed to print bar to os
|
return os << bar.DebugString(); // whatever needed to print bar to os
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -580,7 +580,7 @@ class Bar { // We want googletest to be able to print instances of this.
|
||||||
// If you can't declare the function in the class it's important that the
|
// If you can't declare the function in the class it's important that the
|
||||||
// << operator is defined in the SAME namespace that defines Bar. C++'s look-up
|
// << operator is defined in the SAME namespace that defines Bar. C++'s look-up
|
||||||
// rules rely on that.
|
// rules rely on that.
|
||||||
::std::ostream& operator<<(::std::ostream& os, const Bar& bar) {
|
std::ostream& operator<<(std::ostream& os, const Bar& bar) {
|
||||||
return os << bar.DebugString(); // whatever needed to print bar to os
|
return os << bar.DebugString(); // whatever needed to print bar to os
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,7 +601,7 @@ namespace foo {
|
||||||
|
|
||||||
class Bar {
|
class Bar {
|
||||||
...
|
...
|
||||||
friend void PrintTo(const Bar& bar, ::std::ostream* os) {
|
friend void PrintTo(const Bar& bar, std::ostream* os) {
|
||||||
*os << bar.DebugString(); // whatever needed to print bar to os
|
*os << bar.DebugString(); // whatever needed to print bar to os
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -609,7 +609,7 @@ class Bar {
|
||||||
// If you can't declare the function in the class it's important that PrintTo()
|
// If you can't declare the function in the class it's important that PrintTo()
|
||||||
// is defined in the SAME namespace that defines Bar. C++'s look-up rules rely
|
// is defined in the SAME namespace that defines Bar. C++'s look-up rules rely
|
||||||
// on that.
|
// on that.
|
||||||
void PrintTo(const Bar& bar, ::std::ostream* os) {
|
void PrintTo(const Bar& bar, std::ostream* os) {
|
||||||
*os << bar.DebugString(); // whatever needed to print bar to os
|
*os << bar.DebugString(); // whatever needed to print bar to os
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,7 +649,7 @@ _death tests_. More generally, any test that checks that a program terminates
|
||||||
Note that if a piece of code throws an exception, we don't consider it "death"
|
Note that if a piece of code throws an exception, we don't consider it "death"
|
||||||
for the purpose of death tests, as the caller of the code could catch the
|
for the purpose of death tests, as the caller of the code could catch the
|
||||||
exception and avoid the crash. If you want to verify exceptions thrown by your
|
exception and avoid the crash. If you want to verify exceptions thrown by your
|
||||||
code, see [Exception Assertions](#ExceptionAssertions).
|
code, see [Exception Assertions](#exception-assertions).
|
||||||
|
|
||||||
If you want to test `EXPECT_*()/ASSERT_*()` failures in your test code, see
|
If you want to test `EXPECT_*()/ASSERT_*()` failures in your test code, see
|
||||||
Catching Failures
|
Catching Failures
|
||||||
|
@ -1147,7 +1147,7 @@ test has at least one failure of either kind.
|
||||||
|
|
||||||
In your test code, you can call `RecordProperty("key", value)` to log additional
|
In your test code, you can call `RecordProperty("key", value)` to log additional
|
||||||
information, where `value` can be either a string or an `int`. The *last* value
|
information, where `value` can be either a string or an `int`. The *last* value
|
||||||
recorded for a key will be emitted to the [XML output](#XmlReport) if you
|
recorded for a key will be emitted to the [XML output](#generating-an-xml-report) if you
|
||||||
specify one. For example, the test
|
specify one. For example, the test
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
|
@ -1424,7 +1424,7 @@ will have these names:
|
||||||
* `InstantiationName/FooTest.HasBlahBlah/1` for `"miny"`
|
* `InstantiationName/FooTest.HasBlahBlah/1` for `"miny"`
|
||||||
* `InstantiationName/FooTest.HasBlahBlah/2` for `"moe"`
|
* `InstantiationName/FooTest.HasBlahBlah/2` for `"moe"`
|
||||||
|
|
||||||
You can use these names in [`--gtest_filter`](#TestFilter).
|
You can use these names in [`--gtest_filter`](#running-a-subset-of-the-tests).
|
||||||
|
|
||||||
This statement will instantiate all tests from `FooTest` again, each with
|
This statement will instantiate all tests from `FooTest` again, each with
|
||||||
parameter values `"cat"` and `"dog"`:
|
parameter values `"cat"` and `"dog"`:
|
||||||
|
@ -1674,7 +1674,7 @@ To test them, we use the following special techniques:
|
||||||
* Both static functions and definitions/declarations in an unnamed namespace
|
* Both static functions and definitions/declarations in an unnamed namespace
|
||||||
are only visible within the same translation unit. To test them, you can
|
are only visible within the same translation unit. To test them, you can
|
||||||
`#include` the entire `.cc` file being tested in your `*_test.cc` file.
|
`#include` the entire `.cc` file being tested in your `*_test.cc` file.
|
||||||
(#including `.cc` files is not a good way to reuse code - you should not do
|
(including `.cc` files is not a good way to reuse code - you should not do
|
||||||
this in production code!)
|
this in production code!)
|
||||||
|
|
||||||
However, a better approach is to move the private code into the
|
However, a better approach is to move the private code into the
|
||||||
|
@ -2120,7 +2120,7 @@ $ foo_test --gtest_repeat=1000 --gtest_filter=FooBar.*
|
||||||
Repeat the tests whose name matches the filter 1000 times.
|
Repeat the tests whose name matches the filter 1000 times.
|
||||||
```
|
```
|
||||||
|
|
||||||
If your test program contains [global set-up/tear-down](#GlobalSetUp) code, it
|
If your test program contains [global set-up/tear-down](#global-set-up-and-tear-down) code, it
|
||||||
will be repeated in each iteration as well, as the flakiness may be in it. You
|
will be repeated in each iteration as well, as the flakiness may be in it. You
|
||||||
can also specify the repeat count by setting the `GTEST_REPEAT` environment
|
can also specify the repeat count by setting the `GTEST_REPEAT` environment
|
||||||
variable.
|
variable.
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
//
|
//
|
||||||
// The Google C++ Testing and Mocking Framework (Google Test)
|
// The Google C++ Testing and Mocking Framework (Google Test)
|
||||||
//
|
//
|
||||||
|
@ -162,7 +161,7 @@ GTEST_API_ bool InDeathTestChild();
|
||||||
// is rarely a problem as people usually don't put the test binary
|
// is rarely a problem as people usually don't put the test binary
|
||||||
// directory in PATH.
|
// directory in PATH.
|
||||||
//
|
//
|
||||||
// TODO(wan@google.com): make thread-safe death tests search the PATH.
|
// FIXME: make thread-safe death tests search the PATH.
|
||||||
|
|
||||||
// Asserts that a given statement causes the program to exit, with an
|
// Asserts that a given statement causes the program to exit, with an
|
||||||
// integer exit status that satisfies predicate, and emitting error output
|
// integer exit status that satisfies predicate, and emitting error output
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
//
|
//
|
||||||
// The Google C++ Testing and Mocking Framework (Google Test)
|
// The Google C++ Testing and Mocking Framework (Google Test)
|
||||||
//
|
//
|
||||||
|
@ -52,6 +51,9 @@
|
||||||
|
|
||||||
#include "gtest/internal/gtest-port.h"
|
#include "gtest/internal/gtest-port.h"
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
||||||
|
/* class A needs to have dll-interface to be used by clients of class B */)
|
||||||
|
|
||||||
// Ensures that there is at least one operator<< in the global namespace.
|
// Ensures that there is at least one operator<< in the global namespace.
|
||||||
// See Message& operator<<(...) below for why.
|
// See Message& operator<<(...) below for why.
|
||||||
void operator<<(const testing::internal::Secret&, int);
|
void operator<<(const testing::internal::Secret&, int);
|
||||||
|
@ -248,4 +250,6 @@ std::string StreamableToString(const T& streamable) {
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
||||||
|
|
||||||
#endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
|
#endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
|
||||||
|
|
|
@ -31,8 +31,6 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// Authors: vladl@google.com (Vlad Losev)
|
|
||||||
//
|
|
||||||
// Macros and functions for implementing parameterized tests
|
// Macros and functions for implementing parameterized tests
|
||||||
// in Google C++ Testing and Mocking Framework (Google Test)
|
// in Google C++ Testing and Mocking Framework (Google Test)
|
||||||
//
|
//
|
||||||
|
|
|
@ -30,8 +30,6 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// Authors: vladl@google.com (Vlad Losev)
|
|
||||||
//
|
|
||||||
// Macros and functions for implementing parameterized tests
|
// Macros and functions for implementing parameterized tests
|
||||||
// in Google C++ Testing and Mocking Framework (Google Test)
|
// in Google C++ Testing and Mocking Framework (Google Test)
|
||||||
//
|
//
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Google Test - The Google C++ Testing and Mocking Framework
|
// Google Test - The Google C++ Testing and Mocking Framework
|
||||||
//
|
//
|
||||||
|
@ -827,7 +826,7 @@ void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) {
|
||||||
// If the array has more than kThreshold elements, we'll have to
|
// If the array has more than kThreshold elements, we'll have to
|
||||||
// omit some details by printing only the first and the last
|
// omit some details by printing only the first and the last
|
||||||
// kChunkSize elements.
|
// kChunkSize elements.
|
||||||
// TODO(wan@google.com): let the user control the threshold using a flag.
|
// FIXME: let the user control the threshold using a flag.
|
||||||
if (len <= kThreshold) {
|
if (len <= kThreshold) {
|
||||||
PrintRawArrayTo(begin, len, os);
|
PrintRawArrayTo(begin, len, os);
|
||||||
} else {
|
} else {
|
||||||
|
@ -979,12 +978,13 @@ struct TuplePolicy {
|
||||||
static const size_t tuple_size = ::std::tr1::tuple_size<Tuple>::value;
|
static const size_t tuple_size = ::std::tr1::tuple_size<Tuple>::value;
|
||||||
|
|
||||||
template <size_t I>
|
template <size_t I>
|
||||||
struct tuple_element : ::std::tr1::tuple_element<I, Tuple> {};
|
struct tuple_element : ::std::tr1::tuple_element<static_cast<int>(I), Tuple> {
|
||||||
|
};
|
||||||
|
|
||||||
template <size_t I>
|
template <size_t I>
|
||||||
static typename AddReference<
|
static typename AddReference<const typename ::std::tr1::tuple_element<
|
||||||
const typename ::std::tr1::tuple_element<I, Tuple>::type>::type get(
|
static_cast<int>(I), Tuple>::type>::type
|
||||||
const Tuple& tuple) {
|
get(const Tuple& tuple) {
|
||||||
return ::std::tr1::get<I>(tuple);
|
return ::std::tr1::get<I>(tuple);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
//
|
//
|
||||||
// Utilities for testing Google Test itself and code that uses Google Test
|
// Utilities for testing Google Test itself and code that uses Google Test
|
||||||
// (e.g. frameworks built on top of Google Test).
|
// (e.g. frameworks built on top of Google Test).
|
||||||
|
@ -39,6 +38,9 @@
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
||||||
|
/* class A needs to have dll-interface to be used by clients of class B */)
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
// This helper class can be used to mock out Google Test failure reporting
|
// This helper class can be used to mock out Google Test failure reporting
|
||||||
|
@ -113,6 +115,8 @@ class GTEST_API_ SingleFailureChecker {
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
||||||
|
|
||||||
// A set of macros for testing Google Test assertions or code that's expected
|
// A set of macros for testing Google Test assertions or code that's expected
|
||||||
// to generate Google Test fatal failures. It verifies that the given
|
// to generate Google Test fatal failures. It verifies that the given
|
||||||
// statement will cause exactly one fatal Google Test failure with 'substr'
|
// statement will cause exactly one fatal Google Test failure with 'substr'
|
||||||
|
|
|
@ -27,9 +27,6 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// Author: mheule@google.com (Markus Heule)
|
|
||||||
//
|
|
||||||
|
|
||||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||||
|
|
||||||
#ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
|
#ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
|
||||||
|
@ -40,6 +37,9 @@
|
||||||
#include "gtest/internal/gtest-internal.h"
|
#include "gtest/internal/gtest-internal.h"
|
||||||
#include "gtest/internal/gtest-string.h"
|
#include "gtest/internal/gtest-string.h"
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
||||||
|
/* class A needs to have dll-interface to be used by clients of class B */)
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
// A copyable object representing the result of a test part (i.e. an
|
// A copyable object representing the result of a test part (i.e. an
|
||||||
|
@ -145,7 +145,7 @@ class GTEST_API_ TestPartResultArray {
|
||||||
};
|
};
|
||||||
|
|
||||||
// This interface knows how to report a test part result.
|
// This interface knows how to report a test part result.
|
||||||
class TestPartResultReporterInterface {
|
class GTEST_API_ TestPartResultReporterInterface {
|
||||||
public:
|
public:
|
||||||
virtual ~TestPartResultReporterInterface() {}
|
virtual ~TestPartResultReporterInterface() {}
|
||||||
|
|
||||||
|
@ -178,4 +178,6 @@ class GTEST_API_ HasNewFatalFailureHelper
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
||||||
|
|
||||||
#endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
|
#endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
//
|
//
|
||||||
// The Google C++ Testing and Mocking Framework (Google Test)
|
// The Google C++ Testing and Mocking Framework (Google Test)
|
||||||
//
|
//
|
||||||
|
@ -67,6 +66,9 @@
|
||||||
#include "gtest/gtest-test-part.h"
|
#include "gtest/gtest-test-part.h"
|
||||||
#include "gtest/gtest-typed-test.h"
|
#include "gtest/gtest-typed-test.h"
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
||||||
|
/* class A needs to have dll-interface to be used by clients of class B */)
|
||||||
|
|
||||||
// Depending on the platform, different string classes are available.
|
// Depending on the platform, different string classes are available.
|
||||||
// On Linux, in addition to ::std::string, Google also makes use of
|
// On Linux, in addition to ::std::string, Google also makes use of
|
||||||
// class ::string, which has the same interface as ::std::string, but
|
// class ::string, which has the same interface as ::std::string, but
|
||||||
|
@ -316,7 +318,7 @@ class GTEST_API_ AssertionResult {
|
||||||
const char* message() const {
|
const char* message() const {
|
||||||
return message_.get() != NULL ? message_->c_str() : "";
|
return message_.get() != NULL ? message_->c_str() : "";
|
||||||
}
|
}
|
||||||
// TODO(vladl@google.com): Remove this after making sure no clients use it.
|
// FIXME: Remove this after making sure no clients use it.
|
||||||
// Deprecated; please use message() instead.
|
// Deprecated; please use message() instead.
|
||||||
const char* failure_message() const { return message(); }
|
const char* failure_message() const { return message(); }
|
||||||
|
|
||||||
|
@ -622,7 +624,7 @@ class GTEST_API_ TestResult {
|
||||||
|
|
||||||
// Adds a failure if the key is a reserved attribute of Google Test
|
// Adds a failure if the key is a reserved attribute of Google Test
|
||||||
// testcase tags. Returns true if the property is valid.
|
// testcase tags. Returns true if the property is valid.
|
||||||
// TODO(russr): Validate attribute names are legal and human readable.
|
// FIXME: Validate attribute names are legal and human readable.
|
||||||
static bool ValidateTestProperty(const std::string& xml_element,
|
static bool ValidateTestProperty(const std::string& xml_element,
|
||||||
const TestProperty& test_property);
|
const TestProperty& test_property);
|
||||||
|
|
||||||
|
@ -2331,4 +2333,6 @@ inline int RUN_ALL_TESTS() {
|
||||||
return ::testing::UnitTest::GetInstance()->Run();
|
return ::testing::UnitTest::GetInstance()->Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
||||||
|
|
||||||
#endif // GTEST_INCLUDE_GTEST_GTEST_H_
|
#endif // GTEST_INCLUDE_GTEST_GTEST_H_
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
//
|
//
|
||||||
// Google C++ Testing and Mocking Framework definitions useful in production code.
|
// Google C++ Testing and Mocking Framework definitions useful in production code.
|
||||||
// GOOGLETEST_CM0003 DO NOT DELETE
|
// GOOGLETEST_CM0003 DO NOT DELETE
|
||||||
|
|
56
googletest/include/gtest/internal/custom/README.md
Normal file
56
googletest/include/gtest/internal/custom/README.md
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
# Customization Points
|
||||||
|
|
||||||
|
The custom directory is an injection point for custom user configurations.
|
||||||
|
|
||||||
|
## Header `gtest.h`
|
||||||
|
|
||||||
|
### The following macros can be defined:
|
||||||
|
|
||||||
|
* `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of
|
||||||
|
`OsStackTraceGetterInterface`.
|
||||||
|
* `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for `testing::TempDir()`. See
|
||||||
|
`testing::TempDir` for semantics and signature.
|
||||||
|
|
||||||
|
## Header `gtest-port.h`
|
||||||
|
|
||||||
|
The following macros can be defined:
|
||||||
|
|
||||||
|
### Flag related macros:
|
||||||
|
|
||||||
|
* `GTEST_FLAG(flag_name)`
|
||||||
|
* `GTEST_USE_OWN_FLAGFILE_FLAG_` - Define to 0 when the system provides its
|
||||||
|
own flagfile flag parsing.
|
||||||
|
* `GTEST_DECLARE_bool_(name)`
|
||||||
|
* `GTEST_DECLARE_int32_(name)`
|
||||||
|
* `GTEST_DECLARE_string_(name)`
|
||||||
|
* `GTEST_DEFINE_bool_(name, default_val, doc)`
|
||||||
|
* `GTEST_DEFINE_int32_(name, default_val, doc)`
|
||||||
|
* `GTEST_DEFINE_string_(name, default_val, doc)`
|
||||||
|
|
||||||
|
### Logging:
|
||||||
|
|
||||||
|
* `GTEST_LOG_(severity)`
|
||||||
|
* `GTEST_CHECK_(condition)`
|
||||||
|
* Functions `LogToStderr()` and `FlushInfoLog()` have to be provided too.
|
||||||
|
|
||||||
|
### Threading:
|
||||||
|
|
||||||
|
* `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided.
|
||||||
|
* `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if `Mutex` and `ThreadLocal`
|
||||||
|
are already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)`
|
||||||
|
and `GTEST_DEFINE_STATIC_MUTEX_(mutex)`
|
||||||
|
* `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)`
|
||||||
|
* `GTEST_LOCK_EXCLUDED_(locks)`
|
||||||
|
|
||||||
|
### Underlying library support features
|
||||||
|
|
||||||
|
* `GTEST_HAS_CXXABI_H_`
|
||||||
|
|
||||||
|
### Exporting API symbols:
|
||||||
|
|
||||||
|
* `GTEST_API_` - Specifier for exported symbols.
|
||||||
|
|
||||||
|
## Header `gtest-printers.h`
|
||||||
|
|
||||||
|
* See documentation at `gtest/gtest-printers.h` for details on how to define a
|
||||||
|
custom printer.
|
|
@ -27,40 +27,7 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// Injection point for custom user configurations.
|
// Injection point for custom user configurations. See README for details
|
||||||
// The following macros can be defined:
|
|
||||||
//
|
|
||||||
// Flag related macros:
|
|
||||||
// GTEST_FLAG(flag_name)
|
|
||||||
// GTEST_USE_OWN_FLAGFILE_FLAG_ - Define to 0 when the system provides its
|
|
||||||
// own flagfile flag parsing.
|
|
||||||
// GTEST_DECLARE_bool_(name)
|
|
||||||
// GTEST_DECLARE_int32_(name)
|
|
||||||
// GTEST_DECLARE_string_(name)
|
|
||||||
// GTEST_DEFINE_bool_(name, default_val, doc)
|
|
||||||
// GTEST_DEFINE_int32_(name, default_val, doc)
|
|
||||||
// GTEST_DEFINE_string_(name, default_val, doc)
|
|
||||||
//
|
|
||||||
// Logging:
|
|
||||||
// GTEST_LOG_(severity)
|
|
||||||
// GTEST_CHECK_(condition)
|
|
||||||
// Functions LogToStderr() and FlushInfoLog() have to be provided too.
|
|
||||||
//
|
|
||||||
// Threading:
|
|
||||||
// GTEST_HAS_NOTIFICATION_ - Enabled if Notification is already provided.
|
|
||||||
// GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - Enabled if Mutex and ThreadLocal are
|
|
||||||
// already provided.
|
|
||||||
// Must also provide GTEST_DECLARE_STATIC_MUTEX_(mutex) and
|
|
||||||
// GTEST_DEFINE_STATIC_MUTEX_(mutex)
|
|
||||||
//
|
|
||||||
// GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
|
|
||||||
// GTEST_LOCK_EXCLUDED_(locks)
|
|
||||||
//
|
|
||||||
// Underlying library support features:
|
|
||||||
// GTEST_HAS_CXXABI_H_
|
|
||||||
//
|
|
||||||
// Exporting API symbols:
|
|
||||||
// GTEST_API_ - Specifier for exported symbols.
|
|
||||||
//
|
//
|
||||||
// ** Custom implementation starts here **
|
// ** Custom implementation starts here **
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
// installation of gTest.
|
// installation of gTest.
|
||||||
// It will be included from gtest-printers.h and the overrides in this file
|
// It will be included from gtest-printers.h and the overrides in this file
|
||||||
// will be visible to everyone.
|
// will be visible to everyone.
|
||||||
// See documentation at gtest/gtest-printers.h for details on how to define a
|
//
|
||||||
// custom printer.
|
// Injection point for custom user configurations. See README for details
|
||||||
//
|
//
|
||||||
// ** Custom implementation starts here **
|
// ** Custom implementation starts here **
|
||||||
|
|
||||||
|
|
|
@ -27,15 +27,7 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// Injection point for custom user configurations.
|
// Injection point for custom user configurations. See README for details
|
||||||
// The following macros can be defined:
|
|
||||||
//
|
|
||||||
// GTEST_OS_STACK_TRACE_GETTER_ - The name of an implementation of
|
|
||||||
// OsStackTraceGetterInterface.
|
|
||||||
//
|
|
||||||
// GTEST_CUSTOM_TEMPDIR_FUNCTION_ - An override for testing::TempDir().
|
|
||||||
// See testing::TempDir for semantics and
|
|
||||||
// signature.
|
|
||||||
//
|
//
|
||||||
// ** Custom implementation starts here **
|
// ** Custom implementation starts here **
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// The Google C++ Testing and Mocking Framework (Google Test)
|
// The Google C++ Testing and Mocking Framework (Google Test)
|
||||||
//
|
//
|
||||||
// This header file defines internal utilities needed for implementing
|
// This header file defines internal utilities needed for implementing
|
||||||
|
@ -53,6 +52,9 @@ const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
|
||||||
|
|
||||||
#if GTEST_HAS_DEATH_TEST
|
#if GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
||||||
|
/* class A needs to have dll-interface to be used by clients of class B */)
|
||||||
|
|
||||||
// DeathTest is a class that hides much of the complexity of the
|
// DeathTest is a class that hides much of the complexity of the
|
||||||
// GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
|
// GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
|
||||||
// returns a concrete class that depends on the prevailing death test
|
// returns a concrete class that depends on the prevailing death test
|
||||||
|
@ -136,6 +138,8 @@ class GTEST_API_ DeathTest {
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
||||||
|
|
||||||
// Factory interface for death tests. May be mocked out for testing.
|
// Factory interface for death tests. May be mocked out for testing.
|
||||||
class DeathTestFactory {
|
class DeathTestFactory {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// Google Test filepath utilities
|
// Google Test filepath utilities
|
||||||
//
|
//
|
||||||
// This header file declares classes and functions used internally by
|
// This header file declares classes and functions used internally by
|
||||||
|
@ -43,6 +42,9 @@
|
||||||
|
|
||||||
#include "gtest/internal/gtest-string.h"
|
#include "gtest/internal/gtest-string.h"
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
||||||
|
/* class A needs to have dll-interface to be used by clients of class B */)
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
|
@ -204,4 +206,6 @@ class GTEST_API_ FilePath {
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
||||||
|
|
||||||
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
|
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// The Google C++ Testing and Mocking Framework (Google Test)
|
// The Google C++ Testing and Mocking Framework (Google Test)
|
||||||
//
|
//
|
||||||
// This header file declares functions and macros used internally by
|
// This header file declares functions and macros used internally by
|
||||||
|
@ -142,6 +141,9 @@ GTEST_API_ std::string AppendUserMessage(
|
||||||
|
|
||||||
#if GTEST_HAS_EXCEPTIONS
|
#if GTEST_HAS_EXCEPTIONS
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4275 \
|
||||||
|
/* an exported class was derived from a class that was not exported */)
|
||||||
|
|
||||||
// This exception is thrown by (and only by) a failed Google Test
|
// This exception is thrown by (and only by) a failed Google Test
|
||||||
// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
|
// assertion when GTEST_FLAG(throw_on_failure) is true (if exceptions
|
||||||
// are enabled). We derive it from std::runtime_error, which is for
|
// are enabled). We derive it from std::runtime_error, which is for
|
||||||
|
@ -153,6 +155,8 @@ class GTEST_API_ GoogleTestFailureException : public ::std::runtime_error {
|
||||||
explicit GoogleTestFailureException(const TestPartResult& failure);
|
explicit GoogleTestFailureException(const TestPartResult& failure);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4275
|
||||||
|
|
||||||
#endif // GTEST_HAS_EXCEPTIONS
|
#endif // GTEST_HAS_EXCEPTIONS
|
||||||
|
|
||||||
namespace edit_distance {
|
namespace edit_distance {
|
||||||
|
@ -529,6 +533,9 @@ GTEST_API_ bool SkipPrefix(const char* prefix, const char** pstr);
|
||||||
|
|
||||||
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
|
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \
|
||||||
|
/* class A needs to have dll-interface to be used by clients of class B */)
|
||||||
|
|
||||||
// State of the definition of a type-parameterized test case.
|
// State of the definition of a type-parameterized test case.
|
||||||
class GTEST_API_ TypedTestCasePState {
|
class GTEST_API_ TypedTestCasePState {
|
||||||
public:
|
public:
|
||||||
|
@ -574,6 +581,8 @@ class GTEST_API_ TypedTestCasePState {
|
||||||
RegisteredTestsMap registered_tests_;
|
RegisteredTestsMap registered_tests_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251
|
||||||
|
|
||||||
// Skips to the first non-space char after the first comma in 'str';
|
// Skips to the first non-space char after the first comma in 'str';
|
||||||
// returns NULL if no comma is found in 'str'.
|
// returns NULL if no comma is found in 'str'.
|
||||||
inline const char* SkipComma(const char* str) {
|
inline const char* SkipComma(const char* str) {
|
||||||
|
|
|
@ -27,8 +27,6 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// Authors: Dan Egnor (egnor@google.com)
|
|
||||||
//
|
|
||||||
// A "smart" pointer type with reference tracking. Every pointer to a
|
// A "smart" pointer type with reference tracking. Every pointer to a
|
||||||
// particular object is kept on a circular linked list. When the last pointer
|
// particular object is kept on a circular linked list. When the last pointer
|
||||||
// to an object is destroyed or reassigned, the object is deleted.
|
// to an object is destroyed or reassigned, the object is deleted.
|
||||||
|
@ -62,7 +60,7 @@
|
||||||
// raw pointer (e.g. via get()) concurrently, and
|
// raw pointer (e.g. via get()) concurrently, and
|
||||||
// - it's safe to write to two linked_ptrs that point to the same
|
// - it's safe to write to two linked_ptrs that point to the same
|
||||||
// shared object concurrently.
|
// shared object concurrently.
|
||||||
// TODO(wan@google.com): rename this to safe_linked_ptr to avoid
|
// FIXME: rename this to safe_linked_ptr to avoid
|
||||||
// confusion with normal linked_ptr.
|
// confusion with normal linked_ptr.
|
||||||
|
|
||||||
// GOOGLETEST_CM0001 DO NOT DELETE
|
// GOOGLETEST_CM0001 DO NOT DELETE
|
||||||
|
|
|
@ -30,8 +30,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: vladl@google.com (Vlad Losev)
|
|
||||||
|
|
||||||
// Type and function utilities for implementing parameterized tests.
|
// Type and function utilities for implementing parameterized tests.
|
||||||
// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
|
// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
|
||||||
|
|
|
@ -29,8 +29,7 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: vladl@google.com (Vlad Losev)
|
|
||||||
|
|
||||||
// Type and function utilities for implementing parameterized tests.
|
// Type and function utilities for implementing parameterized tests.
|
||||||
// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
|
// This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: vladl@google.com (Vlad Losev)
|
|
||||||
|
|
||||||
// Type and function utilities for implementing parameterized tests.
|
// Type and function utilities for implementing parameterized tests.
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,6 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
// Authors: wan@google.com (Zhanyong Wan)
|
|
||||||
//
|
|
||||||
// Low-level types and utilities for porting Google Test to various
|
// Low-level types and utilities for porting Google Test to various
|
||||||
// platforms. All macros ending with _ and symbols defined in an
|
// platforms. All macros ending with _ and symbols defined in an
|
||||||
// internal namespace are subject to change without notice. Code
|
// internal namespace are subject to change without notice. Code
|
||||||
|
@ -329,6 +327,22 @@
|
||||||
# define GTEST_DISABLE_MSC_WARNINGS_POP_()
|
# define GTEST_DISABLE_MSC_WARNINGS_POP_()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Clang on Windows does not understand MSVC's pragma warning.
|
||||||
|
// We need clang-specific way to disable function deprecation warning.
|
||||||
|
#ifdef __clang__
|
||||||
|
# define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \
|
||||||
|
_Pragma("clang diagnostic push") \
|
||||||
|
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") \
|
||||||
|
_Pragma("clang diagnostic ignored \"-Wdeprecated-implementations\"")
|
||||||
|
#define GTEST_DISABLE_MSC_DEPRECATED_POP_() \
|
||||||
|
_Pragma("clang diagnostic pop")
|
||||||
|
#else
|
||||||
|
# define GTEST_DISABLE_MSC_DEPRECATED_PUSH_() \
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996)
|
||||||
|
# define GTEST_DISABLE_MSC_DEPRECATED_POP_() \
|
||||||
|
GTEST_DISABLE_MSC_WARNINGS_POP_()
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef GTEST_LANG_CXX11
|
#ifndef GTEST_LANG_CXX11
|
||||||
// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
|
// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
|
||||||
// -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a
|
// -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a
|
||||||
|
@ -533,7 +547,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
|
||||||
#ifndef GTEST_HAS_STD_WSTRING
|
#ifndef GTEST_HAS_STD_WSTRING
|
||||||
// The user didn't tell us whether ::std::wstring is available, so we need
|
// The user didn't tell us whether ::std::wstring is available, so we need
|
||||||
// to figure it out.
|
// to figure it out.
|
||||||
// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
|
// FIXME: uses autoconf to detect whether ::std::wstring
|
||||||
// is available.
|
// is available.
|
||||||
|
|
||||||
// Cygwin 1.7 and below doesn't support ::std::wstring.
|
// Cygwin 1.7 and below doesn't support ::std::wstring.
|
||||||
|
@ -745,7 +759,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
|
||||||
// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
|
// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
|
||||||
// which is #included by <tr1/tuple>, to not compile when RTTI is
|
// which is #included by <tr1/tuple>, to not compile when RTTI is
|
||||||
// disabled. _TR1_FUNCTIONAL is the header guard for
|
// disabled. _TR1_FUNCTIONAL is the header guard for
|
||||||
// <tr1/functional>. Hence the following #define is a hack to prevent
|
// <tr1/functional>. Hence the following #define is used to prevent
|
||||||
// <tr1/functional> from being included.
|
// <tr1/functional> from being included.
|
||||||
# define _TR1_FUNCTIONAL 1
|
# define _TR1_FUNCTIONAL 1
|
||||||
# include <tr1/tuple>
|
# include <tr1/tuple>
|
||||||
|
@ -1250,7 +1264,7 @@ class GTEST_API_ RE {
|
||||||
// PartialMatch(str, re) returns true iff regular expression re
|
// PartialMatch(str, re) returns true iff regular expression re
|
||||||
// matches a substring of str (including str itself).
|
// matches a substring of str (including str itself).
|
||||||
//
|
//
|
||||||
// TODO(wan@google.com): make FullMatch() and PartialMatch() work
|
// FIXME: make FullMatch() and PartialMatch() work
|
||||||
// when str contains NUL characters.
|
// when str contains NUL characters.
|
||||||
static bool FullMatch(const ::std::string& str, const RE& re) {
|
static bool FullMatch(const ::std::string& str, const RE& re) {
|
||||||
return FullMatch(str.c_str(), re);
|
return FullMatch(str.c_str(), re);
|
||||||
|
@ -1277,7 +1291,7 @@ class GTEST_API_ RE {
|
||||||
void Init(const char* regex);
|
void Init(const char* regex);
|
||||||
|
|
||||||
// We use a const char* instead of an std::string, as Google Test used to be
|
// We use a const char* instead of an std::string, as Google Test used to be
|
||||||
// used where std::string is not available. TODO(wan@google.com): change to
|
// used where std::string is not available. FIXME: change to
|
||||||
// std::string.
|
// std::string.
|
||||||
const char* pattern_;
|
const char* pattern_;
|
||||||
bool is_valid_;
|
bool is_valid_;
|
||||||
|
@ -2093,8 +2107,8 @@ class MutexBase {
|
||||||
// particular, the owner_ field (a pthread_t) is not explicitly initialized.
|
// particular, the owner_ field (a pthread_t) is not explicitly initialized.
|
||||||
// This allows initialization to work whether pthread_t is a scalar or struct.
|
// This allows initialization to work whether pthread_t is a scalar or struct.
|
||||||
// The flag -Wmissing-field-initializers must not be specified for this to work.
|
// The flag -Wmissing-field-initializers must not be specified for this to work.
|
||||||
# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
|
#define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
|
||||||
::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false }
|
::testing::internal::MutexBase mutex = {PTHREAD_MUTEX_INITIALIZER, false, 0}
|
||||||
|
|
||||||
// The Mutex class can only be used for mutexes created at runtime. It
|
// The Mutex class can only be used for mutexes created at runtime. It
|
||||||
// shares its API with MutexBase otherwise.
|
// shares its API with MutexBase otherwise.
|
||||||
|
@ -2484,7 +2498,7 @@ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
|
||||||
|
|
||||||
// Functions deprecated by MSVC 8.0.
|
// Functions deprecated by MSVC 8.0.
|
||||||
|
|
||||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996 /* deprecated function */)
|
GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
|
||||||
|
|
||||||
inline const char* StrNCpy(char* dest, const char* src, size_t n) {
|
inline const char* StrNCpy(char* dest, const char* src, size_t n) {
|
||||||
return strncpy(dest, src, n);
|
return strncpy(dest, src, n);
|
||||||
|
@ -2532,7 +2546,7 @@ inline const char* GetEnv(const char* name) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
GTEST_DISABLE_MSC_WARNINGS_POP_()
|
GTEST_DISABLE_MSC_DEPRECATED_POP_()
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS_MOBILE
|
#if GTEST_OS_WINDOWS_MOBILE
|
||||||
// Windows CE has no C library. The abort() function is used in
|
// Windows CE has no C library. The abort() function is used in
|
||||||
|
@ -2670,7 +2684,7 @@ typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseconds.
|
||||||
// Parses 'str' for a 32-bit signed integer. If successful, writes the result
|
// Parses 'str' for a 32-bit signed integer. If successful, writes the result
|
||||||
// to *value and returns true; otherwise leaves *value unchanged and returns
|
// to *value and returns true; otherwise leaves *value unchanged and returns
|
||||||
// false.
|
// false.
|
||||||
// TODO(chandlerc): Find a better way to refactor flag and environment parsing
|
// FIXME: Find a better way to refactor flag and environment parsing
|
||||||
// out of both gtest-port.cc and gtest.cc to avoid exporting this utility
|
// out of both gtest-port.cc and gtest.cc to avoid exporting this utility
|
||||||
// function.
|
// function.
|
||||||
bool ParseInt32(const Message& src_text, const char* str, Int32* value);
|
bool ParseInt32(const Message& src_text, const char* str, Int32* value);
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// The Google C++ Testing and Mocking Framework (Google Test)
|
// The Google C++ Testing and Mocking Framework (Google Test)
|
||||||
//
|
//
|
||||||
// This header file declares the String class and functions used internally by
|
// This header file declares the String class and functions used internally by
|
||||||
|
|
|
@ -30,8 +30,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
|
// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
|
||||||
|
|
||||||
|
@ -44,7 +43,7 @@
|
||||||
|
|
||||||
// The compiler used in Symbian has a bug that prevents us from declaring the
|
// The compiler used in Symbian has a bug that prevents us from declaring the
|
||||||
// tuple template as a friend (it complains that tuple is redefined). This
|
// tuple template as a friend (it complains that tuple is redefined). This
|
||||||
// hack bypasses the bug by declaring the members that should otherwise be
|
// bypasses the bug by declaring the members that should otherwise be
|
||||||
// private as public.
|
// private as public.
|
||||||
// Sun Studio versions < 12 also have the above bug.
|
// Sun Studio versions < 12 also have the above bug.
|
||||||
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
|
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
|
||||||
|
|
|
@ -29,8 +29,7 @@ $$ This meta comment fixes auto-indentation in Emacs. }}
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
|
// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
|
||||||
|
|
||||||
|
@ -43,7 +42,7 @@ $$ This meta comment fixes auto-indentation in Emacs. }}
|
||||||
|
|
||||||
// The compiler used in Symbian has a bug that prevents us from declaring the
|
// The compiler used in Symbian has a bug that prevents us from declaring the
|
||||||
// tuple template as a friend (it complains that tuple is redefined). This
|
// tuple template as a friend (it complains that tuple is redefined). This
|
||||||
// hack bypasses the bug by declaring the members that should otherwise be
|
// bypasses the bug by declaring the members that should otherwise be
|
||||||
// private as public.
|
// private as public.
|
||||||
// Sun Studio versions < 12 also have the above bug.
|
// Sun Studio versions < 12 also have the above bug.
|
||||||
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
|
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
|
||||||
|
|
|
@ -30,8 +30,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Type utilities needed for implementing typed and type-parameterized
|
// Type utilities needed for implementing typed and type-parameterized
|
||||||
// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
|
// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
|
||||||
|
|
|
@ -28,8 +28,7 @@ $var n = 50 $$ Maximum length of type lists we want to support.
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
// Type utilities needed for implementing typed and type-parameterized
|
// Type utilities needed for implementing typed and type-parameterized
|
||||||
// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
|
// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
|
||||||
|
|
|
@ -26,9 +26,8 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
// Author: vladl@google.com (Vlad Losev)
|
|
||||||
|
|
||||||
// This provides interface PrimeTable that determines whether a number is a
|
// This provides interface PrimeTable that determines whether a number is a
|
||||||
// prime and determines a next prime number. This interface is used
|
// prime and determines a next prime number. This interface is used
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// A sample program demonstrating using Google C++ testing framework.
|
// A sample program demonstrating using Google C++ testing framework.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
#include "sample1.h"
|
#include "sample1.h"
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// A sample program demonstrating using Google C++ testing framework.
|
// A sample program demonstrating using Google C++ testing framework.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
#ifndef GTEST_SAMPLES_SAMPLE1_H_
|
#ifndef GTEST_SAMPLES_SAMPLE1_H_
|
||||||
#define GTEST_SAMPLES_SAMPLE1_H_
|
#define GTEST_SAMPLES_SAMPLE1_H_
|
||||||
|
|
|
@ -25,8 +25,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: vladl@google.com (Vlad Losev)
|
|
||||||
|
|
||||||
// This sample shows how to use Google Test listener API to implement
|
// This sample shows how to use Google Test listener API to implement
|
||||||
// a primitive leak checker.
|
// a primitive leak checker.
|
||||||
|
|
|
@ -28,9 +28,6 @@
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// A sample program demonstrating using Google C++ testing framework.
|
// A sample program demonstrating using Google C++ testing framework.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
|
|
||||||
// This sample shows how to write a simple unit test for a function,
|
// This sample shows how to write a simple unit test for a function,
|
||||||
// using Google C++ testing framework.
|
// using Google C++ testing framework.
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// A sample program demonstrating using Google C++ testing framework.
|
// A sample program demonstrating using Google C++ testing framework.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
#include "sample2.h"
|
#include "sample2.h"
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// A sample program demonstrating using Google C++ testing framework.
|
// A sample program demonstrating using Google C++ testing framework.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
#ifndef GTEST_SAMPLES_SAMPLE2_H_
|
#ifndef GTEST_SAMPLES_SAMPLE2_H_
|
||||||
#define GTEST_SAMPLES_SAMPLE2_H_
|
#define GTEST_SAMPLES_SAMPLE2_H_
|
||||||
|
|
|
@ -28,9 +28,6 @@
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// A sample program demonstrating using Google C++ testing framework.
|
// A sample program demonstrating using Google C++ testing framework.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
|
|
||||||
// This sample shows how to write a more complex unit test for a class
|
// This sample shows how to write a more complex unit test for a class
|
||||||
// that has multiple member functions.
|
// that has multiple member functions.
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// A sample program demonstrating using Google C++ testing framework.
|
// A sample program demonstrating using Google C++ testing framework.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
#ifndef GTEST_SAMPLES_SAMPLE3_INL_H_
|
#ifndef GTEST_SAMPLES_SAMPLE3_INL_H_
|
||||||
#define GTEST_SAMPLES_SAMPLE3_INL_H_
|
#define GTEST_SAMPLES_SAMPLE3_INL_H_
|
||||||
|
|
|
@ -28,9 +28,6 @@
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// A sample program demonstrating using Google C++ testing framework.
|
// A sample program demonstrating using Google C++ testing framework.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
|
|
||||||
// In this example, we use a more advanced feature of Google Test called
|
// In this example, we use a more advanced feature of Google Test called
|
||||||
// test fixture.
|
// test fixture.
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// A sample program demonstrating using Google C++ testing framework.
|
// A sample program demonstrating using Google C++ testing framework.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -40,6 +38,16 @@ int Counter::Increment() {
|
||||||
return counter_++;
|
return counter_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns the current counter value, and decrements it.
|
||||||
|
// counter can not be less than 0, return 0 in this case
|
||||||
|
int Counter::Decrement() {
|
||||||
|
if (counter_ == 0) {
|
||||||
|
return counter_;
|
||||||
|
} else {
|
||||||
|
return counter_--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Prints the current counter value to STDOUT.
|
// Prints the current counter value to STDOUT.
|
||||||
void Counter::Print() const {
|
void Counter::Print() const {
|
||||||
printf("%d", counter_);
|
printf("%d", counter_);
|
||||||
|
|
|
@ -28,9 +28,6 @@
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// A sample program demonstrating using Google C++ testing framework.
|
// A sample program demonstrating using Google C++ testing framework.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
#ifndef GTEST_SAMPLES_SAMPLE4_H_
|
#ifndef GTEST_SAMPLES_SAMPLE4_H_
|
||||||
#define GTEST_SAMPLES_SAMPLE4_H_
|
#define GTEST_SAMPLES_SAMPLE4_H_
|
||||||
|
|
||||||
|
@ -46,6 +43,9 @@ class Counter {
|
||||||
// Returns the current counter value, and increments it.
|
// Returns the current counter value, and increments it.
|
||||||
int Increment();
|
int Increment();
|
||||||
|
|
||||||
|
// Returns the current counter value, and decrements it.
|
||||||
|
int Decrement();
|
||||||
|
|
||||||
// Prints the current counter value to STDOUT.
|
// Prints the current counter value to STDOUT.
|
||||||
void Print() const;
|
void Print() const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,8 +26,7 @@
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
|
|
||||||
#include "sample4.h"
|
#include "sample4.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
@ -38,12 +37,17 @@ namespace {
|
||||||
TEST(Counter, Increment) {
|
TEST(Counter, Increment) {
|
||||||
Counter c;
|
Counter c;
|
||||||
|
|
||||||
|
// Test that counter 0 returns 0
|
||||||
|
EXPECT_EQ(0, c.Decrement());
|
||||||
|
|
||||||
// EXPECT_EQ() evaluates its arguments exactly once, so they
|
// EXPECT_EQ() evaluates its arguments exactly once, so they
|
||||||
// can have side effects.
|
// can have side effects.
|
||||||
|
|
||||||
EXPECT_EQ(0, c.Increment());
|
EXPECT_EQ(0, c.Increment());
|
||||||
EXPECT_EQ(1, c.Increment());
|
EXPECT_EQ(1, c.Increment());
|
||||||
EXPECT_EQ(2, c.Increment());
|
EXPECT_EQ(2, c.Increment());
|
||||||
|
|
||||||
|
EXPECT_EQ(3, c.Decrement());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user