Googletest - Google Testing and Mocking Framework

Related tags

Debug googletest
Overview

GoogleTest

OSS Builds Status

Build status

Announcements

Release 1.10.x

Release 1.10.x is now available.

Coming Soon

Welcome to GoogleTest, 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.

Getting Started

The information for GoogleTest is available in the GoogleTest Primer documentation.

GoogleMock is an extension to GoogleTest for writing and using C++ mock classes. See the separate GoogleMock documentation.

More detailed documentation for googletest is in its interior googletest/README.md file.

Features

  • An 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.

Supported Platforms

GoogleTest requires a codebase and compiler compliant with the C++11 standard or newer.

The GoogleTest code is officially supported on the following platforms. Operating systems or tools not listed below are community-supported. For community-supported platforms, patches that do not complicate the code may be considered.

If you notice any problems on your platform, please file an issue on the GoogleTest GitHub Issue Tracker. Pull requests containing fixes are welcome!

Operating Systems

  • Linux
  • macOS
  • Windows

Compilers

  • gcc 5.0+
  • clang 5.0+
  • MSVC 2015+

macOS users: Xcode 9.3+ provides clang 5.0+.

Build Systems

Note: Bazel is the build system used by the team internally and in tests. CMake is supported on a best-effort basis and by the community.

Who Is Using GoogleTest?

In addition to many internal projects at Google, GoogleTest is also used by the following notable projects:

Related Open Source Projects

GTest Runner is a Qt5 based automated test-runner and Graphical User Interface with powerful features for Windows and Linux platforms.

GoogleTest UI is a 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 is an event listener for GoogleTest that implements the TAP protocol for test result output. If your test runner understands TAP, you may find it useful.

gtest-parallel is a test runner that runs tests from your binary in parallel to provide significant speed-up.

GoogleTest Adapter is a VS Code extension allowing to view GoogleTest in a tree view, and run/debug your tests.

C++ TestMate is a VS Code extension allowing to view GoogleTest in a tree view, and run/debug your tests.

Cornichon is a small Gherkin DSL parser that generates stub code for GoogleTest.

Contributing Changes

Please read CONTRIBUTING.md for details on how to contribute to this project.

Happy testing!

