{"id":19189264,"url":"https://github.com/plexinc/googlemock","last_synced_at":"2025-02-23T03:43:51.234Z","repository":{"id":18089647,"uuid":"21155091","full_name":"plexinc/googlemock","owner":"plexinc","description":"Google Mock mirror","archived":false,"fork":false,"pushed_at":"2014-06-24T07:13:51.000Z","size":916,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":47,"default_branch":"master","last_synced_at":"2025-01-04T06:21:51.711Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plexinc.png","metadata":{"files":{"readme":"README","changelog":"CHANGES","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-24T06:54:11.000Z","updated_at":"2014-06-24T07:13:51.000Z","dependencies_parsed_at":"2022-09-25T05:11:01.187Z","dependency_job_id":null,"html_url":"https://github.com/plexinc/googlemock","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plexinc%2Fgooglemock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plexinc%2Fgooglemock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plexinc%2Fgooglemock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plexinc%2Fgooglemock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plexinc","download_url":"https://codeload.github.com/plexinc/googlemock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240266854,"owners_count":19774074,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T11:28:49.571Z","updated_at":"2025-02-23T03:43:51.214Z","avatar_url":"https://github.com/plexinc.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Google C++ Mocking Framework\n============================\n\nhttp://code.google.com/p/googlemock/\n\nOverview\n--------\n\nGoogle's framework for writing and using C++ mock classes on a variety\nof platforms (Linux, Mac OS X, Windows, Windows CE, Symbian, etc).\nInspired by jMock, EasyMock, and Hamcrest, and designed with C++'s\nspecifics in mind, it can help you derive better designs of your\nsystem and write better tests.\n\nGoogle Mock:\n\n- provides a declarative syntax for defining mocks,\n- can easily define partial (hybrid) mocks, which are a cross of real\n  and mock objects,\n- handles functions of arbitrary types and overloaded functions,\n- comes with a rich set of matchers for validating function arguments,\n- uses an intuitive syntax for controlling the behavior of a mock,\n- does automatic verification of expectations (no record-and-replay\n  needed),\n- allows arbitrary (partial) ordering constraints on\n  function calls to be expressed,\n- lets a user extend it by defining new matchers and actions.\n- does not use exceptions, and\n- is easy to learn and use.\n\nPlease see the project page above for more information as well as the\nmailing list for questions, discussions, and development.  There is\nalso an IRC channel on OFTC (irc.oftc.net) #gtest available.  Please\njoin us!\n\nPlease note that code under scripts/generator/ is from the cppclean\nproject (http://code.google.com/p/cppclean/) and under the Apache\nLicense, which is different from Google Mock's license.\n\nRequirements for End Users\n--------------------------\n\nGoogle Mock is implemented on top of the Google Test C++ testing\nframework (http://code.google.com/p/googletest/), and includes the\nlatter as part of the SVN repository and distribution package.  You\nmust use the bundled version of Google Test when using Google Mock, or\nyou may get compiler/linker errors.\n\nYou can also easily configure Google Mock to work with another testing\nframework of your choice; although it will still need Google Test as\nan internal dependency.  Please read\nhttp://code.google.com/p/googlemock/wiki/ForDummies#Using_Google_Mock_with_Any_Testing_Framework\nfor how to do it.\n\nGoogle Mock depends on advanced C++ features and thus requires a more\nmodern compiler.  The following are needed to use Google Mock:\n\n### Linux Requirements ###\n\nThese are the base requirements to build and use Google Mock from a source\npackage (as described below):\n\n  * GNU-compatible Make or \"gmake\"\n  * POSIX-standard shell\n  * POSIX(-2) Regular Expressions (regex.h)\n  * C++98-standard-compliant compiler (e.g. GCC 3.4 or newer)\n\n### Windows Requirements ###\n\n  * Microsoft Visual C++ 8.0 SP1 or newer\n\n### Mac OS X Requirements ###\n\n  * Mac OS X 10.4 Tiger or newer\n  * Developer Tools Installed\n\nRequirements for Contributors\n-----------------------------\n\nWe welcome patches.  If you plan to contribute a patch, you need to\nbuild Google Mock and its own tests from an SVN checkout (described\nbelow), which has further requirements:\n\n  * Automake version 1.9 or newer\n  * Autoconf version 2.59 or newer\n  * Libtool / Libtoolize\n  * Python version 2.3 or newer (for running some of the tests and\n    re-generating certain source files from templates)\n\nGetting the Source\n------------------\n\nThere are two primary ways of getting Google Mock's source code: you\ncan download a stable source release in your preferred archive format,\nor directly check out the source from our Subversion (SVN) repository.\nThe SVN checkout requires a few extra steps and some extra software\npackages on your system, but lets you track development and make\npatches much more easily, so we highly encourage it.\n\n### Source Package ###\n\nGoogle Mock is released in versioned source packages which can be\ndownloaded from the download page [1].  Several different archive\nformats are provided, but the only difference is the tools needed to\nextract their contents, and the size of the resulting file.  Download\nwhichever you are most comfortable with.\n\n  [1] http://code.google.com/p/googlemock/downloads/list\n\nOnce downloaded expand the archive using whichever tools you prefer\nfor that type.  This will always result in a new directory with the\nname \"gmock-X.Y.Z\" which contains all of the source code.  Here are\nsome examples on Linux:\n\n  tar -xvzf gmock-X.Y.Z.tar.gz\n  tar -xvjf gmock-X.Y.Z.tar.bz2\n  unzip gmock-X.Y.Z.zip\n\n### SVN Checkout ###\n\nTo check out the main branch (also known as the \"trunk\") of Google\nMock, run the following Subversion command:\n\n  svn checkout http://googlemock.googlecode.com/svn/trunk/ gmock-svn\n\nIf you are using a *nix system and plan to use the GNU Autotools build\nsystem to build Google Mock (described below), you'll need to\nconfigure it now.  Otherwise you are done with getting the source\nfiles.\n\nTo prepare the Autotools build system, enter the target directory of\nthe checkout command you used ('gmock-svn') and proceed with the\nfollowing command:\n\n  autoreconf -fvi\n\nOnce you have completed this step, you are ready to build the library.\nNote that you should only need to complete this step once.  The\nsubsequent 'make' invocations will automatically re-generate the bits\nof the build system that need to be changed.\n\nIf your system uses older versions of the autotools, the above command\nwill fail.  You may need to explicitly specify a version to use.  For\ninstance, if you have both GNU Automake 1.4 and 1.9 installed and\n'automake' would invoke the 1.4, use instead:\n\n  AUTOMAKE=automake-1.9 ACLOCAL=aclocal-1.9 autoreconf -fvi\n\nMake sure you're using the same version of automake and aclocal.\n\nSetting up the Build\n--------------------\n\nTo build Google Mock and your tests that use it, you need to tell your\nbuild system where to find its headers and source files.  The exact\nway to do it depends on which build system you use, and is usually\nstraightforward.\n\n### Generic Build Instructions ###\n\nThis section shows how you can integrate Google Mock into your\nexisting build system.\n\nSuppose you put Google Mock in directory ${GMOCK_DIR} and Google Test\nin ${GTEST_DIR} (the latter is ${GMOCK_DIR}/gtest by default).  To\nbuild Google Mock, create a library build target (or a project as\ncalled by Visual Studio and Xcode) to compile\n\n  ${GTEST_DIR}/src/gtest-all.cc and ${GMOCK_DIR}/src/gmock-all.cc\n\nwith\n\n  ${GTEST_DIR}/include and ${GMOCK_DIR}/include\n\nin the system header search path, and\n\n  ${GTEST_DIR} and ${GMOCK_DIR}\n\nin the normal header search path.  Assuming a Linux-like system and gcc,\nsomething like the following will do:\n\n  g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \\\n      -isystem ${GMOCK_DIR}/include -I${GMOCK_DIR} \\\n      -pthread -c ${GTEST_DIR}/src/gtest-all.cc\n  g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \\\n      -isystem ${GMOCK_DIR}/include -I${GMOCK_DIR} \\\n      -pthread -c ${GMOCK_DIR}/src/gmock-all.cc\n  ar -rv libgmock.a gtest-all.o gmock-all.o\n\n(We need -pthread as Google Test and Google Mock use threads.)\n\nNext, you should compile your test source file with\n${GTEST_DIR}/include and ${GMOCK_DIR}/include in the header search\npath, and link it with gmock and any other necessary libraries:\n\n  g++ -isystem ${GTEST_DIR}/include -isystem ${GMOCK_DIR}/include \\\n      -pthread path/to/your_test.cc libgmock.a -o your_test\n\nAs an example, the make/ directory contains a Makefile that you can\nuse to build Google Mock on systems where GNU make is available\n(e.g. Linux, Mac OS X, and Cygwin).  It doesn't try to build Google\nMock's own tests.  Instead, it just builds the Google Mock library and\na sample test.  You can use it as a starting point for your own build\nscript.\n\nIf the default settings are correct for your environment, the\nfollowing commands should succeed:\n\n  cd ${GMOCK_DIR}/make\n  make\n  ./gmock_test\n\nIf you see errors, try to tweak the contents of make/Makefile to make\nthem go away.  There are instructions in make/Makefile on how to do\nit.\n\n### Windows ###\n\nThe msvc/2005 directory contains VC++ 2005 projects and the msvc/2010\ndirectory contains VC++ 2010 projects for building Google Mock and\nselected tests.\n\nChange to the appropriate directory and run \"msbuild gmock.sln\" to\nbuild the library and tests (or open the gmock.sln in the MSVC IDE).\nIf you want to create your own project to use with Google Mock, you'll\nhave to configure it to use the gmock_config propety sheet.  For that:\n\n * Open the Property Manager window (View | Other Windows | Property Manager)\n * Right-click on your project and select \"Add Existing Property Sheet...\"\n * Navigate to gmock_config.vsprops or gmock_config.props and select it.\n * In Project Properties | Configuration Properties | General | Additional\n   Include Directories, type \u003cpath to Google Mock\u003e/include.\n\nTweaking Google Mock\n--------------------\n\nGoogle Mock can be used in diverse environments.  The default\nconfiguration may not work (or may not work well) out of the box in\nsome environments.  However, you can easily tweak Google Mock by\ndefining control macros on the compiler command line.  Generally,\nthese macros are named like GTEST_XYZ and you define them to either 1\nor 0 to enable or disable a certain feature.\n\nWe list the most frequently used macros below.  For a complete list,\nsee file ${GTEST_DIR}/include/gtest/internal/gtest-port.h.\n\n### Choosing a TR1 Tuple Library ###\n\nGoogle Mock uses the C++ Technical Report 1 (TR1) tuple library\nheavily.  Unfortunately TR1 tuple is not yet widely available with all\ncompilers.  The good news is that Google Test 1.4.0+ implements a\nsubset of TR1 tuple that's enough for Google Mock's need.  Google Mock\nwill automatically use that implementation when the compiler doesn't\nprovide TR1 tuple.\n\nUsually you don't need to care about which tuple library Google Test\nand Google Mock use.  However, if your project already uses TR1 tuple,\nyou need to tell Google Test and Google Mock to use the same TR1 tuple\nlibrary the rest of your project uses, or the two tuple\nimplementations will clash.  To do that, add\n\n  -DGTEST_USE_OWN_TR1_TUPLE=0\n\nto the compiler flags while compiling Google Test, Google Mock, and\nyour tests.  If you want to force Google Test and Google Mock to use\ntheir own tuple library, just add\n\n  -DGTEST_USE_OWN_TR1_TUPLE=1\n\nto the compiler flags instead.\n\nIf you want to use Boost's TR1 tuple library with Google Mock, please\nrefer to the Boost website (http://www.boost.org/) for how to obtain\nit and set it up.\n\n### As a Shared Library (DLL) ###\n\nGoogle Mock is compact, so most users can build and link it as a static\nlibrary for the simplicity.  Google Mock can be used as a DLL, but the\nsame DLL must contain Google Test as well.  See Google Test's README\nfile for instructions on how to set up necessary compiler settings.\n\n### Tweaking Google Mock ###\n\nMost of Google Test's control macros apply to Google Mock as well.\nPlease see file ${GTEST_DIR}/README for how to tweak them.\n\nUpgrading from an Earlier Version\n---------------------------------\n\nWe strive to keep Google Mock releases backward compatible.\nSometimes, though, we have to make some breaking changes for the\nusers' long-term benefits.  This section describes what you'll need to\ndo if you are upgrading from an earlier version of Google Mock.\n\n### Upgrading from 1.1.0 or Earlier ###\n\nYou may need to explicitly enable or disable Google Test's own TR1\ntuple library.  See the instructions in section \"Choosing a TR1 Tuple\nLibrary\".\n\n### Upgrading from 1.4.0 or Earlier ###\n\nOn platforms where the pthread library is available, Google Test and\nGoogle Mock use it in order to be thread-safe.  For this to work, you\nmay need to tweak your compiler and/or linker flags.  Please see the\n\"Multi-threaded Tests\" section in file ${GTEST_DIR}/README for what\nyou may need to do.\n\nIf you have custom matchers defined using MatcherInterface or\nMakePolymorphicMatcher(), you'll need to update their definitions to\nuse the new matcher API [2].  Matchers defined using MATCHER() or\nMATCHER_P*() aren't affected.\n\n  [2] http://code.google.com/p/googlemock/wiki/CookBook#Writing_New_Monomorphic_Matchers,\n      http://code.google.com/p/googlemock/wiki/CookBook#Writing_New_Polymorphic_Matchers\n\nDeveloping Google Mock\n----------------------\n\nThis section discusses how to make your own changes to Google Mock.\n\n### Testing Google Mock Itself ###\n\nTo make sure your changes work as intended and don't break existing\nfunctionality, you'll want to compile and run Google Test's own tests.\nFor that you'll need Autotools.  First, make sure you have followed\nthe instructions in section \"SVN Checkout\" to configure Google Mock.\nThen, create a build output directory and enter it.  Next,\n\n  ${GMOCK_DIR}/configure  # Standard GNU configure script, --help for more info\n\nOnce you have successfully configured Google Mock, the build steps are\nstandard for GNU-style OSS packages.\n\n  make        # Standard makefile following GNU conventions\n  make check  # Builds and runs all tests - all should pass.\n\nNote that when building your project against Google Mock, you are building\nagainst Google Test as well.  There is no need to configure Google Test\nseparately.\n\n### Regenerating Source Files ###\n\nSome of Google Mock's source files are generated from templates (not\nin the C++ sense) using a script.  A template file is named FOO.pump,\nwhere FOO is the name of the file it will generate.  For example, the\nfile include/gmock/gmock-generated-actions.h.pump is used to generate\ngmock-generated-actions.h in the same directory.\n\nNormally you don't need to worry about regenerating the source files,\nunless you need to modify them.  In that case, you should modify the\ncorresponding .pump files instead and run the 'pump' script (for Pump\nis Useful for Meta Programming) to regenerate them.  You can find\npump.py in the ${GTEST_DIR}/scripts/ directory.  Read the Pump manual\n[3] for how to use it.\n\n  [3] http://code.google.com/p/googletest/wiki/PumpManual.\n\n### Contributing a Patch ###\n\nWe welcome patches.  Please read the Google Mock developer's guide [4]\nfor how you can contribute.  In particular, make sure you have signed\nthe Contributor License Agreement, or we won't be able to accept the\npatch.\n\n  [4] http://code.google.com/p/googlemock/wiki/DevGuide\n\nHappy testing!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplexinc%2Fgooglemock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplexinc%2Fgooglemock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplexinc%2Fgooglemock/lists"}