{"id":16903899,"url":"https://github.com/briansmith/googletest","last_synced_at":"2026-01-29T23:02:29.599Z","repository":{"id":34900286,"uuid":"38933402","full_name":"briansmith/googletest","owner":"briansmith","description":"The GTest (GoogleTest) C++ unit testing framework, automatically imported from upstream revision 771","archived":false,"fork":false,"pushed_at":"2015-07-11T16:59:36.000Z","size":1908,"stargazers_count":0,"open_issues_count":127,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-03T13:06:36.550Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://code.google.com/p/googletest","language":"C++","has_issues":false,"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/briansmith.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":"2015-07-11T16:56:54.000Z","updated_at":"2015-07-15T20:55:56.000Z","dependencies_parsed_at":"2022-09-15T22:30:50.646Z","dependency_job_id":null,"html_url":"https://github.com/briansmith/googletest","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/briansmith/googletest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briansmith%2Fgoogletest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briansmith%2Fgoogletest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briansmith%2Fgoogletest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briansmith%2Fgoogletest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/briansmith","download_url":"https://codeload.github.com/briansmith/googletest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briansmith%2Fgoogletest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28889863,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T21:06:44.224Z","status":"ssl_error","status_checked_at":"2026-01-29T21:06:42.160Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-10-13T18:29:41.816Z","updated_at":"2026-01-29T23:02:29.586Z","avatar_url":"https://github.com/briansmith.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Google C++ Testing Framework\n============================\n\nhttp://code.google.com/p/googletest/\n\nOverview\n--------\n\nGoogle's framework for writing C++ tests on a variety of platforms\n(Linux, Mac OS X, Windows, Windows CE, Symbian, etc).  Based on the\nxUnit architecture.  Supports automatic test discovery, a rich set of\nassertions, user-defined assertions, death tests, fatal and non-fatal\nfailures, various options for running the tests, and XML test report\ngeneration.\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\nRequirements for End Users\n--------------------------\n\nGoogle Test is designed to have fairly minimal requirements to build\nand use with your projects, but there are some.  Currently, we support\nLinux, Windows, Mac OS X, and Cygwin.  We will also make our best\neffort to support other platforms (e.g. Solaris, AIX, and z/OS).\nHowever, since core members of the Google Test project have no access\nto these platforms, Google Test may have outstanding issues there.  If\nyou notice any problems on your platform, please notify\ngoogletestframework@googlegroups.com.  Patches for fixing them are\neven more welcome!\n\n### Linux Requirements ###\n\nThese are the base requirements to build and use Google Test from a source\npackage (as described below):\n  * GNU-compatible Make or gmake\n  * POSIX-standard shell\n  * POSIX(-2) Regular Expressions (regex.h)\n  * A C++98-standard-compliant compiler\n\n### Windows Requirements ###\n\n  * Microsoft Visual C++ 7.1 or newer\n\n### Cygwin Requirements ###\n\n  * Cygwin 1.5.25-14 or newer\n\n### Mac OS X Requirements ###\n\n  * Mac OS X 10.4 Tiger or newer\n  * Developer Tools Installed\n\nAlso, you'll need CMake 2.6.4 or higher if you want to build the\nsamples using the provided CMake script, regardless of the platform.\n\nRequirements for Contributors\n-----------------------------\n\nWe welcome patches.  If you plan to contribute a patch, you need to\nbuild Google Test and its own tests from an SVN checkout (described\nbelow), which has further requirements:\n\n  * Python version 2.3 or newer (for running some of the tests and\n    re-generating certain source files from templates)\n  * CMake 2.6.4 or newer\n\nGetting the Source\n------------------\n\nThere are two primary ways of getting Google Test'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 the latest development and\nmake patches much more easily, so we highly encourage it.\n\n### Source Package ###\n\nGoogle Test 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 used to\nmanipulate them, and the size of the resulting file.  Download\nwhichever you are most comfortable with.\n\n  [1] http://code.google.com/p/googletest/downloads/list\n\nOnce the package is downloaded, expand it using whichever tools you\nprefer for that type.  This will result in a new directory with the\nname \"gtest-X.Y.Z\" which contains all of the source code.  Here are\nsome examples on Linux:\n\n  tar -xvzf gtest-X.Y.Z.tar.gz\n  tar -xvjf gtest-X.Y.Z.tar.bz2\n  unzip gtest-X.Y.Z.zip\n\n### SVN Checkout ###\n\nTo check out the main branch (also known as the \"trunk\") of Google\nTest, run the following Subversion command:\n\n  svn checkout http://googletest.googlecode.com/svn/trunk/ gtest-svn\n\nSetting up the Build\n--------------------\n\nTo build Google Test 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\nSuppose you put Google Test in directory ${GTEST_DIR}.  To build it,\ncreate a library build target (or a project as called by Visual Studio\nand Xcode) to compile\n\n  ${GTEST_DIR}/src/gtest-all.cc\n\nwith ${GTEST_DIR}/include in the system header search path and ${GTEST_DIR}\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      -pthread -c ${GTEST_DIR}/src/gtest-all.cc\n  ar -rv libgtest.a gtest-all.o\n\n(We need -pthread as Google Test uses threads.)\n\nNext, you should compile your test source file with\n${GTEST_DIR}/include in the system header search path, and link it\nwith gtest and any other necessary libraries:\n\n  g++ -isystem ${GTEST_DIR}/include -pthread path/to/your_test.cc libgtest.a \\\n      -o your_test\n\nAs an example, the make/ directory contains a Makefile that you can\nuse to build Google Test on systems where GNU make is available\n(e.g. Linux, Mac OS X, and Cygwin).  It doesn't try to build Google\nTest's own tests.  Instead, it just builds the Google Test 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 ${GTEST_DIR}/make\n  make\n  ./sample1_unittest\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### Using CMake ###\n\nGoogle Test comes with a CMake build script (CMakeLists.txt) that can\nbe used on a wide range of platforms (\"C\" stands for cross-platform.).\nIf you don't have CMake installed already, you can download it for\nfree from http://www.cmake.org/.\n\nCMake works by generating native makefiles or build projects that can\nbe used in the compiler environment of your choice.  The typical\nworkflow starts with:\n\n  mkdir mybuild       # Create a directory to hold the build output.\n  cd mybuild\n  cmake ${GTEST_DIR}  # Generate native build scripts.\n\nIf you want to build Google Test's samples, you should replace the\nlast command with\n\n  cmake -Dgtest_build_samples=ON ${GTEST_DIR}\n\nIf you are on a *nix system, you should now see a Makefile in the\ncurrent directory.  Just type 'make' to build gtest.\n\nIf you use Windows and have Visual Studio installed, a gtest.sln file\nand several .vcproj files will be created.  You can then build them\nusing Visual Studio.\n\nOn Mac OS X with Xcode installed, a .xcodeproj file will be generated.\n\n### Legacy Build Scripts ###\n\nBefore settling on CMake, we have been providing hand-maintained build\nprojects/scripts for Visual Studio, Xcode, and Autotools.  While we\ncontinue to provide them for convenience, they are not actively\nmaintained any more.  We highly recommend that you follow the\ninstructions in the previous two sections to integrate Google Test\nwith your existing build system.\n\nIf you still need to use the legacy build scripts, here's how:\n\nThe msvc\\ folder contains two solutions with Visual C++ projects.\nOpen the gtest.sln or gtest-md.sln file using Visual Studio, and you\nare ready to build Google Test the same way you build any Visual\nStudio project.  Files that have names ending with -md use DLL\nversions of Microsoft runtime libraries (the /MD or the /MDd compiler\noption).  Files without that suffix use static versions of the runtime\nlibraries (the /MT or the /MTd option).  Please note that one must use\nthe same option to compile both gtest and the test code.  If you use\nVisual Studio 2005 or above, we recommend the -md version as /MD is\nthe default for new projects in these versions of Visual Studio.\n\nOn Mac OS X, open the gtest.xcodeproj in the xcode/ folder using\nXcode.  Build the \"gtest\" target.  The universal binary framework will\nend up in your selected build directory (selected in the Xcode\n\"Preferences...\" -\u003e \"Building\" pane and defaults to xcode/build).\nAlternatively, at the command line, enter:\n\n  xcodebuild\n\nThis will build the \"Release\" configuration of gtest.framework in your\ndefault build location.  See the \"xcodebuild\" man page for more\ninformation about building different configurations and building in\ndifferent locations.\n\nIf you wish to use the Google Test Xcode project with Xcode 4.x and\nabove, you need to either:\n * update the SDK configuration options in xcode/Config/General.xconfig.\n   Comment options SDKROOT, MACOS_DEPLOYMENT_TARGET, and GCC_VERSION. If\n   you choose this route you lose the ability to target earlier versions\n   of MacOS X.\n * Install an SDK for an earlier version. This doesn't appear to be\n   supported by Apple, but has been reported to work\n   (http://stackoverflow.com/questions/5378518).\n\nTweaking Google Test\n--------------------\n\nGoogle Test 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 Test 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 include/gtest/internal/gtest-port.h.\n\n### Choosing a TR1 Tuple Library ###\n\nSome Google Test features require the C++ Technical Report 1 (TR1)\ntuple library, which is not yet available with all compilers.  The\ngood news is that Google Test implements a subset of TR1 tuple that's\nenough for its own need, and will automatically use this when the\ncompiler doesn't provide TR1 tuple.\n\nUsually you don't need to care about which tuple library Google Test\nuses.  However, if your project already uses TR1 tuple, you need to\ntell Google Test to use the same TR1 tuple library the rest of your\nproject uses, or the two tuple implementations will clash.  To do\nthat, add\n\n  -DGTEST_USE_OWN_TR1_TUPLE=0\n\nto the compiler flags while compiling Google Test and your tests.  If\nyou want to force Google Test to use its own tuple library, just add\n\n  -DGTEST_USE_OWN_TR1_TUPLE=1\n\nto the compiler flags instead.\n\nIf you don't want Google Test to use tuple at all, add\n\n  -DGTEST_HAS_TR1_TUPLE=0\n\nand all features using tuple will be disabled.\n\n### Multi-threaded Tests ###\n\nGoogle Test is thread-safe where the pthread library is available.\nAfter #include \"gtest/gtest.h\", you can check the GTEST_IS_THREADSAFE\nmacro to see whether this is the case (yes if the macro is #defined to\n1, no if it's undefined.).\n\nIf Google Test doesn't correctly detect whether pthread is available\nin your environment, you can force it with\n\n  -DGTEST_HAS_PTHREAD=1\n\nor\n\n  -DGTEST_HAS_PTHREAD=0\n\nWhen Google Test uses pthread, you may need to add flags to your\ncompiler and/or linker to select the pthread library, or you'll get\nlink errors.  If you use the CMake script or the deprecated Autotools\nscript, this is taken care of for you.  If you use your own build\nscript, you'll need to read your compiler and linker's manual to\nfigure out what flags to add.\n\n### As a Shared Library (DLL) ###\n\nGoogle Test is compact, so most users can build and link it as a\nstatic library for the simplicity.  You can choose to use Google Test\nas a shared library (known as a DLL on Windows) if you prefer.\n\nTo compile *gtest* as a shared library, add\n\n  -DGTEST_CREATE_SHARED_LIBRARY=1\n\nto the compiler flags.  You'll also need to tell the linker to produce\na shared library instead - consult your linker's manual for how to do\nit.\n\nTo compile your *tests* that use the gtest shared library, add\n\n  -DGTEST_LINKED_AS_SHARED_LIBRARY=1\n\nto the compiler flags.\n\nNote: while the above steps aren't technically necessary today when\nusing some compilers (e.g. GCC), they may become necessary in the\nfuture, if we decide to improve the speed of loading the library (see\nhttp://gcc.gnu.org/wiki/Visibility for details).  Therefore you are\nrecommended to always add the above flags when using Google Test as a\nshared library.  Otherwise a future release of Google Test may break\nyour build script.\n\n### Avoiding Macro Name Clashes ###\n\nIn C++, macros don't obey namespaces.  Therefore two libraries that\nboth define a macro of the same name will clash if you #include both\ndefinitions.  In case a Google Test macro clashes with another\nlibrary, you can force Google Test to rename its macro to avoid the\nconflict.\n\nSpecifically, if both Google Test and some other code define macro\nFOO, you can add\n\n  -DGTEST_DONT_DEFINE_FOO=1\n\nto the compiler flags to tell Google Test to change the macro's name\nfrom FOO to GTEST_FOO.  Currently FOO can be FAIL, SUCCEED, or TEST.\nFor example, with -DGTEST_DONT_DEFINE_TEST=1, you'll need to write\n\n  GTEST_TEST(SomeTest, DoesThis) { ... }\n\ninstead of\n\n  TEST(SomeTest, DoesThis) { ... }\n\nin order to define a test.\n\nUpgrating from an Earlier Version\n---------------------------------\n\nWe strive to keep Google Test 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 Test.\n\n### Upgrading from 1.3.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\nThe Autotools build script (configure + make) is no longer officially\nsupportted.  You are encouraged to migrate to your own build system or\nuse CMake.  If you still need to use Autotools, you can find\ninstructions in the README file from Google Test 1.4.0.\n\nOn platforms where the pthread library is available, Google Test uses\nit in order to be thread-safe.  See the \"Multi-threaded Tests\" section\nfor what this means to your build script.\n\nIf you use Microsoft Visual C++ 7.1 with exceptions disabled, Google\nTest will no longer compile.  This should affect very few people, as a\nlarge portion of STL (including \u003cstring\u003e) doesn't compile in this mode\nanyway.  We decided to stop supporting it in order to greatly simplify\nGoogle Test's implementation.\n\nDeveloping Google Test\n----------------------\n\nThis section discusses how to make your own changes to Google Test.\n\n### Testing Google Test 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 can use CMake:\n\n  mkdir mybuild\n  cd mybuild\n  cmake -Dgtest_build_tests=ON ${GTEST_DIR}\n\nMake sure you have Python installed, as some of Google Test's tests\nare written in Python.  If the cmake command complains about not being\nable to find Python (\"Could NOT find PythonInterp (missing:\nPYTHON_EXECUTABLE)\"), try telling it explicitly where your Python\nexecutable can be found:\n\n  cmake -DPYTHON_EXECUTABLE=path/to/python -Dgtest_build_tests=ON ${GTEST_DIR}\n\nNext, you can build Google Test and all of its own tests.  On *nix,\nthis is usually done by 'make'.  To run the tests, do\n\n  make test\n\nAll tests should pass.\n\n### Regenerating Source Files ###\n\nSome of Google Test'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/gtest/internal/gtest-type-util.h.pump is used to generate\ngtest-type-util.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.py Python script to\nregenerate them.  You can find pump.py in the scripts/ directory.\nRead the Pump manual [2] for how to use it.\n\n  [2] http://code.google.com/p/googletest/wiki/PumpManual\n\n### Contributing a Patch ###\n\nWe welcome patches.  Please read the Google Test developer's guide [3]\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  [3] http://code.google.com/p/googletest/wiki/GoogleTestDevGuide\n\nHappy testing!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriansmith%2Fgoogletest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbriansmith%2Fgoogletest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriansmith%2Fgoogletest/lists"}