diff --git a/.gitignore b/.gitignore
index 3c4efe2..de730ba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,8 @@
*.userprefs
# Build results
+build/*
+!build/README.md
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
@@ -22,6 +24,9 @@ bld/
[Oo]bj/
[Ll]og/
+# User development files
+compile_commands.json
+
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
@@ -258,4 +263,4 @@ paket-files/
# Python Tools for Visual Studio (PTVS)
__pycache__/
-*.pyc
\ No newline at end of file
+*.pyc
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..abccdb3
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,156 @@
+# Initial CMake configurations
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Debug)
+endif()
+
+# CMakeLists for RocketAnalytics
+cmake_minimum_required (VERSION 3.9)
+project (
+ RocketAnalyticsLib
+ VERSION 0.2
+ DESCRIPTION "Rocket League replay parsing library"
+)
+
+set (CMAKE_CXX_STANDARD 17)
+add_compile_options(-std=c++17)
+
+# Google Testing Framework
+# Download and unpack googletest at configure time
+configure_file (CMakeLists.txt.in googletest-download/CMakeLists.txt)
+execute_process (COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
+ RESULT_VARIABLE result
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download
+)
+if (result)
+ message (FATAL_ERROR "CMake step for googletest failed: ${result}")
+endif ()
+execute_process (COMMAND ${CMAKE_COMMAND} --build .
+ RESULT_VARIABLE result
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download
+)
+if (result)
+ message (FATAL_ERROR "Build step for googletest failed: ${result}")
+endif ()
+
+# Prevent overriding the parent project's compiler/linker
+# settings on Windows
+set (gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+
+# Add googletest directly to our build. This defines
+# the gtest and gtest_main targets.
+add_subdirectory (${CMAKE_BINARY_DIR}/googletest-src
+ ${CMAKE_BINARY_DIR}/googletest-build
+ EXCLUDE_FROM_ALL)
+
+# The gtest/gtest_main targets carry header search path
+# dependencies automatically when using CMake 2.8.11 or
+# later. Otherwise we have to add them here ourselves.
+if (CMAKE_VERSION VERSION_LESS 2.8.11)
+ include_directories ("${gtest_SOURCE_DIR}/include")
+endif ()
+
+# Compiler flags
+# set (CMAKE_CXX_FLAGS
+# "-std=c++14 -Wall -Wextra -Wpedantic -Wzero-as-null-pointer-constant"
+# )
+
+# Configure RocketAnalyticsLib Build
+add_library (RocketAnalyticsLib
+ "RocketAnalyticsLib/src/BinaryReader.cpp"
+ "RocketAnalyticsLib/src/Byte.cpp"
+ "RocketAnalyticsLib/src/ReplayFile.cpp"
+ "RocketAnalyticsLib/src/ReplayFileReader.cpp"
+ "RocketAnalyticsLib/src/ReplayHeader.cpp"
+ "RocketAnalyticsLib/src/ReplayLevels.cpp"
+ "RocketAnalyticsLib/src/Version.cpp"
+ "RocketAnalyticsLib/src/properties/ByteValue.cpp"
+ "RocketAnalyticsLib/src/properties/Property.cpp"
+ "RocketAnalyticsLib/src/properties/PropertyType.cpp"
+ "RocketAnalyticsLib/src/properties/PropertyValue.cpp"
+)
+
+# TODO: Add public interface header
+# RocketAnalyticsLib header files
+target_include_directories (RocketAnalyticsLib
+ PRIVATE
+ ${PROJECT_SOURCE_DIR}/RocketAnalyticsLib/include
+ ${PROJECT_SOURCE_DIR}/RocketAnalyticsLib/include/properties
+)
+
+# RocketAnalyticsLib properties
+set_target_properties (RocketAnalyticsLib PROPERTIES
+ VERSION ${PROJECT_VERSION}
+ CXX_STANDARD_REQUIRED 17
+ CXX_STANDARD_REQUIRED ON
+)
+
+# Configure Tests Build
+add_executable (unitTests
+ "RocketAnalyticsTests/src/BinaryReaderTests.cpp"
+ "RocketAnalyticsTests/src/ByteTests.cpp"
+ "RocketAnalyticsTests/src/ReplayHeaderTests.cpp"
+ "RocketAnalyticsTests/src/RocketAnalyticsTests.cpp"
+ "RocketAnalyticsTests/src/VersionTests.cpp"
+ "RocketAnalyticsTests/src/properties/ByteValueTests.cpp"
+ "RocketAnalyticsTests/src/properties/PropertyTests.cpp"
+ "RocketAnalyticsTests/src/properties/PropertyTypeTests.cpp"
+ "RocketAnalyticsTests/src/properties/PropertyValueTests.cpp"
+)
+
+target_link_libraries (unitTests gtest gmock_main RocketAnalyticsLib)
+
+# Tests header files
+target_include_directories (unitTests
+ PRIVATE
+ ${PROJECT_SOURCE_DIR}/RocketAnalyticsLib/include
+ ${PROJECT_SOURCE_DIR}/RocketAnalyticsLib/include/properties
+)
+
+# Tests properties
+set_target_properties (unitTests PROPERTIES
+ VERSION 0.1
+ CXX_STANDARD_REQUIRED 17
+ CXX_STANDARD_REQUIRED ON
+)
+
+enable_testing()
+add_test (NAME unit_tests1 COMMAND unitTests)
+
+# Look for clang-tidy
+unset (CLANG_TIDY_EXECUTABLE)
+if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.clang-tidy")
+ find_program (CLANG_TIDY_EXECUTABLE "clang-tidy"
+ DOC "Path to clang-tidy executable"
+ )
+ if (CLANG_TIDY_EXECUTABLE MATCHES "CLANG_TIDY_EXECUTABLE")
+ unset (CLANG_TIDY_EXECUTABLE)
+ message (WARNING "WARNING: .clang-tidy file found for \
+ project ${PROJECT_NAME}, yet clang-tidy not on PATH so disabling \
+ lint pass"
+ )
+ endif ()
+endif ()
+
+# Add clang-tidy to compilation if it exists
+if (DEFINED CLANG_TIDY_EXECUTABLE)
+ if (MSVC)
+ # Tell clang-tidy to interpret these parameters as clang-cl would
+ set_target_properties (${PROJECT_NAME} PROPERTIES
+ CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE};-fms-extensions;\
+ -fms-compatibility-version=19;-D_M_AMD64=100;"
+ )
+ else()
+ set_target_properties (${PROJECT_NAME} PROPERTIES
+ CXX_CLANG_TIDY ${CLANG_TIDY_EXECUTABLE}
+ )
+ endif()
+endif()
+
+# Output location
+set (LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/build)
+
+# Export compile_commands.json
+set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+# Compiling messages
+message ("Compiling for: " ${CMAKE_BUILD_TYPE})
diff --git a/CMakeLists.txt.in b/CMakeLists.txt.in
new file mode 100644
index 0000000..4c67ef5
--- /dev/null
+++ b/CMakeLists.txt.in
@@ -0,0 +1,15 @@
+cmake_minimum_required(VERSION 2.8.2)
+
+project(googletest-download NONE)
+
+include(ExternalProject)
+ExternalProject_Add(googletest
+ GIT_REPOSITORY https://github.com/google/googletest.git
+ GIT_TAG master
+ SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src"
+ BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build"
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ TEST_COMMAND ""
+)
diff --git a/GTest/GTest.vcxproj b/GTest/GTest.vcxproj
deleted file mode 100644
index ddf2f2d..0000000
--- a/GTest/GTest.vcxproj
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 15.0
- {79E03DBE-1638-49C0-A908-70E3B95B0DC0}
- Win32Proj
- GTest
- 10.0.15063.0
-
-
-
- StaticLibrary
- true
- v141
- Unicode
-
-
- StaticLibrary
- false
- v141
- true
- Unicode
-
-
- StaticLibrary
- true
- v141
- Unicode
-
-
- StaticLibrary
- false
- v141
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Level3
- Disabled
- WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
- $(SolutionDir)googletest\googletest\include;$(SolutionDir)googletest\googletest;%(AdditionalIncludeDirectories)
-
-
- Windows
-
-
-
-
-
-
- Level3
- Disabled
- _DEBUG;_LIB;%(PreprocessorDefinitions)
- $(SolutionDir)googletest\googletest\include;$(SolutionDir)googletest\googletest;%(AdditionalIncludeDirectories)
-
-
- Windows
-
-
-
-
- Level3
-
-
- MaxSpeed
- true
- true
- WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)
-
-
- Windows
- true
- true
-
-
-
-
- Level3
-
-
- MaxSpeed
- true
- true
- NDEBUG;_LIB;%(PreprocessorDefinitions)
-
-
- Windows
- true
- true
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/GTest/GTest.vcxproj.filters b/GTest/GTest.vcxproj.filters
deleted file mode 100644
index 30a8589..0000000
--- a/GTest/GTest.vcxproj.filters
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hh;hpp;hxx;hm;inl;inc;xsd
-
-
- {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
-
-
- Source Files
-
-
- Source Files
-
-
-
\ No newline at end of file
diff --git a/RocketAnalytics.sln b/RocketAnalytics.sln
deleted file mode 100644
index eef9f62..0000000
--- a/RocketAnalytics.sln
+++ /dev/null
@@ -1,102 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.27130.2026
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RocketAnalytics", "RocketAnalytics\RocketAnalytics.vcxproj", "{EBA778DB-6DC2-4999-8175-18724438DBC3}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RocketAnalyticsApp", "RocketAnalyticsApp\RocketAnalyticsApp.vcxproj", "{E459A44C-37AF-46F9-A29B-42A122A9CBE8}"
- ProjectSection(ProjectDependencies) = postProject
- {C0B68325-40BE-4B93-8F9A-7AE2482F7CF4} = {C0B68325-40BE-4B93-8F9A-7AE2482F7CF4}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RocketAnalyticsLib", "RocketAnalyticsLib\RocketAnalyticsLib.vcxproj", "{C0B68325-40BE-4B93-8F9A-7AE2482F7CF4}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RocketAnalyticsTests", "RocketAnalyticsTests\RocketAnalyticsTests.vcxproj", "{1EA737FE-FD97-4565-B22A-3B616EA8C755}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GTest", "GTest\GTest.vcxproj", "{79E03DBE-1638-49C0-A908-70E3B95B0DC0}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E0ED532C-655F-4E9A-A6F5-EECE05F84F86}"
- ProjectSection(SolutionItems) = preProject
- .editorconfig = .editorconfig
- README.md = README.md
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Lib|x64 = Lib|x64
- Lib|x86 = Lib|x86
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {EBA778DB-6DC2-4999-8175-18724438DBC3}.Debug|x64.ActiveCfg = Debug|x64
- {EBA778DB-6DC2-4999-8175-18724438DBC3}.Debug|x64.Build.0 = Debug|x64
- {EBA778DB-6DC2-4999-8175-18724438DBC3}.Debug|x86.ActiveCfg = Debug|Win32
- {EBA778DB-6DC2-4999-8175-18724438DBC3}.Debug|x86.Build.0 = Debug|Win32
- {EBA778DB-6DC2-4999-8175-18724438DBC3}.Lib|x64.ActiveCfg = Lib|x64
- {EBA778DB-6DC2-4999-8175-18724438DBC3}.Lib|x64.Build.0 = Lib|x64
- {EBA778DB-6DC2-4999-8175-18724438DBC3}.Lib|x86.ActiveCfg = Lib|Win32
- {EBA778DB-6DC2-4999-8175-18724438DBC3}.Lib|x86.Build.0 = Lib|Win32
- {EBA778DB-6DC2-4999-8175-18724438DBC3}.Release|x64.ActiveCfg = Debug|x64
- {EBA778DB-6DC2-4999-8175-18724438DBC3}.Release|x64.Build.0 = Debug|x64
- {EBA778DB-6DC2-4999-8175-18724438DBC3}.Release|x86.ActiveCfg = Release|Win32
- {EBA778DB-6DC2-4999-8175-18724438DBC3}.Release|x86.Build.0 = Release|Win32
- {E459A44C-37AF-46F9-A29B-42A122A9CBE8}.Debug|x64.ActiveCfg = Debug|x64
- {E459A44C-37AF-46F9-A29B-42A122A9CBE8}.Debug|x64.Build.0 = Debug|x64
- {E459A44C-37AF-46F9-A29B-42A122A9CBE8}.Debug|x86.ActiveCfg = Debug|Win32
- {E459A44C-37AF-46F9-A29B-42A122A9CBE8}.Debug|x86.Build.0 = Debug|Win32
- {E459A44C-37AF-46F9-A29B-42A122A9CBE8}.Lib|x64.ActiveCfg = Lib|x64
- {E459A44C-37AF-46F9-A29B-42A122A9CBE8}.Lib|x64.Build.0 = Lib|x64
- {E459A44C-37AF-46F9-A29B-42A122A9CBE8}.Lib|x86.ActiveCfg = Lib|Win32
- {E459A44C-37AF-46F9-A29B-42A122A9CBE8}.Lib|x86.Build.0 = Lib|Win32
- {E459A44C-37AF-46F9-A29B-42A122A9CBE8}.Release|x64.ActiveCfg = Debug|x64
- {E459A44C-37AF-46F9-A29B-42A122A9CBE8}.Release|x64.Build.0 = Debug|x64
- {E459A44C-37AF-46F9-A29B-42A122A9CBE8}.Release|x86.ActiveCfg = Release|Win32
- {E459A44C-37AF-46F9-A29B-42A122A9CBE8}.Release|x86.Build.0 = Release|Win32
- {C0B68325-40BE-4B93-8F9A-7AE2482F7CF4}.Debug|x64.ActiveCfg = Debug|x64
- {C0B68325-40BE-4B93-8F9A-7AE2482F7CF4}.Debug|x64.Build.0 = Debug|x64
- {C0B68325-40BE-4B93-8F9A-7AE2482F7CF4}.Debug|x86.ActiveCfg = Debug|Win32
- {C0B68325-40BE-4B93-8F9A-7AE2482F7CF4}.Debug|x86.Build.0 = Debug|Win32
- {C0B68325-40BE-4B93-8F9A-7AE2482F7CF4}.Lib|x64.ActiveCfg = Release|x64
- {C0B68325-40BE-4B93-8F9A-7AE2482F7CF4}.Lib|x64.Build.0 = Release|x64
- {C0B68325-40BE-4B93-8F9A-7AE2482F7CF4}.Lib|x86.ActiveCfg = Release|Win32
- {C0B68325-40BE-4B93-8F9A-7AE2482F7CF4}.Lib|x86.Build.0 = Release|Win32
- {C0B68325-40BE-4B93-8F9A-7AE2482F7CF4}.Release|x64.ActiveCfg = Release|x64
- {C0B68325-40BE-4B93-8F9A-7AE2482F7CF4}.Release|x64.Build.0 = Release|x64
- {C0B68325-40BE-4B93-8F9A-7AE2482F7CF4}.Release|x86.ActiveCfg = Release|Win32
- {C0B68325-40BE-4B93-8F9A-7AE2482F7CF4}.Release|x86.Build.0 = Release|Win32
- {1EA737FE-FD97-4565-B22A-3B616EA8C755}.Debug|x64.ActiveCfg = Debug|x64
- {1EA737FE-FD97-4565-B22A-3B616EA8C755}.Debug|x64.Build.0 = Debug|x64
- {1EA737FE-FD97-4565-B22A-3B616EA8C755}.Debug|x86.ActiveCfg = Debug|Win32
- {1EA737FE-FD97-4565-B22A-3B616EA8C755}.Debug|x86.Build.0 = Debug|Win32
- {1EA737FE-FD97-4565-B22A-3B616EA8C755}.Lib|x64.ActiveCfg = Release|x64
- {1EA737FE-FD97-4565-B22A-3B616EA8C755}.Lib|x64.Build.0 = Release|x64
- {1EA737FE-FD97-4565-B22A-3B616EA8C755}.Lib|x86.ActiveCfg = Release|Win32
- {1EA737FE-FD97-4565-B22A-3B616EA8C755}.Lib|x86.Build.0 = Release|Win32
- {1EA737FE-FD97-4565-B22A-3B616EA8C755}.Release|x64.ActiveCfg = Release|x64
- {1EA737FE-FD97-4565-B22A-3B616EA8C755}.Release|x64.Build.0 = Release|x64
- {1EA737FE-FD97-4565-B22A-3B616EA8C755}.Release|x86.ActiveCfg = Release|Win32
- {1EA737FE-FD97-4565-B22A-3B616EA8C755}.Release|x86.Build.0 = Release|Win32
- {79E03DBE-1638-49C0-A908-70E3B95B0DC0}.Debug|x64.ActiveCfg = Debug|x64
- {79E03DBE-1638-49C0-A908-70E3B95B0DC0}.Debug|x64.Build.0 = Debug|x64
- {79E03DBE-1638-49C0-A908-70E3B95B0DC0}.Debug|x86.ActiveCfg = Debug|Win32
- {79E03DBE-1638-49C0-A908-70E3B95B0DC0}.Debug|x86.Build.0 = Debug|Win32
- {79E03DBE-1638-49C0-A908-70E3B95B0DC0}.Lib|x64.ActiveCfg = Release|x64
- {79E03DBE-1638-49C0-A908-70E3B95B0DC0}.Lib|x64.Build.0 = Release|x64
- {79E03DBE-1638-49C0-A908-70E3B95B0DC0}.Lib|x86.ActiveCfg = Release|Win32
- {79E03DBE-1638-49C0-A908-70E3B95B0DC0}.Lib|x86.Build.0 = Release|Win32
- {79E03DBE-1638-49C0-A908-70E3B95B0DC0}.Release|x64.ActiveCfg = Release|x64
- {79E03DBE-1638-49C0-A908-70E3B95B0DC0}.Release|x64.Build.0 = Release|x64
- {79E03DBE-1638-49C0-A908-70E3B95B0DC0}.Release|x86.ActiveCfg = Release|Win32
- {79E03DBE-1638-49C0-A908-70E3B95B0DC0}.Release|x86.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {076D57A3-6913-42E5-A6A7-DE4ED79DB063}
- EndGlobalSection
-EndGlobal
diff --git a/RocketAnalytics/RocketAnalytics.vcxproj b/RocketAnalytics/RocketAnalytics.vcxproj
deleted file mode 100644
index d5ccc38..0000000
--- a/RocketAnalytics/RocketAnalytics.vcxproj
+++ /dev/null
@@ -1,165 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Lib
- Win32
-
-
- Lib
- x64
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
- Tests
- Win32
-
-
- Tests
- x64
-
-
-
- 15.0
- {EBA778DB-6DC2-4999-8175-18724438DBC3}
- RocketAnalytics
- 10.0.15063.0
-
-
-
- Application
- true
- v141
- MultiByte
-
-
- Application
- false
- v141
- true
- MultiByte
-
-
- Application
- true
- v141
- MultiByte
-
-
- Application
- false
- v141
- true
- MultiByte
-
-
- v141
-
-
- v141
-
-
- v141
-
-
- v141
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- EnableAllWarnings
- Disabled
- true
- D:\Library\Development\Libraries\boost_1_64_0;D:\Library\Development\Libraries\EasyLogging++;%(AdditionalIncludeDirectories)
-
-
-
-
- Level3
- Disabled
- true
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- true
-
-
- true
- true
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- true
-
-
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/RocketAnalytics/RocketAnalytics.vcxproj.filters b/RocketAnalytics/RocketAnalytics.vcxproj.filters
deleted file mode 100644
index 8bc3f41..0000000
--- a/RocketAnalytics/RocketAnalytics.vcxproj.filters
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hh;hpp;hxx;hm;inl;inc;xsd
-
-
- {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/RocketAnalytics/doc/replay_binary_data.txt b/RocketAnalytics/doc/replay_binary_data.txt
deleted file mode 100644
index d6fcebb..0000000
--- a/RocketAnalytics/doc/replay_binary_data.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-1. CRC: 20 Bytes
-2. Header start: 24 Bytes
-3. Header information: ?? Bytes
-4. Levels: ARRAY LENGTH followed by STRINGs
-5. Keyframe: ARRAY LENGTH followed by STRUCT(Time, Frame, File position)
-6. Network Stream: ARRAY LENGTH followed by BYTES
- - Current Time FLOAT
- - Delta Time FLOAT
- - Actors that stoppped replicating:
- + Signal destroyed actor - 1 BIT
- + Actor's network channel ID - COMPRESSED INTEGER
- + Signal channel closing - 1 BIT
- - Actors that started replicating:
- + Signal spawned actor - 1 BIT
- + Actor's network channel ID - COMPRESSED INTEGER
- + Signal channel open - 1 BIT
- + Signal new actor - 1 BIT
- + Data on how to reference actor:
- > Static actor:
- | INTEGER ID from Objects Table
- > Dynamic actor:
- | INTEGER ID for 'Archetype'
- | (Optional) Initial location {VECTOR}
- | (Optional*) Rotation(Pitch, Yaw, Roll - 3 BYTES total)
- - Actors replicating:
- + Signal replicating actor - 1 BIT
- + Actor's network channel ID - COMPRESSED INTEGER
- + Signal channel is open - 1 BIT
- + Signal not a new actor - 1 BIT
- + Stream of Properties and Values:
- > Signal new Property - 1 BIT
- > Property ID - COMPRESSED PROPERTY ID (Max value pulled from Class Net Cache)
- >
-7. !Debug Logs: ARRAY LENGTH followed by STRINGs
-8. Tick Marks: ARRAY LENGTH followed by STRUCT(Type, Frame)
-9. Replicated packages: ??
-10. Object table: ??
-11. Name Table: ??
-12. Class Index Map: ??
-13. CNC Map: ??
-
-
-# NOTE 1 #
-For each frame, first there are 2 floats for Time and DeltaTime.
-Then a single bit with a value of 1 to say we have actors that were destroyed,
-so it is expected that the first frame of the replay would have a 0 for that bit
-since no actors have been destroyed yet. If an actor has been destroyed it then
-puts the 10 bits for the channel ID, no padding (I think). If no actors were destroyed
-it just moves on to the next phase (actors that were spawned).
-
-The optional location and rotation are in the following bits, no property identifiers.
-It looks like actors always write their compressed vector location. The way we know if
-it needs initial rotation is by checking properties on the class at runtime (Actor.bNetInitialRotation),
-which is part of the game, not included with the replay.
-
-Vectors are compressed over the network, and the amount of bits they take depends on the vector.
-The code used for serializing them is the same as in UE4's FVector_NetQuantize NetSerialize() function.
-
-
-# NOTE 2 #
-https://gitlab.com/taylorfausak/octane/blob/master/README.md
diff --git a/RocketAnalytics/include/Replay.hpp b/RocketAnalytics/include/Replay.hpp
deleted file mode 100644
index aa1ee68..0000000
--- a/RocketAnalytics/include/Replay.hpp
+++ /dev/null
@@ -1,73 +0,0 @@
-// Author: Michael Doyle
-// Date: 6/10/17
-// Replay.hpp
-
-
-#ifndef REPLAY_H
-#define REPLAY_H
-
-#include
-#include
-#include
-#include "../include/ReplayProperty.hpp"
-
-
-class ReplayProperty::Property;
-
-class Replay {
- public:
- // Constructors
- Replay(std::string filepath);
- Replay();
- ~Replay();
-
- // Getters
- static int replay_count();
- std::string filepath() const;
- std::int32_t part1_length() const;
- std::int32_t part1_crc() const;
- std::int32_t version_major() const;
- std::int32_t version_minor() const;
- std::string replay_identifier() const;
- std::int32_t part2_length() const;
- std::int32_t part2_crc() const;
- std::int32_t level_length() const;
-
- // Other
- std::string to_string(void);
- void parse();
-
- private:
- static int replay_count_;
- std::string filepath_;
- std::int32_t part1_length_;
- std::int32_t part1_crc_;
- std::int32_t version_major_;
- std::int32_t version_minor_;
- std::string replay_identifier_;
- std::vector properties_;
- std::int32_t part2_length_;
- std::int32_t part2_crc_;
- std::int32_t level_length_;
-
- // Parsing functions
- void parse_part1_length(std::ifstream &br);
- void parse_part1_crc(std::ifstream &br);
- void parse_version_major(std::ifstream &br);
- void parse_version_minor(std::ifstream &br);
- void parse_replay_identifier(std::ifstream &br);
- void parse_replay_properties(std::ifstream &br);
-
- // Helping property reader functions
- ReplayProperty::Property * read_property(std::ifstream &br);
- std::int32_t read_int_property(std::ifstream &br);
- std::string read_str_property(std::ifstream &br);
- std::string read_name_property(std::ifstream &br);
- bool read_bool_property(std::ifstream &br);
- std::int64_t read_qword_property(std::ifstream &br);
- std::int8_t read_byte_property(std::ifstream &br);
- float read_float_property(std::ifstream &br);
- std::vector< std::vector > read_array_property(std::ifstream &br);
-};
-
-#endif
diff --git a/RocketAnalytics/include/ReplayParser.hpp b/RocketAnalytics/include/ReplayParser.hpp
deleted file mode 100644
index 88fca1e..0000000
--- a/RocketAnalytics/include/ReplayParser.hpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// Author: Michael Doyle
-// Date: 6/10/17
-// ReplayParser.h
-
-
-#ifndef REPLAY_PARSER_H
-#define REPLAY_PARSER_H
-
-namespace ReplayParser {
-
- const int crc_length = 20; // 20 Bytes
- const int header_start_length = 24; // 24 Bytes
- const int unknown_length = 8; // 8 Bytes
-
- class ReplayParser {
- private:
-
-
- public:
-
-
- };
-
-}
-
-#endif
diff --git a/RocketAnalytics/include/ReplayProperty.hpp b/RocketAnalytics/include/ReplayProperty.hpp
deleted file mode 100644
index 9fc818b..0000000
--- a/RocketAnalytics/include/ReplayProperty.hpp
+++ /dev/null
@@ -1,71 +0,0 @@
-// Author: Michael Doyle
-// Date: 6/20/17
-// ReplayProperty.hpp
-
-
-#ifndef REPLAY_PROPERTY_H
-#define REPLAY_PROPERTY_H
-
-#include
-#include
-#include
-#include "../include/ReplayPropertyValue.hpp"
-
-namespace ReplayProperty {
-
- enum Type;
-
- class Property {
-
- public:
- // Constructors & Destructors
- Property(); // TODO: Make overloaded Property constructors
- ~Property(); // TODO: Make Property destructors.
-
- // Member Getters
- std::string key();
- Type type();
- std::string value_to_string();
-
- // Setters
- void set_key(std::string string);
- void set_none();
- void set_int(std::int32_t i);
- void set_str(std::string str);
- void set_name(std::string name);
- void set_bool(bool b);
- void set_qword(std::int64_t qword);
- void set_byte(std::int8_t byte);
- void set_float(float f);
- void set_array(std::vector> vector);
-
- private:
- // Fields
- std::string key_;
- Value value_;
- };
-
-
- /* REMOVED CODE
- // Replay Property struct
- struct Property {
- std::string key;
- Type type;
- union value {
- std::int64_t i64;
- std::int32_t i32;
- std::int8_t i8;
- float f;
- bool b;
- std::string s;
- std::vector> v;
- value() {}
- ~value() {}
- }value;
- Property() {}
- ~Property() {}
- };
- */
-
-}
-#endif
diff --git a/RocketAnalytics/include/ReplayPropertyTypes.hpp b/RocketAnalytics/include/ReplayPropertyTypes.hpp
deleted file mode 100644
index 7d57c60..0000000
--- a/RocketAnalytics/include/ReplayPropertyTypes.hpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// Author: Michael Doyle
-// Date: 7/15/17
-// ReplayPropertyTypes.hpp
-
-
-#ifndef REPLAY_PROPERTY_TYPES_H
-#define REPLAY_PROPERTY_TYPES_H
-
-#include
-
-namespace ReplayProperty {
-
- // Replay Property Types
- enum Type {
- None = 0,
- IntProperty = 1, StrProperty = 2,
- NameProperty = 3, BoolProperty = 4,
- QWordProperty = 5, ByteProperty = 6,
- FloatProperty = 7, ArrayProperty = 8,
- };
-
- // Convert Type ENUM to String
- std::string type_to_string(Type p_type);
-
-}
-#endif
diff --git a/RocketAnalytics/include/ReplayPropertyValue.hpp b/RocketAnalytics/include/ReplayPropertyValue.hpp
deleted file mode 100644
index 66ccec9..0000000
--- a/RocketAnalytics/include/ReplayPropertyValue.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-// Author: Michael Doyle
-// Date: 7/16/17
-// ReplayPropertyValue.hpp
-
-
-#ifndef REPLAY_PROPERTY_VALUE_H
-#define REPLAY_PROPERTY_VALUE_H
-
-#include
-#include
-#include
-
-namespace ReplayProperty {
-
- enum Type;
- class Property;
-
- class Value {
- public:
- // Constructors & Destructors
- Value();
- ~Value();
- // Setters
- void set_none();
- void set_int(std::int32_t i);
- void set_str(std::string str);
- void set_name(std::string name);
- void set_bool(bool b);
- void set_qword(std::int64_t qword);
- void set_byte(std::int8_t byte);
- void set_float(float f);
- void set_array(std::vector> vector);
- // Getters
- Type type();
- std::string to_string();
-
- private:
- // Fields
- Type type_;
- union UValue{
- std::int64_t i64;
- std::int32_t i32;
- std::int8_t i8;
- float f;
- bool b;
- std::string s;
- std::vector < std::vector> v;
- UValue();
- ~UValue();
- }value_;
-
- // Functions
- void destroy_value();
- };
-
-}
-#endif
diff --git a/RocketAnalytics/src/Replay.cpp b/RocketAnalytics/src/Replay.cpp
deleted file mode 100644
index 51be81a..0000000
--- a/RocketAnalytics/src/Replay.cpp
+++ /dev/null
@@ -1,361 +0,0 @@
-// Author: Michael Doyle
-// Date: 6/13/17
-// Replay.cpp
-
-#include
-#include
-#include
-#include "../include/ReplayPropertyTypes.hpp"
-#include "../include/Replay.hpp"
-
-
-// Initialize static replay count
-int Replay::replay_count_ = 0;
-
-
-// Constructors
-Replay::Replay() {
- replay_count_++; // Increment replay count
-}
-
-
-Replay::Replay(std::string filepath) {
- filepath_ = filepath;
- replay_count_++; // Increment replay count
-}
-
-
-// Destructor
-Replay::~Replay(void) {
- replay_count_--; // Decrement replay count
- // TODO: Deallocate Replay from memory
-}
-
-
-// Return the amount of Replay objects initialized
-int Replay::replay_count(void) { return replay_count_; }
-
-
-// Standard Getters
-std::string Replay::filepath(void) const { return filepath_; }
-std::int32_t Replay::part1_length(void) const { return part1_length_; }
-std::int32_t Replay::part1_crc(void) const { return part1_crc_; }
-std::int32_t Replay::version_major(void) const { return version_major_; }
-std::int32_t Replay::version_minor(void) const { return version_minor_; }
-std::string Replay::replay_identifier(void) const { return replay_identifier_; }
-std::int32_t Replay::part2_length(void) const { return part2_length_; }
-std::int32_t Replay::part2_crc(void) const { return part2_crc_; }
-std::int32_t Replay::level_length(void) const { return level_length_; }
-
-
-// To string
-std::string Replay::to_string(void) {
- std::stringstream output_stream;
- output_stream << "filepath: " << filepath_ << '\n'
- << "part1_length: " << part1_length_ << '\n'
- << "part1_crc: " << part1_crc_ << '\n'
- << "version_major: " << version_major_ << '\n'
- << "version_minor: " << version_minor_ << '\n'
- << "replay_identifier: " << replay_identifier_ << '\n';
- // << "properties: \n\t" << properties_.front()->key() << "\n\t" << properties_.front()->value_to_string() << '\n';
- // HACK: Only looking at first property in first array index
- std::string output = output_stream.str();
- return output;
-}
-
-
-// Parse the entire replay file
-void Replay::parse() {
- std::ifstream binary_reader(filepath_, std::ios::binary);
-
- if (!binary_reader) {
- //TODO: What happens if replay file does not open?
- }
- else {
- binary_reader.seekg(0, std::ostream::beg);
- parse_part1_length(binary_reader);
- parse_part1_crc(binary_reader);
- parse_version_major(binary_reader);
- parse_version_minor(binary_reader);
- parse_replay_identifier(binary_reader);
- //parse_replay_properties(binary_reader);
- binary_reader.close();
- }
-}
-
-
-// Assumes the ifstream is pointed at the correct file position
-void Replay::parse_part1_length(std::ifstream &br) {
- std::int32_t raw_int;
- br.read(reinterpret_cast(&raw_int), sizeof(raw_int));
- part1_length_ = raw_int;
-}
-
-
-// Assumes the ifstream is pointed at the correct file position
-void Replay::parse_part1_crc(std::ifstream &br) {
- std::int32_t raw_int;
- br.read(reinterpret_cast(&raw_int), sizeof(raw_int));
- part1_crc_ = raw_int;
-}
-
-
-// Assumes the ifstream is pointed at the correct file position
-void Replay::parse_version_major(std::ifstream &br) {
- std::int32_t raw_int;
- br.read(reinterpret_cast(&raw_int), sizeof(raw_int));
- version_major_ = raw_int;
-}
-
-
-// Assumes the ifstream is pointed at the correct file position
-void Replay::parse_version_minor(std::ifstream &br) {
- std::int32_t raw_int;
- br.read(reinterpret_cast(&raw_int), sizeof(raw_int));
- version_minor_ = raw_int;
-}
-
-
-// Assumes the ifstream is pointed at the correct file position
-void Replay::parse_replay_identifier(std::ifstream &br) {
- std::int32_t size; // Size of the string to read
- std::string raw_string; // string buffer
- br.read(reinterpret_cast(&size), sizeof(size)); // Read size integer from file
- br.read(reinterpret_cast(&raw_string), size); // Read characters from file
- replay_identifier_ = raw_string; // Assign the read string as the replay_identifier_
-}
-
-/*
-// Assumes the ifstream is pointed at the correct file position
-void Replay::parse_replay_identifier(std::ifstream &br) {
- std::int32_t size; // Size of the string to read
- char * raw_string; // string buffer
-
- br.read(reinterpret_cast(&size), sizeof(size)); // Read size integer from file
- raw_string = new char[size]; // Initialize string of length 'size'
- br.read(raw_string, size); // Read characters from file
- replay_identifier_ = raw_string; // Assign the read string as the replay_identifier_
- delete raw_string; // deallocate the string buffer
-}
-*/
-
-// Parse all properties in replay file.
-// Assumeds the ifstream is pointed at the currect file position.
-void Replay::parse_replay_properties(std::ifstream &br) {
-
- while (true) { // While 'None' was not read (exits internally)
-
- std::cout << "Attempting to read replay property\n";
-
- ReplayProperty::Property * property = read_property(br);
-
- // Check whether the 'None' key is read
- // If so, exit the function.
- // Else, read the property
- if (property->type() == ReplayProperty::None) {
- // String representation of Type enums
- std::cout << "-> Replay property was 'None'\n";
- delete property;
- std::cout << "-> Deleted replay property\n";
- return;
- }
- else {
- std::cout << "-> Attempting to add property to property list...\n";
- properties_.push_back(property); // Add property to property list
- std::cout << "-->Successfully added property to list\n";
- }
- }
-}
-
-
-ReplayProperty::Property * Replay::read_property(std::ifstream &br) {
- std::int32_t key_length; // Length of key to read
- std::string key_name; // Key name
- std::int32_t type_length;
- std::string type_string;
- ReplayProperty::Property * property = new ReplayProperty::Property(); // Initialize ReplayProperty
-
- std::cout << "-> Created replay pointer\n";
-
- // Read key length
- br.read(reinterpret_cast(&key_length), sizeof(key_length));
-
- std::cout << "-> read the key length\n";
-
- // Read key
- br.read(reinterpret_cast(&key_name), key_length);
-
- std::cout << "-> Read key: " << key_name << "\n";
-
- // Assign key to property
- property->set_key(key_name);
-
- std::cout << "-> Assigned key\n";
-
- // If the key_name is 'None', assign None Type and return property.
- if (key_name == type_to_string(ReplayProperty::None)) {
- property->set_none();
- return property;
- }
-
- std::cout << "-> Key is not 'None'\n";
-
- // Read type length
- br.read(reinterpret_cast(&type_length), sizeof(type_length));
-
- std::cout << "-> Read type length\n";
-
- // Read property type
- br.read(reinterpret_cast(&type_string), type_length);
-
- std::cout << "-> Read type: " << type_string << "\n";
-
- // Determine the type of property which must be read
- if (type_string == type_to_string(ReplayProperty::IntProperty)) { // IntProperty
- std::cout << "-> IntProperty\n";
- property->set_int(read_int_property(br));
- std::cout << "-> Read IntProeprty\n";
- }
- else if (type_string == type_to_string(ReplayProperty::StrProperty)) { // StrProperty
- std::cout << "-> StrProperty\n";
- property->set_str(read_str_property(br));
- std::cout << "-> Read StrProperty\n";
- }
- else if (type_string == type_to_string(ReplayProperty::NameProperty)) { // NameProperty
- std::cout << "-> NameProperty\n";
- property->set_name(read_name_property(br));
- std::cout << "-> Read NameProperty\n";
- }
- else if (type_string == type_to_string(ReplayProperty::BoolProperty)) { // BoolProperty
- std::cout << "-> BoolProperty\n";
- property->set_bool(read_bool_property(br));
- std::cout << "-> Read BoolProperty\n";
- }
- else if (type_string == type_to_string(ReplayProperty::QWordProperty)) { // QWordProperty
- std::cout << "-> QWordProperty\n";
- property->set_qword(read_qword_property(br));
- std::cout << "-> Read QWordProperty\n";
- }
- else if (type_string == type_to_string(ReplayProperty::ByteProperty)) { // ByteProperty
- std::cout << "-> ByteProperty\n";
- property->set_byte(read_byte_property(br));
- std::cout << "-> Read ByteProperty\n";
- }
- else if (type_string == type_to_string(ReplayProperty::FloatProperty)) { // FloatProperty
- std::cout << "-> FloatProperty\n";
- property->set_float(read_float_property(br));
- std::cout << "-> Read FloatProperty\n";
- }
- else if (type_string == type_to_string(ReplayProperty::ArrayProperty)) { // ArrayProperty
- std::cout << "-> ArrayProperty\n";
- property->set_array(read_array_property(br));
- std::cout << "-> Read ArrayProperty\n";
- }
- else {
- std::cerr << "Replay property type mismatch\n";
- delete property;
- return new ReplayProperty::Property();
- }
-
-
-
- return property;
-}
-
-
-// Read Integer from replay file and return it
-std::int32_t Replay::read_int_property(std::ifstream &br) {
- std::int32_t value;
- br.seekg(8, std::ios::cur); // Next 8 bytes are always "04 00 00 00 00 00 00 00"
- br.read(reinterpret_cast(&value), sizeof(value));
- return value;
-}
-
-
-// Read String from replay file and return it
-std::string Replay::read_str_property(std::ifstream &br) {
- std::int64_t string_size; // Buffer to read string size
- std::string value;
- br.read(reinterpret_cast(&string_size), sizeof(string_size)); // Get string size to read
- br.read(reinterpret_cast(&value), string_size); // Read string from file
- return value;
-}
-
-
-// Read Name from replay file and return it
-// * Currently does the same thing as read_str_property
-std::string Replay::read_name_property(std::ifstream &br) {
- std::int64_t name_size; // Buffer to read name size
- std::string value;
- br.read(reinterpret_cast(&name_size), sizeof(name_size)); // Get name size to read
- br.read(reinterpret_cast(&value), name_size); // Read name from file
- return value;
-}
-
-
-// Read Bool from replay file and return it
-bool Replay::read_bool_property(std::ifstream &br) {
- bool value;
- br.seekg(8, std::ios::cur); // Next 8 bytes are always "00 00 00 00 00 00 00 00"
- br.read(reinterpret_cast(&value), 1); // Read bool from file
- return value;
-}
-
-
-// Read QWord from replay file and return it
-std::int64_t Replay::read_qword_property(std::ifstream &br) {
- std::int64_t value;
- br.seekg(8, std::ios::cur); // Next 8 bytes are always "08 00 00 00 00 00 00 00"
- br.read(reinterpret_cast(&value), sizeof(value)); // Read QWord from file
- return value;
-}
-
-
-// Read Byte from replay file and return it
-std::int8_t Replay::read_byte_property(std::ifstream &br) {
- std::int8_t value;
- br.read(reinterpret_cast(&value), sizeof(value)); // Read Byte from file
- br.seekg(7, std::ios::cur); // Next 7 bytes are always "00 00 00 00 00 00 00"
- return value;
-}
-
-
-// Read Float from replay file and return it
-float Replay::read_float_property(std::ifstream &br) {
- float value;
- br.seekg(8, std::ios::cur); // Next 8 bytes are always "08 00 00 00 00 00 00"
- br.read(reinterpret_cast(&value), sizeof(value)); // Read Float from file
- return value;
-}
-
-
-// Read Vector from replay file and return it
-std::vector< std::vector > Replay::read_array_property(std::ifstream &br) {
- // TODO: Complete read_array_property
- std::int32_t size; // Size buyffer
- std::vector> value_array; // Vector to hold Property vectors
- br.seekg(8, std::ios::cur); // Skip 8 bytes. HACK: What do these skipped 8 bytes do?
- br.read(reinterpret_cast(&size), sizeof(size)); // Read array size from file
-
- for (int i = 0; i < size; i++) {
- std::vector properties;
- while (true) {
- ReplayProperty::Property * property = read_property(br); // Read property
- if (property) {
- // Check whether the 'None' key is read
- // If so, exit the function.
- // Else, add property to vector
- if (property->type() == ReplayProperty::None) {
- delete property;
- break;
- }
- else {
- properties.push_back(property);
- }
- }
- }
- value_array.push_back(properties); // Add list of properties to the ArrayList of Properties
- }
-
- return value_array;
-}
diff --git a/RocketAnalytics/src/ReplayParser.cpp b/RocketAnalytics/src/ReplayParser.cpp
deleted file mode 100644
index 120443b..0000000
--- a/RocketAnalytics/src/ReplayParser.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-// Author: Michael Doyle
-// Date: 6/10/17
-// ReplayParser.ccp
-
-
-#include
-#include
-#include "../include/ReplayParser.hpp"
-
diff --git a/RocketAnalytics/src/ReplayProperty.cpp b/RocketAnalytics/src/ReplayProperty.cpp
deleted file mode 100644
index df48e77..0000000
--- a/RocketAnalytics/src/ReplayProperty.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-// Author: Michael Doyle
-// Date: 7/7/17
-// ReplayProperty.cpp
-
-
-#include "../include/ReplayPropertyTypes.hpp"
-#include "../include/ReplayProperty.hpp"
-
-namespace ReplayProperty {
-
- Property::Property() {
- value_.set_none();
- }
-
-
- Property::~Property() {
- // TODO: Make Property destructor
- }
-
-
- // Read Property key
- std::string Property::key() {
- return key_;
- }
-
-
- // Read Property type
- Type Property::type() {
- return value_.type();
- }
-
-
- /* REMOVED FROM PUBLIC SCOPE
- Value * Property::value() {
- return &value_;
- }
- */
-
-
- // Read Property value (as string)
- std::string Property::value_to_string() {
- std::string value_string;
- value_string = value_.to_string();
- return value_string;
- }
-
- void Property::set_key(std::string string) {
- key_ = string;
- }
-
- void Property::set_none() {
- value_.set_none();
- }
-
-
- void Property::set_int(int32_t i) {
- value_.set_int(i);
- }
-
-
- void Property::set_str(std::string str) {
- value_.set_str(str);
- }
-
-
- void Property::set_name(std::string name) {
- value_.set_name(name);
- }
-
-
- void Property::set_bool(bool b) {
- value_.set_bool(b);
- }
-
-
- void Property::set_qword(std::int64_t qword) {
- value_.set_qword(qword);
- }
-
-
- void Property::set_byte(std::int8_t byte) {
- value_.set_byte(byte);
- }
-
-
- void Property::set_float(float f) {
- value_.set_float(f);
- }
-
-
- void Property::set_array(std::vector> vector) {
- value_.set_array(vector);
- }
-}
diff --git a/RocketAnalytics/src/ReplayPropertyTypes.cpp b/RocketAnalytics/src/ReplayPropertyTypes.cpp
deleted file mode 100644
index 328070e..0000000
--- a/RocketAnalytics/src/ReplayPropertyTypes.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// Author: Michael Doyle
-// Date: 7/15/17
-// ReplayPropertyTypes.cpp
-
-
-#include "../include/ReplayPropertyTypes.hpp"
-
-namespace ReplayProperty {
-
- // String representation of Type enums
- const std::string PROPERTY_TYPE_STRINGS[] = { "None",
- "IntProperty", "StrProperty",
- "NameProperty", "BoolProperty",
- "QWordProperty", "ByteProperty",
- "FloatProperty", "ArrayProperty" };
-
- // Convert Type ENUM to String
- std::string type_to_string(Type p_type) {
- return PROPERTY_TYPE_STRINGS[p_type];
- }
-
-}
diff --git a/RocketAnalytics/src/ReplayPropertyValue.cpp b/RocketAnalytics/src/ReplayPropertyValue.cpp
deleted file mode 100644
index 2509445..0000000
--- a/RocketAnalytics/src/ReplayPropertyValue.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-// Author: Michael Doyle
-// Date: 7/16/17
-// ReplayPropertyValue.cpp
-
-
-#include "../include/ReplayPropertyTypes.hpp"
-#include "../include/ReplayProperty.hpp"
-#include "../include/ReplayPropertyValue.hpp"
-
-
-namespace ReplayProperty {
-
- Value::Value() {
- set_none();
- }
-
-
- Value::~Value() {
- destroy_value();
- }
-
-
- Type Value::type() {
- return type_;
- }
-
-
- void Value::set_none() {
- destroy_value();
- type_ = Type::None;
- }
-
-
- void Value::set_int(int32_t i) {
- destroy_value();
- type_ = Type::IntProperty;
- value_.i32 = i;
- }
-
-
- void Value::set_str(std::string str) {
- destroy_value();
- type_ = Type::StrProperty;
- new (&value_.s) std::string(std::move(str)); // HACK: Is this the proper way to move strings?
- }
-
-
- void Value::set_name(std::string name) {
- destroy_value();
- type_ = Type::NameProperty;
- new (&value_.s) std::string(std::move(name)); // HACK: Is this the proper way to move strings?
- }
-
-
- void Value::set_bool(bool b) {
- destroy_value();
- type_ = Type::BoolProperty;
- value_.b = b;
- }
-
-
- void Value::set_qword(std::int64_t qword) {
- destroy_value();
- type_ = Type::QWordProperty;
- value_.i64 = qword;
- }
-
-
- void Value::set_byte(std::int8_t byte) {
- destroy_value();
- type_ = Type::ByteProperty;
- value_.i8 = byte;
- }
-
-
- void Value::set_float(float f) {
- destroy_value();
- type_ = Type::FloatProperty;
- value_.f = f;
- }
-
-
- void Value::set_array(std::vector> vector) {
- destroy_value();
- type_ = Type::ArrayProperty;
- value_.v = vector; // HACK: Is this proper?
- }
-
-
- // Read Property value (as string)
- // TODO: FIX THIS FUNCTION
- std::string Value::to_string() {
- std::string value_string;
-
- // HACK(?): Is there a better way to do this?
- if (this->type() == ArrayProperty) { // HACK: Optimize reading vectors as string
- std::vector> full_property_array(value_.v);
- std::vector> full_property_array_copy(value_.v);
- std::vector property_array;
- Property * property;
- while (!(full_property_array.empty())) {
- value_string += "\n\t[";
-
- // Take Array of Properties from Property vector
- property_array = full_property_array.back();
- full_property_array.pop_back();
-
- while (!(property_array.empty())) {
- // Take Property from Array of Properties
- property = property_array.back();
- property_array.pop_back();
-
- value_string += property->key();
- value_string += ": ";
- value_string += property->value_to_string();
-
- if (property_array.empty()) {
- break;
- }
- else {
- value_string += ", ";
- }
- } // While end
-
- value_string += "]";
- } // While end
-
- this->value_.v = full_property_array_copy;
- }
- else if (this->type() == IntProperty) {
- value_string = std::to_string(this->value_.i32);
- }
- else if (this->type() == StrProperty || this->type() == NameProperty) {
- value_string = this->value_.s;
- }
- else if (this->type() == BoolProperty) {
- this->value_.b ? value_string = "True" : value_string = "False";
- }
- else if (this->type() == QWordProperty) {
- value_string = std::to_string(this->value_.i64);
- }
- else if (this->type() == ByteProperty) {
- value_string = std::to_string(this->value_.i8);
- }
- else if (this->type() == FloatProperty) {
- value_string = std::to_string(this->value_.f);
- }
- return value_string;
- }
-
-
- void Value::destroy_value() {
-
- switch (type_) {
- case StrProperty:
- (&value_.s)->std::string::~basic_string();
- break;
- case NameProperty:
- (&value_.s)->std::string::~basic_string();
- break;
- case ArrayProperty:
- if (value_.s.empty()) {
- (&value_.v)->std::vector< std::vector >::~vector();
- }
- break;
- default:
- value_.i64 = 0;
-
- }
-
- type_ = None;
-
- }
-
-
- Value::UValue::UValue() {
- i64 = 0;
- }
-
-
- Value::UValue::~UValue() {}
-
-}
diff --git a/RocketAnalytics/src/RocketAnalytics.cpp b/RocketAnalytics/src/RocketAnalytics.cpp
deleted file mode 100644
index 872a846..0000000
--- a/RocketAnalytics/src/RocketAnalytics.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Author: Michael Doyle
-// Date: 6/10/17
-// RocketAnalytics.cpp
-
-
-#include
-#include
-#include
-#include
-#include
-#include "../include/ReplayPropertyTypes.hpp"
-#include "../include/Replay.hpp"
-
-
-int main() {
-
-
- std::cout << "~~~ Attempting to convert all Type Enums to String ~~~\n";
- for (int i = ReplayProperty::Type::None; i < ReplayProperty::Type::ArrayProperty; i++) {
- std::cout << ReplayProperty::type_to_string(static_cast(i)) << '\n';
- }
- std::cout << "~~~ Finished converting all Type Enums to String ~~~\n" << std::endl;
-
-
- Replay replay_file("Testing/0A797CAB49E97F824000D9BB757BF7F9.replay");
- replay_file.parse();
-
- std::cout << replay_file.to_string() << std::endl;
- std::cout << "Replay Count: " << Replay::replay_count() << std::endl;
-
- _getch();
-
- return 0;
-}
diff --git a/RocketAnalytics/test/ReplayPropertyValueTests.cpp b/RocketAnalytics/test/ReplayPropertyValueTests.cpp
deleted file mode 100644
index 2325cca..0000000
--- a/RocketAnalytics/test/ReplayPropertyValueTests.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-// Author: Michael Doyle
-// Date: 7/18/17
-// ReplayPropertyValueTests.hpp
-
-#include "gtest/gtest.h"
-#include "../include/ReplayPropertyValue.hpp"
-
-using namespace ReplayProperty;
-
-class ReplayPropertyValueTest: public ::testing::Test {
-
- public:
- Value* value;
-
- // Constructor
- ReplayPropertyValueTest() {
- value = new Value;
- }
-
- // Called prior to TEST completion
- void SetUp() {
-
- }
-
- // Called after TEST completes
- void TearDown() {
-
- }
-
- // Destructor
- virtual ~ReplayPropertyValueTest() {
- delete value;
- }
-};
-
-TEST_F (ReplayPropertyValueTest, CanSetInt) {
- value->set_int(5);
- EXPECT_EQ ("5", value->to_string());
-}
\ No newline at end of file
diff --git a/RocketAnalyticsApp/src/RocketAnalyticsApp.cpp b/RocketAnalyticsApp/src/RocketAnalyticsApp.cpp
index 2bc302f..7d48812 100644
--- a/RocketAnalyticsApp/src/RocketAnalyticsApp.cpp
+++ b/RocketAnalyticsApp/src/RocketAnalyticsApp.cpp
@@ -1,6 +1,7 @@
// RocketAnalyticsApp.cpp : Defines the entry point for the console application.
#include
+#include
#include
#include "BinaryReader.hpp"
#include "ReplayHeader.hpp"
@@ -18,12 +19,12 @@ void test_binary_reader(const string file_path) {
BinaryReader b_reader(file_path);
cout << "Headersize: " << b_reader.read_aligned_uint32() << endl;
cout << "CRC: " << b_reader.read_aligned_uint32() << endl;
- cout << "Version: " << b_reader.read_aligned_uint32() << "."
- << b_reader.read_aligned_uint32() << endl;
- cout << "ReplayIdentifier: " << b_reader.read_length_prefixed_string() << endl;
+ cout << "Version: " << b_reader.read_aligned_uint32() << "." <<
+ b_reader.read_aligned_uint32() << endl;
+ cout << "ReplayIdentifier: " <<
+ b_reader.read_length_prefixed_string() << endl;
cout << "---END TESTING BinaryReader---" << "\n" << endl;
- }
- catch (const std::runtime_error &e) {
+ } catch (const std::runtime_error &e) {
e.what();
}
}
@@ -34,16 +35,21 @@ void test_replay(const string file_path) {
cout << "Filepath: " << file_path << endl;
ReplayFile replay = ReplayFile(file_path);
- cout << "Header size: " << replay.get_header().get_header_size() << endl;
+ cout << "Header size: " <<
+ replay.get_header().get_header_size() << endl;
cout << "CRC1: " << replay.get_header().get_crc1() << endl;
cout << "Version: " << replay.get_header().get_version() << endl;
- cout << "Version major: " << replay.get_header().get_version_major() << endl;
- cout << "Version minor: " << replay.get_header().get_version_minor() << endl;
- cout << "Replay Identifier: " << replay.get_header().get_replay_identifier() << endl;
+ cout << "Version major: " <<
+ replay.get_header().get_version_major() << endl;
+ cout << "Version minor: " <<
+ replay.get_header().get_version_minor() << endl;
+ cout << "Replay Identifier: " <<
+ replay.get_header().get_replay_identifier() << endl;
cout << "Properties:" << endl;
for (int i = 0; i < replay.get_header().get_properties().size(); i++) {
- cout << " > " << replay.get_header().get_properties().at(i).to_string() << endl;
+ cout << " > " <<
+ replay.get_header().get_properties().at(i).to_string() << endl;
}
cout << "Body Size: " << replay.get_header().get_body_size() << endl;
@@ -54,16 +60,24 @@ void test_replay(const string file_path) {
cout << "> " << replay.get_levels().get_levels().at(i) << endl;
}
- cout << "---END TESTING ReplayHeader---" << "\n" << endl;
- }
- catch (const std::runtime_error &e) {
+ cout << "Replay Keyframes:" << endl;
+ for (int i = 0; i < replay.get_keyframes().count(); i++) {
+ cout << i << ")\n\t" << std::fixed << std::setprecision(4) <<
+ "> " << replay.get_keyframes().get(i).time() << "\n\t" <<
+ "> " << replay.get_keyframes().get(i).frame() << "\n\t" <<
+ "> " << replay.get_keyframes().get(i).filePosition() << endl;
+ }
+
+ cout << "---END TESTING ReplayFile---" << "\n" << endl;
+ } catch (const std::runtime_error &e) {
e.what();
}
}
int main() {
try {
- const string file_path = "../Testing/0A797CAB49E97F824000D9BB757BF7F9.replay";
+ const string file_path =
+ "../Testing/0A797CAB49E97F824000D9BB757BF7F9.replay";
test_binary_reader(file_path);
test_replay(file_path);
}
diff --git a/RocketAnalyticsLib/RocketAnalyticsLib.vcxproj b/RocketAnalyticsLib/RocketAnalyticsLib.vcxproj
index c1c14b9..dea183b 100644
--- a/RocketAnalyticsLib/RocketAnalyticsLib.vcxproj
+++ b/RocketAnalyticsLib/RocketAnalyticsLib.vcxproj
@@ -136,6 +136,8 @@
+
+
@@ -149,6 +151,7 @@
+
@@ -156,6 +159,7 @@
+ stdcpp14
diff --git a/RocketAnalyticsLib/RocketAnalyticsLib.vcxproj.filters b/RocketAnalyticsLib/RocketAnalyticsLib.vcxproj.filters
index ea55b80..8bf8540 100644
--- a/RocketAnalyticsLib/RocketAnalyticsLib.vcxproj.filters
+++ b/RocketAnalyticsLib/RocketAnalyticsLib.vcxproj.filters
@@ -51,6 +51,12 @@
include
+
+ include
+
+
+ include
+
@@ -86,5 +92,11 @@
src
+
+ src
+
+
+ src
+
\ No newline at end of file
diff --git a/RocketAnalyticsLib/include/BinaryReader.hpp b/RocketAnalyticsLib/include/BinaryReader.hpp
index e2993f8..0bfd183 100644
--- a/RocketAnalyticsLib/include/BinaryReader.hpp
+++ b/RocketAnalyticsLib/include/BinaryReader.hpp
@@ -7,11 +7,13 @@
* reading of standard data types, compressed integers, and individual bits.
*****************************************************************************/
-#ifndef BINARY_READER_H
-#define BINARY_READER_H
+#ifndef BINARYREADER_HPP
+#define BINARYREADER_HPP
#include "Byte.hpp"
+#include
#include
+#include
namespace ReplayParser {
@@ -19,7 +21,7 @@ namespace ReplayParser {
class BinaryReader {
public:
- BinaryReader(const std::string file_path);
+ explicit BinaryReader(const std::string &file_path);
float read_aligned_float();
std::uint8_t read_aligned_uint8();
std::uint32_t read_aligned_uint32();
@@ -33,7 +35,7 @@ namespace ReplayParser {
int byte_position;
int bit_position;
- void read_file(std::string filepath);
+ void read_file(const std::string &filepath);
Byte read_aligned_byte();
float bytes_to_float(std::array bytes);
std::uint32_t bytes_to_uint32(std::array bytes);
@@ -44,6 +46,6 @@ namespace ReplayParser {
void increment_bit_position();
};
-}
+} // namespace ReplayParser
#endif
diff --git a/RocketAnalyticsLib/include/Byte.hpp b/RocketAnalyticsLib/include/Byte.hpp
index e0b271f..a0213f3 100644
--- a/RocketAnalyticsLib/include/Byte.hpp
+++ b/RocketAnalyticsLib/include/Byte.hpp
@@ -1,4 +1,4 @@
-/******************************************************************************
+/******************************************************************************L
* Author: Michael Doyle
* Date: 8/13/17
* File: Byte.hpp
@@ -11,6 +11,7 @@
#ifndef BYTE_H
#define BYTE_H
+#include
#include
#include
@@ -19,28 +20,16 @@ namespace ReplayParser {
class Byte {
public:
Byte();
- Byte(std::uint8_t value);
+ explicit Byte(std::uint8_t value);
Byte(const Byte &byte);
- std::uint8_t get_value();
- int get_bit(int index);
+ std::byte get_value();
+ std::int8_t get_bit(int index);
std::string to_string();
private:
- union {
- uint8_t value;
- struct {
- std::uint8_t bit1 : 1; // Least Significant
- std::uint8_t bit2 : 1; //
- std::uint8_t bit3 : 1; //
- std::uint8_t bit4 : 1; // System dependant, but how my
- std::uint8_t bit5 : 1; // system currently reads replays.
- std::uint8_t bit6 : 1; //
- std::uint8_t bit7 : 1; //
- std::uint8_t bit8 : 1; // Most Significant
- }bits;
- }byte_value;
- };
+ std::byte value;
+ };
-}
+} // namespace ReplayParser
#endif
diff --git a/RocketAnalyticsLib/include/Keyframe.hpp b/RocketAnalyticsLib/include/Keyframe.hpp
new file mode 100644
index 0000000..37bb5d5
--- /dev/null
+++ b/RocketAnalyticsLib/include/Keyframe.hpp
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * Author: Michael Doyle
+ * Date: 2/19/18
+ * File: Keyframe.hpp
+ * Description:
+ * Represents a Keyframe.
+ *****************************************************************************/
+
+#ifndef KEYFRAME_H
+#define KEYFRAME_H
+
+#include
+
+namespace ReplayParser {
+
+ class Keyframe {
+ public:
+ Keyframe(float time, std::uint32_t frame, std::uint32_t filePosition);
+
+ float time();
+ std::uint32_t frame();
+ std::uint32_t filePosition();
+
+ bool operator==(const Keyframe &k1) const;
+
+ private:
+ float timeStamp;
+ std::uint32_t frameNum;
+ std::uint32_t filePos;
+ };
+
+}
+
+#endif
diff --git a/RocketAnalyticsLib/include/ReplayFile.hpp b/RocketAnalyticsLib/include/ReplayFile.hpp
index 3abea65..33c5bbb 100644
--- a/RocketAnalyticsLib/include/ReplayFile.hpp
+++ b/RocketAnalyticsLib/include/ReplayFile.hpp
@@ -7,30 +7,34 @@
* replay file.
*****************************************************************************/
-#ifndef REPLAY_FILE_H
-#define REPLAY_FILE_H
+#ifndef REPLAYFILE_HPP
+#define REPLAYFILE_HPP
-#include
-#include
-#include
#include "ReplayHeader.hpp"
+#include "ReplayKeyframes.hpp"
#include "ReplayLevels.hpp"
+#include
+#include
+#include
namespace ReplayParser {
class ReplayFile {
public:
- ReplayFile(std::string filepath);
+ explicit ReplayFile(const std::string &filepath);
ReplayHeader get_header();
ReplayLevels get_levels();
+ ReplayKeyframes get_keyframes();
private:
std::string replay_file_path;
ReplayHeader replay_header;
ReplayLevels replay_levels;
+ ReplayKeyframes replay_keyframes;
};
-}
+} // namespace ReplayParser
+
#endif
diff --git a/RocketAnalyticsLib/include/ReplayHeader.hpp b/RocketAnalyticsLib/include/ReplayHeader.hpp
index ef4fb0c..23ef54a 100644
--- a/RocketAnalyticsLib/include/ReplayHeader.hpp
+++ b/RocketAnalyticsLib/include/ReplayHeader.hpp
@@ -10,7 +10,7 @@
#ifndef REPLAY_HEADER_H
#define REPLAY_HEADER_H
-#include "properties\Property.hpp"
+#include "properties/Property.hpp"
#include "Version.hpp"
#include "BinaryReader.hpp"
#include
diff --git a/RocketAnalyticsLib/include/ReplayKeyframes.hpp b/RocketAnalyticsLib/include/ReplayKeyframes.hpp
new file mode 100644
index 0000000..7cc9f62
--- /dev/null
+++ b/RocketAnalyticsLib/include/ReplayKeyframes.hpp
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * Author: Michael Doyle
+ * Date: 2/19/18
+ * File: ReplayKeyframes.hpp
+ * Description:
+ * Represents a a Replay's Keyframes.
+ *****************************************************************************/
+
+#ifndef REPLAY_KEYFRAMES_H
+#define REPLAY_KEYFRAMES_H
+
+#include
+#include
+#include "BinaryReader.hpp"
+#include "Keyframe.hpp"
+
+namespace ReplayParser {
+
+ class Keyframe;
+
+ class ReplayKeyframes {
+ public:
+ static ReplayKeyframes deserialize_keyframes(BinaryReader& binary_reader);
+
+ void add(Keyframe);
+ bool remove(Keyframe);
+ Keyframe get(int index);
+ size_t count();
+
+ private:
+ std::vector keyframes;
+ };
+
+}
+
+#endif
diff --git a/RocketAnalyticsLib/include/ReplayLevels.hpp b/RocketAnalyticsLib/include/ReplayLevels.hpp
index 26be308..9c0badb 100644
--- a/RocketAnalyticsLib/include/ReplayLevels.hpp
+++ b/RocketAnalyticsLib/include/ReplayLevels.hpp
@@ -19,7 +19,6 @@ namespace ReplayParser {
class ReplayLevels {
public:
- ReplayLevels();
static ReplayLevels deserialize_levels(BinaryReader& binary_reader);
vector get_levels();
diff --git a/RocketAnalyticsLib/src/BinaryReader.cpp b/RocketAnalyticsLib/src/BinaryReader.cpp
index 4ec4a6d..f12417c 100644
--- a/RocketAnalyticsLib/src/BinaryReader.cpp
+++ b/RocketAnalyticsLib/src/BinaryReader.cpp
@@ -1,199 +1,197 @@
/******************************************************************************
- * Author: Michael Doyle
- * Date: 8/13/17
- * File: BinaryReader.cpp
+ * Author: Michael Doyle
+ * Date: 8/13/17
+ * File: BinaryReader.cpp
*****************************************************************************/
-#include "BinaryReader.hpp"
+#include "../include/BinaryReader.hpp"
+#include
+#include
#include
#include
-#include
-#include
-#include
using std::runtime_error;
using std::ios;
using std::string;
using std::size_t;
using std::array;
-using std::cout;
-using std::endl;
-//TODO: Add flag to see if file_bytes exist. Throw exception on bad read.
+// TODO(michaeldoylecs): Add flag to see if file_bytes exist.
+// Throw exception on bad read.
namespace ReplayParser {
- BinaryReader::BinaryReader(const string filepath) {
- try {
- byte_position = 0;
- bit_position = 0;
- read_file(filepath);
- }
- catch(const runtime_error &e) {
- file_bytes.resize(0);
- throw e;
- }
- }
-
- void BinaryReader::read_file(string filepath) {
- std::ifstream file_stream(filepath, ios::binary | ios::in);
- if (file_stream.is_open()) {
- size_t file_size = get_file_size(file_stream);
- file_bytes.resize(file_size);
-
- // HACK: Kinda hack to directly assign to Byte object memory space
- file_stream.read(reinterpret_cast(file_bytes.data()), file_size);
- file_stream.close();
- }
- else {
- throw runtime_error("Failed to open file exception");
- }
- }
-
- size_t BinaryReader::get_file_size(std::ifstream &file_stream) {
- size_t file_start = file_stream.tellg();
- file_stream.seekg(0, ios::end);
- size_t file_size = file_stream.tellg();
- file_stream.seekg(file_start, ios::beg);
- return file_size;
- }
-
- float BinaryReader::read_aligned_float() {
- try {
- const int FLOAT_SIZE = 4;
- array list_of_bytes;
- for (int index = 0; index < FLOAT_SIZE; index++) {
- list_of_bytes[index] = read_aligned_byte();
- }
- return bytes_to_float(list_of_bytes);
- }
- catch (runtime_error e) {
- cout << "Exception caught: " << e.what() << endl;
- return 0;
- }
- }
-
- float BinaryReader::bytes_to_float(array bytes) {
- float combined_value = 0.0f;
- memcpy(&combined_value, &bytes, sizeof(combined_value));
- return combined_value;
- }
-
- uint8_t BinaryReader::read_aligned_uint8() {
- try {
- Byte next_byte = read_aligned_byte();
- uint8_t read_value = next_byte.get_value();
- return read_value;
- }
- catch (runtime_error e) {
- cout << "Exception caught: " << e.what() << endl;
- return 0;
- }
- }
-
- uint32_t BinaryReader::read_aligned_uint32() {
- try {
- const int AMOUNT_OF_BYTES_TO_READ = 4;
- array list_of_bytes;
- for (int index = 0; index < AMOUNT_OF_BYTES_TO_READ; index++) {
- list_of_bytes[index] = read_aligned_byte();
- }
- uint32_t read_value = bytes_to_uint32(list_of_bytes);
- return read_value;
- }
- catch(runtime_error e){
- cout << "Exception caught: " << e.what() << endl;
- return 0;
- }
- }
-
- uint32_t BinaryReader::bytes_to_uint32(array bytes) {
- uint32_t combined_value = 0;
- memcpy(&combined_value, &bytes, sizeof(combined_value));
- return combined_value;
- }
-
- uint64_t BinaryReader::read_aligned_uint64() {
- try {
- const int AMOUNT_OF_BYTES_TO_READ = 8;
- array list_of_bytes;
- for (int index = 0; index < AMOUNT_OF_BYTES_TO_READ; index++) {
- list_of_bytes[index] = read_aligned_byte();
- }
- uint64_t read_value = bytes_to_uint64(list_of_bytes);
- return read_value;
- }
- catch (runtime_error e) {
- cout << "Exception caught: " << e.what() << endl;
- return 0;
- }
- }
-
- uint64_t BinaryReader::bytes_to_uint64(array bytes) {
- uint64_t combined_value = 0;
- memcpy(&combined_value, &bytes, sizeof(combined_value));
- return combined_value;
- }
-
- string BinaryReader::read_length_prefixed_string() {
- string string_value;
- uint32_t string_length = read_aligned_uint32();
- string_value = read_string_of_n_length(string_length);
- return string_value;
- }
-
- //TODO: Cleanup method
- string BinaryReader::read_string_of_n_length(uint32_t length) {
- try {
- char *string_array = new char[length];
- for (uint32_t index = 0; index < length; index++) {
- Byte next_byte = read_aligned_byte();
- uint8_t byte_value = next_byte.get_value();
- char next_char;
- memcpy(&next_char, &byte_value, sizeof(next_char));
- string_array[index] = next_char;
- }
- string string_value(string_array);
- delete string_array;
- return string_value;
- }
- catch (runtime_error e) {
- cout << "Exception caught: " << e.what() << endl;
- return string("READ_FAIL");
- }
- }
-
- Byte BinaryReader::read_aligned_byte() {
- if (bit_position != 0) {
- throw runtime_error(
- "Attempted to read byte with bit pointer misaligned"
- );
- }
- Byte next_byte = file_bytes.at(byte_position);
- increment_byte_position();
- return next_byte;
- }
-
- void BinaryReader::increment_byte_position() {
- byte_position++;
- }
-
- void BinaryReader::increment_bit_position() {
- bit_position++;
- if (bit_position > 7) {
- bit_position = 0;
- increment_byte_position();
- }
- }
-
- size_t BinaryReader::size() {
- return file_bytes.size();
- }
-
- void BinaryReader::close() {
- file_bytes.clear();
- byte_position = 0;
- bit_position = 0;
- }
-
-}
+ BinaryReader::BinaryReader(const string &filepath) {
+ try {
+ byte_position = 0;
+ bit_position = 0;
+ read_file(filepath);
+ }
+ catch(const runtime_error &e) {
+ file_bytes.resize(0);
+ }
+ }
+
+ void BinaryReader::read_file(const string &filepath) {
+ std::ifstream file_stream(filepath, ios::binary | ios::in);
+ if (file_stream.is_open()) {
+ size_t file_size = get_file_size(file_stream);
+ file_bytes.resize(file_size);
+
+ // TODO(michaeldoylecs): Replace named cast
+ file_stream.read(reinterpret_cast(file_bytes.data()), file_size);
+ file_stream.close();
+ }
+ else {
+ throw runtime_error("Failed to open file exception");
+ }
+ }
+
+ size_t BinaryReader::get_file_size(std::ifstream &file_stream) {
+ size_t file_start = file_stream.tellg();
+ file_stream.seekg(0, ios::end);
+ size_t file_size = file_stream.tellg();
+ file_stream.seekg(file_start, ios::beg);
+ return file_size;
+ }
+
+ float BinaryReader::read_aligned_float() {
+ try {
+ const int FLOAT_SIZE = 4;
+ array list_of_bytes;
+ for (int index = 0; index < FLOAT_SIZE; index++) {
+ list_of_bytes.at(index) = read_aligned_byte();
+ }
+ return bytes_to_float(list_of_bytes);
+ }
+ catch (runtime_error &e) {
+ std::cerr << "Exception caught: " << e.what() << std::endl;
+ return 0;
+ }
+ }
+
+ float BinaryReader::bytes_to_float(array bytes) {
+ float combined_value = 0.0f;
+ // TODO(michaeldoylecs): Replaced non-trivial memcpy
+ memcpy(&combined_value, &bytes, sizeof(combined_value));
+ return combined_value;
+ }
+
+ uint8_t BinaryReader::read_aligned_uint8() {
+ try {
+ Byte next_byte = read_aligned_byte();
+ uint8_t read_value = std::to_integer(next_byte.get_value());
+ return read_value;
+ }
+ catch (runtime_error &e) {
+ std::cerr << "Exception caught: " << e.what() << std::endl;
+ return 0;
+ }
+ }
+
+ uint32_t BinaryReader::read_aligned_uint32() {
+ try {
+ const int AMOUNT_OF_BYTES_TO_READ = 4;
+ array list_of_bytes;
+ for (int index = 0; index < AMOUNT_OF_BYTES_TO_READ; index++) {
+ list_of_bytes.at(index) = read_aligned_byte();
+ }
+ uint32_t read_value = bytes_to_uint32(list_of_bytes);
+ return read_value;
+ }
+ catch(runtime_error &e){
+ std::cerr << "Exception caught: " << e.what() << std::endl;
+ return 0;
+ }
+ }
+
+ uint32_t BinaryReader::bytes_to_uint32(array bytes) {
+ uint32_t combined_value = 0;
+ // TODO(michaeldoylecs): Replace non-trivial memcpy
+ memcpy(&combined_value, &bytes, sizeof(combined_value));
+ return combined_value;
+ }
+
+ uint64_t BinaryReader::read_aligned_uint64() {
+ try {
+ const int AMOUNT_OF_BYTES_TO_READ = 8;
+ array list_of_bytes;
+ for (int index = 0; index < AMOUNT_OF_BYTES_TO_READ; index++) {
+ list_of_bytes.at(index) = read_aligned_byte();
+ }
+ uint64_t read_value = bytes_to_uint64(list_of_bytes);
+ return read_value;
+ }
+ catch (runtime_error &e) {
+ std::cerr << "Exception caught: " << e.what() << std::endl;
+ return 0;
+ }
+ }
+
+ uint64_t BinaryReader::bytes_to_uint64(array bytes) {
+ uint64_t combined_value = 0;
+ // TODO(michaeldoylecs): Replace non-trivial memcpy
+ memcpy(&combined_value, &bytes, sizeof(combined_value));
+ return combined_value;
+ }
+
+ string BinaryReader::read_length_prefixed_string() {
+ string string_value;
+ uint32_t string_length = read_aligned_uint32();
+ string_value = read_string_of_n_length(string_length);
+ return string_value;
+ }
+
+ // TODO(michaeldoylecs): Cleanup method
+ string BinaryReader::read_string_of_n_length(uint32_t length) {
+ try {
+ string read_string;
+ for (uint32_t i = 0; i < length; i++) {
+ Byte next_byte = read_aligned_byte();
+ auto byte_value = std::to_integer(next_byte.get_value());
+ char next_char;
+ memcpy(&next_char, &byte_value, sizeof(next_char));
+ read_string += next_char;
+ }
+ return read_string;
+ }
+ catch (runtime_error &e) {
+ std::cerr << "Exception caught: " << e.what() << std::endl;
+ return {};
+ }
+ }
+
+ Byte BinaryReader::read_aligned_byte() {
+ if (bit_position != 0) {
+ throw runtime_error(
+ "Attempted to read byte with bit pointer misaligned"
+ );
+ }
+ Byte next_byte = file_bytes.at(byte_position);
+ increment_byte_position();
+ return next_byte;
+ }
+
+ void BinaryReader::increment_byte_position() {
+ byte_position++;
+ }
+
+ void BinaryReader::increment_bit_position() {
+ bit_position++;
+ if (bit_position > 7) {
+ bit_position = 0;
+ increment_byte_position();
+ }
+ }
+
+ size_t BinaryReader::size() {
+ return file_bytes.size();
+ }
+
+ void BinaryReader::close() {
+ file_bytes.clear();
+ byte_position = 0;
+ bit_position = 0;
+ }
+
+} // namespace ReplayParser
diff --git a/RocketAnalyticsLib/src/Byte.cpp b/RocketAnalyticsLib/src/Byte.cpp
index 6c6ddee..2643184 100644
--- a/RocketAnalyticsLib/src/Byte.cpp
+++ b/RocketAnalyticsLib/src/Byte.cpp
@@ -4,76 +4,67 @@
* File: Byte.cpp
*****************************************************************************/
-#include "Byte.hpp"
+#include "../include/Byte.hpp"
+#include
namespace ReplayParser {
Byte::Byte() {
- byte_value.value = 0;
+ this->value = std::byte(0);
}
-
Byte::Byte(std::uint8_t value) {
- byte_value.value = value;
+ this->value = std::byte(value);
}
-
Byte::Byte(const Byte &byte) {
- byte_value.value = byte.byte_value.value;
+ this->value = byte.value;
}
-
- std::uint8_t Byte::get_value() {
- return byte_value.value;
+ std::byte Byte::get_value() {
+ return value;
}
-
- int Byte::get_bit(int index) {
- std::uint8_t bit_value = 0;
+ int8_t Byte::get_bit(int index) {
+ std::byte bit_value = std::byte(0);
+ const std::byte BIT_MASK = std::byte(0x01);
switch (index) {
case 0:
- bit_value = byte_value.bits.bit1;
+ bit_value |= (this->value >> 7) & BIT_MASK;
break;
case 1:
- bit_value = byte_value.bits.bit2;
+ bit_value |= (this->value >> 6) & BIT_MASK;
break;
case 2:
- bit_value = byte_value.bits.bit3;
+ bit_value |= (this->value >> 5) & BIT_MASK;
break;
case 3:
- bit_value = byte_value.bits.bit4;
+ bit_value |= (this->value >> 4) & BIT_MASK;
break;
case 4:
- bit_value = byte_value.bits.bit5;
+ bit_value |= (this->value >> 3) & BIT_MASK;
break;
case 5:
- bit_value = byte_value.bits.bit6;
+ bit_value |= (this->value >> 2) & BIT_MASK;
break;
case 6:
- bit_value = byte_value.bits.bit7;
+ bit_value |= (this->value >> 1) & BIT_MASK;
break;
case 7:
- bit_value = byte_value.bits.bit8;
+ bit_value |= this->value & BIT_MASK;
break;
default:
- bit_value = 0;
break;
}
- return bit_value;
+ return std::to_integer(bit_value);
}
std::string Byte::to_string() {
- std::string bit1 = std::to_string(byte_value.bits.bit1);
- std::string bit2 = std::to_string(byte_value.bits.bit2);
- std::string bit3 = std::to_string(byte_value.bits.bit3);
- std::string bit4 = std::to_string(byte_value.bits.bit4);
- std::string bit5 = std::to_string(byte_value.bits.bit5);
- std::string bit6 = std::to_string(byte_value.bits.bit6);
- std::string bit7 = std::to_string(byte_value.bits.bit7);
- std::string bit8 = std::to_string(byte_value.bits.bit8);
- std::string output = bit8 + bit7 + bit6 + bit5 + bit4 + bit3 + bit2 + bit1;
- return output;
+ std::stringstream output;
+ output << get_bit(0) << get_bit(1) << get_bit (2) << get_bit(3) \
+ << get_bit(4) << get_bit(5) << get_bit(6) << get_bit(7);
+ return output.str();
}
}
diff --git a/RocketAnalyticsLib/src/Keyframe.cpp b/RocketAnalyticsLib/src/Keyframe.cpp
new file mode 100644
index 0000000..f9d1a65
--- /dev/null
+++ b/RocketAnalyticsLib/src/Keyframe.cpp
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * Author: Michael Doyle
+ * Date: 3/31/18
+ * File: Keyframe.cpp
+ *****************************************************************************/
+
+#include "../include/Keyframe.hpp"
+
+using std::uint32_t;
+
+namespace ReplayParser {
+
+ Keyframe::Keyframe(float time, uint32_t frame, uint32_t filePosition) {
+ this->timeStamp = time;
+ this->frameNum = frame;
+ this->filePos = filePosition;
+ }
+
+ float Keyframe::time() {
+ return this->timeStamp;
+ }
+
+ uint32_t Keyframe::frame() {
+ return this->frameNum;
+ }
+
+ uint32_t Keyframe::filePosition() {
+ return this->filePos;
+ }
+
+ bool Keyframe::operator==(const Keyframe &k2) const {
+ if (this->timeStamp == k2.timeStamp &&
+ this->frameNum == k2.frameNum &&
+ this->filePos == k2.filePos) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/RocketAnalyticsLib/src/ReplayFile.cpp b/RocketAnalyticsLib/src/ReplayFile.cpp
index c56fe11..ff207cc 100644
--- a/RocketAnalyticsLib/src/ReplayFile.cpp
+++ b/RocketAnalyticsLib/src/ReplayFile.cpp
@@ -4,16 +4,17 @@
* File: ReplayFile.cpp
*****************************************************************************/
-#include "ReplayFile.hpp"
-#include "BinaryReader.hpp"
-#include "ReplayHeader.hpp"
+#include "../include/ReplayFile.hpp"
+#include "../include/BinaryReader.hpp"
namespace ReplayParser {
- ReplayFile::ReplayFile(std::string filepath) {
- BinaryReader file_reader = BinaryReader(filepath);
+ ReplayFile::ReplayFile(const std::string &filepath) {
+ replay_file_path = filepath;
+ BinaryReader file_reader = BinaryReader(replay_file_path);
replay_header = ReplayHeader::deserialize(file_reader);
replay_levels = ReplayLevels::deserialize_levels(file_reader);
+ replay_keyframes = ReplayKeyframes::deserialize_keyframes(file_reader);
file_reader.close();
}
@@ -25,4 +26,8 @@ namespace ReplayParser {
return replay_levels;
}
-}
+ ReplayKeyframes ReplayFile::get_keyframes() {
+ return replay_keyframes;
+ }
+
+} // namespace ReplayParser
diff --git a/RocketAnalyticsLib/src/ReplayHeader.cpp b/RocketAnalyticsLib/src/ReplayHeader.cpp
index 2db8741..ee12802 100644
--- a/RocketAnalyticsLib/src/ReplayHeader.cpp
+++ b/RocketAnalyticsLib/src/ReplayHeader.cpp
@@ -4,7 +4,7 @@
* File: ReplayHeader.cpp
*****************************************************************************/
-#include "ReplayHeader.hpp"
+#include "../include/ReplayHeader.hpp"
#include
using std::uint32_t;
diff --git a/RocketAnalyticsLib/src/ReplayKeyframes.cpp b/RocketAnalyticsLib/src/ReplayKeyframes.cpp
new file mode 100644
index 0000000..e60632f
--- /dev/null
+++ b/RocketAnalyticsLib/src/ReplayKeyframes.cpp
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * Author: Michael Doyle
+ * Date: 3/31/18
+ * File: ReplayKeyframes.cpp
+ *****************************************************************************/
+
+#include "../include/ReplayKeyframes.hpp"
+
+namespace ReplayParser {
+
+ ReplayKeyframes ReplayKeyframes::deserialize_keyframes(BinaryReader& binary_reader) {
+ ReplayKeyframes keyframes;
+ float time;
+ uint32_t frame;
+ uint32_t filePos;
+ uint32_t keyframe_count = binary_reader.read_aligned_uint32();
+ for (uint32_t i = 0; i < keyframe_count; ++i) {
+ time = binary_reader.read_aligned_float();
+ frame = binary_reader.read_aligned_uint32();
+ filePos = binary_reader.read_aligned_uint32();
+ keyframes.add(Keyframe(time, frame, filePos));
+ }
+ return keyframes;
+ }
+
+ void ReplayKeyframes::add(Keyframe keyframe) {
+ keyframes.push_back(keyframe);
+ }
+
+ bool ReplayKeyframes::remove(Keyframe keyframe) {
+ size_t size = this->count();
+ int indexToRemove = -1;
+
+ // Check if the keyframe is in the list of keyframes
+ for (int i = 0; i < size; ++i) {
+ if (this->keyframes[i] == keyframe) {
+ indexToRemove = i;
+ break;
+ }
+ }
+
+ // If the keyframe was found, remove it.
+ if (indexToRemove != -1) {
+ this->keyframes.erase(keyframes.begin() + indexToRemove);
+ return true;
+ }
+
+ return false;
+ }
+
+ Keyframe ReplayKeyframes::get(int index) {
+ return keyframes[index];
+ }
+
+ size_t ReplayKeyframes::count() {
+ return keyframes.size();
+ }
+}
diff --git a/RocketAnalyticsLib/src/ReplayLevels.cpp b/RocketAnalyticsLib/src/ReplayLevels.cpp
index 1b85315..127f977 100644
--- a/RocketAnalyticsLib/src/ReplayLevels.cpp
+++ b/RocketAnalyticsLib/src/ReplayLevels.cpp
@@ -4,8 +4,7 @@
* File: ReplayLevels.cpp
*****************************************************************************/
-#include
-#include "ReplayLevels.hpp"
+#include "../include/ReplayLevels.hpp"
using std::uint32_t;
using std::string;
@@ -13,9 +12,6 @@ using std::vector;
namespace ReplayParser {
- ReplayLevels::ReplayLevels() {
- }
-
ReplayLevels ReplayLevels::deserialize_levels(BinaryReader& binary_reader) {
ReplayLevels replay_levels;
uint32_t level_count = binary_reader.read_aligned_uint32();
diff --git a/RocketAnalyticsLib/src/Version.cpp b/RocketAnalyticsLib/src/Version.cpp
index 3e86436..484fd1c 100644
--- a/RocketAnalyticsLib/src/Version.cpp
+++ b/RocketAnalyticsLib/src/Version.cpp
@@ -4,7 +4,7 @@
* File: Version.cpp
*****************************************************************************/
-#include "Version.hpp"
+#include "../include/Version.hpp"
namespace ReplayParser {
diff --git a/RocketAnalyticsLib/src/properties/ByteValue.cpp b/RocketAnalyticsLib/src/properties/ByteValue.cpp
index c09d832..4c4b4c0 100644
--- a/RocketAnalyticsLib/src/properties/ByteValue.cpp
+++ b/RocketAnalyticsLib/src/properties/ByteValue.cpp
@@ -4,7 +4,7 @@
* File: ByteValue.cpp
*****************************************************************************/
-#include "ByteValue.hpp"
+#include "../../include/properties/ByteValue.hpp"
namespace ReplayParser {
diff --git a/RocketAnalyticsLib/src/properties/Property.cpp b/RocketAnalyticsLib/src/properties/Property.cpp
index b4bbaac..765eccd 100644
--- a/RocketAnalyticsLib/src/properties/Property.cpp
+++ b/RocketAnalyticsLib/src/properties/Property.cpp
@@ -4,8 +4,8 @@
* File: Property.cpp
*****************************************************************************/
-#include "PropertyValue.hpp"
-#include "Property.hpp"
+#include "../../include/properties/PropertyValue.hpp"
+#include "../../include/properties/Property.hpp"
using std::string;
using std::vector;
diff --git a/RocketAnalyticsLib/src/properties/PropertyType.cpp b/RocketAnalyticsLib/src/properties/PropertyType.cpp
index 1ae6019..04729fa 100644
--- a/RocketAnalyticsLib/src/properties/PropertyType.cpp
+++ b/RocketAnalyticsLib/src/properties/PropertyType.cpp
@@ -4,7 +4,7 @@
* File: PropertyType.cpp
*****************************************************************************/
-#include "properties\PropertyType.hpp"
+#include "../../include/properties/PropertyType.hpp"
namespace ReplayParser {
diff --git a/RocketAnalyticsLib/src/properties/PropertyValue.cpp b/RocketAnalyticsLib/src/properties/PropertyValue.cpp
index 4bdb076..e6d3940 100644
--- a/RocketAnalyticsLib/src/properties/PropertyValue.cpp
+++ b/RocketAnalyticsLib/src/properties/PropertyValue.cpp
@@ -4,10 +4,10 @@
* File: PropertyValue.cpp
*****************************************************************************/
-#include "ByteValue.hpp"
-#include "PropertyType.hpp"
-#include "PropertyValue.hpp"
-#include "Property.hpp"
+#include "../../include/properties/ByteValue.hpp"
+#include "../../include/properties/PropertyType.hpp"
+#include "../../include/properties/PropertyValue.hpp"
+#include "../../include/properties/Property.hpp"
namespace ReplayParser {
@@ -227,7 +227,7 @@ namespace ReplayParser {
std::string string_value = "";
size_t property_count = property_value.list.size();
std::vector property_array;
- for (int i = 0; i < property_count; i++) {
+ for (size_t i = 0; i < property_count; i++) {
property_array = property_value.list[i];
Property property;
int index = 0;
diff --git a/RocketAnalyticsTests/RocketAnalyticsTests.vcxproj b/RocketAnalyticsTests/RocketAnalyticsTests.vcxproj
deleted file mode 100644
index 23c257b..0000000
--- a/RocketAnalyticsTests/RocketAnalyticsTests.vcxproj
+++ /dev/null
@@ -1,179 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 15.0
- {1EA737FE-FD97-4565-B22A-3B616EA8C755}
- Win32Proj
- RocketAnalyticsTests
- 10.0.15063.0
-
-
-
- Application
- true
- v141
- Unicode
-
-
- Application
- false
- v141
- true
- Unicode
-
-
- Application
- true
- v141
- Unicode
-
-
- Application
- false
- v141
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
- static
- $(SolutionDir)Debug;$(LibraryPath)
-
-
- true
-
-
- false
-
-
- false
-
-
-
-
-
- Level4
- Disabled
- WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
- $(SolutionDir)RocketAnalyticsLib\include\properties;$(SolutionDir)RocketAnalyticsLib\include;$(SolutionDir)googletest\googletest\include;$(SolutionDir)googletest\googletest;%(AdditionalIncludeDirectories)
- true
-
-
- Console
- $(SolutionDir)Debug;%(AdditionalLibraryDirectories)
- $(SolutionDir)Debug\RocketAnalyticsLib.lib;%(AdditionalDependencies)
-
-
-
-
-
-
- Level4
- Disabled
- _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
- $(SolutionDir)RocketAnalyticsLib\include;$(SolutionDir)RocketAnalyticsLib\include\properties;$(SolutionDir)googletest\googletest\include;$(SolutionDir)googletest\googletest;%(AdditionalIncludeDirectories)
- true
-
-
- Console
- D:\Library\Development\Projects\RocketAnalytics\x64\Debug;%(AdditionalLibraryDirectories)
-
-
-
-
-
-
-
-
-
-
-
-
- Level3
-
-
- MaxSpeed
- true
- true
- WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
-
-
- Console
- true
- true
-
-
-
-
- Level3
-
-
- MaxSpeed
- true
- true
- NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
-
-
- Console
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {79e03dbe-1638-49c0-a908-70e3b95b0dc0}
-
-
- {c0b68325-40be-4b93-8f9a-7ae2482f7cf4}
-
-
-
-
-
\ No newline at end of file
diff --git a/RocketAnalyticsTests/RocketAnalyticsTests.vcxproj.filters b/RocketAnalyticsTests/RocketAnalyticsTests.vcxproj.filters
deleted file mode 100644
index 4529f43..0000000
--- a/RocketAnalyticsTests/RocketAnalyticsTests.vcxproj.filters
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hh;hpp;hxx;hm;inl;inc;xsd
-
-
- {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
-
\ No newline at end of file
diff --git a/RocketAnalyticsTests/src/BinaryReaderTests.cpp b/RocketAnalyticsTests/src/BinaryReaderTests.cpp
index 4f4ebc5..e139fbb 100644
--- a/RocketAnalyticsTests/src/BinaryReaderTests.cpp
+++ b/RocketAnalyticsTests/src/BinaryReaderTests.cpp
@@ -2,14 +2,14 @@
// Date: 8/13/17
// BinaryReaderTests.cpp
-#include "BinaryReader.hpp"
-#include "gtest/gtest.h"
-#include
+#include "../../build/googletest-src/googletest/include/gtest/gtest.h"
+#include "../../RocketAnalyticsLib/include/BinaryReader.hpp"
#include
+#include
-using namespace ReplayParser;
+using ReplayParser::BinaryReader;
-//TODO: Write better tests for BinaryReader
+// TODO(michaeldoylecs): Write better tests for BinaryReader
TEST(BinaryReaderTests, ReadTestReplay) {
BinaryReader binary_reader("../../Testing/BinaryReaderTests/TestReplay.replay");
diff --git a/RocketAnalyticsTests/src/ByteTests.cpp b/RocketAnalyticsTests/src/ByteTests.cpp
index 5c0de9c..13dd353 100644
--- a/RocketAnalyticsTests/src/ByteTests.cpp
+++ b/RocketAnalyticsTests/src/ByteTests.cpp
@@ -2,60 +2,55 @@
// Date: 8/13/17
// ByteMain.cpp
-#include "Byte.hpp"
-#include "gtest/gtest.h"
+#include "../../build/googletest-src/googletest/include/gtest/gtest.h"
+#include "../../RocketAnalyticsLib/include/Byte.hpp"
-using namespace ReplayParser;
+using ReplayParser::Byte;
struct ByteTests: testing::Test{
- Byte *byte;
- std::uint8_t value = 54; // 0x00110110
+ Byte byte;
+ std::uint8_t value = 54; // 0b00110110
ByteTests() {
- byte = new Byte(value);
+ byte = Byte(value);
}
- ~ByteTests(){
- delete byte;
- }
+ ~ByteTests() = default;
};
-
TEST_F(ByteTests, ByteCopyTest) {
- Byte new_byte = *byte;
- EXPECT_EQ(new_byte.get_value(), byte->get_value());
+ Byte new_byte = byte;
+ EXPECT_EQ( \
+ std::to_integer(new_byte.get_value()), \
+ std::to_integer(byte.get_value()) \
+ );
}
-
TEST_F(ByteTests, SizeOfByte) {
EXPECT_EQ(sizeof(Byte), sizeof(std::uint8_t));
}
-
TEST_F(ByteTests, GetValue) {
- EXPECT_EQ(byte->get_value(), value);
+ EXPECT_EQ(std::to_integer(byte.get_value()), value);
}
-
TEST_F(ByteTests, ByteToString) {
- EXPECT_EQ(byte->to_string(), "00110110");
+ EXPECT_EQ(byte.to_string(), "00110110");
}
-
TEST_F(ByteTests, CheckBits) {
- EXPECT_EQ(byte->get_bit(0), 0);
- EXPECT_EQ(byte->get_bit(1), 1);
- EXPECT_EQ(byte->get_bit(2), 1);
- EXPECT_EQ(byte->get_bit(3), 0);
- EXPECT_EQ(byte->get_bit(4), 1);
- EXPECT_EQ(byte->get_bit(5), 1);
- EXPECT_EQ(byte->get_bit(6), 0);
- EXPECT_EQ(byte->get_bit(7), 0);
+ EXPECT_EQ(byte.get_bit(0), 0);
+ EXPECT_EQ(byte.get_bit(1), 1);
+ EXPECT_EQ(byte.get_bit(2), 1);
+ EXPECT_EQ(byte.get_bit(3), 0);
+ EXPECT_EQ(byte.get_bit(4), 1);
+ EXPECT_EQ(byte.get_bit(5), 1);
+ EXPECT_EQ(byte.get_bit(6), 0);
+ EXPECT_EQ(byte.get_bit(7), 0);
}
-
TEST_F(ByteTests, DefaultConstructor) {
Byte byteObject;
- EXPECT_EQ(byteObject.get_value(), 0);
+ EXPECT_EQ(std::to_integer(byteObject.get_value()), 0);
}
diff --git a/RocketAnalyticsTests/src/ReplayHeaderTests.cpp b/RocketAnalyticsTests/src/ReplayHeaderTests.cpp
index 055c72a..0ee1818 100644
--- a/RocketAnalyticsTests/src/ReplayHeaderTests.cpp
+++ b/RocketAnalyticsTests/src/ReplayHeaderTests.cpp
@@ -2,10 +2,11 @@
// Date: 8/24/17
// ReplayHeaderTests.cpp
-#include "ReplayHeader.hpp"
-#include "gtest\gtest.h"
+#include "../../build/googletest-src/googletest/include/gtest/gtest.h"
+#include "../../RocketAnalyticsLib/include/ReplayHeader.hpp"
-using namespace ReplayParser;
+using ReplayParser::ReplayHeader;
+using ReplayParser::BinaryReader;
struct ReplayHeaderTest :testing::Test {
ReplayHeader replay_header;
@@ -24,11 +25,9 @@ struct ReplayHeaderTest :testing::Test {
replay_header = ReplayHeader::deserialize(binary_reader);
}
- ~ReplayHeaderTest() {
- }
+ ~ReplayHeaderTest() = default;
};
-
TEST_F(ReplayHeaderTest, DeserializeHeader) {
EXPECT_EQ(replay_header.get_header_size(), EXPECTED_HEADER_SIZE);
EXPECT_EQ(replay_header.get_crc1(), EXPECTED_CRC1);
diff --git a/RocketAnalyticsTests/src/RocketAnalyticsTests.cpp b/RocketAnalyticsTests/src/RocketAnalyticsTests.cpp
index ac7a456..8bfcc52 100644
--- a/RocketAnalyticsTests/src/RocketAnalyticsTests.cpp
+++ b/RocketAnalyticsTests/src/RocketAnalyticsTests.cpp
@@ -2,7 +2,7 @@
// Date: 7/25/17
// TestsMain.cpp
-#include "gtest/gtest.h"
+#include "../../build/googletest-src/googletest/include/gtest/gtest.h"
int main(int argc, char **argv)
{
diff --git a/RocketAnalyticsTests/src/VersionTests.cpp b/RocketAnalyticsTests/src/VersionTests.cpp
index 4253819..afb121e 100644
--- a/RocketAnalyticsTests/src/VersionTests.cpp
+++ b/RocketAnalyticsTests/src/VersionTests.cpp
@@ -2,10 +2,10 @@
// Date: 8/10/17
// VersionTests.cpp
-#include "Version.hpp"
-#include "gtest/gtest.h"
+#include "../../build/googletest-src/googletest/include/gtest/gtest.h"
+#include "../../RocketAnalyticsLib/include/Version.hpp"
-using namespace ReplayParser;
+using ReplayParser::Version;
using std::string;
using std::to_string;
using std::uint32_t;
@@ -27,7 +27,7 @@ struct VersionTests :testing::TestWithParam {
version = new Version(GetParam().version_major, GetParam().version_minor);
}
- ~VersionTests() {
+ ~VersionTests() override {
delete version;
}
};
diff --git a/RocketAnalyticsTests/src/properties/ByteValueTests.cpp b/RocketAnalyticsTests/src/properties/ByteValueTests.cpp
index 46af4ef..730b6bc 100644
--- a/RocketAnalyticsTests/src/properties/ByteValueTests.cpp
+++ b/RocketAnalyticsTests/src/properties/ByteValueTests.cpp
@@ -2,8 +2,8 @@
// Date: 8/12/17
// ByteValueTests.cpp
-#include "ByteValue.hpp"
-#include "gtest\gtest.h"
+#include "../../../build/googletest-src/googletest/include/gtest/gtest.h"
+#include "../../../RocketAnalyticsLib/include/properties/ByteValue.hpp"
using namespace ReplayParser;
diff --git a/RocketAnalyticsTests/src/properties/PropertyTests.cpp b/RocketAnalyticsTests/src/properties/PropertyTests.cpp
index 429e346..e52f813 100644
--- a/RocketAnalyticsTests/src/properties/PropertyTests.cpp
+++ b/RocketAnalyticsTests/src/properties/PropertyTests.cpp
@@ -2,9 +2,9 @@
// Date: 8/11/17
// PropertyTests.cpp
-#include "PropertyType.hpp"
-#include "Property.hpp"
-#include "gtest\gtest.h"
+#include "../../../build/googletest-src/googletest/include/gtest/gtest.h"
+#include "../../../RocketAnalyticsLib/include/properties/Property.hpp"
+#include "../../../RocketAnalyticsLib/include/properties/PropertyType.hpp"
using namespace ReplayParser;
diff --git a/RocketAnalyticsTests/src/properties/PropertyTypeTests.cpp b/RocketAnalyticsTests/src/properties/PropertyTypeTests.cpp
index 5eff8fc..623dc47 100644
--- a/RocketAnalyticsTests/src/properties/PropertyTypeTests.cpp
+++ b/RocketAnalyticsTests/src/properties/PropertyTypeTests.cpp
@@ -2,8 +2,8 @@
// Date: 8/10/17
// VersionTests.cpp
-#include "properties\PropertyType.hpp"
-#include "gtest\gtest.h"
+#include "../../../build/googletest-src/googletest/include/gtest/gtest.h"
+#include "../../../RocketAnalyticsLib/include/properties/PropertyType.hpp"
#include
using namespace ReplayParser;
diff --git a/RocketAnalyticsTests/src/properties/PropertyValueTests.cpp b/RocketAnalyticsTests/src/properties/PropertyValueTests.cpp
index 9a0257e..5bca92a 100644
--- a/RocketAnalyticsTests/src/properties/PropertyValueTests.cpp
+++ b/RocketAnalyticsTests/src/properties/PropertyValueTests.cpp
@@ -2,10 +2,10 @@
// Date: 8/12/17
// PropertyValueTests.cpp
-#include "Property.hpp"
-#include "PropertyType.hpp"
-#include "PropertyValue.hpp"
-#include "gtest\gtest.h"
+#include "../../../build/googletest-src/googletest/include/gtest/gtest.h"
+#include "../../../RocketAnalyticsLib/include/properties/Property.hpp"
+#include "../../../RocketAnalyticsLib/include/properties/PropertyType.hpp"
+#include "../../../RocketAnalyticsLib/include/properties/PropertyValue.hpp"
using namespace ReplayParser;
diff --git a/build/README.md b/build/README.md
new file mode 100644
index 0000000..150065e
--- /dev/null
+++ b/build/README.md
@@ -0,0 +1,5 @@
+# Build Information
+
+While inside of the *build* directory:
+1. Run `cmake ..` to generate the *make* file and download the necessary *google-test* files for testing purposes.
+2. Run `make .` to build the project.
diff --git a/googletest/.gitignore b/googletest/.gitignore
deleted file mode 100644
index 4cea432..0000000
--- a/googletest/.gitignore
+++ /dev/null
@@ -1,24 +0,0 @@
-# Ignore CI build directory
-build/
-xcuserdata
-cmake-build-debug/
-.idea/
-bazel-bin
-bazel-genfiles
-bazel-googletest
-bazel-out
-bazel-testlogs
-# python
-*.pyc
-
-# Visual Studio files
-*.sdf
-*.opensdf
-*.VC.opendb
-*.suo
-*.user
-_ReSharper.Caches/
-Win32-Debug/
-Win32-Release/
-x64-Debug/
-x64-Release/
diff --git a/googletest/.travis.yml b/googletest/.travis.yml
deleted file mode 100644
index 4afad4a..0000000
--- a/googletest/.travis.yml
+++ /dev/null
@@ -1,74 +0,0 @@
-# Build matrix / environment variable are explained on:
-# http://about.travis-ci.org/docs/user/build-configuration/
-# This file can be validated on:
-# http://lint.travis-ci.org/
-
-sudo: false
-language: cpp
-
-# Define the matrix explicitly, manually expanding the combinations of (os, compiler, env).
-# It is more tedious, but grants us far more flexibility.
-matrix:
- include:
- - os: linux
- compiler: gcc
- sudo: true
- cache:
- install: ./ci/install-linux.sh && ./ci/log-config.sh
- script: ./ci/build-linux-bazel.sh
- - os: linux
- compiler: clang
- sudo: true
- cache:
- install: ./ci/install-linux.sh && ./ci/log-config.sh
- script: ./ci/build-linux-bazel.sh
- - os: linux
- compiler: gcc
- env: BUILD_TYPE=Debug VERBOSE=1
- - os: linux
- compiler: gcc
- env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
- - os: linux
- compiler: clang
- env: BUILD_TYPE=Debug VERBOSE=1
- - os: linux
- compiler: clang
- env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
- - os: osx
- compiler: gcc
- env: BUILD_TYPE=Debug VERBOSE=1
- - os: osx
- compiler: gcc
- env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
- - os: osx
- compiler: clang
- env: BUILD_TYPE=Debug VERBOSE=1
- - os: osx
- compiler: clang
- env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c++11
-
-# These are the install and build (script) phases for the most common entries in the matrix. They could be included
-# in each entry in the matrix, but that is just repetitive.
-install:
- - ./ci/install-${TRAVIS_OS_NAME}.sh
- - . ./ci/env-${TRAVIS_OS_NAME}.sh
- - ./ci/log-config.sh
-
-script: ./ci/travis.sh
-
-# For sudo=false builds this section installs the necessary dependencies.
-addons:
- apt:
- # List of whitelisted in travis packages for ubuntu-precise can be found here:
- # https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
- # List of whitelisted in travis apt-sources:
- # https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
- sources:
- - ubuntu-toolchain-r-test
- - llvm-toolchain-precise-3.7
- packages:
- - g++-4.9
- - clang-3.7
-
-notifications:
- email: false
diff --git a/googletest/BUILD.bazel b/googletest/BUILD.bazel
deleted file mode 100644
index a442374..0000000
--- a/googletest/BUILD.bazel
+++ /dev/null
@@ -1,147 +0,0 @@
-# Copyright 2017 Google Inc.
-# All Rights Reserved.
-#
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Author: misterg@google.com (Gennadiy Civil)
-#
-# Bazel Build for Google C++ Testing Framework(Google Test)
-
-package(default_visibility = ["//visibility:public"])
-
-licenses(["notice"])
-
-config_setting(
- name = "win",
- values = {"cpu": "x64_windows_msvc"},
-)
-
-# Google Test including Google Mock
-cc_library(
- name = "gtest",
- srcs = glob(
- include = [
- "googletest/src/*.cc",
- "googletest/src/*.h",
- "googletest/include/gtest/**/*.h",
- "googlemock/src/*.cc",
- "googlemock/include/gmock/**/*.h",
- ],
- exclude = [
- "googletest/src/gtest-all.cc",
- "googletest/src/gtest_main.cc",
- "googlemock/src/gmock-all.cc",
- "googlemock/src/gmock_main.cc",
- ],
- ),
- hdrs =glob([
- "googletest/include/gtest/*.h",
- "googlemock/include/gmock/*.h",
- ]),
- copts = select(
- {
- ":win": [],
- "//conditions:default": ["-pthread"],
- },
- ),
- includes = [
- "googlemock",
- "googlemock/include",
- "googletest",
- "googletest/include",
- ],
- linkopts = select({
- ":win": [],
- "//conditions:default": [
- "-pthread",
- ],
- }),
-)
-
-cc_library(
- name = "gtest_main",
- srcs = [
- "googlemock/src/gmock_main.cc",
- ],
- deps = ["//:gtest"],
-)
-
-# The following rules build samples of how to use gTest.
-cc_library(
- name = "gtest_sample_lib",
- srcs = [
- "googletest/samples/sample1.cc",
- "googletest/samples/sample2.cc",
- "googletest/samples/sample4.cc",
- ],
- hdrs = [
- "googletest/samples/prime_tables.h",
- "googletest/samples/sample1.h",
- "googletest/samples/sample2.h",
- "googletest/samples/sample3-inl.h",
- "googletest/samples/sample4.h",
- ],
-)
-
-cc_test(
- name = "gtest_samples",
- size = "small",
- #All Samples except:
- #sample9 ( main )
- #sample10 (main and takes a command line option and needs to be separate)
- srcs = [
- "googletest/samples/sample1_unittest.cc",
- "googletest/samples/sample2_unittest.cc",
- "googletest/samples/sample3_unittest.cc",
- "googletest/samples/sample4_unittest.cc",
- "googletest/samples/sample5_unittest.cc",
- "googletest/samples/sample6_unittest.cc",
- "googletest/samples/sample7_unittest.cc",
- "googletest/samples/sample8_unittest.cc",
- ],
- deps = [
- "gtest_sample_lib",
- ":gtest_main",
- ],
-)
-
-cc_test(
- name = "sample9_unittest",
- size = "small",
- srcs = ["googletest/samples/sample9_unittest.cc"],
- deps = [":gtest"],
-)
-
-cc_test(
- name = "sample10_unittest",
- size = "small",
- srcs = ["googletest/samples/sample10_unittest.cc"],
- deps = [
- ":gtest",
- ],
-)
diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt
deleted file mode 100644
index f8a97fa..0000000
--- a/googletest/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-cmake_minimum_required(VERSION 2.6.4)
-
-if (POLICY CMP0048)
- cmake_policy(SET CMP0048 NEW)
-endif (POLICY CMP0048)
-
-project( googletest-distribution )
-
-enable_testing()
-
-include(CMakeDependentOption)
-if (CMAKE_VERSION VERSION_LESS 2.8.5)
- 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
-option(BUILD_GMOCK "Builds the googlemock subproject" 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)
- add_subdirectory( googlemock )
-elseif(BUILD_GTEST)
- add_subdirectory( googletest )
-endif()
diff --git a/googletest/CONTRIBUTING.md b/googletest/CONTRIBUTING.md
deleted file mode 100644
index 0ebdfcc..0000000
--- a/googletest/CONTRIBUTING.md
+++ /dev/null
@@ -1,160 +0,0 @@
-# How to become a contributor and submit your own code
-
-## Contributor License Agreements
-
-We'd love to accept your patches! Before we can take them, we
-have to jump a couple of legal hurdles.
-
-Please fill out either the individual or corporate Contributor License Agreement
-(CLA).
-
- * If you are an individual writing original source code and you're sure you
- own the intellectual property, then you'll need to sign an
- [individual CLA](https://developers.google.com/open-source/cla/individual).
- * If you work for a company that wants to allow you to contribute your work,
- then you'll need to sign a
- [corporate CLA](https://developers.google.com/open-source/cla/corporate).
-
-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
-accept your pull requests.
-
-## Contributing A Patch
-
-1. Submit an issue describing your proposed change to the
- [issue tracker](https://github.com/google/googletest).
-1. Please don't mix more than one logical change per submittal,
- because it makes the history hard to follow. If you want to make a
- change that doesn't have a corresponding issue in the issue
- tracker, please create one.
-1. Also, coordinate with team members that are listed on the issue in
- question. This ensures that work isn't being duplicated and
- communicating your plan early also generally leads to better
- patches.
-1. If your proposed change is accepted, and you haven't already done so, sign a
- Contributor License Agreement (see details above).
-1. Fork the desired repo, develop and test your code changes.
-1. Ensure that your code adheres to the existing style in the sample to which
- you are contributing.
-1. Ensure that your code has an appropriate set of unit tests which all pass.
-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 community exists primarily through the
-[discussion group](http://groups.google.com/group/googletestframework)
-and the GitHub repository.
-Likewise, the Google Mock community exists primarily through their own
-[discussion group](http://groups.google.com/group/googlemock).
-You are definitely encouraged to contribute to the
-discussion and you can also help us to keep the effectiveness of the
-group high by following and promoting the guidelines listed here.
-
-### Please Be Friendly ###
-
-Showing courtesy and respect to others is a vital part of the Google
-culture, and we strongly encourage everyone participating in Google
-Test development to join us in accepting nothing less. Of course,
-being courteous is not the same as failing to constructively disagree
-with each other, but it does mean that we should be respectful of each
-other when enumerating the 42 technical reasons that a particular
-proposal may not be the best choice. There's never a reason to be
-antagonistic or dismissive toward anyone who is sincerely trying to
-contribute to a discussion.
-
-Sure, C++ testing is serious business and all that, but it's also
-a lot of fun. Let's keep it that way. Let's strive to be one of the
-friendliest communities in all of open source.
-
-As always, discuss Google Test in the official GoogleTest discussion group.
-You don't have to actually submit code in order to sign up. Your participation
-itself is a valuable contribution.
-
-## Style
-
-To keep the source consistent, readable, diffable and easy to merge,
-we use a fairly rigid coding style, as defined by the [google-styleguide](https://github.com/google/styleguide) project. All patches will be expected
-to conform to the style outlined [here](https://google.github.io/styleguide/cppguide.html).
-
-## Requirements for Contributors ###
-
-If you plan to contribute a patch, you need to build Google Test,
-Google Mock, and their own tests from a git checkout, which has
-further requirements:
-
- * [Python](https://www.python.org/) v2.3 or newer (for running some of
- the tests and re-generating certain source files from templates)
- * [CMake](https://cmake.org/) v2.6.4 or newer
- * [GNU Build System](https://en.wikipedia.org/wiki/GNU_Build_System)
- including automake (>= 1.9), autoconf (>= 2.59), and
- libtool / libtoolize.
-
-## Developing Google Test ##
-
-This section discusses how to make your own changes to Google Test.
-
-### Testing Google Test Itself ###
-
-To make sure your changes work as intended and don't break existing
-functionality, you'll want to compile and run Google Test's own tests.
-For that you can use CMake:
-
- mkdir mybuild
- cd mybuild
- cmake -Dgtest_build_tests=ON ${GTEST_DIR}
-
-Make sure you have Python installed, as some of Google Test's tests
-are written in Python. If the cmake command complains about not being
-able to find Python (`Could NOT find PythonInterp (missing:
-PYTHON_EXECUTABLE)`), try telling it explicitly where your Python
-executable can be found:
-
- cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR}
-
-Next, you can build Google Test and all of its own tests. On \*nix,
-this is usually done by 'make'. To run the tests, do
-
- make test
-
-All tests should pass.
-
-### Regenerating Source Files ##
-
-Some of Google Test's source files are generated from templates (not
-in the C++ sense) using a script.
-For example, the
-file include/gtest/internal/gtest-type-util.h.pump is used to generate
-gtest-type-util.h in the same directory.
-
-You don't need to worry about regenerating the source files
-unless you need to modify them. You would then modify the
-corresponding `.pump` files and run the '[pump.py](googletest/scripts/pump.py)'
-generator script. See the [Pump Manual](googletest/docs/PumpManual.md).
-
-## Developing Google Mock ###
-
-This section discusses how to make your own changes to Google Mock.
-
-#### Testing Google Mock Itself ####
-
-To make sure your changes work as intended and don't break existing
-functionality, you'll want to compile and run Google Test's own tests.
-For that you'll need Autotools. First, make sure you have followed
-the instructions above to configure Google Mock.
-Then, create a build output directory and enter it. Next,
-
- ${GMOCK_DIR}/configure # try --help for more info
-
-Once you have successfully configured Google Mock, the build steps are
-standard for GNU-style OSS packages.
-
- make # Standard makefile following GNU conventions
- make check # Builds and runs all tests - all should pass.
-
-Note that when building your project against Google Mock, you are building
-against Google Test as well. There is no need to configure Google Test
-separately.
diff --git a/googletest/LICENSE b/googletest/LICENSE
deleted file mode 100644
index 1941a11..0000000
--- a/googletest/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright 2008, Google Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/googletest/README.md b/googletest/README.md
deleted file mode 100644
index 7936300..0000000
--- a/googletest/README.md
+++ /dev/null
@@ -1,122 +0,0 @@
-
-# Google Test #
-
-[](https://travis-ci.org/google/googletest)
-[](https://ci.appveyor.com/project/GoogleTestAppVeyor/googletest/branch/master)
-
-Welcome to **Google Test**, Google's C++ test framework!
-
-This repository is a merger of the formerly separate GoogleTest and
-GoogleMock projects. These were so closely related that it makes sense to
-maintain and release them together.
-
-Please see the project page above for more information as well as the
-mailing list for questions, discussions, and development. There is
-also an IRC channel on [OFTC](https://webchat.oftc.net/) (irc.oftc.net) #gtest available. Please
-join us!
-
-Getting started information for **Google Test** is available in the
-[Google Test Primer](googletest/docs/Primer.md) documentation.
-
-**Google Mock** is an extension to Google Test for writing and using C++ mock
-classes. See the separate [Google Mock documentation](googlemock/README.md).
-
-More detailed documentation for googletest (including build instructions) are
-in its interior [googletest/README.md](googletest/README.md) file.
-
-## Features ##
-
- * An [xUnit](https://en.wikipedia.org/wiki/XUnit) test framework.
- * Test discovery.
- * A rich set of assertions.
- * User-defined assertions.
- * Death tests.
- * Fatal and non-fatal failures.
- * Value-parameterized tests.
- * Type-parameterized tests.
- * Various options for running the tests.
- * XML test report generation.
-
-## Platforms ##
-
-Google test has been used on a variety of platforms:
-
- * Linux
- * Mac OS X
- * Windows
- * Cygwin
- * MinGW
- * Windows Mobile
- * Symbian
-
-## Who Is Using Google Test? ##
-
-In addition to many internal projects at Google, Google Test is also used by
-the following notable projects:
-
- * The [Chromium projects](http://www.chromium.org/) (behind the Chrome
- browser and Chrome OS).
- * The [LLVM](http://llvm.org/) compiler.
- * [Protocol Buffers](https://github.com/google/protobuf), Google's data
- interchange format.
- * The [OpenCV](http://opencv.org/) computer vision library.
- * [tiny-dnn](https://github.com/tiny-dnn/tiny-dnn): header only, dependency-free deep learning framework in C++11.
-
-## Related Open Source Projects ##
-
-[GTest Runner](https://github.com/nholthaus/gtest-runner) is a Qt5 based automated test-runner and Graphical User Interface with powerful features for Windows and Linux platforms.
-
-[Google Test UI](https://github.com/ospector/gtest-gbar) is test runner that runs
-your test binary, allows you to track its progress via a progress bar, and
-displays a list of test failures. Clicking on one shows failure text. Google
-Test UI is written in C#.
-
-[GTest TAP Listener](https://github.com/kinow/gtest-tap-listener) is an event
-listener for Google Test that implements the
-[TAP protocol](https://en.wikipedia.org/wiki/Test_Anything_Protocol) for test
-result output. If your test runner understands TAP, you may find it useful.
-
-[gtest-parallel](https://github.com/google/gtest-parallel) is a test runner that
-runs tests from your binary in parallel to provide significant speed-up.
-
-## Requirements ##
-
-Google Test is designed to have fairly minimal requirements to build
-and use with your projects, but there are some. Currently, we support
-Linux, Windows, Mac OS X, and Cygwin. We will also make our best
-effort to support other platforms (e.g. Solaris, AIX, and z/OS).
-However, since core members of the Google Test project have no access
-to these platforms, Google Test may have outstanding issues there. If
-you notice any problems on your platform, please notify
-[googletestframework@googlegroups.com](https://groups.google.com/forum/#!forum/googletestframework). Patches for fixing them are
-even more welcome!
-
-### Linux Requirements ###
-
-These are the base requirements to build and use Google Test from a source
-package (as described below):
-
- * GNU-compatible Make or gmake
- * POSIX-standard shell
- * POSIX(-2) Regular Expressions (regex.h)
- * A C++98-standard-compliant compiler
-
-### Windows Requirements ###
-
- * Microsoft Visual C++ 2010 or newer
-
-### Cygwin Requirements ###
-
- * Cygwin v1.5.25-14 or newer
-
-### Mac OS X Requirements ###
-
- * Mac OS X v10.4 Tiger or newer
- * Xcode Developer Tools
-
-## Contributing change
-
-Please read the [`CONTRIBUTING.md`](CONTRIBUTING.md) for details on
-how to contribute to this project.
-
-Happy testing!
diff --git a/googletest/WORKSPACE b/googletest/WORKSPACE
deleted file mode 100644
index 106b824..0000000
--- a/googletest/WORKSPACE
+++ /dev/null
@@ -1 +0,0 @@
-workspace(name = "com_google_googletest")
diff --git a/googletest/appveyor.yml b/googletest/appveyor.yml
deleted file mode 100644
index 4e8d6f6..0000000
--- a/googletest/appveyor.yml
+++ /dev/null
@@ -1,96 +0,0 @@
-version: '{build}'
-
-os: Visual Studio 2015
-
-environment:
- matrix:
- - compiler: msvc-15-seh
- generator: "Visual Studio 15 2017"
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
-
- - compiler: msvc-15-seh
- generator: "Visual Studio 15 2017 Win64"
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
-
- - compiler: msvc-14-seh
- generator: "Visual Studio 14 2015"
-
- - compiler: msvc-14-seh
- generator: "Visual Studio 14 2015 Win64"
-
- - compiler: msvc-12-seh
- generator: "Visual Studio 12 2013"
-
- - compiler: msvc-12-seh
- generator: "Visual Studio 12 2013 Win64"
-
- - compiler: msvc-11-seh
- generator: "Visual Studio 11 2012"
-
- - compiler: msvc-11-seh
- generator: "Visual Studio 11 2012 Win64"
-
- - compiler: msvc-10-seh
- generator: "Visual Studio 10 2010"
-
- - compiler: gcc-5.3.0-posix
- generator: "MinGW Makefiles"
- cxx_path: 'C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin'
-
- - compiler: gcc-6.3.0-posix
- generator: "MinGW Makefiles"
- cxx_path: 'C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin'
-
-configuration:
- - Debug
- #- Release
-
-build:
- verbosity: minimal
-
-install:
-- ps: |
- Write-Output "Compiler: $env:compiler"
- Write-Output "Generator: $env:generator"
-
- # git bash conflicts with MinGW makefiles
- if ($env:generator -eq "MinGW Makefiles") {
- $env:path = $env:path.replace("C:\Program Files\Git\usr\bin;", "")
- if ($env:cxx_path -ne "") {
- $env:path += ";$env:cxx_path"
- }
- }
-
-build_script:
-- ps: |
- md _build -Force | Out-Null
- cd _build
-
- $conf = if ($env:generator -eq "MinGW Makefiles") {"-DCMAKE_BUILD_TYPE=$env:configuration"} else {"-DCMAKE_CONFIGURATION_TYPES=Debug;Release"}
- # Disable test for MinGW (gtest tests fail, gmock tests can not build)
- $gtest_build_tests = if ($env:generator -eq "MinGW Makefiles") {"-Dgtest_build_tests=OFF"} else {"-Dgtest_build_tests=ON"}
- $gmock_build_tests = if ($env:generator -eq "MinGW Makefiles") {"-Dgmock_build_tests=OFF"} else {"-Dgmock_build_tests=ON"}
- & cmake -G "$env:generator" $conf -Dgtest_build_samples=ON $gtest_build_tests $gmock_build_tests ..
- if ($LastExitCode -ne 0) {
- throw "Exec: $ErrorMessage"
- }
- & cmake --build . --config $env:configuration
- if ($LastExitCode -ne 0) {
- throw "Exec: $ErrorMessage"
- }
-
-test_script:
-- ps: |
- if ($env:generator -eq "MinGW Makefiles") {
- return # No test available for MinGW
- }
- & ctest -C $env:configuration --timeout 300 --output-on-failure
- if ($LastExitCode -ne 0) {
- throw "Exec: $ErrorMessage"
- }
-
-artifacts:
- - path: '_build/CMakeFiles/*.log'
- name: logs
- - path: '_build/Testing/**/*.xml'
- name: test_results
diff --git a/googletest/ci/build-linux-bazel.sh b/googletest/ci/build-linux-bazel.sh
deleted file mode 100644
index 2f63896..0000000
--- a/googletest/ci/build-linux-bazel.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2017 Google Inc.
-# All Rights Reserved.
-#
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-set -e
-
-bazel build --curses=no //...:all
-bazel test --curses=no //...:all
diff --git a/googletest/ci/env-linux.sh b/googletest/ci/env-linux.sh
deleted file mode 100644
index 9086b1f..0000000
--- a/googletest/ci/env-linux.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2017 Google Inc.
-# All Rights Reserved.
-#
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#
-# This file should be sourced, and not executed as a standalone script.
-#
-
-# TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}.
-
-if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
- if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi
-fi
diff --git a/googletest/ci/env-osx.sh b/googletest/ci/env-osx.sh
deleted file mode 100644
index 31c8835..0000000
--- a/googletest/ci/env-osx.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2017 Google Inc.
-# All Rights Reserved.
-#
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#
-# This file should be sourced, and not executed as a standalone script.
-#
-
-# TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}.
-
-if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
- if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi
-fi
diff --git a/googletest/ci/install-linux.sh b/googletest/ci/install-linux.sh
deleted file mode 100644
index 02a1943..0000000
--- a/googletest/ci/install-linux.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2017 Google Inc.
-# All Rights Reserved.
-#
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-set -eu
-
-if [ "${TRAVIS_OS_NAME}" != linux ]; then
- echo "Not a Linux build; skipping installation"
- exit 0
-fi
-
-
-if [ "${TRAVIS_SUDO}" = "true" ]; then
- echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | \
- sudo tee /etc/apt/sources.list.d/bazel.list
- curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
- sudo apt-get update && sudo apt-get install -y bazel gcc-4.9 g++-4.9 clang-3.7
-elif [ "${CXX}" = "clang++" ]; then
- # Use ccache, assuming $HOME/bin is in the path, which is true in the Travis build environment.
- ln -sf /usr/bin/ccache $HOME/bin/${CXX};
- ln -sf /usr/bin/ccache $HOME/bin/${CC};
-fi
diff --git a/googletest/ci/install-osx.sh b/googletest/ci/install-osx.sh
deleted file mode 100644
index 6550ff5..0000000
--- a/googletest/ci/install-osx.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2017 Google Inc.
-# All Rights Reserved.
-#
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-set -eu
-
-if [ "${TRAVIS_OS_NAME}" != "osx" ]; then
- echo "Not a macOS build; skipping installation"
- exit 0
-fi
-
-brew install ccache
diff --git a/googletest/ci/log-config.sh b/googletest/ci/log-config.sh
deleted file mode 100644
index 5fef119..0000000
--- a/googletest/ci/log-config.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2017 Google Inc.
-# All Rights Reserved.
-#
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-set -e
-
-# ccache on OS X needs installation first
-# reset ccache statistics
-ccache --zero-stats
-
-echo PATH=${PATH}
-
-echo "Compiler configuration:"
-echo CXX=${CXX}
-echo CC=${CC}
-echo CXXFLAGS=${CXXFLAGS}
-
-echo "C++ compiler version:"
-${CXX} --version || echo "${CXX} does not seem to support the --version flag"
-${CXX} -v || echo "${CXX} does not seem to support the -v flag"
-
-echo "C compiler version:"
-${CC} --version || echo "${CXX} does not seem to support the --version flag"
-${CC} -v || echo "${CXX} does not seem to support the -v flag"
diff --git a/googletest/ci/travis.sh b/googletest/ci/travis.sh
deleted file mode 100644
index 24a557e..0000000
--- a/googletest/ci/travis.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env sh
-set -evx
-
-# if possible, ask for the precise number of processors,
-# otherwise take 2 processors as reasonable default; see
-# https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization
-if [ -x /usr/bin/getconf ]; then
- NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
-else
- NPROCESSORS=2
-fi
-# as of 2017-09-04 Travis CI reports 32 processors, but GCC build
-# crashes if parallelized too much (maybe memory consumption problem),
-# so limit to 4 processors for the time being.
-if [ $NPROCESSORS -gt 4 ] ; then
- echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4."
- NPROCESSORS=4
-fi
-# Tell make to use the processors. No preceding '-' required.
-MAKEFLAGS="j${NPROCESSORS}"
-export MAKEFLAGS
-
-env | sort
-
-mkdir build || true
-cd build
-cmake -Dgtest_build_samples=ON \
- -Dgtest_build_tests=ON \
- -Dgmock_build_tests=ON \
- -DCMAKE_CXX_FLAGS=$CXX_FLAGS \
- -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
- ..
-make
-CTEST_OUTPUT_ON_FAILURE=1 make test
diff --git a/googletest/googlemock/CHANGES b/googletest/googlemock/CHANGES
deleted file mode 100644
index 4328ece..0000000
--- a/googletest/googlemock/CHANGES
+++ /dev/null
@@ -1,126 +0,0 @@
-Changes for 1.7.0:
-
-* All new improvements in Google Test 1.7.0.
-* New feature: matchers DoubleNear(), FloatNear(),
- NanSensitiveDoubleNear(), NanSensitiveFloatNear(),
- UnorderedElementsAre(), UnorderedElementsAreArray(), WhenSorted(),
- WhenSortedBy(), IsEmpty(), and SizeIs().
-* Improvement: Google Mock can now be built as a DLL.
-* Improvement: when compiled by a C++11 compiler, matchers AllOf()
- and AnyOf() can accept an arbitrary number of matchers.
-* Improvement: when compiled by a C++11 compiler, matchers
- ElementsAreArray() can accept an initializer list.
-* Improvement: when exceptions are enabled, a mock method with no
- default action now throws instead crashing the test.
-* Improvement: added class testing::StringMatchResultListener to aid
- definition of composite matchers.
-* Improvement: function return types used in MOCK_METHOD*() macros can
- now contain unprotected commas.
-* Improvement (potentially breaking): EXPECT_THAT() and ASSERT_THAT()
- are now more strict in ensuring that the value type and the matcher
- type are compatible, catching potential bugs in tests.
-* Improvement: Pointee() now works on an optional.
-* Improvement: the ElementsAreArray() matcher can now take a vector or
- iterator range as input, and makes a copy of its input elements
- before the conversion to a Matcher.
-* Improvement: the Google Mock Generator can now generate mocks for
- some class templates.
-* Bug fix: mock object destruction triggerred by another mock object's
- destruction no longer hangs.
-* Improvement: Google Mock Doctor works better with newer Clang and
- GCC now.
-* Compatibility fixes.
-* Bug/warning fixes.
-
-Changes for 1.6.0:
-
-* Compilation is much faster and uses much less memory, especially
- when the constructor and destructor of a mock class are moved out of
- the class body.
-* New matchers: Pointwise(), Each().
-* New actions: ReturnPointee() and ReturnRefOfCopy().
-* CMake support.
-* Project files for Visual Studio 2010.
-* AllOf() and AnyOf() can handle up-to 10 arguments now.
-* Google Mock doctor understands Clang error messages now.
-* SetArgPointee<> now accepts string literals.
-* gmock_gen.py handles storage specifier macros and template return
- types now.
-* Compatibility fixes.
-* Bug fixes and implementation clean-ups.
-* Potentially incompatible changes: disables the harmful 'make install'
- command in autotools.
-
-Potentially breaking changes:
-
-* The description string for MATCHER*() changes from Python-style
- interpolation to an ordinary C++ string expression.
-* SetArgumentPointee is deprecated in favor of SetArgPointee.
-* Some non-essential project files for Visual Studio 2005 are removed.
-
-Changes for 1.5.0:
-
- * New feature: Google Mock can be safely used in multi-threaded tests
- on platforms having pthreads.
- * New feature: function for printing a value of arbitrary type.
- * New feature: function ExplainMatchResult() for easy definition of
- composite matchers.
- * The new matcher API lets user-defined matchers generate custom
- explanations more directly and efficiently.
- * Better failure messages all around.
- * NotNull() and IsNull() now work with smart pointers.
- * Field() and Property() now work when the matcher argument is a pointer
- passed by reference.
- * Regular expression matchers on all platforms.
- * Added GCC 4.0 support for Google Mock Doctor.
- * Added gmock_all_test.cc for compiling most Google Mock tests
- in a single file.
- * Significantly cleaned up compiler warnings.
- * Bug fixes, better test coverage, and implementation clean-ups.
-
- Potentially breaking changes:
-
- * Custom matchers defined using MatcherInterface or MakePolymorphicMatcher()
- need to be updated after upgrading to Google Mock 1.5.0; matchers defined
- using MATCHER or MATCHER_P* aren't affected.
- * Dropped support for 'make install'.
-
-Changes for 1.4.0 (we skipped 1.2.* and 1.3.* to match the version of
-Google Test):
-
- * Works in more environments: Symbian and minGW, Visual C++ 7.1.
- * Lighter weight: comes with our own implementation of TR1 tuple (no
- more dependency on Boost!).
- * New feature: --gmock_catch_leaked_mocks for detecting leaked mocks.
- * New feature: ACTION_TEMPLATE for defining templatized actions.
- * New feature: the .After() clause for specifying expectation order.
- * New feature: the .With() clause for specifying inter-argument
- constraints.
- * New feature: actions ReturnArg(), ReturnNew(...), and
- DeleteArg().
- * New feature: matchers Key(), Pair(), Args<...>(), AllArgs(), IsNull(),
- and Contains().
- * New feature: utility class MockFunction, useful for checkpoints, etc.
- * New feature: functions Value(x, m) and SafeMatcherCast(m).
- * New feature: copying a mock object is rejected at compile time.
- * New feature: a script for fusing all Google Mock and Google Test
- source files for easy deployment.
- * Improved the Google Mock doctor to diagnose more diseases.
- * Improved the Google Mock generator script.
- * Compatibility fixes for Mac OS X and gcc.
- * Bug fixes and implementation clean-ups.
-
-Changes for 1.1.0:
-
- * New feature: ability to use Google Mock with any testing framework.
- * New feature: macros for easily defining new matchers
- * New feature: macros for easily defining new actions.
- * New feature: more container matchers.
- * New feature: actions for accessing function arguments and throwing
- exceptions.
- * Improved the Google Mock doctor script for diagnosing compiler errors.
- * Bug fixes and implementation clean-ups.
-
-Changes for 1.0.0:
-
- * Initial Open Source release of Google Mock
diff --git a/googletest/googlemock/CMakeLists.txt b/googletest/googlemock/CMakeLists.txt
deleted file mode 100644
index ead51bf..0000000
--- a/googletest/googlemock/CMakeLists.txt
+++ /dev/null
@@ -1,225 +0,0 @@
-########################################################################
-# CMake build script for Google Mock.
-#
-# To run the tests for Google Mock itself on Linux, use 'make test' or
-# ctest. You can select which tests to run using 'ctest -R regex'.
-# 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)
-
-# A directory to find Google Test sources.
-if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt")
- set(gtest_dir gtest)
-else()
- set(gtest_dir ../googletest)
-endif()
-
-# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().
-include("${gtest_dir}/cmake/hermetic_build.cmake" OPTIONAL)
-
-if (COMMAND pre_project_set_up_hermetic_build)
- # Google Test also calls hermetic setup functions from add_subdirectory,
- # although its changes will not affect things at the current scope.
- pre_project_set_up_hermetic_build()
-endif()
-
-########################################################################
-#
-# Project-wide settings
-
-# Name of the project.
-#
-# CMake files in this project can refer to the root source directory
-# as ${gmock_SOURCE_DIR} and to the root binary directory as
-# ${gmock_BINARY_DIR}.
-# Language "C" is required for find_package(Threads).
-if (CMAKE_VERSION VERSION_LESS 3.0)
- project(gmock CXX C)
-else()
- cmake_policy(SET CMP0048 NEW)
- project(gmock VERSION 1.9.0 LANGUAGES CXX C)
-endif()
-cmake_minimum_required(VERSION 2.6.4)
-
-if (COMMAND set_up_hermetic_build)
- set_up_hermetic_build()
-endif()
-
-# Instructs CMake to process Google Test's CMakeLists.txt and add its
-# targets to the current scope. We are placing Google Test's binary
-# directory in a subdirectory of our own as VC compilation may break
-# if they are the same (the default).
-add_subdirectory("${gtest_dir}" "${gmock_BINARY_DIR}/gtest")
-
-# Although Google Test's CMakeLists.txt calls this function, the
-# changes there don't affect the current scope. Therefore we have to
-# call it again here.
-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.
-include_directories("${gmock_SOURCE_DIR}/include"
- "${gmock_SOURCE_DIR}"
- "${gtest_SOURCE_DIR}/include"
- # This directory is needed to build directly from Google
- # Test sources.
- "${gtest_SOURCE_DIR}")
-
-# Summary of tuple support for Microsoft Visual Studio:
-# Compiler version(MS) version(cmake) Support
-# ---------- ----------- -------------- -----------------------------
-# <= VS 2010 <= 10 <= 1600 Use Google Tests's own tuple.
-# VS 2012 11 1700 std::tr1::tuple + _VARIADIC_MAX=10
-# VS 2013 12 1800 std::tr1::tuple
-# VS 2015 14 1900 std::tuple
-# VS 2017 15 >= 1910 std::tuple
-if (MSVC AND MSVC_VERSION EQUAL 1700)
- add_definitions(/D _VARIADIC_MAX=10)
-endif()
-
-########################################################################
-#
-# Defines the gmock & gmock_main libraries. User tests should link
-# with one of them.
-
-# Google Mock libraries. We build them using more strict warnings than what
-# are used for other targets, to ensure that Google Mock can be compiled by
-# a user aggressive about warnings.
-cxx_library(gmock
- "${cxx_strict}"
- "${gtest_dir}/src/gtest-all.cc"
- src/gmock-all.cc)
-
-cxx_library(gmock_main
- "${cxx_strict}"
- "${gtest_dir}/src/gtest-all.cc"
- src/gmock-all.cc
- src/gmock_main.cc)
-
-# 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
-# in via add_subdirectory() rather than being a standalone build).
-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_main SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include")
-endif()
-
-########################################################################
-#
-# Install rules
-if(INSTALL_GMOCK)
- 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()
-
-########################################################################
-#
-# Google Mock's own tests.
-#
-# You can skip this section if you aren't interested in testing
-# Google Mock itself.
-#
-# The tests are not built by default. To build them, set the
-# gmock_build_tests option to ON. You can do it by running ccmake
-# or specifying the -Dgmock_build_tests=ON flag when running cmake.
-
-if (gmock_build_tests)
- # This must be set in the root directory for the tests to be run by
- # 'make test' or ctest.
- enable_testing()
-
- ############################################################
- # C++ tests built with standard compiler flags.
-
- cxx_test(gmock-actions_test gmock_main)
- cxx_test(gmock-cardinalities_test gmock_main)
- cxx_test(gmock_ex_test gmock_main)
- cxx_test(gmock-generated-actions_test gmock_main)
- cxx_test(gmock-generated-function-mockers_test gmock_main)
- cxx_test(gmock-generated-internal-utils_test gmock_main)
- cxx_test(gmock-generated-matchers_test gmock_main)
- cxx_test(gmock-internal-utils_test gmock_main)
- cxx_test(gmock-matchers_test gmock_main)
- cxx_test(gmock-more-actions_test gmock_main)
- cxx_test(gmock-nice-strict_test gmock_main)
- cxx_test(gmock-port_test gmock_main)
- cxx_test(gmock-spec-builders_test gmock_main)
- cxx_test(gmock_link_test gmock_main test/gmock_link2_test.cc)
- cxx_test(gmock_test gmock_main)
-
- if (DEFINED GTEST_HAS_PTHREAD)
- cxx_test(gmock_stress_test gmock)
- endif()
-
- # gmock_all_test is commented to save time building and running tests.
- # Uncomment if necessary.
- # cxx_test(gmock_all_test gmock_main)
-
- ############################################################
- # C++ tests built with non-standard compiler flags.
-
- cxx_library(gmock_main_no_exception "${cxx_no_exception}"
- "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
-
- cxx_library(gmock_main_no_rtti "${cxx_no_rtti}"
- "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
-
- if (NOT MSVC OR MSVC_VERSION LESS 1600) # 1600 is Visual Studio 2010.
- # Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that
- # conflict with our own definitions. Therefore using our own tuple does not
- # work on those compilers.
- cxx_library(gmock_main_use_own_tuple "${cxx_use_own_tuple}"
- "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
-
- cxx_test_with_flags(gmock_use_own_tuple_test "${cxx_use_own_tuple}"
- gmock_main_use_own_tuple test/gmock-spec-builders_test.cc)
- endif()
-
- cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}"
- gmock_main_no_exception test/gmock-more-actions_test.cc)
-
- cxx_test_with_flags(gmock_no_rtti_test "${cxx_no_rtti}"
- gmock_main_no_rtti test/gmock-spec-builders_test.cc)
-
- cxx_shared_library(shared_gmock_main "${cxx_default}"
- "${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)
-
- # Tests that a binary can be built with Google Mock as a shared library. On
- # some system configurations, it may not possible to run the binary without
- # knowing more details about the system configurations. We do not try to run
- # this binary. To get a more robust shared library coverage, configure with
- # -DBUILD_SHARED_LIBS=ON.
- cxx_executable_with_flags(shared_gmock_test_ "${cxx_default}"
- shared_gmock_main test/gmock-spec-builders_test.cc)
- set_target_properties(shared_gmock_test_
- PROPERTIES
- COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
-
- ############################################################
- # Python tests.
-
- cxx_executable(gmock_leak_test_ test gmock_main)
- py_test(gmock_leak_test)
-
- cxx_executable(gmock_output_test_ test gmock)
- py_test(gmock_output_test)
-endif()
diff --git a/googletest/googlemock/CONTRIBUTORS b/googletest/googlemock/CONTRIBUTORS
deleted file mode 100644
index 6e9ae36..0000000
--- a/googletest/googlemock/CONTRIBUTORS
+++ /dev/null
@@ -1,40 +0,0 @@
-# This file contains a list of people who've made non-trivial
-# contribution to the Google C++ Mocking Framework project. People
-# who commit code to the project are encouraged to add their names
-# here. Please keep the list sorted by first names.
-
-Benoit Sigoure
-Bogdan Piloca
-Chandler Carruth
-Dave MacLachlan
-David Anderson
-Dean Sturtevant
-Gene Volovich
-Hal Burch
-Jeffrey Yasskin
-Jim Keller
-Joe Walnes
-Jon Wray
-Keir Mierle
-Keith Ray
-Kostya Serebryany
-Lev Makhlis
-Manuel Klimek
-Mario Tanev
-Mark Paskin
-Markus Heule
-Matthew Simmons
-Mike Bland
-Neal Norwitz
-Nermin Ozkiranartli
-Owen Carlsen
-Paneendra Ba
-Paul Menage
-Piotr Kaminski
-Russ Rufer
-Sverre Sundsdal
-Takeshi Yoshino
-Vadim Berman
-Vlad Losev
-Wolfgang Klier
-Zhanyong Wan
diff --git a/googletest/googlemock/LICENSE b/googletest/googlemock/LICENSE
deleted file mode 100644
index 1941a11..0000000
--- a/googletest/googlemock/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright 2008, Google Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/googletest/googlemock/Makefile.am b/googletest/googlemock/Makefile.am
deleted file mode 100644
index 9adbc51..0000000
--- a/googletest/googlemock/Makefile.am
+++ /dev/null
@@ -1,224 +0,0 @@
-# Automake file
-
-# Nonstandard package files for distribution.
-EXTRA_DIST = LICENSE
-
-# We may need to build our internally packaged gtest. If so, it will be
-# included in the 'subdirs' variable.
-SUBDIRS = $(subdirs)
-
-# This is generated by the configure script, so clean it for distribution.
-DISTCLEANFILES = scripts/gmock-config
-
-# We define the global AM_CPPFLAGS as everything we compile includes from these
-# directories.
-AM_CPPFLAGS = $(GTEST_CPPFLAGS) -I$(srcdir)/include
-
-# Modifies compiler and linker flags for pthreads compatibility.
-if HAVE_PTHREADS
- AM_CXXFLAGS = @PTHREAD_CFLAGS@ -DGTEST_HAS_PTHREAD=1
- AM_LIBS = @PTHREAD_LIBS@
-endif
-
-# Build rules for libraries.
-lib_LTLIBRARIES = lib/libgmock.la lib/libgmock_main.la
-
-lib_libgmock_la_SOURCES = src/gmock-all.cc
-
-pkginclude_HEADERS = \
- include/gmock/gmock-actions.h \
- include/gmock/gmock-cardinalities.h \
- include/gmock/gmock-generated-actions.h \
- include/gmock/gmock-generated-function-mockers.h \
- include/gmock/gmock-generated-matchers.h \
- include/gmock/gmock-generated-nice-strict.h \
- include/gmock/gmock-matchers.h \
- include/gmock/gmock-more-actions.h \
- include/gmock/gmock-more-matchers.h \
- include/gmock/gmock-spec-builders.h \
- include/gmock/gmock.h
-
-pkginclude_internaldir = $(pkgincludedir)/internal
-pkginclude_internal_HEADERS = \
- include/gmock/internal/gmock-generated-internal-utils.h \
- include/gmock/internal/gmock-internal-utils.h \
- include/gmock/internal/gmock-port.h \
- include/gmock/internal/custom/gmock-generated-actions.h \
- include/gmock/internal/custom/gmock-matchers.h \
- include/gmock/internal/custom/gmock-port.h
-
-lib_libgmock_main_la_SOURCES = src/gmock_main.cc
-lib_libgmock_main_la_LIBADD = lib/libgmock.la
-
-# Build rules for tests. Automake's naming for some of these variables isn't
-# terribly obvious, so this is a brief reference:
-#
-# TESTS -- Programs run automatically by "make check"
-# check_PROGRAMS -- Programs built by "make check" but not necessarily run
-
-TESTS=
-check_PROGRAMS=
-AM_LDFLAGS = $(GTEST_LDFLAGS)
-
-# This exercises all major components of Google Mock. It also
-# verifies that libgmock works.
-TESTS += test/gmock-spec-builders_test
-check_PROGRAMS += test/gmock-spec-builders_test
-test_gmock_spec_builders_test_SOURCES = test/gmock-spec-builders_test.cc
-test_gmock_spec_builders_test_LDADD = $(GTEST_LIBS) lib/libgmock.la
-
-# This tests using Google Mock in multiple translation units. It also
-# verifies that libgmock_main and libgmock work.
-TESTS += test/gmock_link_test
-check_PROGRAMS += test/gmock_link_test
-test_gmock_link_test_SOURCES = \
- test/gmock_link2_test.cc \
- test/gmock_link_test.cc \
- test/gmock_link_test.h
-test_gmock_link_test_LDADD = $(GTEST_LIBS) lib/libgmock_main.la lib/libgmock.la
-
-if HAVE_PYTHON
- # Tests that fused gmock files compile and work.
- TESTS += test/gmock_fused_test
- check_PROGRAMS += test/gmock_fused_test
- test_gmock_fused_test_SOURCES = \
- fused-src/gmock-gtest-all.cc \
- fused-src/gmock/gmock.h \
- fused-src/gmock_main.cc \
- fused-src/gtest/gtest.h \
- test/gmock_test.cc
- test_gmock_fused_test_CPPFLAGS = -I"$(srcdir)/fused-src"
-endif
-
-# Google Mock source files that we don't compile directly.
-GMOCK_SOURCE_INGLUDES = \
- src/gmock-cardinalities.cc \
- src/gmock-internal-utils.cc \
- src/gmock-matchers.cc \
- src/gmock-spec-builders.cc \
- src/gmock.cc
-
-EXTRA_DIST += $(GMOCK_SOURCE_INGLUDES)
-
-# C++ tests that we don't compile using autotools.
-EXTRA_DIST += \
- test/gmock-actions_test.cc \
- test/gmock_all_test.cc \
- test/gmock-cardinalities_test.cc \
- test/gmock_ex_test.cc \
- test/gmock-generated-actions_test.cc \
- test/gmock-generated-function-mockers_test.cc \
- test/gmock-generated-internal-utils_test.cc \
- test/gmock-generated-matchers_test.cc \
- test/gmock-internal-utils_test.cc \
- test/gmock-matchers_test.cc \
- test/gmock-more-actions_test.cc \
- test/gmock-nice-strict_test.cc \
- test/gmock-port_test.cc \
- test/gmock_stress_test.cc
-
-# Python tests, which we don't run using autotools.
-EXTRA_DIST += \
- test/gmock_leak_test.py \
- test/gmock_leak_test_.cc \
- test/gmock_output_test.py \
- test/gmock_output_test_.cc \
- test/gmock_output_test_golden.txt \
- test/gmock_test_utils.py
-
-# Nonstandard package files for distribution.
-EXTRA_DIST += \
- CHANGES \
- CONTRIBUTORS \
- make/Makefile
-
-# Pump scripts for generating Google Mock headers.
-# TODO(chandlerc@google.com): automate the generation of *.h from *.h.pump.
-EXTRA_DIST += \
- include/gmock/gmock-generated-actions.h.pump \
- include/gmock/gmock-generated-function-mockers.h.pump \
- include/gmock/gmock-generated-matchers.h.pump \
- include/gmock/gmock-generated-nice-strict.h.pump \
- include/gmock/internal/gmock-generated-internal-utils.h.pump \
- include/gmock/internal/custom/gmock-generated-actions.h.pump
-
-# Script for fusing Google Mock and Google Test source files.
-EXTRA_DIST += scripts/fuse_gmock_files.py
-
-# The Google Mock Generator tool from the cppclean project.
-EXTRA_DIST += \
- scripts/generator/LICENSE \
- scripts/generator/README \
- scripts/generator/README.cppclean \
- scripts/generator/cpp/__init__.py \
- scripts/generator/cpp/ast.py \
- scripts/generator/cpp/gmock_class.py \
- scripts/generator/cpp/keywords.py \
- scripts/generator/cpp/tokenize.py \
- scripts/generator/cpp/utils.py \
- scripts/generator/gmock_gen.py
-
-# Script for diagnosing compiler errors in programs that use Google
-# Mock.
-EXTRA_DIST += scripts/gmock_doctor.py
-
-# CMake scripts.
-EXTRA_DIST += \
- CMakeLists.txt
-
-# Microsoft Visual Studio 2005 projects.
-EXTRA_DIST += \
- msvc/2005/gmock.sln \
- msvc/2005/gmock.vcproj \
- msvc/2005/gmock_config.vsprops \
- msvc/2005/gmock_main.vcproj \
- msvc/2005/gmock_test.vcproj
-
-# Microsoft Visual Studio 2010 projects.
-EXTRA_DIST += \
- msvc/2010/gmock.sln \
- msvc/2010/gmock.vcxproj \
- msvc/2010/gmock_config.props \
- msvc/2010/gmock_main.vcxproj \
- msvc/2010/gmock_test.vcxproj
-
-if HAVE_PYTHON
-# gmock_test.cc does not really depend on files generated by the
-# fused-gmock-internal rule. However, gmock_test.o does, and it is
-# important to include test/gmock_test.cc as part of this rule in order to
-# prevent compiling gmock_test.o until all dependent files have been
-# generated.
-$(test_gmock_fused_test_SOURCES): fused-gmock-internal
-
-# TODO(vladl@google.com): Find a way to add Google Tests's sources here.
-fused-gmock-internal: $(pkginclude_HEADERS) $(pkginclude_internal_HEADERS) \
- $(lib_libgmock_la_SOURCES) $(GMOCK_SOURCE_INGLUDES) \
- $(lib_libgmock_main_la_SOURCES) \
- scripts/fuse_gmock_files.py
- mkdir -p "$(srcdir)/fused-src"
- chmod -R u+w "$(srcdir)/fused-src"
- rm -f "$(srcdir)/fused-src/gtest/gtest.h"
- rm -f "$(srcdir)/fused-src/gmock/gmock.h"
- rm -f "$(srcdir)/fused-src/gmock-gtest-all.cc"
- "$(srcdir)/scripts/fuse_gmock_files.py" "$(srcdir)/fused-src"
- cp -f "$(srcdir)/src/gmock_main.cc" "$(srcdir)/fused-src"
-
-maintainer-clean-local:
- rm -rf "$(srcdir)/fused-src"
-endif
-
-# Death tests may produce core dumps in the build directory. In case
-# this happens, clean them to keep distcleancheck happy.
-CLEANFILES = core
-
-# Disables 'make install' as installing a compiled version of Google
-# Mock can lead to undefined behavior due to violation of the
-# One-Definition Rule.
-
-install-exec-local:
- echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Mock into your build system."
- false
-
-install-data-local:
- echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Mock into your build system."
- false
diff --git a/googletest/googlemock/README.md b/googletest/googlemock/README.md
deleted file mode 100644
index 1170cfa..0000000
--- a/googletest/googlemock/README.md
+++ /dev/null
@@ -1,344 +0,0 @@
-## Google Mock ##
-
-The Google C++ mocking framework.
-
-### Overview ###
-
-Google's framework for writing and using C++ mock classes.
-It can help you derive better designs of your system and write better tests.
-
-It is inspired by:
-
- * [jMock](http://www.jmock.org/),
- * [EasyMock](http://www.easymock.org/), and
- * [Hamcrest](http://code.google.com/p/hamcrest/),
-
-and designed with C++'s specifics in mind.
-
-Google mock:
-
- * lets you create mock classes trivially using simple macros.
- * supports a rich set of matchers and actions.
- * handles unordered, partially ordered, or completely ordered expectations.
- * is extensible by users.
-
-We hope you find it useful!
-
-### Features ###
-
- * Provides a declarative syntax for defining mocks.
- * Can easily define partial (hybrid) mocks, which are a cross of real
- and mock objects.
- * Handles functions of arbitrary types and overloaded functions.
- * Comes with a rich set of matchers for validating function arguments.
- * Uses an intuitive syntax for controlling the behavior of a mock.
- * Does automatic verification of expectations (no record-and-replay needed).
- * Allows arbitrary (partial) ordering constraints on
- function calls to be expressed,.
- * Lets an user extend it by defining new matchers and actions.
- * Does not use exceptions.
- * Is easy to learn and use.
-
-Please see the project page above for more information as well as the
-mailing list for questions, discussions, and development. There is
-also an IRC channel on OFTC (irc.oftc.net) #gtest available. Please
-join us!
-
-Please note that code under [scripts/generator](scripts/generator/) is
-from [cppclean](http://code.google.com/p/cppclean/) and released under
-the Apache License, which is different from Google Mock's license.
-
-## Getting Started ##
-
-If you are new to the project, we suggest that you read the user
-documentation in the following order:
-
- * Learn the [basics](../../master/googletest/docs/Primer.md) of
- Google Test, if you choose to use Google Mock with it (recommended).
- * Read [Google Mock for Dummies](../../master/googlemock/docs/ForDummies.md).
- * Read the instructions below on how to build Google Mock.
-
-You can also watch Zhanyong's [talk](http://www.youtube.com/watch?v=sYpCyLI47rM) on Google Mock's usage and implementation.
-
-Once you understand the basics, check out the rest of the docs:
-
- * [CheatSheet](../../master/googlemock/docs/CheatSheet.md) - all the commonly used stuff
- at a glance.
- * [CookBook](../../master/googlemock/docs/CookBook.md) - recipes for getting things done,
- including advanced techniques.
-
-If you need help, please check the
-[KnownIssues](docs/KnownIssues.md) and
-[FrequentlyAskedQuestions](docs/FrequentlyAskedQuestions.md) before
-posting a question on the
-[discussion group](http://groups.google.com/group/googlemock).
-
-
-### Using Google Mock Without Google Test ###
-
-Google Mock is not a testing framework itself. Instead, it needs a
-testing framework for writing tests. Google Mock works seamlessly
-with [Google Test](https://github.com/google/googletest), but
-you can also use it with [any C++ testing framework](../../master/googlemock/docs/ForDummies.md#using-google-mock-with-any-testing-framework).
-
-### Requirements for End Users ###
-
-Google Mock is implemented on top of [Google Test](
-http://github.com/google/googletest/), and depends on it.
-You must use the bundled version of Google Test when using Google Mock.
-
-You can also easily configure Google Mock to work with another testing
-framework, although it will still need Google Test. Please read
-["Using_Google_Mock_with_Any_Testing_Framework"](
- ../../master/googlemock/docs/ForDummies.md#using-google-mock-with-any-testing-framework)
-for instructions.
-
-Google Mock depends on advanced C++ features and thus requires a more
-modern compiler. The following are needed to use Google Mock:
-
-#### Linux Requirements ####
-
- * GNU-compatible Make or "gmake"
- * POSIX-standard shell
- * POSIX(-2) Regular Expressions (regex.h)
- * C++98-standard-compliant compiler (e.g. GCC 3.4 or newer)
-
-#### Windows Requirements ####
-
- * Microsoft Visual C++ 8.0 SP1 or newer
-
-#### Mac OS X Requirements ####
-
- * Mac OS X 10.4 Tiger or newer
- * Developer Tools Installed
-
-### Requirements for Contributors ###
-
-We welcome patches. If you plan to contribute a patch, you need to
-build Google Mock and its tests, which has further requirements:
-
- * Automake version 1.9 or newer
- * Autoconf version 2.59 or newer
- * Libtool / Libtoolize
- * Python version 2.3 or newer (for running some of the tests and
- re-generating certain source files from templates)
-
-### Building Google Mock ###
-
-#### Using CMake ####
-
-If you have CMake available, it is recommended that you follow the
-[build instructions][gtest_cmakebuild]
-as described for Google Test.
-
-If are using Google Mock with an
-existing CMake project, the section
-[Incorporating Into An Existing CMake Project][gtest_incorpcmake]
-may be of particular interest.
-To make it work for Google Mock you will need to change
-
- target_link_libraries(example gtest_main)
-
-to
-
- target_link_libraries(example gmock_main)
-
-This works because `gmock_main` library is compiled with Google Test.
-However, it does not automatically add Google Test includes.
-Therefore you will also have to change
-
- if (CMAKE_VERSION VERSION_LESS 2.8.11)
- include_directories("${gtest_SOURCE_DIR}/include")
- endif()
-
-to
-
- if (CMAKE_VERSION VERSION_LESS 2.8.11)
- include_directories(BEFORE SYSTEM
- "${gtest_SOURCE_DIR}/include" "${gmock_SOURCE_DIR}/include")
- else()
- target_include_directories(gmock_main SYSTEM BEFORE INTERFACE
- "${gtest_SOURCE_DIR}/include" "${gmock_SOURCE_DIR}/include")
- endif()
-
-This will addtionally mark Google Mock includes as system, which will
-silence compiler warnings when compiling your tests using clang with
-`-Wpedantic -Wall -Wextra -Wconversion`.
-
-
-#### Preparing to Build (Unix only) ####
-
-If you are using a Unix system and plan to use the GNU Autotools build
-system to build Google Mock (described below), you'll need to
-configure it now.
-
-To prepare the Autotools build system:
-
- cd googlemock
- autoreconf -fvi
-
-To build Google Mock and your tests that use it, you need to tell your
-build system where to find its headers and source files. The exact
-way to do it depends on which build system you use, and is usually
-straightforward.
-
-This section shows how you can integrate Google Mock into your
-existing build system.
-
-Suppose you put Google Mock in directory `${GMOCK_DIR}` and Google Test
-in `${GTEST_DIR}` (the latter is `${GMOCK_DIR}/gtest` by default). To
-build Google Mock, create a library build target (or a project as
-called by Visual Studio and Xcode) to compile
-
- ${GTEST_DIR}/src/gtest-all.cc and ${GMOCK_DIR}/src/gmock-all.cc
-
-with
-
- ${GTEST_DIR}/include and ${GMOCK_DIR}/include
-
-in the system header search path, and
-
- ${GTEST_DIR} and ${GMOCK_DIR}
-
-in the normal header search path. Assuming a Linux-like system and gcc,
-something like the following will do:
-
- g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \
- -isystem ${GMOCK_DIR}/include -I${GMOCK_DIR} \
- -pthread -c ${GTEST_DIR}/src/gtest-all.cc
- g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \
- -isystem ${GMOCK_DIR}/include -I${GMOCK_DIR} \
- -pthread -c ${GMOCK_DIR}/src/gmock-all.cc
- ar -rv libgmock.a gtest-all.o gmock-all.o
-
-(We need -pthread as Google Test and Google Mock use threads.)
-
-Next, you should compile your test source file with
-${GTEST\_DIR}/include and ${GMOCK\_DIR}/include in the header search
-path, and link it with gmock and any other necessary libraries:
-
- g++ -isystem ${GTEST_DIR}/include -isystem ${GMOCK_DIR}/include \
- -pthread path/to/your_test.cc libgmock.a -o your_test
-
-As an example, the make/ directory contains a Makefile that you can
-use to build Google Mock on systems where GNU make is available
-(e.g. Linux, Mac OS X, and Cygwin). It doesn't try to build Google
-Mock's own tests. Instead, it just builds the Google Mock library and
-a sample test. You can use it as a starting point for your own build
-script.
-
-If the default settings are correct for your environment, the
-following commands should succeed:
-
- cd ${GMOCK_DIR}/make
- make
- ./gmock_test
-
-If you see errors, try to tweak the contents of
-[make/Makefile](make/Makefile) to make them go away.
-
-### Windows ###
-
-The msvc/2005 directory contains VC++ 2005 projects and the msvc/2010
-directory contains VC++ 2010 projects for building Google Mock and
-selected tests.
-
-Change to the appropriate directory and run "msbuild gmock.sln" to
-build the library and tests (or open the gmock.sln in the MSVC IDE).
-If you want to create your own project to use with Google Mock, you'll
-have to configure it to use the `gmock_config` propety sheet. For that:
-
- * Open the Property Manager window (View | Other Windows | Property Manager)
- * Right-click on your project and select "Add Existing Property Sheet..."
- * Navigate to `gmock_config.vsprops` or `gmock_config.props` and select it.
- * In Project Properties | Configuration Properties | General | Additional
- Include Directories, type /include.
-
-### Tweaking Google Mock ###
-
-Google Mock can be used in diverse environments. The default
-configuration may not work (or may not work well) out of the box in
-some environments. However, you can easily tweak Google Mock by
-defining control macros on the compiler command line. Generally,
-these macros are named like `GTEST_XYZ` and you define them to either 1
-or 0 to enable or disable a certain feature.
-
-We list the most frequently used macros below. For a complete list,
-see file [${GTEST\_DIR}/include/gtest/internal/gtest-port.h](
-../googletest/include/gtest/internal/gtest-port.h).
-
-### Choosing a TR1 Tuple Library ###
-
-Google Mock uses the C++ Technical Report 1 (TR1) tuple library
-heavily. Unfortunately TR1 tuple is not yet widely available with all
-compilers. The good news is that Google Test 1.4.0+ implements a
-subset of TR1 tuple that's enough for Google Mock's need. Google Mock
-will automatically use that implementation when the compiler doesn't
-provide TR1 tuple.
-
-Usually you don't need to care about which tuple library Google Test
-and Google Mock use. However, if your project already uses TR1 tuple,
-you need to tell Google Test and Google Mock to use the same TR1 tuple
-library the rest of your project uses, or the two tuple
-implementations will clash. To do that, add
-
- -DGTEST_USE_OWN_TR1_TUPLE=0
-
-to the compiler flags while compiling Google Test, Google Mock, and
-your tests. If you want to force Google Test and Google Mock to use
-their own tuple library, just add
-
- -DGTEST_USE_OWN_TR1_TUPLE=1
-
-to the compiler flags instead.
-
-If you want to use Boost's TR1 tuple library with Google Mock, please
-refer to the Boost website (http://www.boost.org/) for how to obtain
-it and set it up.
-
-### As a Shared Library (DLL) ###
-
-Google Mock is compact, so most users can build and link it as a static
-library for the simplicity. Google Mock can be used as a DLL, but the
-same DLL must contain Google Test as well. See
-[Google Test's README][gtest_readme]
-for instructions on how to set up necessary compiler settings.
-
-### Tweaking Google Mock ###
-
-Most of Google Test's control macros apply to Google Mock as well.
-Please see [Google Test's README][gtest_readme] for how to tweak them.
-
-### Upgrading from an Earlier Version ###
-
-We strive to keep Google Mock releases backward compatible.
-Sometimes, though, we have to make some breaking changes for the
-users' long-term benefits. This section describes what you'll need to
-do if you are upgrading from an earlier version of Google Mock.
-
-#### Upgrading from 1.1.0 or Earlier ####
-
-You may need to explicitly enable or disable Google Test's own TR1
-tuple library. See the instructions in section "[Choosing a TR1 Tuple
-Library](../googletest/#choosing-a-tr1-tuple-library)".
-
-#### Upgrading from 1.4.0 or Earlier ####
-
-On platforms where the pthread library is available, Google Test and
-Google Mock use it in order to be thread-safe. For this to work, you
-may need to tweak your compiler and/or linker flags. Please see the
-"[Multi-threaded Tests](../googletest#multi-threaded-tests
-)" section in file Google Test's README for what you may need to do.
-
-If you have custom matchers defined using `MatcherInterface` or
-`MakePolymorphicMatcher()`, you'll need to update their definitions to
-use the new matcher API (
-[monomorphic](./docs/CookBook.md#writing-new-monomorphic-matchers),
-[polymorphic](./docs/CookBook.md#writing-new-polymorphic-matchers)).
-Matchers defined using `MATCHER()` or `MATCHER_P*()` aren't affected.
-
-Happy testing!
-
-[gtest_readme]: ../googletest/README.md "googletest"
-[gtest_cmakebuild]: ../googletest/README.md#using-cmake "Using CMake"
-[gtest_incorpcmake]: ../googletest/README.md#incorporating-into-an-existing-cmake-project "Incorporating Into An Existing CMake Project"
diff --git a/googletest/googlemock/build-aux/.keep b/googletest/googlemock/build-aux/.keep
deleted file mode 100644
index e69de29..0000000
diff --git a/googletest/googlemock/cmake/gmock.pc.in b/googletest/googlemock/cmake/gmock.pc.in
deleted file mode 100644
index c441642..0000000
--- a/googletest/googlemock/cmake/gmock.pc.in
+++ /dev/null
@@ -1,9 +0,0 @@
-libdir=@CMAKE_INSTALL_FULL_LIBDIR@
-includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
-
-Name: gmock
-Description: GoogleMock (without main() function)
-Version: @PROJECT_VERSION@
-URL: https://github.com/google/googletest
-Libs: -L${libdir} -lgmock @CMAKE_THREAD_LIBS_INIT@
-Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@
diff --git a/googletest/googlemock/cmake/gmock_main.pc.in b/googletest/googlemock/cmake/gmock_main.pc.in
deleted file mode 100644
index c377dba..0000000
--- a/googletest/googlemock/cmake/gmock_main.pc.in
+++ /dev/null
@@ -1,9 +0,0 @@
-libdir=@CMAKE_INSTALL_FULL_LIBDIR@
-includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
-
-Name: gmock_main
-Description: GoogleMock (with main() function)
-Version: @PROJECT_VERSION@
-URL: https://github.com/google/googletest
-Libs: -L${libdir} -lgmock_main @CMAKE_THREAD_LIBS_INIT@
-Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@
diff --git a/googletest/googlemock/configure.ac b/googletest/googlemock/configure.ac
deleted file mode 100644
index c23ed45..0000000
--- a/googletest/googlemock/configure.ac
+++ /dev/null
@@ -1,146 +0,0 @@
-m4_include(../googletest/m4/acx_pthread.m4)
-
-AC_INIT([Google C++ Mocking Framework],
- [1.8.0],
- [googlemock@googlegroups.com],
- [gmock])
-
-# Provide various options to initialize the Autoconf and configure processes.
-AC_PREREQ([2.59])
-AC_CONFIG_SRCDIR([./LICENSE])
-AC_CONFIG_AUX_DIR([build-aux])
-AC_CONFIG_HEADERS([build-aux/config.h])
-AC_CONFIG_FILES([Makefile])
-AC_CONFIG_FILES([scripts/gmock-config], [chmod +x scripts/gmock-config])
-
-# Initialize Automake with various options. We require at least v1.9, prevent
-# pedantic complaints about package files, and enable various distribution
-# targets.
-AM_INIT_AUTOMAKE([1.9 dist-bzip2 dist-zip foreign subdir-objects])
-
-# Check for programs used in building Google Test.
-AC_PROG_CC
-AC_PROG_CXX
-AC_LANG([C++])
-AC_PROG_LIBTOOL
-
-# TODO(chandlerc@google.com): Currently we aren't running the Python tests
-# against the interpreter detected by AM_PATH_PYTHON, and so we condition
-# HAVE_PYTHON by requiring "python" to be in the PATH, and that interpreter's
-# version to be >= 2.3. This will allow the scripts to use a "/usr/bin/env"
-# hashbang.
-PYTHON= # We *do not* allow the user to specify a python interpreter
-AC_PATH_PROG([PYTHON],[python],[:])
-AS_IF([test "$PYTHON" != ":"],
- [AM_PYTHON_CHECK_VERSION([$PYTHON],[2.3],[:],[PYTHON=":"])])
-AM_CONDITIONAL([HAVE_PYTHON],[test "$PYTHON" != ":"])
-
-# TODO(chandlerc@google.com) Check for the necessary system headers.
-
-# Configure pthreads.
-AC_ARG_WITH([pthreads],
- [AS_HELP_STRING([--with-pthreads],
- [use pthreads (default is yes)])],
- [with_pthreads=$withval],
- [with_pthreads=check])
-
-have_pthreads=no
-AS_IF([test "x$with_pthreads" != "xno"],
- [ACX_PTHREAD(
- [],
- [AS_IF([test "x$with_pthreads" != "xcheck"],
- [AC_MSG_FAILURE(
- [--with-pthreads was specified, but unable to be used])])])
- have_pthreads="$acx_pthread_ok"])
-AM_CONDITIONAL([HAVE_PTHREADS],[test "x$have_pthreads" == "xyes"])
-AC_SUBST(PTHREAD_CFLAGS)
-AC_SUBST(PTHREAD_LIBS)
-
-# GoogleMock currently has hard dependencies upon GoogleTest above and beyond
-# running its own test suite, so we both provide our own version in
-# a subdirectory and provide some logic to use a custom version or a system
-# installed version.
-AC_ARG_WITH([gtest],
- [AS_HELP_STRING([--with-gtest],
- [Specifies how to find the gtest package. If no
- arguments are given, the default behavior, a
- system installed gtest will be used if present,
- and an internal version built otherwise. If a
- path is provided, the gtest built or installed at
- that prefix will be used.])],
- [],
- [with_gtest=yes])
-AC_ARG_ENABLE([external-gtest],
- [AS_HELP_STRING([--disable-external-gtest],
- [Disables any detection or use of a system
- installed or user provided gtest. Any option to
- '--with-gtest' is ignored. (Default is enabled.)])
- ], [], [enable_external_gtest=yes])
-AS_IF([test "x$with_gtest" == "xno"],
- [AC_MSG_ERROR([dnl
-Support for GoogleTest was explicitly disabled. Currently GoogleMock has a hard
-dependency upon GoogleTest to build, please provide a version, or allow
-GoogleMock to use any installed version and fall back upon its internal
-version.])])
-
-# Setup various GTEST variables. TODO(chandlerc@google.com): When these are
-# used below, they should be used such that any pre-existing values always
-# trump values we set them to, so that they can be used to selectively override
-# details of the detection process.
-AC_ARG_VAR([GTEST_CONFIG],
- [The exact path of Google Test's 'gtest-config' script.])
-AC_ARG_VAR([GTEST_CPPFLAGS],
- [C-like preprocessor flags for Google Test.])
-AC_ARG_VAR([GTEST_CXXFLAGS],
- [C++ compile flags for Google Test.])
-AC_ARG_VAR([GTEST_LDFLAGS],
- [Linker path and option flags for Google Test.])
-AC_ARG_VAR([GTEST_LIBS],
- [Library linking flags for Google Test.])
-AC_ARG_VAR([GTEST_VERSION],
- [The version of Google Test available.])
-HAVE_BUILT_GTEST="no"
-
-GTEST_MIN_VERSION="1.8.0"
-
-AS_IF([test "x${enable_external_gtest}" = "xyes"],
- [# Begin filling in variables as we are able.
- AS_IF([test "x${with_gtest}" != "xyes"],
- [AS_IF([test -x "${with_gtest}/scripts/gtest-config"],
- [GTEST_CONFIG="${with_gtest}/scripts/gtest-config"],
- [GTEST_CONFIG="${with_gtest}/bin/gtest-config"])
- AS_IF([test -x "${GTEST_CONFIG}"], [],
- [AC_MSG_ERROR([dnl
-Unable to locate either a built or installed Google Test at '${with_gtest}'.])
- ])])
-
- AS_IF([test -x "${GTEST_CONFIG}"], [],
- [AC_PATH_PROG([GTEST_CONFIG], [gtest-config])])
- AS_IF([test -x "${GTEST_CONFIG}"],
- [AC_MSG_CHECKING([for Google Test version >= ${GTEST_MIN_VERSION}])
- AS_IF([${GTEST_CONFIG} --min-version=${GTEST_MIN_VERSION}],
- [AC_MSG_RESULT([yes])
- HAVE_BUILT_GTEST="yes"],
- [AC_MSG_RESULT([no])])])])
-
-AS_IF([test "x${HAVE_BUILT_GTEST}" = "xyes"],
- [GTEST_CPPFLAGS=`${GTEST_CONFIG} --cppflags`
- GTEST_CXXFLAGS=`${GTEST_CONFIG} --cxxflags`
- GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
- GTEST_LIBS=`${GTEST_CONFIG} --libs`
- GTEST_VERSION=`${GTEST_CONFIG} --version`],
- [AC_CONFIG_SUBDIRS([../googletest])
- # GTEST_CONFIG needs to be executable both in a Makefile environment and
- # in a shell script environment, so resolve an absolute path for it here.
- GTEST_CONFIG="`pwd -P`/../googletest/scripts/gtest-config"
- GTEST_CPPFLAGS='-I$(top_srcdir)/../googletest/include'
- GTEST_CXXFLAGS='-g'
- GTEST_LDFLAGS=''
- GTEST_LIBS='$(top_builddir)/../googletest/lib/libgtest.la'
- GTEST_VERSION="${GTEST_MIN_VERSION}"])
-
-# TODO(chandlerc@google.com) Check the types, structures, and other compiler
-# and architecture characteristics.
-
-# Output the generated files. No further autoconf macros may be used.
-AC_OUTPUT
diff --git a/googletest/googlemock/docs/CheatSheet.md b/googletest/googlemock/docs/CheatSheet.md
deleted file mode 100644
index c6367fd..0000000
--- a/googletest/googlemock/docs/CheatSheet.md
+++ /dev/null
@@ -1,562 +0,0 @@
-
-
-# Defining a Mock Class #
-
-## Mocking a Normal Class ##
-
-Given
-```
-class Foo {
- ...
- virtual ~Foo();
- virtual int GetSize() const = 0;
- virtual string Describe(const char* name) = 0;
- virtual string Describe(int type) = 0;
- virtual bool Process(Bar elem, int count) = 0;
-};
-```
-(note that `~Foo()` **must** be virtual) we can define its mock as
-```
-#include "gmock/gmock.h"
-
-class MockFoo : public Foo {
- MOCK_CONST_METHOD0(GetSize, int());
- MOCK_METHOD1(Describe, string(const char* name));
- MOCK_METHOD1(Describe, string(int type));
- MOCK_METHOD2(Process, bool(Bar elem, int count));
-};
-```
-
-To create a "nice" mock object which ignores all uninteresting calls,
-or a "strict" mock object, which treats them as failures:
-```
-NiceMock nice_foo; // The type is a subclass of MockFoo.
-StrictMock strict_foo; // The type is a subclass of MockFoo.
-```
-
-## Mocking a Class Template ##
-
-To mock
-```
-template
-class StackInterface {
- public:
- ...
- virtual ~StackInterface();
- virtual int GetSize() const = 0;
- virtual void Push(const Elem& x) = 0;
-};
-```
-(note that `~StackInterface()` **must** be virtual) just append `_T` to the `MOCK_*` macros:
-```
-template
-class MockStack : public StackInterface {
- public:
- ...
- MOCK_CONST_METHOD0_T(GetSize, int());
- MOCK_METHOD1_T(Push, void(const Elem& x));
-};
-```
-
-## Specifying Calling Conventions for Mock Functions ##
-
-If your mock function doesn't use the default calling convention, you
-can specify it by appending `_WITH_CALLTYPE` to any of the macros
-described in the previous two sections and supplying the calling
-convention as the first argument to the macro. For example,
-```
- MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, Foo, bool(int n));
- MOCK_CONST_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, Bar, int(double x, double y));
-```
-where `STDMETHODCALLTYPE` is defined by `` on Windows.
-
-# Using Mocks in Tests #
-
-The typical flow is:
- 1. Import the Google Mock names you need to use. All Google Mock names are in the `testing` namespace unless they are macros or otherwise noted.
- 1. Create the mock objects.
- 1. Optionally, set the default actions of the mock objects.
- 1. Set your expectations on the mock objects (How will they be called? What wil they do?).
- 1. Exercise code that uses the mock objects; if necessary, check the result using [Google Test](../../googletest/) assertions.
- 1. When a mock objects is destructed, Google Mock automatically verifies that all expectations on it have been satisfied.
-
-Here is an example:
-```
-using ::testing::Return; // #1
-
-TEST(BarTest, DoesThis) {
- MockFoo foo; // #2
-
- ON_CALL(foo, GetSize()) // #3
- .WillByDefault(Return(1));
- // ... other default actions ...
-
- EXPECT_CALL(foo, Describe(5)) // #4
- .Times(3)
- .WillRepeatedly(Return("Category 5"));
- // ... other expectations ...
-
- EXPECT_EQ("good", MyProductionFunction(&foo)); // #5
-} // #6
-```
-
-# Setting Default Actions #
-
-Google Mock has a **built-in default action** for any function that
-returns `void`, `bool`, a numeric value, or a pointer.
-
-To customize the default action for functions with return type `T` globally:
-```
-using ::testing::DefaultValue;
-
-// Sets the default value to be returned. T must be CopyConstructible.
-DefaultValue::Set(value);
-// Sets a factory. Will be invoked on demand. T must be MoveConstructible.
-// T MakeT();
-DefaultValue::SetFactory(&MakeT);
-// ... use the mocks ...
-// Resets the default value.
-DefaultValue::Clear();
-```
-
-To customize the default action for a particular method, use `ON_CALL()`:
-```
-ON_CALL(mock_object, method(matchers))
- .With(multi_argument_matcher) ?
- .WillByDefault(action);
-```
-
-# Setting Expectations #
-
-`EXPECT_CALL()` sets **expectations** on a mock method (How will it be
-called? What will it do?):
-```
-EXPECT_CALL(mock_object, method(matchers))
- .With(multi_argument_matcher) ?
- .Times(cardinality) ?
- .InSequence(sequences) *
- .After(expectations) *
- .WillOnce(action) *
- .WillRepeatedly(action) ?
- .RetiresOnSaturation(); ?
-```
-
-If `Times()` is omitted, the cardinality is assumed to be:
-
- * `Times(1)` when there is neither `WillOnce()` nor `WillRepeatedly()`;
- * `Times(n)` when there are `n WillOnce()`s but no `WillRepeatedly()`, where `n` >= 1; or
- * `Times(AtLeast(n))` when there are `n WillOnce()`s and a `WillRepeatedly()`, where `n` >= 0.
-
-A method with no `EXPECT_CALL()` is free to be invoked _any number of times_, and the default action will be taken each time.
-
-# Matchers #
-
-A **matcher** matches a _single_ argument. You can use it inside
-`ON_CALL()` or `EXPECT_CALL()`, or use it to validate a value
-directly:
-
-| `EXPECT_THAT(value, matcher)` | Asserts that `value` matches `matcher`. |
-|:------------------------------|:----------------------------------------|
-| `ASSERT_THAT(value, matcher)` | The same as `EXPECT_THAT(value, matcher)`, except that it generates a **fatal** failure. |
-
-Built-in matchers (where `argument` is the function argument) are
-divided into several categories:
-
-## Wildcard ##
-|`_`|`argument` can be any value of the correct type.|
-|:--|:-----------------------------------------------|
-|`A()` or `An()`|`argument` can be any value of type `type`. |
-
-## Generic Comparison ##
-
-|`Eq(value)` or `value`|`argument == value`|
-|:---------------------|:------------------|
-|`Ge(value)` |`argument >= value`|
-|`Gt(value)` |`argument > value` |
-|`Le(value)` |`argument <= value`|
-|`Lt(value)` |`argument < value` |
-|`Ne(value)` |`argument != value`|
-|`IsNull()` |`argument` is a `NULL` pointer (raw or smart).|
-|`NotNull()` |`argument` is a non-null pointer (raw or smart).|
-|`Ref(variable)` |`argument` is a reference to `variable`.|
-|`TypedEq(value)`|`argument` has type `type` and is equal to `value`. You may need to use this instead of `Eq(value)` when the mock function is overloaded.|
-
-Except `Ref()`, these matchers make a _copy_ of `value` in case it's
-modified or destructed later. If the compiler complains that `value`
-doesn't have a public copy constructor, try wrap it in `ByRef()`,
-e.g. `Eq(ByRef(non_copyable_value))`. If you do that, make sure
-`non_copyable_value` is not changed afterwards, or the meaning of your
-matcher will be changed.
-
-## Floating-Point Matchers ##
-
-|`DoubleEq(a_double)`|`argument` is a `double` value approximately equal to `a_double`, treating two NaNs as unequal.|
-|:-------------------|:----------------------------------------------------------------------------------------------|
-|`FloatEq(a_float)` |`argument` is a `float` value approximately equal to `a_float`, treating two NaNs as unequal. |
-|`NanSensitiveDoubleEq(a_double)`|`argument` is a `double` value approximately equal to `a_double`, treating two NaNs as equal. |
-|`NanSensitiveFloatEq(a_float)`|`argument` is a `float` value approximately equal to `a_float`, treating two NaNs as equal. |
-
-The above matchers use ULP-based comparison (the same as used in
-[Google Test](../../googletest/)). They
-automatically pick a reasonable error bound based on the absolute
-value of the expected value. `DoubleEq()` and `FloatEq()` conform to
-the IEEE standard, which requires comparing two NaNs for equality to
-return false. The `NanSensitive*` version instead treats two NaNs as
-equal, which is often what a user wants.
-
-|`DoubleNear(a_double, max_abs_error)`|`argument` is a `double` value close to `a_double` (absolute error <= `max_abs_error`), treating two NaNs as unequal.|
-|:------------------------------------|:--------------------------------------------------------------------------------------------------------------------|
-|`FloatNear(a_float, max_abs_error)` |`argument` is a `float` value close to `a_float` (absolute error <= `max_abs_error`), treating two NaNs as unequal. |
-|`NanSensitiveDoubleNear(a_double, max_abs_error)`|`argument` is a `double` value close to `a_double` (absolute error <= `max_abs_error`), treating two NaNs as equal. |
-|`NanSensitiveFloatNear(a_float, max_abs_error)`|`argument` is a `float` value close to `a_float` (absolute error <= `max_abs_error`), treating two NaNs as equal. |
-
-## String Matchers ##
-
-The `argument` can be either a C string or a C++ string object:
-
-|`ContainsRegex(string)`|`argument` matches the given regular expression.|
-|:----------------------|:-----------------------------------------------|
-|`EndsWith(suffix)` |`argument` ends with string `suffix`. |
-|`HasSubstr(string)` |`argument` contains `string` as a sub-string. |
-|`MatchesRegex(string)` |`argument` matches the given regular expression with the match starting at the first character and ending at the last character.|
-|`StartsWith(prefix)` |`argument` starts with string `prefix`. |
-|`StrCaseEq(string)` |`argument` is equal to `string`, ignoring case. |
-|`StrCaseNe(string)` |`argument` is not equal to `string`, ignoring case.|
-|`StrEq(string)` |`argument` is equal to `string`. |
-|`StrNe(string)` |`argument` is not equal to `string`. |
-
-`ContainsRegex()` and `MatchesRegex()` use the regular expression
-syntax defined
-[here](../../googletest/docs/AdvancedGuide.md#regular-expression-syntax).
-`StrCaseEq()`, `StrCaseNe()`, `StrEq()`, and `StrNe()` work for wide
-strings as well.
-
-## Container Matchers ##
-
-Most STL-style containers support `==`, so you can use
-`Eq(expected_container)` or simply `expected_container` to match a
-container exactly. If you want to write the elements in-line,
-match them more flexibly, or get more informative messages, you can use:
-
-| `ContainerEq(container)` | The same as `Eq(container)` except that the failure message also includes which elements are in one container but not the other. |
-|:-------------------------|:---------------------------------------------------------------------------------------------------------------------------------|
-| `Contains(e)` | `argument` contains an element that matches `e`, which can be either a value or a matcher. |
-| `Each(e)` | `argument` is a container where _every_ element matches `e`, which can be either a value or a matcher. |
-| `ElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, where the i-th element matches `ei`, which can be a value or a matcher. 0 to 10 arguments are allowed. |
-| `ElementsAreArray({ e0, e1, ..., en })`, `ElementsAreArray(array)`, or `ElementsAreArray(array, count)` | The same as `ElementsAre()` except that the expected element values/matchers come from an initializer list, STL-style container, or C-style array. |
-| `IsEmpty()` | `argument` is an empty container (`container.empty()`). |
-| `Pointwise(m, container)` | `argument` contains the same number of elements as in `container`, and for all i, (the i-th element in `argument`, the i-th element in `container`) match `m`, which is a matcher on 2-tuples. E.g. `Pointwise(Le(), upper_bounds)` verifies that each element in `argument` doesn't exceed the corresponding element in `upper_bounds`. See more detail below. |
-| `SizeIs(m)` | `argument` is a container whose size matches `m`. E.g. `SizeIs(2)` or `SizeIs(Lt(2))`. |
-| `UnorderedElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, and under some permutation each element matches an `ei` (for a different `i`), which can be a value or a matcher. 0 to 10 arguments are allowed. |
-| `UnorderedElementsAreArray({ e0, e1, ..., en })`, `UnorderedElementsAreArray(array)`, or `UnorderedElementsAreArray(array, count)` | The same as `UnorderedElementsAre()` except that the expected element values/matchers come from an initializer list, STL-style container, or C-style array. |
-| `WhenSorted(m)` | When `argument` is sorted using the `<` operator, it matches container matcher `m`. E.g. `WhenSorted(ElementsAre(1, 2, 3))` verifies that `argument` contains elements `1`, `2`, and `3`, ignoring order. |
-| `WhenSortedBy(comparator, m)` | The same as `WhenSorted(m)`, except that the given comparator instead of `<` is used to sort `argument`. E.g. `WhenSortedBy(std::greater(), ElementsAre(3, 2, 1))`. |
-
-Notes:
-
- * These matchers can also match:
- 1. a native array passed by reference (e.g. in `Foo(const int (&a)[5])`), and
- 1. an array passed as a pointer and a count (e.g. in `Bar(const T* buffer, int len)` -- see [Multi-argument Matchers](#Multiargument_Matchers.md)).
- * The array being matched may be multi-dimensional (i.e. its elements can be arrays).
- * `m` in `Pointwise(m, ...)` should be a matcher for `::testing::tuple` where `T` and `U` are the element type of the actual container and the expected container, respectively. For example, to compare two `Foo` containers where `Foo` doesn't support `operator==` but has an `Equals()` method, one might write:
-
-```
-using ::testing::get;
-MATCHER(FooEq, "") {
- return get<0>(arg).Equals(get<1>(arg));
-}
-...
-EXPECT_THAT(actual_foos, Pointwise(FooEq(), expected_foos));
-```
-
-## Member Matchers ##
-
-|`Field(&class::field, m)`|`argument.field` (or `argument->field` when `argument` is a plain pointer) matches matcher `m`, where `argument` is an object of type _class_.|
-|:------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------|
-|`Key(e)` |`argument.first` matches `e`, which can be either a value or a matcher. E.g. `Contains(Key(Le(5)))` can verify that a `map` contains a key `<= 5`.|
-|`Pair(m1, m2)` |`argument` is an `std::pair` whose `first` field matches `m1` and `second` field matches `m2`. |
-|`Property(&class::property, m)`|`argument.property()` (or `argument->property()` when `argument` is a plain pointer) matches matcher `m`, where `argument` is an object of type _class_.|
-
-## Matching the Result of a Function or Functor ##
-
-|`ResultOf(f, m)`|`f(argument)` matches matcher `m`, where `f` is a function or functor.|
-|:---------------|:---------------------------------------------------------------------|
-
-## Pointer Matchers ##
-
-|`Pointee(m)`|`argument` (either a smart pointer or a raw pointer) points to a value that matches matcher `m`.|
-|:-----------|:-----------------------------------------------------------------------------------------------|
-|`WhenDynamicCastTo(m)`| when `argument` is passed through `dynamic_cast()`, it matches matcher `m`. |
-
-## Multiargument Matchers ##
-
-Technically, all matchers match a _single_ value. A "multi-argument"
-matcher is just one that matches a _tuple_. The following matchers can
-be used to match a tuple `(x, y)`:
-
-|`Eq()`|`x == y`|
-|:-----|:-------|
-|`Ge()`|`x >= y`|
-|`Gt()`|`x > y` |
-|`Le()`|`x <= y`|
-|`Lt()`|`x < y` |
-|`Ne()`|`x != y`|
-
-You can use the following selectors to pick a subset of the arguments
-(or reorder them) to participate in the matching:
-
-|`AllArgs(m)`|Equivalent to `m`. Useful as syntactic sugar in `.With(AllArgs(m))`.|
-|:-----------|:-------------------------------------------------------------------|
-|`Args(m)`|The tuple of the `k` selected (using 0-based indices) arguments matches `m`, e.g. `Args<1, 2>(Eq())`.|
-
-## Composite Matchers ##
-
-You can make a matcher from one or more other matchers:
-
-|`AllOf(m1, m2, ..., mn)`|`argument` matches all of the matchers `m1` to `mn`.|
-|:-----------------------|:---------------------------------------------------|
-|`AnyOf(m1, m2, ..., mn)`|`argument` matches at least one of the matchers `m1` to `mn`.|
-|`Not(m)` |`argument` doesn't match matcher `m`. |
-
-## Adapters for Matchers ##
-
-|`MatcherCast(m)`|casts matcher `m` to type `Matcher`.|
-|:------------------|:--------------------------------------|
-|`SafeMatcherCast(m)`| [safely casts](CookBook.md#casting-matchers) matcher `m` to type `Matcher`. |
-|`Truly(predicate)` |`predicate(argument)` returns something considered by C++ to be true, where `predicate` is a function or functor.|
-
-## Matchers as Predicates ##
-
-|`Matches(m)(value)`|evaluates to `true` if `value` matches `m`. You can use `Matches(m)` alone as a unary functor.|
-|:------------------|:---------------------------------------------------------------------------------------------|
-|`ExplainMatchResult(m, value, result_listener)`|evaluates to `true` if `value` matches `m`, explaining the result to `result_listener`. |
-|`Value(value, m)` |evaluates to `true` if `value` matches `m`. |
-
-## Defining Matchers ##
-
-| `MATCHER(IsEven, "") { return (arg % 2) == 0; }` | Defines a matcher `IsEven()` to match an even number. |
-|:-------------------------------------------------|:------------------------------------------------------|
-| `MATCHER_P(IsDivisibleBy, n, "") { *result_listener << "where the remainder is " << (arg % n); return (arg % n) == 0; }` | Defines a macher `IsDivisibleBy(n)` to match a number divisible by `n`. |
-| `MATCHER_P2(IsBetween, a, b, std::string(negation ? "isn't" : "is") + " between " + PrintToString(a) + " and " + PrintToString(b)) { return a <= arg && arg <= b; }` | Defines a matcher `IsBetween(a, b)` to match a value in the range [`a`, `b`]. |
-
-**Notes:**
-
- 1. The `MATCHER*` macros cannot be used inside a function or class.
- 1. The matcher body must be _purely functional_ (i.e. it cannot have any side effect, and the result must not depend on anything other than the value being matched and the matcher parameters).
- 1. You can use `PrintToString(x)` to convert a value `x` of any type to a string.
-
-## Matchers as Test Assertions ##
-
-|`ASSERT_THAT(expression, m)`|Generates a [fatal failure](../../googletest/docs/Primer.md#assertions) if the value of `expression` doesn't match matcher `m`.|
-|:---------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------|
-|`EXPECT_THAT(expression, m)`|Generates a non-fatal failure if the value of `expression` doesn't match matcher `m`. |
-
-# Actions #
-
-**Actions** specify what a mock function should do when invoked.
-
-## Returning a Value ##
-
-|`Return()`|Return from a `void` mock function.|
-|:---------|:----------------------------------|
-|`Return(value)`|Return `value`. If the type of `value` is different to the mock function's return type, `value` is converted to the latter type at the time the expectation is set, not when the action is executed.|
-|`ReturnArg()`|Return the `N`-th (0-based) argument.|
-|`ReturnNew(a1, ..., ak)`|Return `new T(a1, ..., ak)`; a different object is created each time.|
-|`ReturnNull()`|Return a null pointer. |
-|`ReturnPointee(ptr)`|Return the value pointed to by `ptr`.|
-|`ReturnRef(variable)`|Return a reference to `variable`. |
-|`ReturnRefOfCopy(value)`|Return a reference to a copy of `value`; the copy lives as long as the action.|
-
-## Side Effects ##
-
-|`Assign(&variable, value)`|Assign `value` to variable.|
-|:-------------------------|:--------------------------|
-| `DeleteArg()` | Delete the `N`-th (0-based) argument, which must be a pointer. |
-| `SaveArg(pointer)` | Save the `N`-th (0-based) argument to `*pointer`. |
-| `SaveArgPointee(pointer)` | Save the value pointed to by the `N`-th (0-based) argument to `*pointer`. |
-| `SetArgReferee(value)` | Assign value to the variable referenced by the `N`-th (0-based) argument. |
-|`SetArgPointee(value)` |Assign `value` to the variable pointed by the `N`-th (0-based) argument.|
-|`SetArgumentPointee(value)`|Same as `SetArgPointee(value)`. Deprecated. Will be removed in v1.7.0.|
-|`SetArrayArgument(first, last)`|Copies the elements in source range [`first`, `last`) to the array pointed to by the `N`-th (0-based) argument, which can be either a pointer or an iterator. The action does not take ownership of the elements in the source range.|
-|`SetErrnoAndReturn(error, value)`|Set `errno` to `error` and return `value`.|
-|`Throw(exception)` |Throws the given exception, which can be any copyable value. Available since v1.1.0.|
-
-## Using a Function or a Functor as an Action ##
-
-|`Invoke(f)`|Invoke `f` with the arguments passed to the mock function, where `f` can be a global/static function or a functor.|
-|:----------|:-----------------------------------------------------------------------------------------------------------------|
-|`Invoke(object_pointer, &class::method)`|Invoke the {method on the object with the arguments passed to the mock function. |
-|`InvokeWithoutArgs(f)`|Invoke `f`, which can be a global/static function or a functor. `f` must take no arguments. |
-|`InvokeWithoutArgs(object_pointer, &class::method)`|Invoke the method on the object, which takes no arguments. |
-|`InvokeArgument(arg1, arg2, ..., argk)`|Invoke the mock function's `N`-th (0-based) argument, which must be a function or a functor, with the `k` arguments.|
-
-The return value of the invoked function is used as the return value
-of the action.
-
-When defining a function or functor to be used with `Invoke*()`, you can declare any unused parameters as `Unused`:
-```
- double Distance(Unused, double x, double y) { return sqrt(x*x + y*y); }
- ...
- EXPECT_CALL(mock, Foo("Hi", _, _)).WillOnce(Invoke(Distance));
-```
-
-In `InvokeArgument(...)`, if an argument needs to be passed by reference, wrap it inside `ByRef()`. For example,
-```
- InvokeArgument<2>(5, string("Hi"), ByRef(foo))
-```
-calls the mock function's #2 argument, passing to it `5` and `string("Hi")` by value, and `foo` by reference.
-
-## Default Action ##
-
-|`DoDefault()`|Do the default action (specified by `ON_CALL()` or the built-in one).|
-|:------------|:--------------------------------------------------------------------|
-
-**Note:** due to technical reasons, `DoDefault()` cannot be used inside a composite action - trying to do so will result in a run-time error.
-
-## Composite Actions ##
-
-|`DoAll(a1, a2, ..., an)`|Do all actions `a1` to `an` and return the result of `an` in each invocation. The first `n - 1` sub-actions must return void. |
-|:-----------------------|:-----------------------------------------------------------------------------------------------------------------------------|
-|`IgnoreResult(a)` |Perform action `a` and ignore its result. `a` must not return void. |
-|`WithArg(a)` |Pass the `N`-th (0-based) argument of the mock function to action `a` and perform it. |
-|`WithArgs(a)`|Pass the selected (0-based) arguments of the mock function to action `a` and perform it. |
-|`WithoutArgs(a)` |Perform action `a` without any arguments. |
-
-## Defining Actions ##
-
-| `ACTION(Sum) { return arg0 + arg1; }` | Defines an action `Sum()` to return the sum of the mock function's argument #0 and #1. |
-|:--------------------------------------|:---------------------------------------------------------------------------------------|
-| `ACTION_P(Plus, n) { return arg0 + n; }` | Defines an action `Plus(n)` to return the sum of the mock function's argument #0 and `n`. |
-| `ACTION_Pk(Foo, p1, ..., pk) { statements; }` | Defines a parameterized action `Foo(p1, ..., pk)` to execute the given `statements`. |
-
-The `ACTION*` macros cannot be used inside a function or class.
-
-# Cardinalities #
-
-These are used in `Times()` to specify how many times a mock function will be called:
-
-|`AnyNumber()`|The function can be called any number of times.|
-|:------------|:----------------------------------------------|
-|`AtLeast(n)` |The call is expected at least `n` times. |
-|`AtMost(n)` |The call is expected at most `n` times. |
-|`Between(m, n)`|The call is expected between `m` and `n` (inclusive) times.|
-|`Exactly(n) or n`|The call is expected exactly `n` times. In particular, the call should never happen when `n` is 0.|
-
-# Expectation Order #
-
-By default, the expectations can be matched in _any_ order. If some
-or all expectations must be matched in a given order, there are two
-ways to specify it. They can be used either independently or
-together.
-
-## The After Clause ##
-
-```
-using ::testing::Expectation;
-...
-Expectation init_x = EXPECT_CALL(foo, InitX());
-Expectation init_y = EXPECT_CALL(foo, InitY());
-EXPECT_CALL(foo, Bar())
- .After(init_x, init_y);
-```
-says that `Bar()` can be called only after both `InitX()` and
-`InitY()` have been called.
-
-If you don't know how many pre-requisites an expectation has when you
-write it, you can use an `ExpectationSet` to collect them:
-
-```
-using ::testing::ExpectationSet;
-...
-ExpectationSet all_inits;
-for (int i = 0; i < element_count; i++) {
- all_inits += EXPECT_CALL(foo, InitElement(i));
-}
-EXPECT_CALL(foo, Bar())
- .After(all_inits);
-```
-says that `Bar()` can be called only after all elements have been
-initialized (but we don't care about which elements get initialized
-before the others).
-
-Modifying an `ExpectationSet` after using it in an `.After()` doesn't
-affect the meaning of the `.After()`.
-
-## Sequences ##
-
-When you have a long chain of sequential expectations, it's easier to
-specify the order using **sequences**, which don't require you to given
-each expectation in the chain a different name. All expected
-calls in the same sequence must occur in the order they are
-specified.
-
-```
-using ::testing::Sequence;
-Sequence s1, s2;
-...
-EXPECT_CALL(foo, Reset())
- .InSequence(s1, s2)
- .WillOnce(Return(true));
-EXPECT_CALL(foo, GetSize())
- .InSequence(s1)
- .WillOnce(Return(1));
-EXPECT_CALL(foo, Describe(A()))
- .InSequence(s2)
- .WillOnce(Return("dummy"));
-```
-says that `Reset()` must be called before _both_ `GetSize()` _and_
-`Describe()`, and the latter two can occur in any order.
-
-To put many expectations in a sequence conveniently:
-```
-using ::testing::InSequence;
-{
- InSequence dummy;
-
- EXPECT_CALL(...)...;
- EXPECT_CALL(...)...;
- ...
- EXPECT_CALL(...)...;
-}
-```
-says that all expected calls in the scope of `dummy` must occur in
-strict order. The name `dummy` is irrelevant.)
-
-# Verifying and Resetting a Mock #
-
-Google Mock will verify the expectations on a mock object when it is destructed, or you can do it earlier:
-```
-using ::testing::Mock;
-...
-// Verifies and removes the expectations on mock_obj;
-// returns true iff successful.
-Mock::VerifyAndClearExpectations(&mock_obj);
-...
-// Verifies and removes the expectations on mock_obj;
-// also removes the default actions set by ON_CALL();
-// returns true iff successful.
-Mock::VerifyAndClear(&mock_obj);
-```
-
-You can also tell Google Mock that a mock object can be leaked and doesn't
-need to be verified:
-```
-Mock::AllowLeak(&mock_obj);
-```
-
-# Mock Classes #
-
-Google Mock defines a convenient mock class template
-```
-class MockFunction {
- public:
- MOCK_METHODn(Call, R(A1, ..., An));
-};
-```
-See this [recipe](CookBook.md#using-check-points) for one application of it.
-
-# Flags #
-
-| `--gmock_catch_leaked_mocks=0` | Don't report leaked mock objects as failures. |
-|:-------------------------------|:----------------------------------------------|
-| `--gmock_verbose=LEVEL` | Sets the default verbosity level (`info`, `warning`, or `error`) of Google Mock messages. |
diff --git a/googletest/googlemock/docs/CookBook.md b/googletest/googlemock/docs/CookBook.md
deleted file mode 100644
index 3d07e68..0000000
--- a/googletest/googlemock/docs/CookBook.md
+++ /dev/null
@@ -1,3679 +0,0 @@
-
-
-You can find recipes for using Google Mock here. If you haven't yet,
-please read the [ForDummies](ForDummies.md) document first to make sure you understand
-the basics.
-
-**Note:** Google Mock lives in the `testing` name space. For
-readability, it is recommended to write `using ::testing::Foo;` once in
-your file before using the name `Foo` defined by Google Mock. We omit
-such `using` statements in this page for brevity, but you should do it
-in your own code.
-
-# Creating Mock Classes #
-
-## Mocking Private or Protected Methods ##
-
-You must always put a mock method definition (`MOCK_METHOD*`) in a
-`public:` section of the mock class, regardless of the method being
-mocked being `public`, `protected`, or `private` in the base class.
-This allows `ON_CALL` and `EXPECT_CALL` to reference the mock function
-from outside of the mock class. (Yes, C++ allows a subclass to specify
-a different access level than the base class on a virtual function.)
-Example:
-
-```
-class Foo {
- public:
- ...
- virtual bool Transform(Gadget* g) = 0;
-
- protected:
- virtual void Resume();
-
- private:
- virtual int GetTimeOut();
-};
-
-class MockFoo : public Foo {
- public:
- ...
- MOCK_METHOD1(Transform, bool(Gadget* g));
-
- // The following must be in the public section, even though the
- // methods are protected or private in the base class.
- MOCK_METHOD0(Resume, void());
- MOCK_METHOD0(GetTimeOut, int());
-};
-```
-
-## Mocking Overloaded Methods ##
-
-You can mock overloaded functions as usual. No special attention is required:
-
-```
-class Foo {
- ...
-
- // Must be virtual as we'll inherit from Foo.
- virtual ~Foo();
-
- // Overloaded on the types and/or numbers of arguments.
- virtual int Add(Element x);
- virtual int Add(int times, Element x);
-
- // Overloaded on the const-ness of this object.
- virtual Bar& GetBar();
- virtual const Bar& GetBar() const;
-};
-
-class MockFoo : public Foo {
- ...
- MOCK_METHOD1(Add, int(Element x));
- MOCK_METHOD2(Add, int(int times, Element x);
-
- MOCK_METHOD0(GetBar, Bar&());
- MOCK_CONST_METHOD0(GetBar, const Bar&());
-};
-```
-
-**Note:** if you don't mock all versions of the overloaded method, the
-compiler will give you a warning about some methods in the base class
-being hidden. To fix that, use `using` to bring them in scope:
-
-```
-class MockFoo : public Foo {
- ...
- using Foo::Add;
- MOCK_METHOD1(Add, int(Element x));
- // We don't want to mock int Add(int times, Element x);
- ...
-};
-```
-
-## Mocking Class Templates ##
-
-To mock a class template, append `_T` to the `MOCK_*` macros:
-
-```
-template
-class StackInterface {
- ...
- // Must be virtual as we'll inherit from StackInterface.
- virtual ~StackInterface();
-
- virtual int GetSize() const = 0;
- virtual void Push(const Elem& x) = 0;
-};
-
-template
-class MockStack : public StackInterface {
- ...
- MOCK_CONST_METHOD0_T(GetSize, int());
- MOCK_METHOD1_T(Push, void(const Elem& x));
-};
-```
-
-## Mocking Nonvirtual Methods ##
-
-Google Mock can mock non-virtual functions to be used in what we call _hi-perf
-dependency injection_.
-
-In this case, instead of sharing a common base class with the real
-class, your mock class will be _unrelated_ to the real class, but
-contain methods with the same signatures. The syntax for mocking
-non-virtual methods is the _same_ as mocking virtual methods:
-
-```
-// A simple packet stream class. None of its members is virtual.
-class ConcretePacketStream {
- public:
- void AppendPacket(Packet* new_packet);
- const Packet* GetPacket(size_t packet_number) const;
- size_t NumberOfPackets() const;
- ...
-};
-
-// A mock packet stream class. It inherits from no other, but defines
-// GetPacket() and NumberOfPackets().
-class MockPacketStream {
- public:
- MOCK_CONST_METHOD1(GetPacket, const Packet*(size_t packet_number));
- MOCK_CONST_METHOD0(NumberOfPackets, size_t());
- ...
-};
-```
-
-Note that the mock class doesn't define `AppendPacket()`, unlike the
-real class. That's fine as long as the test doesn't need to call it.
-
-Next, you need a way to say that you want to use
-`ConcretePacketStream` in production code and to use `MockPacketStream`
-in tests. Since the functions are not virtual and the two classes are
-unrelated, you must specify your choice at _compile time_ (as opposed
-to run time).
-
-One way to do it is to templatize your code that needs to use a packet
-stream. More specifically, you will give your code a template type
-argument for the type of the packet stream. In production, you will
-instantiate your template with `ConcretePacketStream` as the type
-argument. In tests, you will instantiate the same template with
-`MockPacketStream`. For example, you may write:
-
-```
-template
-void CreateConnection(PacketStream* stream) { ... }
-
-template
-class PacketReader {
- public:
- void ReadPackets(PacketStream* stream, size_t packet_num);
-};
-```
-
-Then you can use `CreateConnection()` and
-`PacketReader` in production code, and use
-`CreateConnection()` and
-`PacketReader` in tests.
-
-```
- MockPacketStream mock_stream;
- EXPECT_CALL(mock_stream, ...)...;
- .. set more expectations on mock_stream ...
- PacketReader reader(&mock_stream);
- ... exercise reader ...
-```
-
-## Mocking Free Functions ##
-
-It's possible to use Google Mock to mock a free function (i.e. a
-C-style function or a static method). You just need to rewrite your
-code to use an interface (abstract class).
-
-Instead of calling a free function (say, `OpenFile`) directly,
-introduce an interface for it and have a concrete subclass that calls
-the free function:
-
-```
-class FileInterface {
- public:
- ...
- virtual bool Open(const char* path, const char* mode) = 0;
-};
-
-class File : public FileInterface {
- public:
- ...
- virtual bool Open(const char* path, const char* mode) {
- return OpenFile(path, mode);
- }
-};
-```
-
-Your code should talk to `FileInterface` to open a file. Now it's
-easy to mock out the function.
-
-This may seem much hassle, but in practice you often have multiple
-related functions that you can put in the same interface, so the
-per-function syntactic overhead will be much lower.
-
-If you are concerned about the performance overhead incurred by
-virtual functions, and profiling confirms your concern, you can
-combine this with the recipe for [mocking non-virtual methods](#mocking-nonvirtual-methods).
-
-## The Nice, the Strict, and the Naggy ##
-
-If a mock method has no `EXPECT_CALL` spec but is called, Google Mock
-will print a warning about the "uninteresting call". The rationale is:
-
- * New methods may be added to an interface after a test is written. We shouldn't fail a test just because a method it doesn't know about is called.
- * However, this may also mean there's a bug in the test, so Google Mock shouldn't be silent either. If the user believes these calls are harmless, they can add an `EXPECT_CALL()` to suppress the warning.
-
-However, sometimes you may want to suppress all "uninteresting call"
-warnings, while sometimes you may want the opposite, i.e. to treat all
-of them as errors. Google Mock lets you make the decision on a
-per-mock-object basis.
-
-Suppose your test uses a mock class `MockFoo`:
-
-```
-TEST(...) {
- MockFoo mock_foo;
- EXPECT_CALL(mock_foo, DoThis());
- ... code that uses mock_foo ...
-}
-```
-
-If a method of `mock_foo` other than `DoThis()` is called, it will be
-reported by Google Mock as a warning. However, if you rewrite your
-test to use `NiceMock` instead, the warning will be gone,
-resulting in a cleaner test output:
-
-```
-using ::testing::NiceMock;
-
-TEST(...) {
- NiceMock mock_foo;
- EXPECT_CALL(mock_foo, DoThis());
- ... code that uses mock_foo ...
-}
-```
-
-`NiceMock` is a subclass of `MockFoo`, so it can be used
-wherever `MockFoo` is accepted.
-
-It also works if `MockFoo`'s constructor takes some arguments, as
-`NiceMock` "inherits" `MockFoo`'s constructors:
-
-```
-using ::testing::NiceMock;
-
-TEST(...) {
- NiceMock mock_foo(5, "hi"); // Calls MockFoo(5, "hi").
- EXPECT_CALL(mock_foo, DoThis());
- ... code that uses mock_foo ...
-}
-```
-
-The usage of `StrictMock` is similar, except that it makes all
-uninteresting calls failures:
-
-```
-using ::testing::StrictMock;
-
-TEST(...) {
- StrictMock mock_foo;
- EXPECT_CALL(mock_foo, DoThis());
- ... code that uses mock_foo ...
-
- // The test will fail if a method of mock_foo other than DoThis()
- // is called.
-}
-```
-
-There are some caveats though (I don't like them just as much as the
-next guy, but sadly they are side effects of C++'s limitations):
-
- 1. `NiceMock` and `StrictMock` only work for mock methods defined using the `MOCK_METHOD*` family of macros **directly** in the `MockFoo` class. If a mock method is defined in a **base class** of `MockFoo`, the "nice" or "strict" modifier may not affect it, depending on the compiler. In particular, nesting `NiceMock` and `StrictMock` (e.g. `NiceMock >`) is **not** supported.
- 1. The constructors of the base mock (`MockFoo`) cannot have arguments passed by non-const reference, which happens to be banned by the [Google C++ style guide](https://google.github.io/styleguide/cppguide.html).
- 1. During the constructor or destructor of `MockFoo`, the mock object is _not_ nice or strict. This may cause surprises if the constructor or destructor calls a mock method on `this` object. (This behavior, however, is consistent with C++'s general rule: if a constructor or destructor calls a virtual method of `this` object, that method is treated as non-virtual. In other words, to the base class's constructor or destructor, `this` object behaves like an instance of the base class, not the derived class. This rule is required for safety. Otherwise a base constructor may use members of a derived class before they are initialized, or a base destructor may use members of a derived class after they have been destroyed.)
-
-Finally, you should be **very cautious** about when to use naggy or strict mocks, as they tend to make tests more brittle and harder to maintain. When you refactor your code without changing its externally visible behavior, ideally you should't need to update any tests. If your code interacts with a naggy mock, however, you may start to get spammed with warnings as the result of your change. Worse, if your code interacts with a strict mock, your tests may start to fail and you'll be forced to fix them. Our general recommendation is to use nice mocks (not yet the default) most of the time, use naggy mocks (the current default) when developing or debugging tests, and use strict mocks only as the last resort.
-
-## Simplifying the Interface without Breaking Existing Code ##
-
-Sometimes a method has a long list of arguments that is mostly
-uninteresting. For example,
-
-```
-class LogSink {
- public:
- ...
- virtual void send(LogSeverity severity, const char* full_filename,
- const char* base_filename, int line,
- const struct tm* tm_time,
- const char* message, size_t message_len) = 0;
-};
-```
-
-This method's argument list is lengthy and hard to work with (let's
-say that the `message` argument is not even 0-terminated). If we mock
-it as is, using the mock will be awkward. If, however, we try to
-simplify this interface, we'll need to fix all clients depending on
-it, which is often infeasible.
-
-The trick is to re-dispatch the method in the mock class:
-
-```
-class ScopedMockLog : public LogSink {
- public:
- ...
- virtual void send(LogSeverity severity, const char* full_filename,
- const char* base_filename, int line, const tm* tm_time,
- const char* message, size_t message_len) {
- // We are only interested in the log severity, full file name, and
- // log message.
- Log(severity, full_filename, std::string(message, message_len));
- }
-
- // Implements the mock method:
- //
- // void Log(LogSeverity severity,
- // const string& file_path,
- // const string& message);
- MOCK_METHOD3(Log, void(LogSeverity severity, const string& file_path,
- const string& message));
-};
-```
-
-By defining a new mock method with a trimmed argument list, we make
-the mock class much more user-friendly.
-
-## Alternative to Mocking Concrete Classes ##
-
-Often you may find yourself using classes that don't implement
-interfaces. In order to test your code that uses such a class (let's
-call it `Concrete`), you may be tempted to make the methods of
-`Concrete` virtual and then mock it.
-
-Try not to do that.
-
-Making a non-virtual function virtual is a big decision. It creates an
-extension point where subclasses can tweak your class' behavior. This
-weakens your control on the class because now it's harder to maintain
-the class' invariants. You should make a function virtual only when
-there is a valid reason for a subclass to override it.
-
-Mocking concrete classes directly is problematic as it creates a tight
-coupling between the class and the tests - any small change in the
-class may invalidate your tests and make test maintenance a pain.
-
-To avoid such problems, many programmers have been practicing "coding
-to interfaces": instead of talking to the `Concrete` class, your code
-would define an interface and talk to it. Then you implement that
-interface as an adaptor on top of `Concrete`. In tests, you can easily
-mock that interface to observe how your code is doing.
-
-This technique incurs some overhead:
-
- * You pay the cost of virtual function calls (usually not a problem).
- * There is more abstraction for the programmers to learn.
-
-However, it can also bring significant benefits in addition to better
-testability:
-
- * `Concrete`'s API may not fit your problem domain very well, as you may not be the only client it tries to serve. By designing your own interface, you have a chance to tailor it to your need - you may add higher-level functionalities, rename stuff, etc instead of just trimming the class. This allows you to write your code (user of the interface) in a more natural way, which means it will be more readable, more maintainable, and you'll be more productive.
- * If `Concrete`'s implementation ever has to change, you don't have to rewrite everywhere it is used. Instead, you can absorb the change in your implementation of the interface, and your other code and tests will be insulated from this change.
-
-Some people worry that if everyone is practicing this technique, they
-will end up writing lots of redundant code. This concern is totally
-understandable. However, there are two reasons why it may not be the
-case:
-
- * Different projects may need to use `Concrete` in different ways, so the best interfaces for them will be different. Therefore, each of them will have its own domain-specific interface on top of `Concrete`, and they will not be the same code.
- * If enough projects want to use the same interface, they can always share it, just like they have been sharing `Concrete`. You can check in the interface and the adaptor somewhere near `Concrete` (perhaps in a `contrib` sub-directory) and let many projects use it.
-
-You need to weigh the pros and cons carefully for your particular
-problem, but I'd like to assure you that the Java community has been
-practicing this for a long time and it's a proven effective technique
-applicable in a wide variety of situations. :-)
-
-## Delegating Calls to a Fake ##
-
-Some times you have a non-trivial fake implementation of an
-interface. For example:
-
-```
-class Foo {
- public:
- virtual ~Foo() {}
- virtual char DoThis(int n) = 0;
- virtual void DoThat(const char* s, int* p) = 0;
-};
-
-class FakeFoo : public Foo {
- public:
- virtual char DoThis(int n) {
- return (n > 0) ? '+' :
- (n < 0) ? '-' : '0';
- }
-
- virtual void DoThat(const char* s, int* p) {
- *p = strlen(s);
- }
-};
-```
-
-Now you want to mock this interface such that you can set expectations
-on it. However, you also want to use `FakeFoo` for the default
-behavior, as duplicating it in the mock object is, well, a lot of
-work.
-
-When you define the mock class using Google Mock, you can have it
-delegate its default action to a fake class you already have, using
-this pattern:
-
-```
-using ::testing::_;
-using ::testing::Invoke;
-
-class MockFoo : public Foo {
- public:
- // Normal mock method definitions using Google Mock.
- MOCK_METHOD1(DoThis, char(int n));
- MOCK_METHOD2(DoThat, void(const char* s, int* p));
-
- // Delegates the default actions of the methods to a FakeFoo object.
- // This must be called *before* the custom ON_CALL() statements.
- void DelegateToFake() {
- ON_CALL(*this, DoThis(_))
- .WillByDefault(Invoke(&fake_, &FakeFoo::DoThis));
- ON_CALL(*this, DoThat(_, _))
- .WillByDefault(Invoke(&fake_, &FakeFoo::DoThat));
- }
- private:
- FakeFoo fake_; // Keeps an instance of the fake in the mock.
-};
-```
-
-With that, you can use `MockFoo` in your tests as usual. Just remember
-that if you don't explicitly set an action in an `ON_CALL()` or
-`EXPECT_CALL()`, the fake will be called upon to do it:
-
-```
-using ::testing::_;
-
-TEST(AbcTest, Xyz) {
- MockFoo foo;
- foo.DelegateToFake(); // Enables the fake for delegation.
-
- // Put your ON_CALL(foo, ...)s here, if any.
-
- // No action specified, meaning to use the default action.
- EXPECT_CALL(foo, DoThis(5));
- EXPECT_CALL(foo, DoThat(_, _));
-
- int n = 0;
- EXPECT_EQ('+', foo.DoThis(5)); // FakeFoo::DoThis() is invoked.
- foo.DoThat("Hi", &n); // FakeFoo::DoThat() is invoked.
- EXPECT_EQ(2, n);
-}
-```
-
-**Some tips:**
-
- * If you want, you can still override the default action by providing your own `ON_CALL()` or using `.WillOnce()` / `.WillRepeatedly()` in `EXPECT_CALL()`.
- * In `DelegateToFake()`, you only need to delegate the methods whose fake implementation you intend to use.
- * The general technique discussed here works for overloaded methods, but you'll need to tell the compiler which version you mean. To disambiguate a mock function (the one you specify inside the parentheses of `ON_CALL()`), see the "Selecting Between Overloaded Functions" section on this page; to disambiguate a fake function (the one you place inside `Invoke()`), use a `static_cast` to specify the function's type. For instance, if class `Foo` has methods `char DoThis(int n)` and `bool DoThis(double x) const`, and you want to invoke the latter, you need to write `Invoke(&fake_, static_cast(&FakeFoo::DoThis))` instead of `Invoke(&fake_, &FakeFoo::DoThis)` (The strange-looking thing inside the angled brackets of `static_cast` is the type of a function pointer to the second `DoThis()` method.).
- * Having to mix a mock and a fake is often a sign of something gone wrong. Perhaps you haven't got used to the interaction-based way of testing yet. Or perhaps your interface is taking on too many roles and should be split up. Therefore, **don't abuse this**. We would only recommend to do it as an intermediate step when you are refactoring your code.
-
-Regarding the tip on mixing a mock and a fake, here's an example on
-why it may be a bad sign: Suppose you have a class `System` for
-low-level system operations. In particular, it does file and I/O
-operations. And suppose you want to test how your code uses `System`
-to do I/O, and you just want the file operations to work normally. If
-you mock out the entire `System` class, you'll have to provide a fake
-implementation for the file operation part, which suggests that
-`System` is taking on too many roles.
-
-Instead, you can define a `FileOps` interface and an `IOOps` interface
-and split `System`'s functionalities into the two. Then you can mock
-`IOOps` without mocking `FileOps`.
-
-## Delegating Calls to a Real Object ##
-
-When using testing doubles (mocks, fakes, stubs, and etc), sometimes
-their behaviors will differ from those of the real objects. This
-difference could be either intentional (as in simulating an error such
-that you can test the error handling code) or unintentional. If your
-mocks have different behaviors than the real objects by mistake, you
-could end up with code that passes the tests but fails in production.
-
-You can use the _delegating-to-real_ technique to ensure that your
-mock has the same behavior as the real object while retaining the
-ability to validate calls. This technique is very similar to the
-delegating-to-fake technique, the difference being that we use a real
-object instead of a fake. Here's an example:
-
-```
-using ::testing::_;
-using ::testing::AtLeast;
-using ::testing::Invoke;
-
-class MockFoo : public Foo {
- public:
- MockFoo() {
- // By default, all calls are delegated to the real object.
- ON_CALL(*this, DoThis())
- .WillByDefault(Invoke(&real_, &Foo::DoThis));
- ON_CALL(*this, DoThat(_))
- .WillByDefault(Invoke(&real_, &Foo::DoThat));
- ...
- }
- MOCK_METHOD0(DoThis, ...);
- MOCK_METHOD1(DoThat, ...);
- ...
- private:
- Foo real_;
-};
-...
-
- MockFoo mock;
-
- EXPECT_CALL(mock, DoThis())
- .Times(3);
- EXPECT_CALL(mock, DoThat("Hi"))
- .Times(AtLeast(1));
- ... use mock in test ...
-```
-
-With this, Google Mock will verify that your code made the right calls
-(with the right arguments, in the right order, called the right number
-of times, etc), and a real object will answer the calls (so the
-behavior will be the same as in production). This gives you the best
-of both worlds.
-
-## Delegating Calls to a Parent Class ##
-
-Ideally, you should code to interfaces, whose methods are all pure
-virtual. In reality, sometimes you do need to mock a virtual method
-that is not pure (i.e, it already has an implementation). For example:
-
-```
-class Foo {
- public:
- virtual ~Foo();
-
- virtual void Pure(int n) = 0;
- virtual int Concrete(const char* str) { ... }
-};
-
-class MockFoo : public Foo {
- public:
- // Mocking a pure method.
- MOCK_METHOD1(Pure, void(int n));
- // Mocking a concrete method. Foo::Concrete() is shadowed.
- MOCK_METHOD1(Concrete, int(const char* str));
-};
-```
-
-Sometimes you may want to call `Foo::Concrete()` instead of
-`MockFoo::Concrete()`. Perhaps you want to do it as part of a stub
-action, or perhaps your test doesn't need to mock `Concrete()` at all
-(but it would be oh-so painful to have to define a new mock class
-whenever you don't need to mock one of its methods).
-
-The trick is to leave a back door in your mock class for accessing the
-real methods in the base class:
-
-```
-class MockFoo : public Foo {
- public:
- // Mocking a pure method.
- MOCK_METHOD1(Pure, void(int n));
- // Mocking a concrete method. Foo::Concrete() is shadowed.
- MOCK_METHOD1(Concrete, int(const char* str));
-
- // Use this to call Concrete() defined in Foo.
- int FooConcrete(const char* str) { return Foo::Concrete(str); }
-};
-```
-
-Now, you can call `Foo::Concrete()` inside an action by:
-
-```
-using ::testing::_;
-using ::testing::Invoke;
-...
- EXPECT_CALL(foo, Concrete(_))
- .WillOnce(Invoke(&foo, &MockFoo::FooConcrete));
-```
-
-or tell the mock object that you don't want to mock `Concrete()`:
-
-```
-using ::testing::Invoke;
-...
- ON_CALL(foo, Concrete(_))
- .WillByDefault(Invoke(&foo, &MockFoo::FooConcrete));
-```
-
-(Why don't we just write `Invoke(&foo, &Foo::Concrete)`? If you do
-that, `MockFoo::Concrete()` will be called (and cause an infinite
-recursion) since `Foo::Concrete()` is virtual. That's just how C++
-works.)
-
-# Using Matchers #
-
-## Matching Argument Values Exactly ##
-
-You can specify exactly which arguments a mock method is expecting:
-
-```
-using ::testing::Return;
-...
- EXPECT_CALL(foo, DoThis(5))
- .WillOnce(Return('a'));
- EXPECT_CALL(foo, DoThat("Hello", bar));
-```
-
-## Using Simple Matchers ##
-
-You can use matchers to match arguments that have a certain property:
-
-```
-using ::testing::Ge;
-using ::testing::NotNull;
-using ::testing::Return;
-...
- EXPECT_CALL(foo, DoThis(Ge(5))) // The argument must be >= 5.
- .WillOnce(Return('a'));
- EXPECT_CALL(foo, DoThat("Hello", NotNull()));
- // The second argument must not be NULL.
-```
-
-A frequently used matcher is `_`, which matches anything:
-
-```
-using ::testing::_;
-using ::testing::NotNull;
-...
- EXPECT_CALL(foo, DoThat(_, NotNull()));
-```
-
-## Combining Matchers ##
-
-You can build complex matchers from existing ones using `AllOf()`,
-`AnyOf()`, and `Not()`:
-
-```
-using ::testing::AllOf;
-using ::testing::Gt;
-using ::testing::HasSubstr;
-using ::testing::Ne;
-using ::testing::Not;
-...
- // The argument must be > 5 and != 10.
- EXPECT_CALL(foo, DoThis(AllOf(Gt(5),
- Ne(10))));
-
- // The first argument must not contain sub-string "blah".
- EXPECT_CALL(foo, DoThat(Not(HasSubstr("blah")),
- NULL));
-```
-
-## Casting Matchers ##
-
-Google Mock matchers are statically typed, meaning that the compiler
-can catch your mistake if you use a matcher of the wrong type (for
-example, if you use `Eq(5)` to match a `string` argument). Good for
-you!
-
-Sometimes, however, you know what you're doing and want the compiler
-to give you some slack. One example is that you have a matcher for
-`long` and the argument you want to match is `int`. While the two
-types aren't exactly the same, there is nothing really wrong with
-using a `Matcher` to match an `int` - after all, we can first
-convert the `int` argument to a `long` before giving it to the
-matcher.
-
-To support this need, Google Mock gives you the
-`SafeMatcherCast(m)` function. It casts a matcher `m` to type
-`Matcher`. To ensure safety, Google Mock checks that (let `U` be the
-type `m` accepts):
-
- 1. Type `T` can be implicitly cast to type `U`;
- 1. When both `T` and `U` are built-in arithmetic types (`bool`, integers, and floating-point numbers), the conversion from `T` to `U` is not lossy (in other words, any value representable by `T` can also be represented by `U`); and
- 1. When `U` is a reference, `T` must also be a reference (as the underlying matcher may be interested in the address of the `U` value).
-
-The code won't compile if any of these conditions aren't met.
-
-Here's one example:
-
-```
-using ::testing::SafeMatcherCast;
-
-// A base class and a child class.
-class Base { ... };
-class Derived : public Base { ... };
-
-class MockFoo : public Foo {
- public:
- MOCK_METHOD1(DoThis, void(Derived* derived));
-};
-...
-
- MockFoo foo;
- // m is a Matcher we got from somewhere.
- EXPECT_CALL(foo, DoThis(SafeMatcherCast(m)));
-```
-
-If you find `SafeMatcherCast(m)` too limiting, you can use a similar
-function `MatcherCast(m)`. The difference is that `MatcherCast` works
-as long as you can `static_cast` type `T` to type `U`.
-
-`MatcherCast` essentially lets you bypass C++'s type system
-(`static_cast` isn't always safe as it could throw away information,
-for example), so be careful not to misuse/abuse it.
-
-## Selecting Between Overloaded Functions ##
-
-If you expect an overloaded function to be called, the compiler may
-need some help on which overloaded version it is.
-
-To disambiguate functions overloaded on the const-ness of this object,
-use the `Const()` argument wrapper.
-
-```
-using ::testing::ReturnRef;
-
-class MockFoo : public Foo {
- ...
- MOCK_METHOD0(GetBar, Bar&());
- MOCK_CONST_METHOD0(GetBar, const Bar&());
-};
-...
-
- MockFoo foo;
- Bar bar1, bar2;
- EXPECT_CALL(foo, GetBar()) // The non-const GetBar().
- .WillOnce(ReturnRef(bar1));
- EXPECT_CALL(Const(foo), GetBar()) // The const GetBar().
- .WillOnce(ReturnRef(bar2));
-```
-
-(`Const()` is defined by Google Mock and returns a `const` reference
-to its argument.)
-
-To disambiguate overloaded functions with the same number of arguments
-but different argument types, you may need to specify the exact type
-of a matcher, either by wrapping your matcher in `Matcher()`, or
-using a matcher whose type is fixed (`TypedEq`, `An()`,
-etc):
-
-```
-using ::testing::An;
-using ::testing::Lt;
-using ::testing::Matcher;
-using ::testing::TypedEq;
-
-class MockPrinter : public Printer {
- public:
- MOCK_METHOD1(Print, void(int n));
- MOCK_METHOD1(Print, void(char c));
-};
-
-TEST(PrinterTest, Print) {
- MockPrinter printer;
-
- EXPECT_CALL(printer, Print(An())); // void Print(int);
- EXPECT_CALL(printer, Print(Matcher(Lt(5)))); // void Print(int);
- EXPECT_CALL(printer, Print(TypedEq('a'))); // void Print(char);
-
- printer.Print(3);
- printer.Print(6);
- printer.Print('a');
-}
-```
-
-## Performing Different Actions Based on the Arguments ##
-
-When a mock method is called, the _last_ matching expectation that's
-still active will be selected (think "newer overrides older"). So, you
-can make a method do different things depending on its argument values
-like this:
-
-```
-using ::testing::_;
-using ::testing::Lt;
-using ::testing::Return;
-...
- // The default case.
- EXPECT_CALL(foo, DoThis(_))
- .WillRepeatedly(Return('b'));
-
- // The more specific case.
- EXPECT_CALL(foo, DoThis(Lt(5)))
- .WillRepeatedly(Return('a'));
-```
-
-Now, if `foo.DoThis()` is called with a value less than 5, `'a'` will
-be returned; otherwise `'b'` will be returned.
-
-## Matching Multiple Arguments as a Whole ##
-
-Sometimes it's not enough to match the arguments individually. For
-example, we may want to say that the first argument must be less than
-the second argument. The `With()` clause allows us to match
-all arguments of a mock function as a whole. For example,
-
-```
-using ::testing::_;
-using ::testing::Lt;
-using ::testing::Ne;
-...
- EXPECT_CALL(foo, InRange(Ne(0), _))
- .With(Lt());
-```
-
-says that the first argument of `InRange()` must not be 0, and must be
-less than the second argument.
-
-The expression inside `With()` must be a matcher of type
-`Matcher< ::testing::tuple >`, where `A1`, ..., `An` are the
-types of the function arguments.
-
-You can also write `AllArgs(m)` instead of `m` inside `.With()`. The
-two forms are equivalent, but `.With(AllArgs(Lt()))` is more readable
-than `.With(Lt())`.
-
-You can use `Args(m)` to match the `n` selected arguments
-(as a tuple) against `m`. For example,
-
-```
-using ::testing::_;
-using ::testing::AllOf;
-using ::testing::Args;
-using ::testing::Lt;
-...
- EXPECT_CALL(foo, Blah(_, _, _))
- .With(AllOf(Args<0, 1>(Lt()), Args<1, 2>(Lt())));
-```
-
-says that `Blah()` will be called with arguments `x`, `y`, and `z` where
-`x < y < z`.
-
-As a convenience and example, Google Mock provides some matchers for
-2-tuples, including the `Lt()` matcher above. See the [CheatSheet](CheatSheet.md) for
-the complete list.
-
-Note that if you want to pass the arguments to a predicate of your own
-(e.g. `.With(Args<0, 1>(Truly(&MyPredicate)))`), that predicate MUST be
-written to take a `::testing::tuple` as its argument; Google Mock will pass the `n` selected arguments as _one_ single tuple to the predicate.
-
-## Using Matchers as Predicates ##
-
-Have you noticed that a matcher is just a fancy predicate that also
-knows how to describe itself? Many existing algorithms take predicates
-as arguments (e.g. those defined in STL's `` header), and
-it would be a shame if Google Mock matchers are not allowed to
-participate.
-
-Luckily, you can use a matcher where a unary predicate functor is
-expected by wrapping it inside the `Matches()` function. For example,
-
-```
-#include
-#include
-
-std::vector v;
-...
-// How many elements in v are >= 10?
-const int count = count_if(v.begin(), v.end(), Matches(Ge(10)));
-```
-
-Since you can build complex matchers from simpler ones easily using
-Google Mock, this gives you a way to conveniently construct composite
-predicates (doing the same using STL's `` header is just
-painful). For example, here's a predicate that's satisfied by any
-number that is >= 0, <= 100, and != 50:
-
-```
-Matches(AllOf(Ge(0), Le(100), Ne(50)))
-```
-
-## Using Matchers in Google Test Assertions ##
-
-Since matchers are basically predicates that also know how to describe
-themselves, there is a way to take advantage of them in
-[Google Test](../../googletest/) assertions. It's
-called `ASSERT_THAT` and `EXPECT_THAT`:
-
-```
- ASSERT_THAT(value, matcher); // Asserts that value matches matcher.
- EXPECT_THAT(value, matcher); // The non-fatal version.
-```
-
-For example, in a Google Test test you can write:
-
-```
-#include "gmock/gmock.h"
-
-using ::testing::AllOf;
-using ::testing::Ge;
-using ::testing::Le;
-using ::testing::MatchesRegex;
-using ::testing::StartsWith;
-...
-
- EXPECT_THAT(Foo(), StartsWith("Hello"));
- EXPECT_THAT(Bar(), MatchesRegex("Line \\d+"));
- ASSERT_THAT(Baz(), AllOf(Ge(5), Le(10)));
-```
-
-which (as you can probably guess) executes `Foo()`, `Bar()`, and
-`Baz()`, and verifies that:
-
- * `Foo()` returns a string that starts with `"Hello"`.
- * `Bar()` returns a string that matches regular expression `"Line \\d+"`.
- * `Baz()` returns a number in the range [5, 10].
-
-The nice thing about these macros is that _they read like
-English_. They generate informative messages too. For example, if the
-first `EXPECT_THAT()` above fails, the message will be something like:
-
-```
-Value of: Foo()
- Actual: "Hi, world!"
-Expected: starts with "Hello"
-```
-
-**Credit:** The idea of `(ASSERT|EXPECT)_THAT` was stolen from the
-[Hamcrest](https://github.com/hamcrest/) project, which adds
-`assertThat()` to JUnit.
-
-## Using Predicates as Matchers ##
-
-Google Mock provides a built-in set of matchers. In case you find them
-lacking, you can use an arbitray unary predicate function or functor
-as a matcher - as long as the predicate accepts a value of the type
-you want. You do this by wrapping the predicate inside the `Truly()`
-function, for example:
-
-```
-using ::testing::Truly;
-
-int IsEven(int n) { return (n % 2) == 0 ? 1 : 0; }
-...
-
- // Bar() must be called with an even number.
- EXPECT_CALL(foo, Bar(Truly(IsEven)));
-```
-
-Note that the predicate function / functor doesn't have to return
-`bool`. It works as long as the return value can be used as the
-condition in statement `if (condition) ...`.
-
-## Matching Arguments that Are Not Copyable ##
-
-When you do an `EXPECT_CALL(mock_obj, Foo(bar))`, Google Mock saves
-away a copy of `bar`. When `Foo()` is called later, Google Mock
-compares the argument to `Foo()` with the saved copy of `bar`. This
-way, you don't need to worry about `bar` being modified or destroyed
-after the `EXPECT_CALL()` is executed. The same is true when you use
-matchers like `Eq(bar)`, `Le(bar)`, and so on.
-
-But what if `bar` cannot be copied (i.e. has no copy constructor)? You
-could define your own matcher function and use it with `Truly()`, as
-the previous couple of recipes have shown. Or, you may be able to get
-away from it if you can guarantee that `bar` won't be changed after
-the `EXPECT_CALL()` is executed. Just tell Google Mock that it should
-save a reference to `bar`, instead of a copy of it. Here's how:
-
-```
-using ::testing::Eq;
-using ::testing::ByRef;
-using ::testing::Lt;
-...
- // Expects that Foo()'s argument == bar.
- EXPECT_CALL(mock_obj, Foo(Eq(ByRef(bar))));
-
- // Expects that Foo()'s argument < bar.
- EXPECT_CALL(mock_obj, Foo(Lt(ByRef(bar))));
-```
-
-Remember: if you do this, don't change `bar` after the
-`EXPECT_CALL()`, or the result is undefined.
-
-## Validating a Member of an Object ##
-
-Often a mock function takes a reference to object as an argument. When
-matching the argument, you may not want to compare the entire object
-against a fixed object, as that may be over-specification. Instead,
-you may need to validate a certain member variable or the result of a
-certain getter method of the object. You can do this with `Field()`
-and `Property()`. More specifically,
-
-```
-Field(&Foo::bar, m)
-```
-
-is a matcher that matches a `Foo` object whose `bar` member variable
-satisfies matcher `m`.
-
-```
-Property(&Foo::baz, m)
-```
-
-is a matcher that matches a `Foo` object whose `baz()` method returns
-a value that satisfies matcher `m`.
-
-For example:
-
-| Expression | Description |
-|:-----------------------------|:-----------------------------------|
-| `Field(&Foo::number, Ge(3))` | Matches `x` where `x.number >= 3`. |
-| `Property(&Foo::name, StartsWith("John "))` | Matches `x` where `x.name()` starts with `"John "`. |
-
-Note that in `Property(&Foo::baz, ...)`, method `baz()` must take no
-argument and be declared as `const`.
-
-BTW, `Field()` and `Property()` can also match plain pointers to
-objects. For instance,
-
-```
-Field(&Foo::number, Ge(3))
-```
-
-matches a plain pointer `p` where `p->number >= 3`. If `p` is `NULL`,
-the match will always fail regardless of the inner matcher.
-
-What if you want to validate more than one members at the same time?
-Remember that there is `AllOf()`.
-
-## Validating the Value Pointed to by a Pointer Argument ##
-
-C++ functions often take pointers as arguments. You can use matchers
-like `IsNull()`, `NotNull()`, and other comparison matchers to match a
-pointer, but what if you want to make sure the value _pointed to_ by
-the pointer, instead of the pointer itself, has a certain property?
-Well, you can use the `Pointee(m)` matcher.
-
-`Pointee(m)` matches a pointer iff `m` matches the value the pointer
-points to. For example:
-
-```
-using ::testing::Ge;
-using ::testing::Pointee;
-...
- EXPECT_CALL(foo, Bar(Pointee(Ge(3))));
-```
-
-expects `foo.Bar()` to be called with a pointer that points to a value
-greater than or equal to 3.
-
-One nice thing about `Pointee()` is that it treats a `NULL` pointer as
-a match failure, so you can write `Pointee(m)` instead of
-
-```
- AllOf(NotNull(), Pointee(m))
-```
-
-without worrying that a `NULL` pointer will crash your test.
-
-Also, did we tell you that `Pointee()` works with both raw pointers
-**and** smart pointers (`linked_ptr`, `shared_ptr`, `scoped_ptr`, and
-etc)?
-
-What if you have a pointer to pointer? You guessed it - you can use
-nested `Pointee()` to probe deeper inside the value. For example,
-`Pointee(Pointee(Lt(3)))` matches a pointer that points to a pointer
-that points to a number less than 3 (what a mouthful...).
-
-## Testing a Certain Property of an Object ##
-
-Sometimes you want to specify that an object argument has a certain
-property, but there is no existing matcher that does this. If you want
-good error messages, you should define a matcher. If you want to do it
-quick and dirty, you could get away with writing an ordinary function.
-
-Let's say you have a mock function that takes an object of type `Foo`,
-which has an `int bar()` method and an `int baz()` method, and you
-want to constrain that the argument's `bar()` value plus its `baz()`
-value is a given number. Here's how you can define a matcher to do it:
-
-```
-using ::testing::MatcherInterface;
-using ::testing::MatchResultListener;
-
-class BarPlusBazEqMatcher : public MatcherInterface {
- public:
- explicit BarPlusBazEqMatcher(int expected_sum)
- : expected_sum_(expected_sum) {}
-
- virtual bool MatchAndExplain(const Foo& foo,
- MatchResultListener* listener) const {
- return (foo.bar() + foo.baz()) == expected_sum_;
- }
-
- virtual void DescribeTo(::std::ostream* os) const {
- *os << "bar() + baz() equals " << expected_sum_;
- }
-
- virtual void DescribeNegationTo(::std::ostream* os) const {
- *os << "bar() + baz() does not equal " << expected_sum_;
- }
- private:
- const int expected_sum_;
-};
-
-inline Matcher BarPlusBazEq(int expected_sum) {
- return MakeMatcher(new BarPlusBazEqMatcher(expected_sum));
-}
-
-...
-
- EXPECT_CALL(..., DoThis(BarPlusBazEq(5)))...;
-```
-
-## Matching Containers ##
-
-Sometimes an STL container (e.g. list, vector, map, ...) is passed to
-a mock function and you may want to validate it. Since most STL
-containers support the `==` operator, you can write
-`Eq(expected_container)` or simply `expected_container` to match a
-container exactly.
-
-Sometimes, though, you may want to be more flexible (for example, the
-first element must be an exact match, but the second element can be
-any positive number, and so on). Also, containers used in tests often
-have a small number of elements, and having to define the expected
-container out-of-line is a bit of a hassle.
-
-You can use the `ElementsAre()` or `UnorderedElementsAre()` matcher in
-such cases:
-
-```
-using ::testing::_;
-using ::testing::ElementsAre;
-using ::testing::Gt;
-...
-
- MOCK_METHOD1(Foo, void(const vector& numbers));
-...
-
- EXPECT_CALL(mock, Foo(ElementsAre(1, Gt(0), _, 5)));
-```
-
-The above matcher says that the container must have 4 elements, which
-must be 1, greater than 0, anything, and 5 respectively.
-
-If you instead write:
-
-```
-using ::testing::_;
-using ::testing::Gt;
-using ::testing::UnorderedElementsAre;
-...
-
- MOCK_METHOD1(Foo, void(const vector& numbers));
-...
-
- EXPECT_CALL(mock, Foo(UnorderedElementsAre(1, Gt(0), _, 5)));
-```
-
-It means that the container must have 4 elements, which under some
-permutation must be 1, greater than 0, anything, and 5 respectively.
-
-`ElementsAre()` and `UnorderedElementsAre()` are overloaded to take 0
-to 10 arguments. If more are needed, you can place them in a C-style
-array and use `ElementsAreArray()` or `UnorderedElementsAreArray()`
-instead:
-
-```
-using ::testing::ElementsAreArray;
-...
-
- // ElementsAreArray accepts an array of element values.
- const int expected_vector1[] = { 1, 5, 2, 4, ... };
- EXPECT_CALL(mock, Foo(ElementsAreArray(expected_vector1)));
-
- // Or, an array of element matchers.
- Matcher expected_vector2 = { 1, Gt(2), _, 3, ... };
- EXPECT_CALL(mock, Foo(ElementsAreArray(expected_vector2)));
-```
-
-In case the array needs to be dynamically created (and therefore the
-array size cannot be inferred by the compiler), you can give
-`ElementsAreArray()` an additional argument to specify the array size:
-
-```
-using ::testing::ElementsAreArray;
-...
- int* const expected_vector3 = new int[count];
- ... fill expected_vector3 with values ...
- EXPECT_CALL(mock, Foo(ElementsAreArray(expected_vector3, count)));
-```
-
-**Tips:**
-
- * `ElementsAre*()` can be used to match _any_ container that implements the STL iterator pattern (i.e. it has a `const_iterator` type and supports `begin()/end()`), not just the ones defined in STL. It will even work with container types yet to be written - as long as they follows the above pattern.
- * You can use nested `ElementsAre*()` to match nested (multi-dimensional) containers.
- * If the container is passed by pointer instead of by reference, just write `Pointee(ElementsAre*(...))`.
- * The order of elements _matters_ for `ElementsAre*()`. Therefore don't use it with containers whose element order is undefined (e.g. `hash_map`).
-
-## Sharing Matchers ##
-
-Under the hood, a Google Mock matcher object consists of a pointer to
-a ref-counted implementation object. Copying matchers is allowed and
-very efficient, as only the pointer is copied. When the last matcher
-that references the implementation object dies, the implementation
-object will be deleted.
-
-Therefore, if you have some complex matcher that you want to use again
-and again, there is no need to build it everytime. Just assign it to a
-matcher variable and use that variable repeatedly! For example,
-
-```
- Matcher in_range = AllOf(Gt(5), Le(10));
- ... use in_range as a matcher in multiple EXPECT_CALLs ...
-```
-
-# Setting Expectations #
-
-## Knowing When to Expect ##
-
-`ON_CALL` is likely the single most under-utilized construct in Google Mock.
-
-There are basically two constructs for defining the behavior of a mock object: `ON_CALL` and `EXPECT_CALL`. The difference? `ON_CALL` defines what happens when a mock method is called, but _doesn't imply any expectation on the method being called._ `EXPECT_CALL` not only defines the behavior, but also sets an expectation that _the method will be called with the given arguments, for the given number of times_ (and _in the given order_ when you specify the order too).
-
-Since `EXPECT_CALL` does more, isn't it better than `ON_CALL`? Not really. Every `EXPECT_CALL` adds a constraint on the behavior of the code under test. Having more constraints than necessary is _baaad_ - even worse than not having enough constraints.
-
-This may be counter-intuitive. How could tests that verify more be worse than tests that verify less? Isn't verification the whole point of tests?
-
-The answer, lies in _what_ a test should verify. **A good test verifies the contract of the code.** If a test over-specifies, it doesn't leave enough freedom to the implementation. As a result, changing the implementation without breaking the contract (e.g. refactoring and optimization), which should be perfectly fine to do, can break such tests. Then you have to spend time fixing them, only to see them broken again the next time the implementation is changed.
-
-Keep in mind that one doesn't have to verify more than one property in one test. In fact, **it's a good style to verify only one thing in one test.** If you do that, a bug will likely break only one or two tests instead of dozens (which case would you rather debug?). If you are also in the habit of giving tests descriptive names that tell what they verify, you can often easily guess what's wrong just from the test log itself.
-
-So use `ON_CALL` by default, and only use `EXPECT_CALL` when you actually intend to verify that the call is made. For example, you may have a bunch of `ON_CALL`s in your test fixture to set the common mock behavior shared by all tests in the same group, and write (scarcely) different `EXPECT_CALL`s in different `TEST_F`s to verify different aspects of the code's behavior. Compared with the style where each `TEST` has many `EXPECT_CALL`s, this leads to tests that are more resilient to implementational changes (and thus less likely to require maintenance) and makes the intent of the tests more obvious (so they are easier to maintain when you do need to maintain them).
-
-If you are bothered by the "Uninteresting mock function call" message printed when a mock method without an `EXPECT_CALL` is called, you may use a `NiceMock` instead to suppress all such messages for the mock object, or suppress the message for specific methods by adding `EXPECT_CALL(...).Times(AnyNumber())`. DO NOT suppress it by blindly adding an `EXPECT_CALL(...)`, or you'll have a test that's a pain to maintain.
-
-## Ignoring Uninteresting Calls ##
-
-If you are not interested in how a mock method is called, just don't
-say anything about it. In this case, if the method is ever called,
-Google Mock will perform its default action to allow the test program
-to continue. If you are not happy with the default action taken by
-Google Mock, you can override it using `DefaultValue::Set()`
-(described later in this document) or `ON_CALL()`.
-
-Please note that once you expressed interest in a particular mock
-method (via `EXPECT_CALL()`), all invocations to it must match some
-expectation. If this function is called but the arguments don't match
-any `EXPECT_CALL()` statement, it will be an error.
-
-## Disallowing Unexpected Calls ##
-
-If a mock method shouldn't be called at all, explicitly say so:
-
-```
-using ::testing::_;
-...
- EXPECT_CALL(foo, Bar(_))
- .Times(0);
-```
-
-If some calls to the method are allowed, but the rest are not, just
-list all the expected calls:
-
-```
-using ::testing::AnyNumber;
-using ::testing::Gt;
-...
- EXPECT_CALL(foo, Bar(5));
- EXPECT_CALL(foo, Bar(Gt(10)))
- .Times(AnyNumber());
-```
-
-A call to `foo.Bar()` that doesn't match any of the `EXPECT_CALL()`
-statements will be an error.
-
-## Understanding Uninteresting vs Unexpected Calls ##
-
-_Uninteresting_ calls and _unexpected_ calls are different concepts in Google Mock. _Very_ different.
-
-A call `x.Y(...)` is **uninteresting** if there's _not even a single_ `EXPECT_CALL(x, Y(...))` set. In other words, the test isn't interested in the `x.Y()` method at all, as evident in that the test doesn't care to say anything about it.
-
-A call `x.Y(...)` is **unexpected** if there are some `EXPECT_CALL(x, Y(...))s` set, but none of them matches the call. Put another way, the test is interested in the `x.Y()` method (therefore it _explicitly_ sets some `EXPECT_CALL` to verify how it's called); however, the verification fails as the test doesn't expect this particular call to happen.
-
-**An unexpected call is always an error,** as the code under test doesn't behave the way the test expects it to behave.
-
-**By default, an uninteresting call is not an error,** as it violates no constraint specified by the test. (Google Mock's philosophy is that saying nothing means there is no constraint.) However, it leads to a warning, as it _might_ indicate a problem (e.g. the test author might have forgotten to specify a constraint).
-
-In Google Mock, `NiceMock` and `StrictMock` can be used to make a mock class "nice" or "strict". How does this affect uninteresting calls and unexpected calls?
-
-A **nice mock** suppresses uninteresting call warnings. It is less chatty than the default mock, but otherwise is the same. If a test fails with a default mock, it will also fail using a nice mock instead. And vice versa. Don't expect making a mock nice to change the test's result.
-
-A **strict mock** turns uninteresting call warnings into errors. So making a mock strict may change the test's result.
-
-Let's look at an example:
-
-```
-TEST(...) {
- NiceMock mock_registry;
- EXPECT_CALL(mock_registry, GetDomainOwner("google.com"))
- .WillRepeatedly(Return("Larry Page"));
-
- // Use mock_registry in code under test.
- ... &mock_registry ...
-}
-```
-
-The sole `EXPECT_CALL` here says that all calls to `GetDomainOwner()` must have `"google.com"` as the argument. If `GetDomainOwner("yahoo.com")` is called, it will be an unexpected call, and thus an error. Having a nice mock doesn't change the severity of an unexpected call.
-
-So how do we tell Google Mock that `GetDomainOwner()` can be called with some other arguments as well? The standard technique is to add a "catch all" `EXPECT_CALL`:
-
-```
- EXPECT_CALL(mock_registry, GetDomainOwner(_))
- .Times(AnyNumber()); // catches all other calls to this method.
- EXPECT_CALL(mock_registry, GetDomainOwner("google.com"))
- .WillRepeatedly(Return("Larry Page"));
-```
-
-Remember that `_` is the wildcard matcher that matches anything. With this, if `GetDomainOwner("google.com")` is called, it will do what the second `EXPECT_CALL` says; if it is called with a different argument, it will do what the first `EXPECT_CALL` says.
-
-Note that the order of the two `EXPECT_CALLs` is important, as a newer `EXPECT_CALL` takes precedence over an older one.
-
-For more on uninteresting calls, nice mocks, and strict mocks, read ["The Nice, the Strict, and the Naggy"](#the-nice-the-strict-and-the-naggy).
-
-## Expecting Ordered Calls ##
-
-Although an `EXPECT_CALL()` statement defined earlier takes precedence
-when Google Mock tries to match a function call with an expectation,
-by default calls don't have to happen in the order `EXPECT_CALL()`
-statements are written. For example, if the arguments match the
-matchers in the third `EXPECT_CALL()`, but not those in the first two,
-then the third expectation will be used.
-
-If you would rather have all calls occur in the order of the
-expectations, put the `EXPECT_CALL()` statements in a block where you
-define a variable of type `InSequence`:
-
-```
- using ::testing::_;
- using ::testing::InSequence;
-
- {
- InSequence s;
-
- EXPECT_CALL(foo, DoThis(5));
- EXPECT_CALL(bar, DoThat(_))
- .Times(2);
- EXPECT_CALL(foo, DoThis(6));
- }
-```
-
-In this example, we expect a call to `foo.DoThis(5)`, followed by two
-calls to `bar.DoThat()` where the argument can be anything, which are
-in turn followed by a call to `foo.DoThis(6)`. If a call occurred
-out-of-order, Google Mock will report an error.
-
-## Expecting Partially Ordered Calls ##
-
-Sometimes requiring everything to occur in a predetermined order can
-lead to brittle tests. For example, we may care about `A` occurring
-before both `B` and `C`, but aren't interested in the relative order
-of `B` and `C`. In this case, the test should reflect our real intent,
-instead of being overly constraining.
-
-Google Mock allows you to impose an arbitrary DAG (directed acyclic
-graph) on the calls. One way to express the DAG is to use the
-[After](CheatSheet.md#the-after-clause) clause of `EXPECT_CALL`.
-
-Another way is via the `InSequence()` clause (not the same as the
-`InSequence` class), which we borrowed from jMock 2. It's less
-flexible than `After()`, but more convenient when you have long chains
-of sequential calls, as it doesn't require you to come up with
-different names for the expectations in the chains. Here's how it
-works:
-
-If we view `EXPECT_CALL()` statements as nodes in a graph, and add an
-edge from node A to node B wherever A must occur before B, we can get
-a DAG. We use the term "sequence" to mean a directed path in this
-DAG. Now, if we decompose the DAG into sequences, we just need to know
-which sequences each `EXPECT_CALL()` belongs to in order to be able to
-reconstruct the orginal DAG.
-
-So, to specify the partial order on the expectations we need to do two
-things: first to define some `Sequence` objects, and then for each
-`EXPECT_CALL()` say which `Sequence` objects it is part
-of. Expectations in the same sequence must occur in the order they are
-written. For example,
-
-```
- using ::testing::Sequence;
-
- Sequence s1, s2;
-
- EXPECT_CALL(foo, A())
- .InSequence(s1, s2);
- EXPECT_CALL(bar, B())
- .InSequence(s1);
- EXPECT_CALL(bar, C())
- .InSequence(s2);
- EXPECT_CALL(foo, D())
- .InSequence(s2);
-```
-
-specifies the following DAG (where `s1` is `A -> B`, and `s2` is `A ->
-C -> D`):
-
-```
- +---> B
- |
- A ---|
- |
- +---> C ---> D
-```
-
-This means that A must occur before B and C, and C must occur before
-D. There's no restriction about the order other than these.
-
-## Controlling When an Expectation Retires ##
-
-When a mock method is called, Google Mock only consider expectations
-that are still active. An expectation is active when created, and
-becomes inactive (aka _retires_) when a call that has to occur later
-has occurred. For example, in
-
-```
- using ::testing::_;
- using ::testing::Sequence;
-
- Sequence s1, s2;
-
- EXPECT_CALL(log, Log(WARNING, _, "File too large.")) // #1
- .Times(AnyNumber())
- .InSequence(s1, s2);
- EXPECT_CALL(log, Log(WARNING, _, "Data set is empty.")) // #2
- .InSequence(s1);
- EXPECT_CALL(log, Log(WARNING, _, "User not found.")) // #3
- .InSequence(s2);
-```
-
-as soon as either #2 or #3 is matched, #1 will retire. If a warning
-`"File too large."` is logged after this, it will be an error.
-
-Note that an expectation doesn't retire automatically when it's
-saturated. For example,
-
-```
-using ::testing::_;
-...
- EXPECT_CALL(log, Log(WARNING, _, _)); // #1
- EXPECT_CALL(log, Log(WARNING, _, "File too large.")); // #2
-```
-
-says that there will be exactly one warning with the message `"File
-too large."`. If the second warning contains this message too, #2 will
-match again and result in an upper-bound-violated error.
-
-If this is not what you want, you can ask an expectation to retire as
-soon as it becomes saturated:
-
-```
-using ::testing::_;
-...
- EXPECT_CALL(log, Log(WARNING, _, _)); // #1
- EXPECT_CALL(log, Log(WARNING, _, "File too large.")) // #2
- .RetiresOnSaturation();
-```
-
-Here #2 can be used only once, so if you have two warnings with the
-message `"File too large."`, the first will match #2 and the second
-will match #1 - there will be no error.
-
-# Using Actions #
-
-## Returning References from Mock Methods ##
-
-If a mock function's return type is a reference, you need to use
-`ReturnRef()` instead of `Return()` to return a result:
-
-```
-using ::testing::ReturnRef;
-
-class MockFoo : public Foo {
- public:
- MOCK_METHOD0(GetBar, Bar&());
-};
-...
-
- MockFoo foo;
- Bar bar;
- EXPECT_CALL(foo, GetBar())
- .WillOnce(ReturnRef(bar));
-```
-
-## Returning Live Values from Mock Methods ##
-
-The `Return(x)` action saves a copy of `x` when the action is
-_created_, and always returns the same value whenever it's
-executed. Sometimes you may want to instead return the _live_ value of
-`x` (i.e. its value at the time when the action is _executed_.).
-
-If the mock function's return type is a reference, you can do it using
-`ReturnRef(x)`, as shown in the previous recipe ("Returning References
-from Mock Methods"). However, Google Mock doesn't let you use
-`ReturnRef()` in a mock function whose return type is not a reference,
-as doing that usually indicates a user error. So, what shall you do?
-
-You may be tempted to try `ByRef()`:
-
-```
-using testing::ByRef;
-using testing::Return;
-
-class MockFoo : public Foo {
- public:
- MOCK_METHOD0(GetValue, int());
-};
-...
- int x = 0;
- MockFoo foo;
- EXPECT_CALL(foo, GetValue())
- .WillRepeatedly(Return(ByRef(x)));
- x = 42;
- EXPECT_EQ(42, foo.GetValue());
-```
-
-Unfortunately, it doesn't work here. The above code will fail with error:
-
-```
-Value of: foo.GetValue()
- Actual: 0
-Expected: 42
-```
-
-The reason is that `Return(value)` converts `value` to the actual
-return type of the mock function at the time when the action is
-_created_, not when it is _executed_. (This behavior was chosen for
-the action to be safe when `value` is a proxy object that references
-some temporary objects.) As a result, `ByRef(x)` is converted to an
-`int` value (instead of a `const int&`) when the expectation is set,
-and `Return(ByRef(x))` will always return 0.
-
-`ReturnPointee(pointer)` was provided to solve this problem
-specifically. It returns the value pointed to by `pointer` at the time
-the action is _executed_:
-
-```
-using testing::ReturnPointee;
-...
- int x = 0;
- MockFoo foo;
- EXPECT_CALL(foo, GetValue())
- .WillRepeatedly(ReturnPointee(&x)); // Note the & here.
- x = 42;
- EXPECT_EQ(42, foo.GetValue()); // This will succeed now.
-```
-
-## Combining Actions ##
-
-Want to do more than one thing when a function is called? That's
-fine. `DoAll()` allow you to do sequence of actions every time. Only
-the return value of the last action in the sequence will be used.
-
-```
-using ::testing::DoAll;
-
-class MockFoo : public Foo {
- public:
- MOCK_METHOD1(Bar, bool(int n));
-};
-...
-
- EXPECT_CALL(foo, Bar(_))
- .WillOnce(DoAll(action_1,
- action_2,
- ...
- action_n));
-```
-
-## Mocking Side Effects ##
-
-Sometimes a method exhibits its effect not via returning a value but
-via side effects. For example, it may change some global state or
-modify an output argument. To mock side effects, in general you can
-define your own action by implementing `::testing::ActionInterface`.
-
-If all you need to do is to change an output argument, the built-in
-`SetArgPointee()` action is convenient:
-
-```
-using ::testing::SetArgPointee;
-
-class MockMutator : public Mutator {
- public:
- MOCK_METHOD2(Mutate, void(bool mutate, int* value));
- ...
-};
-...
-
- MockMutator mutator;
- EXPECT_CALL(mutator, Mutate(true, _))
- .WillOnce(SetArgPointee<1>(5));
-```
-
-In this example, when `mutator.Mutate()` is called, we will assign 5
-to the `int` variable pointed to by argument #1
-(0-based).
-
-`SetArgPointee()` conveniently makes an internal copy of the
-value you pass to it, removing the need to keep the value in scope and
-alive. The implication however is that the value must have a copy
-constructor and assignment operator.
-
-If the mock method also needs to return a value as well, you can chain
-`SetArgPointee()` with `Return()` using `DoAll()`:
-
-```
-using ::testing::_;
-using ::testing::Return;
-using ::testing::SetArgPointee;
-
-class MockMutator : public Mutator {
- public:
- ...
- MOCK_METHOD1(MutateInt, bool(int* value));
-};
-...
-
- MockMutator mutator;
- EXPECT_CALL(mutator, MutateInt(_))
- .WillOnce(DoAll(SetArgPointee<0>(5),
- Return(true)));
-```
-
-If the output argument is an array, use the
-`SetArrayArgument(first, last)` action instead. It copies the
-elements in source range `[first, last)` to the array pointed to by
-the `N`-th (0-based) argument:
-
-```
-using ::testing::NotNull;
-using ::testing::SetArrayArgument;
-
-class MockArrayMutator : public ArrayMutator {
- public:
- MOCK_METHOD2(Mutate, void(int* values, int num_values));
- ...
-};
-...
-
- MockArrayMutator mutator;
- int values[5] = { 1, 2, 3, 4, 5 };
- EXPECT_CALL(mutator, Mutate(NotNull(), 5))
- .WillOnce(SetArrayArgument<0>(values, values + 5));
-```
-
-This also works when the argument is an output iterator:
-
-```
-using ::testing::_;
-using ::testing::SetArrayArgument;
-
-class MockRolodex : public Rolodex {
- public:
- MOCK_METHOD1(GetNames, void(std::back_insert_iterator >));
- ...
-};
-...
-
- MockRolodex rolodex;
- vector names;
- names.push_back("George");
- names.push_back("John");
- names.push_back("Thomas");
- EXPECT_CALL(rolodex, GetNames(_))
- .WillOnce(SetArrayArgument<0>(names.begin(), names.end()));
-```
-
-## Changing a Mock Object's Behavior Based on the State ##
-
-If you expect a call to change the behavior of a mock object, you can use `::testing::InSequence` to specify different behaviors before and after the call:
-
-```
-using ::testing::InSequence;
-using ::testing::Return;
-
-...
- {
- InSequence seq;
- EXPECT_CALL(my_mock, IsDirty())
- .WillRepeatedly(Return(true));
- EXPECT_CALL(my_mock, Flush());
- EXPECT_CALL(my_mock, IsDirty())
- .WillRepeatedly(Return(false));
- }
- my_mock.FlushIfDirty();
-```
-
-This makes `my_mock.IsDirty()` return `true` before `my_mock.Flush()` is called and return `false` afterwards.
-
-If the behavior change is more complex, you can store the effects in a variable and make a mock method get its return value from that variable:
-
-```
-using ::testing::_;
-using ::testing::SaveArg;
-using ::testing::Return;
-
-ACTION_P(ReturnPointee, p) { return *p; }
-...
- int previous_value = 0;
- EXPECT_CALL(my_mock, GetPrevValue())
- .WillRepeatedly(ReturnPointee(&previous_value));
- EXPECT_CALL(my_mock, UpdateValue(_))
- .WillRepeatedly(SaveArg<0>(&previous_value));
- my_mock.DoSomethingToUpdateValue();
-```
-
-Here `my_mock.GetPrevValue()` will always return the argument of the last `UpdateValue()` call.
-
-## Setting the Default Value for a Return Type ##
-
-If a mock method's return type is a built-in C++ type or pointer, by
-default it will return 0 when invoked. Also, in C++ 11 and above, a mock
-method whose return type has a default constructor will return a default-constructed
-value by default. You only need to specify an
-action if this default value doesn't work for you.
-
-Sometimes, you may want to change this default value, or you may want
-to specify a default value for types Google Mock doesn't know
-about. You can do this using the `::testing::DefaultValue` class
-template:
-
-```
-class MockFoo : public Foo {
- public:
- MOCK_METHOD0(CalculateBar, Bar());
-};
-...
-
- Bar default_bar;
- // Sets the default return value for type Bar.
- DefaultValue::Set(default_bar);
-
- MockFoo foo;
-
- // We don't need to specify an action here, as the default
- // return value works for us.
- EXPECT_CALL(foo, CalculateBar());
-
- foo.CalculateBar(); // This should return default_bar.
-
- // Unsets the default return value.
- DefaultValue::Clear();
-```
-
-Please note that changing the default value for a type can make you
-tests hard to understand. We recommend you to use this feature
-judiciously. For example, you may want to make sure the `Set()` and
-`Clear()` calls are right next to the code that uses your mock.
-
-## Setting the Default Actions for a Mock Method ##
-
-You've learned how to change the default value of a given
-type. However, this may be too coarse for your purpose: perhaps you
-have two mock methods with the same return type and you want them to
-have different behaviors. The `ON_CALL()` macro allows you to
-customize your mock's behavior at the method level:
-
-```
-using ::testing::_;
-using ::testing::AnyNumber;
-using ::testing::Gt;
-using ::testing::Return;
-...
- ON_CALL(foo, Sign(_))
- .WillByDefault(Return(-1));
- ON_CALL(foo, Sign(0))
- .WillByDefault(Return(0));
- ON_CALL(foo, Sign(Gt(0)))
- .WillByDefault(Return(1));
-
- EXPECT_CALL(foo, Sign(_))
- .Times(AnyNumber());
-
- foo.Sign(5); // This should return 1.
- foo.Sign(-9); // This should return -1.
- foo.Sign(0); // This should return 0.
-```
-
-As you may have guessed, when there are more than one `ON_CALL()`
-statements, the news order take precedence over the older ones. In
-other words, the **last** one that matches the function arguments will
-be used. This matching order allows you to set up the common behavior
-in a mock object's constructor or the test fixture's set-up phase and
-specialize the mock's behavior later.
-
-## Using Functions/Methods/Functors as Actions ##
-
-If the built-in actions don't suit you, you can easily use an existing
-function, method, or functor as an action:
-
-```
-using ::testing::_;
-using ::testing::Invoke;
-
-class MockFoo : public Foo {
- public:
- MOCK_METHOD2(Sum, int(int x, int y));
- MOCK_METHOD1(ComplexJob, bool(int x));
-};
-
-int CalculateSum(int x, int y) { return x + y; }
-
-class Helper {
- public:
- bool ComplexJob(int x);
-};
-...
-
- MockFoo foo;
- Helper helper;
- EXPECT_CALL(foo, Sum(_, _))
- .WillOnce(Invoke(CalculateSum));
- EXPECT_CALL(foo, ComplexJob(_))
- .WillOnce(Invoke(&helper, &Helper::ComplexJob));
-
- foo.Sum(5, 6); // Invokes CalculateSum(5, 6).
- foo.ComplexJob(10); // Invokes helper.ComplexJob(10);
-```
-
-The only requirement is that the type of the function, etc must be
-_compatible_ with the signature of the mock function, meaning that the
-latter's arguments can be implicitly converted to the corresponding
-arguments of the former, and the former's return type can be
-implicitly converted to that of the latter. So, you can invoke
-something whose type is _not_ exactly the same as the mock function,
-as long as it's safe to do so - nice, huh?
-
-## Invoking a Function/Method/Functor Without Arguments ##
-
-`Invoke()` is very useful for doing actions that are more complex. It
-passes the mock function's arguments to the function or functor being
-invoked such that the callee has the full context of the call to work
-with. If the invoked function is not interested in some or all of the
-arguments, it can simply ignore them.
-
-Yet, a common pattern is that a test author wants to invoke a function
-without the arguments of the mock function. `Invoke()` allows her to
-do that using a wrapper function that throws away the arguments before
-invoking an underlining nullary function. Needless to say, this can be
-tedious and obscures the intent of the test.
-
-`InvokeWithoutArgs()` solves this problem. It's like `Invoke()` except
-that it doesn't pass the mock function's arguments to the
-callee. Here's an example:
-
-```
-using ::testing::_;
-using ::testing::InvokeWithoutArgs;
-
-class MockFoo : public Foo {
- public:
- MOCK_METHOD1(ComplexJob, bool(int n));
-};
-
-bool Job1() { ... }
-...
-
- MockFoo foo;
- EXPECT_CALL(foo, ComplexJob(_))
- .WillOnce(InvokeWithoutArgs(Job1));
-
- foo.ComplexJob(10); // Invokes Job1().
-```
-
-## Invoking an Argument of the Mock Function ##
-
-Sometimes a mock function will receive a function pointer or a functor
-(in other words, a "callable") as an argument, e.g.
-
-```
-class MockFoo : public Foo {
- public:
- MOCK_METHOD2(DoThis, bool(int n, bool (*fp)(int)));
-};
-```
-
-and you may want to invoke this callable argument:
-
-```
-using ::testing::_;
-...
- MockFoo foo;
- EXPECT_CALL(foo, DoThis(_, _))
- .WillOnce(...);
- // Will execute (*fp)(5), where fp is the
- // second argument DoThis() receives.
-```
-
-Arghh, you need to refer to a mock function argument but your version
-of C++ has no lambdas, so you have to define your own action. :-(
-Or do you really?
-
-Well, Google Mock has an action to solve _exactly_ this problem:
-
-```
- InvokeArgument(arg_1, arg_2, ..., arg_m)
-```
-
-will invoke the `N`-th (0-based) argument the mock function receives,
-with `arg_1`, `arg_2`, ..., and `arg_m`. No matter if the argument is
-a function pointer or a functor, Google Mock handles them both.
-
-With that, you could write:
-
-```
-using ::testing::_;
-using ::testing::InvokeArgument;
-...
- EXPECT_CALL(foo, DoThis(_, _))
- .WillOnce(InvokeArgument<1>(5));
- // Will execute (*fp)(5), where fp is the
- // second argument DoThis() receives.
-```
-
-What if the callable takes an argument by reference? No problem - just
-wrap it inside `ByRef()`:
-
-```
-...
- MOCK_METHOD1(Bar, bool(bool (*fp)(int, const Helper&)));
-...
-using ::testing::_;
-using ::testing::ByRef;
-using ::testing::InvokeArgument;
-...
-
- MockFoo foo;
- Helper helper;
- ...
- EXPECT_CALL(foo, Bar(_))
- .WillOnce(InvokeArgument<0>(5, ByRef(helper)));
- // ByRef(helper) guarantees that a reference to helper, not a copy of it,
- // will be passed to the callable.
-```
-
-What if the callable takes an argument by reference and we do **not**
-wrap the argument in `ByRef()`? Then `InvokeArgument()` will _make a
-copy_ of the argument, and pass a _reference to the copy_, instead of
-a reference to the original value, to the callable. This is especially
-handy when the argument is a temporary value:
-
-```
-...
- MOCK_METHOD1(DoThat, bool(bool (*f)(const double& x, const string& s)));
-...
-using ::testing::_;
-using ::testing::InvokeArgument;
-...
-
- MockFoo foo;
- ...
- EXPECT_CALL(foo, DoThat(_))
- .WillOnce(InvokeArgument<0>(5.0, string("Hi")));
- // Will execute (*f)(5.0, string("Hi")), where f is the function pointer
- // DoThat() receives. Note that the values 5.0 and string("Hi") are
- // temporary and dead once the EXPECT_CALL() statement finishes. Yet
- // it's fine to perform this action later, since a copy of the values
- // are kept inside the InvokeArgument action.
-```
-
-## Ignoring an Action's Result ##
-
-Sometimes you have an action that returns _something_, but you need an
-action that returns `void` (perhaps you want to use it in a mock
-function that returns `void`, or perhaps it needs to be used in
-`DoAll()` and it's not the last in the list). `IgnoreResult()` lets
-you do that. For example:
-
-```
-using ::testing::_;
-using ::testing::Invoke;
-using ::testing::Return;
-
-int Process(const MyData& data);
-string DoSomething();
-
-class MockFoo : public Foo {
- public:
- MOCK_METHOD1(Abc, void(const MyData& data));
- MOCK_METHOD0(Xyz, bool());
-};
-...
-
- MockFoo foo;
- EXPECT_CALL(foo, Abc(_))
- // .WillOnce(Invoke(Process));
- // The above line won't compile as Process() returns int but Abc() needs
- // to return void.
- .WillOnce(IgnoreResult(Invoke(Process)));
-
- EXPECT_CALL(foo, Xyz())
- .WillOnce(DoAll(IgnoreResult(Invoke(DoSomething)),
- // Ignores the string DoSomething() returns.
- Return(true)));
-```
-
-Note that you **cannot** use `IgnoreResult()` on an action that already
-returns `void`. Doing so will lead to ugly compiler errors.
-
-## Selecting an Action's Arguments ##
-
-Say you have a mock function `Foo()` that takes seven arguments, and
-you have a custom action that you want to invoke when `Foo()` is
-called. Trouble is, the custom action only wants three arguments:
-
-```
-using ::testing::_;
-using ::testing::Invoke;
-...
- MOCK_METHOD7(Foo, bool(bool visible, const string& name, int x, int y,
- const map, double>& weight,
- double min_weight, double max_wight));
-...
-
-bool IsVisibleInQuadrant1(bool visible, int x, int y) {
- return visible && x >= 0 && y >= 0;
-}
-...
-
- EXPECT_CALL(mock, Foo(_, _, _, _, _, _, _))
- .WillOnce(Invoke(IsVisibleInQuadrant1)); // Uh, won't compile. :-(
-```
-
-To please the compiler God, you can to define an "adaptor" that has
-the same signature as `Foo()` and calls the custom action with the
-right arguments:
-
-```
-using ::testing::_;
-using ::testing::Invoke;
-
-bool MyIsVisibleInQuadrant1(bool visible, const string& name, int x, int y,
- const map, double>& weight,
- double min_weight, double max_wight) {
- return IsVisibleInQuadrant1(visible, x, y);
-}
-...
-
- EXPECT_CALL(mock, Foo(_, _, _, _, _, _, _))
- .WillOnce(Invoke(MyIsVisibleInQuadrant1)); // Now it works.
-```
-
-But isn't this awkward?
-
-Google Mock provides a generic _action adaptor_, so you can spend your
-time minding more important business than writing your own
-adaptors. Here's the syntax:
-
-```
- WithArgs(action)
-```
-
-creates an action that passes the arguments of the mock function at
-the given indices (0-based) to the inner `action` and performs
-it. Using `WithArgs`, our original example can be written as:
-
-```
-using ::testing::_;
-using ::testing::Invoke;
-using ::testing::WithArgs;
-...
- EXPECT_CALL(mock, Foo(_, _, _, _, _, _, _))
- .WillOnce(WithArgs<0, 2, 3>(Invoke(IsVisibleInQuadrant1)));
- // No need to define your own adaptor.
-```
-
-For better readability, Google Mock also gives you:
-
- * `WithoutArgs(action)` when the inner `action` takes _no_ argument, and
- * `WithArg(action)` (no `s` after `Arg`) when the inner `action` takes _one_ argument.
-
-As you may have realized, `InvokeWithoutArgs(...)` is just syntactic
-sugar for `WithoutArgs(Invoke(...))`.
-
-Here are more tips:
-
- * The inner action used in `WithArgs` and friends does not have to be `Invoke()` -- it can be anything.
- * You can repeat an argument in the argument list if necessary, e.g. `WithArgs<2, 3, 3, 5>(...)`.
- * You can change the order of the arguments, e.g. `WithArgs<3, 2, 1>(...)`.
- * The types of the selected arguments do _not_ have to match the signature of the inner action exactly. It works as long as they can be implicitly converted to the corresponding arguments of the inner action. For example, if the 4-th argument of the mock function is an `int` and `my_action` takes a `double`, `WithArg<4>(my_action)` will work.
-
-## Ignoring Arguments in Action Functions ##
-
-The selecting-an-action's-arguments recipe showed us one way to make a
-mock function and an action with incompatible argument lists fit
-together. The downside is that wrapping the action in
-`WithArgs<...>()` can get tedious for people writing the tests.
-
-If you are defining a function, method, or functor to be used with
-`Invoke*()`, and you are not interested in some of its arguments, an
-alternative to `WithArgs` is to declare the uninteresting arguments as
-`Unused`. This makes the definition less cluttered and less fragile in
-case the types of the uninteresting arguments change. It could also
-increase the chance the action function can be reused. For example,
-given
-
-```
- MOCK_METHOD3(Foo, double(const string& label, double x, double y));
- MOCK_METHOD3(Bar, double(int index, double x, double y));
-```
-
-instead of
-
-```
-using ::testing::_;
-using ::testing::Invoke;
-
-double DistanceToOriginWithLabel(const string& label, double x, double y) {
- return sqrt(x*x + y*y);
-}
-
-double DistanceToOriginWithIndex(int index, double x, double y) {
- return sqrt(x*x + y*y);
-}
-...
-
- EXEPCT_CALL(mock, Foo("abc", _, _))
- .WillOnce(Invoke(DistanceToOriginWithLabel));
- EXEPCT_CALL(mock, Bar(5, _, _))
- .WillOnce(Invoke(DistanceToOriginWithIndex));
-```
-
-you could write
-
-```
-using ::testing::_;
-using ::testing::Invoke;
-using ::testing::Unused;
-
-double DistanceToOrigin(Unused, double x, double y) {
- return sqrt(x*x + y*y);
-}
-...
-
- EXEPCT_CALL(mock, Foo("abc", _, _))
- .WillOnce(Invoke(DistanceToOrigin));
- EXEPCT_CALL(mock, Bar(5, _, _))
- .WillOnce(Invoke(DistanceToOrigin));
-```
-
-## Sharing Actions ##
-
-Just like matchers, a Google Mock action object consists of a pointer
-to a ref-counted implementation object. Therefore copying actions is
-also allowed and very efficient. When the last action that references
-the implementation object dies, the implementation object will be
-deleted.
-
-If you have some complex action that you want to use again and again,
-you may not have to build it from scratch everytime. If the action
-doesn't have an internal state (i.e. if it always does the same thing
-no matter how many times it has been called), you can assign it to an
-action variable and use that variable repeatedly. For example:
-
-```
- Action set_flag = DoAll(SetArgPointee<0>(5),
- Return(true));
- ... use set_flag in .WillOnce() and .WillRepeatedly() ...
-```
-
-However, if the action has its own state, you may be surprised if you
-share the action object. Suppose you have an action factory
-`IncrementCounter(init)` which creates an action that increments and
-returns a counter whose initial value is `init`, using two actions
-created from the same expression and using a shared action will
-exihibit different behaviors. Example:
-
-```
- EXPECT_CALL(foo, DoThis())
- .WillRepeatedly(IncrementCounter(0));
- EXPECT_CALL(foo, DoThat())
- .WillRepeatedly(IncrementCounter(0));
- foo.DoThis(); // Returns 1.
- foo.DoThis(); // Returns 2.
- foo.DoThat(); // Returns 1 - Blah() uses a different
- // counter than Bar()'s.
-```
-
-versus
-
-```
- Action increment = IncrementCounter(0);
-
- EXPECT_CALL(foo, DoThis())
- .WillRepeatedly(increment);
- EXPECT_CALL(foo, DoThat())
- .WillRepeatedly(increment);
- foo.DoThis(); // Returns 1.
- foo.DoThis(); // Returns 2.
- foo.DoThat(); // Returns 3 - the counter is shared.
-```
-
-# Misc Recipes on Using Google Mock #
-
-## Mocking Methods That Use Move-Only Types ##
-
-C++11 introduced move-only types. A move-only-typed value can be moved from one object to another, but cannot be copied. `std::unique_ptr` is probably the most commonly used move-only type.
-
-Mocking a method that takes and/or returns move-only types presents some challenges, but nothing insurmountable. This recipe shows you how you can do it.
-
-Let’s say we are working on a fictional project that lets one post and share snippets called “buzzes”. Your code uses these types:
-
-```
-enum class AccessLevel { kInternal, kPublic };
-
-class Buzz {
- public:
- explicit Buzz(AccessLevel access) { … }
- ...
-};
-
-class Buzzer {
- public:
- virtual ~Buzzer() {}
- virtual std::unique_ptr