Comments
  • Install CMake export files

    Install CMake export files

    CMake export files automate the task of importing GTest libraries into the CMake project that links them (See Exporting from an Installation Tree). Also:

    1. Issue https://github.com/google/googletest/issues/878 mentions two alternative approaches, but the CMake export files are the more idiomatic solution nowadays (see The Ultimate Guide to Modern CMake). Specifically: a. The add_subdirectory approach might interfere with the global settings of the host CMake project. b. The find_package approach does not support Release+Debug installations. The CMake export files address both these limitations.
    2. W.r.t. PR #768, this patch uses 'GTest' instead of 'Gtest' for the CMake namespace of the exported targets. Rationale: to be consistent with the existing 'FindGtest' CMake module (https://cmake.org/cmake/help/v3.10/module/FindGTest.html).
    3. Also, w.r.t. PR #768, this patch does not override the DEBUG_POSTFIX CMake property for the exported targets. Rationale: give to the user the flexibility to choose its own suffix (and if to use one at all).
    GC Attention Set cla: yes 
    opened by stefanosoffia 46
  • Test Pull For Monotonic clock

    Test Pull For Monotonic clock

    This is a tentative cross platform patch for enabling a monotonic clock in gtest for test elapsed time. It uses C++ 11 chrono library if available; otherwise specific OS calls for Windows/Linux/Mac.

    opened by bryanzim 40
  • add timeouts to tests

    add timeouts to tests

    it would be nice to implement timeouts for tests.
    thus a test will fail if it does not complete successfully within the alloted 
    time frame. makes it easier to impose performance restrictions on cerain 
    operations, and also to make sure that if a certain test hangs, other test 
    cases can run instead of aborting everything/
    
    

    Original issue reported on code.google.com by [email protected] on 29 Dec 2010 at 7:15

    Priority-Low auto-migrated Type-Enhancement OpSys-All Usability 
    opened by GoogleCodeExporter 38
  • Allow MOCK_METHOD without specifying the argument count

    Allow MOCK_METHOD without specifying the argument count

    Currently, you must use the correct MOCK_METHODn macro:

    MOCK_METHOD2(foo, void(int, int));
    MOCK_METHOD3(bar, void(int, int, int));
    

    I suggest a variation that works without the number:

    MOCK_METHOD(foo, void, (int, int));
    MOCK_METHOD(bar, void, (int, int, int));
    

    Note that the return type is now separate from the argument types.

    Implementing this isn't complicated. It's basically this:

    #define MOCK_METHOD(name, ret, args) MOCK_METHOD##PP_NARG(args)(name, ret args)
    

    Where PP_NARG is define as in this StackOverflow answer. It will be limited to a maximum number of arguments - but so are existing MOCK_METHODn macros. Perhaps there's a more elegant implementation, instead of reducing it to existing macros.

    I'm willing to do the development (if I think there's a chance that it will be accepted).

    opened by ugoren 31
  • Use override keyword with new C++11 compilers

    Use override keyword with new C++11 compilers

    From @GoogleCodeExporter on August 24, 2015 22:40

    The C++11 standard introduces new "override" and "final" keywords in virtual 
    function declarations. The "override" keyword is especially useful in context 
    of creating mock functions. Macros MOCK_METHOD* expand to virtual methods that 
    have to be present in base class in order to be useful as mocks. And, since we 
    have to define mocks and class interface separately, this creates a possible 
    gap for bugs when changing method prototypes.
    
    For example, changing a type of argument in base class method, without updating 
    the associated MOCK_METHOD* macro, will define the mock method as overloading 
    and compilers will silently allow such buggy code to compile. However, using 
    the new C++11 feature, mismatched function declarations will result in compile 
    error, thus allowing the programmer to clearly state his purpose.
    
    In my projects, I patched GMock macros to optionally include the override 
    keyword - see the attached diff. I think such improvement merits for inclusion 
    in upstream, so I decided to create this issue.
    

    Original issue reported on code.google.com by [email protected] on 15 Dec 2012 at 9:23

    Attachments:

    Copied from original issue: google/googlemock#157

    help wanted good first issue 
    opened by BillyDonahue 31
  • 10.6 SL : pointer being freed was not allocated

    10.6 SL : pointer being freed was not allocated

    What steps will reproduce the problem?
    1. Build and link code on MacOS X 10.6 GM
    2. Run any test code with or without debugger
    
    What is the expected output? What do you see instead?
    
    1. If code is run without a debugger, the following errors appear in the 
    terminal, EVERY time 
    there is text to display:
    
    <proc>(27319) malloc: *** error for object 0x7fff70ca5500: pointer being freed 
    was not 
    allocated
    *** set a breakpoint in malloc_error_break to debug
    
    The tests will still run, as the SIGABRT is being caught by gtest, but the 
    error will persist.
    
    2. If the code is run with a debugger, here is the following output:
    
    <proc>(27319) malloc: *** error for object 0x7fff70ca5500: pointer being freed 
    was not 
    allocated
    *** set a breakpoint in malloc_error_break to debug
    Program received signal:  “SIGABRT”.
    
    What version of the product are you using? On what operating system?
    
    GTest 1.3.0, 10.6 Snow Leopard (10A432)
    
    Please provide any additional information below.
    
    There seems to be some funny interaction with the libstdc++ and gtest 1.3.0. 
    10.5.x (all 
    versions) work perfectly with gtest 1.3.0
    
    
    

    Original issue reported on code.google.com by [email protected] on 31 Aug 2009 at 3:05

    Priority-Low Type-Defect auto-migrated OpSys-OSX 
    opened by GoogleCodeExporter 31
  • googletest on Visual Studio 2012 RC on Windows 8 RC does not compile

    googletest on Visual Studio 2012 RC on Windows 8 RC does not compile

    I would like to request that the team supports Windows 8 RC.  I know that 
    Windows 8 RC is not a release from Microsoft.  However, being able to support 
    developers working on the Windows 8 platform would be really nice.  Currently, 
    trying to even compile gtest on Windows 8 fails.  I detail the problems below.  
    
    What steps will reproduce the problem?
    1.  Loading the solution with Visual Studio 2012 RC on Windows 8 RC Build 8400 
    will cause the solution to be converted to Visual Studio 2012 v110 code 
    generation.
    2.  Upon attempting to build gtest a number of compiler issues occur.  All of 
    the errors occur in gtest-param-util-generated.h related to templates.  Visual 
    Studio 2012 has an issue with the number of template arguments in 
    std::tr1::tuple according to the compiler.
    
    What is the expected output? What do you see instead?
    The expected output is that the build is successful.  Instead, I get the 
    following output:  
    
    Note: Output has been modified slightly to hide some details unrelated to gtest:
    
    1>\ext\gtest-1.5.0\include\gtest\internal\gtest-param-util-generated.h(4015): 
    error C2977: 'std::tuple' : too many template arguments
    1>          c:\program files (x86)\microsoft visual studio 
    11.0\vc\include\utility(73) : see declaration of 'std::tuple'
    1>          
    \ext\gtest-1.5.0\include\gtest\internal\gtest-param-util-generated.h(4247) : 
    see reference to class template instantiation 
    'testing::internal::CartesianProductGenerator9<T1,T2,T3,T4,T5,T6,T7,T8,T9>' 
    being compiled
    1>c:\users\msfrucht\desktop\win8nfc\win8nfc\c3nfc\ext\gtest-1.5.0\include\gtest\
    internal\gtest-param-util-generated.h(4015): error C3203: 'tuple' : 
    unspecialized class template can't be used as a template argument for template 
    parameter 'T', expected a real type
    1>c:\users\msfrucht\desktop\win8nfc\win8nfc\c3nfc\ext\gtest-1.5.0\include\gtest\
    internal\gtest-param-util-generated.h(4015): error C2955: 'std::tuple' : use of 
    class template requires template argument list
    1>          c:\program files (x86)\microsoft visual studio 
    11.0\vc\include\utility(73) : see declaration of 'std::tuple'
    1>\ext\gtest-1.5.0\include\gtest\internal\gtest-param-util-generated.h(4015): 
    error C2955: 'testing::internal::ParamGeneratorInterface' : use of class 
    template requires template argument list
    1>          \ext\gtest-1.5.0\include\gtest\internal\gtest-param-util.h(141) : 
    see declaration of 'testing::internal::ParamGeneratorInterface'
    1>\gtest-1.5.0\include\gtest\internal\gtest-param-util-generated.h(4017): error 
    C2977: 'std::tuple' : too many template arguments
    1>          c:\program files (x86)\microsoft visual studio 
    11.0\vc\include\utility(73) : see declaration of 'std::tuple'
    
    What version of Google Test are you using? On what operating system?
    I am using Google Test 1.5 on Windows 8 RC Build 8400 x64.
    
    

    Original issue reported on code.google.com by [email protected] on 4 Jun 2012 at 11:45

    Type-Defect auto-migrated Priority-Medium 
    opened by GoogleCodeExporter 30
  • need a way to resume from the TEST that crashed

    need a way to resume from the TEST that crashed

    Requested by Timur Iskhodzhanov <[email protected]>:
    
    Consider we have a large number of tests in one executable (e.g.
    Chromium unit_tests or ui_tests)
    
    Use case:
    One's local change has introduced a failure in a test X.Y which is
    executed somewhere in the middle of the test run
    (e.g. the whole binary takes 10 minutes, the failure happens after 5
    minutes of running).
    
    If he/she is sure the tests that are executed before X.Y are not
    affected by the fix - he/she should be able to skip them and run only
    X.Y and the following tests.
    
    This feature will be especially useful for those who develop Valgrind-
    like tools and test them using binaries based on googletest.
    In this case it's quite common that some particular test is failing
    when run under the tool and when it's fixed we should run only those
    tests that follow X.Y
    
    By "failure" I meant a crash or non-googletest assertion.
    So the execution stops when X.Y fails.
    
    Example: Chromium code uses CHECKs inside its code and as soon as they
    fail, it prints out the stack trace and aborts the execution.
    Another example: if there is a bug in Valgrind-like tool, it may crash
    in an internal assertion when running X.Y and stop the test execution.
    

    Original issue reported on code.google.com by [email protected] on 7 Sep 2010 at 7:07

    auto-migrated Type-Enhancement Priority-High OpSys-All Usability 
    opened by GoogleCodeExporter 29
  • Skipping tests at runtime with GTEST_SKIP()

    Skipping tests at runtime with GTEST_SKIP()

    Description

    Nothing fancy, plain and simple test skipping based on condition evaluated at runtime. One might want to skip

    • tests which are not supported within current environment,
    • tests which depend on some external resource with conditional availability,
    • tests which require privileges when run under user with no such privileges, etc.

    Feature has been requested several times, see #160, #490 and #822. Works as demonstrated in sample test:

    TEST(SkipTest, DoesSkip) {
      SKIP();
      EXPECT_EQ(0, 1);
    }
    

    yields

    [==========] Running 1 test from 1 test case.
    [----------] Global test environment set-up.
    [----------] 1 test from SkipTest
    [ RUN      ] SkipTest.DoesSkip
    [  SKIPPED ] SkipTest.DoesSkip (1 ms)
    [----------] 1 test from SkipTest (1 ms total)
    
    [----------] Global test environment tear-down
    [==========] 1 test from 1 test case ran. (1 ms total)
    [  PASSED  ] 0 tests.
    [  SKIPPED ] 1 test, listed below:
    [  SKIPPED ] SkipTest.DoesSkip
    

    Skipped tests are displayed in green, and are not considered neither successful nor failed since they have never been completely run.

    Further work

    There are some conceptual issues which are not yet resolved, but I would love to hear you thoughts on them.

    1. Listing all skipped tests on teardown might be not such a good idea; it is at least reasonable to add compile option to control this behaviour.
    2. If test is skipped at any point, all preceding failures, which occurred in this test, are ignored; this can be handled in test result assigning with checking for failures before setting kSkip result.
    3. Skipping is not available from SetUp() and TearDown() methods, as well as from functions external to test body, since skipping aborts only current function; this can be resolved by adding additional AssertHelpers in fashion similar to handling FAIL().
    4. Additional improvements shall be made in loggers to support this additional test result.
    GC Attention Set cla: yes 
    opened by app13y 28
  • Fix FreeBSD -Werror compilation issues

    Fix FreeBSD -Werror compilation issues

    The attached pull request fixes 2 trivial issues when compiling the googletest tests on FreeBSD with WARNS >= 1, i.e., -Werror on, with clang.

    This issue was seen when trying to integrate googletest 1.8.1 into the FreeBSD base system on my GitHub project branch.

    This PR requires #2100.

    cla: yes Conversation On-Going 
    opened by ngie-eign 27
  • Regular expressions from C++ 11?

    Regular expressions from C++ 11?

    Hi, I did a preliminary check and it doesn't seem that Google Test uses C++'s regex library. Would you be interested in adding it? Or are there reasons why this is not a good idea?

    If it is something worthwhile, I'd like to take a closer look and propose a pull request.

    opened by lbartnik 26
  • EXPECT_THAT with Throws invokes callable twice when exception is not thrown

    EXPECT_THAT with Throws invokes callable twice when exception is not thrown

    Describe the bug

    EXPECT_THAT macro with the Throws expectation invokes the callable twice when it does not throw an exception. This does not happen when the exception is thrown.

    This causes failures for stateful lambdas or lambdas with side effects.

    Steps to reproduce the bug

    Repro code:

    #include <exception>
    #include <iostream>
    #include <gmock/gmock.h>
    
    int main()
    {
        int state = 1;
        EXPECT_THAT(([&] { std::cout << "I am invoked " << state++ << '\n'; }),
            testing::Throws<std::exception>());
    }
    

    Outputs:

    I am invoked 1
    I am invoked 2
    ...
    

    Also see https://godbolt.org/z/WE44hn5Kc.

    Does the bug persist in the most recent commit?

    Yes.

    What operating system and version are you using?

    Does not matter. The issue happens on both Windows and Linux.

    What compiler and version are you using?

    MSVC 17.4.1, clang trunk.

    bug 
    opened by dragon-dreamer 0
  • weird warning with mingw-gcc-12

    weird warning with mingw-gcc-12

    Describe the bug

    [10/183] Building CXX object googlemock/CMakeFiles/gmock-matchers-misc_test.dir/test/gmock-matchers-misc_test.cc.obj
    In file included from D:/a/_temp/msys64/mingw64/include/c++/12.2.0/x86_64-w64-mingw32/bits/c++allocator.h:33,
                     from D:/a/_temp/msys64/mingw64/include/c++/12.2.0/bits/allocator.h:46,
                     from D:/a/_temp/msys64/mingw64/include/c++/12.2.0/deque:61,
                     from D:/a/googletest/googletest/googlemock/test/gmock-matchers_test.h:42,
                     from D:/a/googletest/googletest/googlemock/test/gmock-matchers-misc_test.cc:42:
    In member function 'void std::__new_allocator<_Tp>::deallocate(_Tp*, size_type) [with _Tp = int]',
        inlined from 'static void std::allocator_traits<std::allocator<_Tp1> >::deallocate(allocator_type&, pointer, size_type) [with _Tp = int]' at D:/a/_temp/msys64/mingw64/include/c++/12.2.0/bits/alloc_traits.h:496:23,
        inlined from 'void std::_Vector_base<_Tp, _Alloc>::_M_deallocate(pointer, std::size_t) [with _Tp = int; _Alloc = std::allocator<int>]' at D:/a/_temp/msys64/mingw64/include/c++/12.2.0/bits/stl_vector.h:[38](https://github.com/lygstate/googletest/actions/runs/3543908093/jobs/5950757313#step:4:39)7:19,
        inlined from 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = int; _Alloc = std::allocator<int>]' at D:/a/_temp/msys64/mingw64/include/c++/12.2.0/bits/stl_vector.h:366:15,
        inlined from 'std::vector<_Tp, _Alloc>::~vector() [with _Tp = int; _Alloc = std::allocator<int>]' at D:/a/_temp/msys64/mingw64/include/c++/12.2.0/bits/stl_vector.h:733:7,
        inlined from 'testing::internal::ContainerEqMatcher<std::vector<int> >::~ContainerEqMatcher()' at D:/a/googletest/googletest/googlemock/include/gmock/gmock-matchers.h:2406:7,
        inlined from 'testing::PolymorphicMatcher<testing::internal::ContainerEqMatcher<typename std::remove_const<_Tp>::type> > testing::ContainerEq(const Container&) [with Container = std::vector<int>]' at D:/a/googletest/googletest/googlemock/include/gmock/gmock-matchers.h:4714:43,
        inlined from 'virtual void testing::gmock_matchers_test::{anonymous}::ContainerEqExtraTest_MultipleValuesMissing_Test::TestBody()' at D:/a/googletest/googletest/googlemock/test/gmock-matchers-misc_test.cc:283:45:
    D:/a/_temp/msys64/mingw64/include/c++/12.2.0/bits/new_allocator.h:158:33: warning: 'void operator delete(void*, std::size_t)' called on pointer '<unknown>' with nonzero offset [4, 9223372036854775804] [-Wfree-nonheap-object]
      158 |         _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
          |                                 ^
    In member function '_Tp* std::__new_allocator<_Tp>::allocate(size_type, const void*) [with _Tp = int]',
        inlined from 'static _Tp* std::allocator_traits<std::allocator<_Tp1> >::allocate(allocator_type&, size_type) [with _Tp = int]' at D:/a/_temp/msys64/mingw64/include/c++/12.2.0/bits/alloc_traits.h:464:28,
        inlined from 'std::_Vector_base<_Tp, _Alloc>::pointer std::_Vector_base<_Tp, _Alloc>::_M_allocate(std::size_t) [with _Tp = int; _Alloc = std::allocator<int>]' at D:/a/_temp/msys64/mingw64/include/c++/12.2.0/bits/stl_vector.h:378:33,
        inlined from 'void std::_Vector_base<_Tp, _Alloc>::_M_create_storage(std::size_t) [with _Tp = int; _Alloc = std::allocator<int>]' at D:/a/_temp/msys64/mingw64/include/c++/12.2.0/bits/stl_vector.h:[39](https://github.com/lygstate/googletest/actions/runs/3543908093/jobs/5950757313#step:4:40)5:44,
        inlined from 'std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::size_t, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>]' at D:/a/_temp/msys64/mingw64/include/c++/12.2.0/bits/stl_vector.h:332:26,
        inlined from 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' at D:/a/_temp/msys64/mingw64/include/c++/12.2.0/bits/stl_vector.h:598:61,
        inlined from 'static testing::internal::StlContainerView<RawContainer>::type testing::internal::StlContainerView<RawContainer>::Copy(const RawContainer&) [with RawContainer = std::vector<int>]' at D:/a/googletest/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h:337:60,
        inlined from 'testing::internal::ContainerEqMatcher<Container>::ContainerEqMatcher(const Container&) [with Container = std::vector<int>]' at D:/a/googletest/googletest/googlemock/include/gmock/gmock-matchers.h:2[42](https://github.com/lygstate/googletest/actions/runs/3543908093/jobs/5950757313#step:4:43)0:9,
        inlined from 'testing::PolymorphicMatcher<testing::internal::ContainerEqMatcher<typename std::remove_const<_Tp>::type> > testing::ContainerEq(const Container&) [with Container = std::vector<int>]' at D:/a/googletest/googletest/googlemock/include/gmock/gmock-matchers.h:4714:[43](https://github.com/lygstate/googletest/actions/runs/3543908093/jobs/5950757313#step:4:44),
        inlined from 'virtual void testing::gmock_matchers_test::{anonymous}::ContainerEqExtraTest_MultipleValuesMissing_Test::TestBody()' at D:/a/googletest/googletest/googlemock/test/gmock-matchers-misc_test.cc:283:[45](https://github.com/lygstate/googletest/actions/runs/3543908093/jobs/5950757313#step:4:46):
    D:/a/_temp/msys64/mingw64/include/c++/12.2.0/bits/new_allocator.h:137:[55](https://github.com/lygstate/googletest/actions/runs/3543908093/jobs/5950757313#step:4:56): note: returned from 'void* operator new(std::size_t)'
      137 |         return static_cast<_Tp*>(_GLIBCXX_OPERATOR_NEW(__n * sizeof(_Tp)));
          |                                                       ^
    [11/183] Building CXX object googlemock/CMakeFiles/gmock-more-actions_test.dir/test/gmock-more-actions_test.cc.obj
    [12/183] Building CXX object googlemock/CMakeFiles/gmock-nice-strict_test.dir/test/gmock-nice-strict_test.cc.obj
    

    Steps to reproduce the bug

    https://github.com/lygstate/googletest/actions/runs/3543908093/jobs/5950757313

    bug 
    opened by lygstate 0
  • CMake Error (dev): uninitialized variable 'cxx_strict_flags'.

    CMake Error (dev): uninitialized variable 'cxx_strict_flags'.

    Describe the bug

    I get an error message when building a project

    Does the bug persist in the most recent commit? Yes

    I use preset:

    "configurePresets": [
        {
          "name": "cmake-pedantic",
          "hidden": true,
          "warnings": {
            "dev": true,
            "deprecated": true,
            "uninitialized": true,
            "unusedCli": true,
            "systemVars": false
          },
          "errors": {
            "dev": true,
            "deprecated": true
          }
        },
    
    $ cmake --preset=dev
    Preset CMake variables:
    
      BUILD_MCSS_DOCS="ON"
      CMAKE_CXX_EXTENSIONS="OFF"
      CMAKE_CXX_FLAGS="/utf-8 /w14165 /w44242 /w44254 /w44263 /w34265 /w34287 /w44296 /w44365 /w44388 /w44464 /w14545 /w14546 /w14547 /w14549 /w14555 /w34619 /w34640 /w24826 /w14905 /w14906 /w14928 /w4503
    8 /W4 /permissive- /volatile:iso /Zc:preprocessor /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew /EHsc"
      CMAKE_CXX_STANDARD="17"
      CMAKE_CXX_STANDARD_REQUIRED="ON"
      super_lib_DEVELOPER_MODE="ON"
    
    -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
    CMake Error (dev) at build/dev/_deps/googletest-src/googletest/cmake/internal_utils.cmake:144 (set):
      uninitialized variable 'cxx_strict_flags'
    Call Stack (most recent call first):
      build/dev/_deps/googletest-src/googletest/CMakeLists.txt:93 (config_compiler_and_linker)
    This error is for project developers. Use -Wno-error=dev to suppress it.
    
    CMake Error (dev) at build/dev/_deps/googletest-src/googletest/cmake/internal_utils.cmake:144 (set):
      uninitialized variable 'cxx_strict_flags'
    Call Stack (most recent call first):
      build/dev/_deps/googletest-src/googlemock/CMakeLists.txt:70 (config_compiler_and_linker)
    This error is for project developers. Use -Wno-error=dev to suppress it.
    
    -- Configuring incomplete, errors occurred!
    See also "C:/_Study/a/super_lib/build/dev/CMakeFiles/CMakeOutput.log".
    See also "C:/_Study/a/super_lib/build/dev/CMakeFiles/CMakeError.log".
    
    bug 
    opened by shrek1402 1
  • googletest does not respect CMake's CMP0091 policy.

    googletest does not respect CMake's CMP0091 policy.

    Describe the bug

    googletest relies on CMake setting the /MD compiler flag as a default https://github.com/google/googletest/blob/9c332145b71c36a5bad9688312c79184f98601ff/googletest/cmake/internal_utils.cmake#L40 However, if CMP0091 is set to NEW this doesn't happen anymore. Because of this, googletest will always use the dynamic version of the CRT and as such, errors like this:

    gtest.lib(gtest-all.cc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MTd_StaticDebug' in main.cpp.obj
    

    when linking against something that uses the static version of the CRT. This behavior happens regardless of whether gtest_force_shared_crt is set to OFF or ON (or set at all), because the string(REPLACE ...) function used doesn't replace anything because the expected /MD flag is not present in any of the flags inspected by the fix_default_compiler_settings_ macro.

    My personal temporary fix was doing

    set_property(TARGET gtest PROPERTY MSVC_RUNTIME_LIBRARY "<proper msvc runtime library here>")
    set_property(TARGET gtest_main PROPERTY MSVC_RUNTIME_LIBRARY "<proper msvc runtime library here>")
    

    after the FetchContent_MakeAvailable(googletest) call. This makes it so the targets now respect the setting given by CMP0091. This also completely overrides the need to set gtest_force_shared_crt.

    Steps to reproduce the bug

    Clone https://github.com/Atari2/SpriteToolSuperDelux Switch to gtest-fail-link branch Run

    mkdir build
    cd build
    cmake -S .. -DMSVC_STATIC_STL=ON
    cmake --build . --config Debug --target PixiUnitTest
    

    and observe the linking bug between harness.cpp.obj and gtest-all.obj.

    Does the bug persist in the most recent commit?

    Yes

    What operating system and version are you using?

    Windows 10, 22H2 build 19045.2251

    What compiler and version are you using?

    Microsoft (R) C/C++ Optimizing Compiler Version 19.34.31933 for x64

    What build system are you using? cmake version 3.24.2

    bug 
    opened by Atari2 0
Releases(release-1.12.1)
  • release-1.12.1(Jun 30, 2022)

    Release Notes

    GoogleTest will not accept patches of new features to the v1.12.x branch.
    We recommend building GoogleTest from the latest commit instead.
    Exceptional critical bug fixes may be considered.

    C++ Language Support

    • This will be the last release to support C++11. Future releases will require at least C++14.

    Mocking

    • Support for move-only values to Return (https://github.com/google/googletest/commit/5126f7166109666a9c0534021fb1a3038659494c)

    Matchers

    • New matchers
      • WhenBase64Unescaped (https://github.com/google/googletest/commit/652ec31f9f53ab34af1257e5e2783d77e872ed45)
    • ResultOf() now has a 3-arg overload that takes a description string for better error messages (https://github.com/google/googletest/commit/0e402173c97aea7a00749e825b194bfede4f2e45)

    Build & Test

    • CMake minimum increased to 3.5
    • Bazel users that build GoogleTest using the Abseil library as a dependency now also require a dependency on RE2 (https://github.com/google/googletest/commit/e33c2b24ca3e13df961ed369f7ed21e4cfcf9eec)
    • Bazel users that build GoogleTest using the Abseil library now use the Abseil library to parse all command-line flags (https://github.com/google/googletest/commit/25dcdc7e8bfac8967f20fb2c0a628f5cf442188d)

    Patches

    58d77fa8070e8cec2dc1ed015d66b454c8d78850 - Fixes the version number in CMakeLists.txt (#3911)

    Source code(tar.gz)
    Source code(zip)
  • release-1.12.0(Jun 23, 2022)

    Release Notes

    GoogleTest will not accept patches of new features to v1.12.0.
    We recommend building GoogleTest from the latest commit instead.
    Exceptional critical bug fixes may be considered.

    C++ Language Support

    • This will be the last release to support C++11. Future releases will require at least C++14.

    Mocking

    • Support for move-only values to Return (https://github.com/google/googletest/commit/5126f7166109666a9c0534021fb1a3038659494c)

    Matchers

    • New matchers
      • WhenBase64Unescaped (https://github.com/google/googletest/commit/652ec31f9f53ab34af1257e5e2783d77e872ed45)
    • ResultOf() now has a 3-arg overload that takes a description string for better error messages (https://github.com/google/googletest/commit/0e402173c97aea7a00749e825b194bfede4f2e45)

    Build & Test

    • CMake minimum increased to 3.5
    • Bazel users that build GoogleTest using the Abseil library as a dependency now also require a dependency on RE2 (https://github.com/google/googletest/commit/e33c2b24ca3e13df961ed369f7ed21e4cfcf9eec)
    • Bazel users that build GoogleTest using the Abseil library now use the Abseil library to parse all command-line flags (https://github.com/google/googletest/commit/25dcdc7e8bfac8967f20fb2c0a628f5cf442188d)
    Source code(tar.gz)
    Source code(zip)
  • release-1.11.0(Jun 12, 2021)

    Release Notes

    GoogleTest will not accept patches of new features to v1.11.0.
    We recommend building GoogleTest from the latest commit instead.
    Exceptional critical bug fixes may be considered.

    Documentation

    • Contents significantly updated
    • Files moved into docs (https://github.com/google/googletest/commit/489283524e3726b7adb9692763c2fb61b235d41a)
    • Now using GitHub pages (https://github.com/google/googletest/commit/1a5a78b9a9c6c285a7897a411cb96bb2ab36d277, https://github.com/google/googletest/commit/d9c309fdab807b716c2cf4d4a42989b8c34f712a, https://github.com/google/googletest/commit/c3fc92f0b7ad49ce59d804dc644dcb5ecbc0c29c)
    • Added Bazel quickstart (https://github.com/google/googletest/commit/32ad3c8c36382165274385a28a23addbea581f5d)
    • Added CMake quickstart (https://github.com/google/googletest/commit/d4e3b8cedf4f57922efa586cb3c796c8fee2d3f3)

    Mocking

    • MOCK_METHOD now handles noexcept correctly (https://github.com/google/googletest/pull/2498)
    • MOCK_METHOD now supports ref-qualifiers (https://github.com/google/googletest/commit/d89b36302116233b8c6377e6e891083f41ee51c5)
    • MOCK_METHOD now supports returning function pointers (https://github.com/google/googletest/commit/1f9edcd9698162b48d94e1ef2e6a2ab7ab4e6c56)
    • DoAll now accepts move-only arguments (https://github.com/google/googletest/commit/48ec64092a38621210ecd835fde61d76861269c1)
    • MockFunction can now be used for mocking std::function (https://github.com/google/googletest/pull/2350)
    • MockFunction is now templated for use with other function classes, besides std::function (https://github.com/google/googletest/commit/662fe38e44900c007eccb65a5d2ea19df7bd520e)
    • ACTION macros now support more than 10 arguments (https://github.com/google/googletest/commit/63713e1ce49019da205daa1ca91b73fcfc9b333f)

    Matchers

    • New matchers
      • IsNan (https://github.com/google/googletest/commit/bbe4b7363bbaa7c9e07dbacde11602a4c69504d3)
      • FieldsAre (https://github.com/google/googletest/commit/a4621888650aaae118de93f9faf8ef5a18cab303)
      • Pointer (https://github.com/google/googletest/commit/a02a591605dfef9addde49634bf010dbe8f95c50)
      • Address (https://github.com/google/googletest/commit/e5644f5f12ff3d5b2232dabc1c5ea272a52e8155)
      • Throws and ThrowsMessage (https://github.com/google/googletest/pull/2904)
    • New actions
      • ReturnRoundRobin (https://github.com/google/googletest/commit/37f322783175a66c11785d17fc153477b0777753)
    • Added Matcher<std::string_view> specialization that internally stores a string instead of string_view (https://github.com/google/googletest/commit/6f5fd0d7199b9a19faa9f499ecc266e6ae0329e7)
    • String matchers now accept string_view input (https://github.com/google/googletest/commit/13a433a94dd9c7e55907d7a9b75f44ff82f309eb)
    • DoubleNearPredFormat matcher now fails on impractically small epsilons (https://github.com/google/googletest/commit/b5687db554a295e697f5d459cf6d3f343d2ca179)
    • Truly matcher now explains failures (https://github.com/google/googletest/commit/0c400f67fcf305869c5fb113dd296eca266c9725)
    • Matchers can now be implemented without extending MatcherInterface (https://github.com/google/googletest/commit/c13c27a513ecd1cbf5700a45fe590e85e8ae6770)
    • Added output messages for skipped tests (https://github.com/google/googletest/pull/2517, https://github.com/google/googletest/pull/2767)

    Behavior

    • New flags
      • --gtest_brief shows only test failures in output (https://github.com/google/googletest/pull/2751)
      • --gtest_fail_fast stops test execution on first failure (https://github.com/google/googletest/commit/1ced315a483f4ecac21893ce6ceeb502afb82eff)
    • Failures in SetUpTestSuite and TearDownTestSuite now cause tests to fail rather than log (https://github.com/google/googletest/commit/9ed99c6c837ae1cbfcabd36959fc802ebb5ae07f)
    • Uninstantiated TEST_P and TYPED_TEST_P now fail unless allowlisted using GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST (https://github.com/google/googletest/commit/d442089d53cecbba59b2d8f35d06eac01f1e46da, https://github.com/google/googletest/commit/a13a0626188b4e7d22d63a4c9fcfe9f441c81e4a, https://github.com/google/googletest/commit/0b024bd91a14a77a7e7d6072ccd88e09c86ddeaa, https://github.com/google/googletest/commit/3e79d366e380ec85b7de9409211b184bc8529655, https://github.com/google/googletest/commit/ec94d9f24c92a5090fda5567156d6dde99cdbf31)

    Output

    • Added specialized printing for std::any, std::optional, and std::variant (https://github.com/google/googletest/pull/2742)
    • Added recursive printing for std::unique_ptr and std::shared_ptr (https://github.com/google/googletest/commit/6b2e74905e9a7e70c7d1017ee0dfe5a8e88a1300)
    • Printing incomplete types is now supported (https://github.com/google/googletest/commit/f8304d762e0ed119d3d1c72deb1976dc80029db5)
    • Start timestamps in XML/JSON output now use millisecond precision (https://github.com/google/googletest/commit/af1e75ce0b3429d70790c049d8dbb0aae3e2480f)
    • Added more structured information about test suite to XML/JSON output on environment failures (https://github.com/google/googletest/commit/ac1d60c2b5ae62a06eca1d2c0f9d6dc92cda8711)

    Build & Test

    • CMake minimum increased to 2.8.12 (https://github.com/google/googletest/pull/3094)
    • GoogleTest is now using Kokoro CI instead of Travis and AppVeyor

    Misc

    • Removed support for GTEST_HAS_STD_STRING (https://github.com/google/googletest/pull/2456)
    • Replaced pump code generation with variadic templates (https://github.com/google/googletest/pull/2388, https://github.com/google/googletest/commit/d8eeb9760afcab45dbdd887c2b6d106887c1739d, https://github.com/google/googletest/commit/4b9c1691c4b7f01fbd9d37d86c88cdad298d48e9, https://github.com/google/googletest/commit/fbf67a70d07543f40832d0cd7a58f304bc6ab1d1, https://github.com/google/googletest/commit/41b5f149ab306e96b5b2faf523505d75acffd98a, https://github.com/google/googletest/commit/710f9c11ca79e578bb38d98d10ab9b70d41d5e07, https://github.com/google/googletest/commit/997c36c1881105bd7ce482a1ec93759badf64ce6, https://github.com/google/googletest/commit/59dea67b815a046122d77113d5c6df1df66076bb)
    Source code(tar.gz)
    Source code(zip)
  • release-1.10.0(Oct 3, 2019)

    Release 1.10.0 1.10.0 Release reflects a current version of the project. The 1.10.x will not consider any requests for any new features, The bug fix requests will only be considered if proven "critical"

    High Level Changes: This release deprecated "....TEST_CASE" API in favor of "....TEST_SUITE". In a nutshell if you have code that uses something like "INSTANTIATE_TYPED_TEST_CASE_P " - this and all other "*_TEST_CASE " are now deprecated in favor of more standard _TEST_SUITE. See https://github.com/google/googletest/blob/master/googletest/docs/primer.md#beware-of-the-nomenclature.

    There is also new powerful MOCK_METHOD macro. See https://github.com/google/googletest/blob/72adf7a4155b6642da1e6761678fe546590c0269/googlemock/docs/cook_book.md#creating-mock-classes. This replaces older way of mocking. For example (Old) MOCK_METHOD1(Bar, double(std::string s)); (New) MOCK_METHOD(double, Bar, (std::string s), (override)); So there is no need to count the parameters anymore.

    Source code(tar.gz)
    Source code(zip)
  • release-1.8.1(Aug 31, 2018)

    1.8.1 Release reflects a current version of the project. The 1.8.x is the last release supporting pre-C++11 compilers. The 1.8.x will not accept any requests for any new features and any bugfix requests will only be accepted if proven "critical"

    Source code(tar.gz)
    Source code(zip)
Owner
Google
Google ❤️ Open Source
Google
🧪 single header unit testing framework for C and C++

?? utest.h A simple one header solution to unit testing for C/C++. Usage Just #include "utest.h" in your code! The current supported platforms are Lin

Neil Henning 544 Dec 1, 2022
A unit testing framework for C

Check Table of Contents About Installing Linking Packaging About Check is a unit testing framework for C. It features a simple interface for defining

null 923 Nov 27, 2022
The fastest feature-rich C++11/14/17/20 single-header testing framework

master branch Windows All dev branch Windows All doctest is a new C++ testing framework but is by far the fastest both in compile times (by orders of

Viktor Kirilov 4.4k Nov 23, 2022
A testing micro framework for creating function test doubles

Fake Function Framework (fff) A Fake Function Framework for C Hello Fake World! Capturing Arguments Return Values Resetting a Fake Call History Defaul

Mike Long 540 Dec 1, 2022
Minimal unit testing framework for C

MinUnit Minunit is a minimal unit testing framework for C/C++ self-contained in a single header file. It provides a way to define and configure test s

David Siñuela Pastor 451 Nov 18, 2022
A lightweight unit testing framework for C++

Maintenance of UnitTest++, recently sporadic, is officially on hiatus until 26 November 2020. Subscribe to https://github.com/unittest-cpp/unittest-cp

UnitTest++ 509 Nov 24, 2022
UT: C++20 μ(micro)/Unit Testing Framework

"If you liked it then you "should have put a"_test on it", Beyonce rule [Boost::ext].UT / μt | Motivation | Quick Start | Overview | Tutorial | Exampl

boost::ext 929 Nov 26, 2022
Simple Unit Testing for C

Unity Test Copyright (c) 2007 - 2021 Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams Welcome to the Unity Test Project, one of the

Throw The Switch 2.8k Nov 24, 2022
A modern, C++-native, header-only, test framework for unit-tests, TDD and BDD - using C++11, C++14, C++17 and later (or C++03 on the Catch1.x branch)

Catch2 v3 is being developed! You are on the devel branch, where the next major version, v3, of Catch2 is being developed. As it is a significant rewo

Catch Org 15.9k Nov 25, 2022
A modern, C++-native, header-only, test framework for unit-tests, TDD and BDD - using C++11, C++14, C++17 and later (or C++03 on the Catch1.x branch)

Catch2 v3 is being developed! You are on the devel branch, where the next major version, v3, of Catch2 is being developed. As it is a significant rewo

Catch Org 15.9k Nov 24, 2022
C++ Benchmark Authoring Library/Framework

Celero C++ Benchmarking Library Copyright 2017-2019 John Farrier Apache 2.0 License Community Support A Special Thanks to the following corporations f

John Farrier 723 Nov 24, 2022
A C++ micro-benchmarking framework

Nonius What is nonius? Nonius is an open-source framework for benchmarking small snippets of C++ code. It is very heavily inspired by Criterion, a sim

Nonius 338 Nov 28, 2022
test framework

Photesthesis This is a small, experimental parameterized-testing tool. It is intended to be used in concert with another unit-testing framework (eg. C

Graydon Hoare 11 Jun 2, 2021
A simple framework for compile-time benchmarks

Metabench A simple framework for compile-time microbenchmarks Overview Metabench is a single, self-contained CMake module making it easy to create com

Louis Dionne 162 Oct 23, 2022
DotX64Dbg aims to provide a seamless way to write and test plugins for X64Dbg using .Net 5.0 and C#.

DotX64Dbg (EARLY ALPHA) Plugins and Scripting with C# for x64Dbg. Create Plugins for X64Dbg with ease DotX64Dbg aims to provide a seamless way to writ

ζeh Matt 7 Oct 16, 2022
The world's first free and open-source PlayStation 3 emulator/debugger, written in C++ for Windows and Linux.

The world's first free and open-source PlayStation 3 emulator/debugger, written in C++ for Windows and Linux.

null 11.9k Dec 1, 2022
A simple C++ 03/11/etc timer class for ~microsecond-precision cross-platform benchmarking. The implementation is as limited and as simple as possible to create the lowest amount of overhead.

plf_nanotimer A simple C++ 03/11/etc timer class for ~microsecond-precision cross-platform benchmarking. The implementation is as limited and simple a

Matt Bentley 100 Nov 16, 2022
Anti-Debug and Anti-Memory Dump for Android

AntiDebugandMemoryDump Anti-Debug and Anti-Memory Dump for Android Some known techniques for anti-debug and anti-memory dump have been used in this pr

Darvin 183 Nov 21, 2022
An efficient OpenFST-based tool for calculating WER and aligning two transcript sequences.

fstalign Overview Installation Dependencies Build Docker Quickstart WER Subcommand Align Subcommand Inputs Outputs Overview fstalign is a tool for cre

Rev 106 Nov 17, 2022