Skip to main content
-1 votes
0 answers
71 views

We have a virtual destructor declared in our class: class HeightCalculator { public: HeightCalculator() = default; virtual ~HeightCalculator() = default; LCOV then complains that we don’t cover ...
Oskar Paulsson's user avatar
Best practices
0 votes
3 replies
105 views

Philosophically, does GoogleTest's ASSERT_EQ(x, y) mean "check that x is equal to y" or "evaluate x == y and check that the result is truthy"? In the former case, then struct S s1, ...
Ben Voigt's user avatar
  • 286k
Best practices
0 votes
5 replies
77 views

I am working on a C++ code base that has a function called "getConfigFilePath()" in name space "utils" which returns the file path to a config file. The config file is really hard-...
feeling_lonely's user avatar
0 votes
0 answers
62 views

In my gtest, every individual case may potentially modify a global variable, so it would be ideal to check its value against a system library call after every test case. But when I attach a testing::...
Byron Hawkins's user avatar
6 votes
1 answer
171 views

The file gtest.h from Google Test includes these lines. // This block of code defines operator==/!= // to block lexical scope lookup. // It prevents using invalid operator==/!= defined at namespace ...
93Iq2Gg2cZtLMO's user avatar
1 vote
1 answer
81 views

Both methods are offered, but what is the difference?
BeeOnRope's user avatar
  • 66.3k
1 vote
1 answer
82 views

Since I learnt to use Google Test/Mock framework, I allways used the form to setup an expectation as following: EXPECT_CALL( mock_obj, mock_method ).WillOnce( Invoke( []() { do_things; } ) ); Few ...
Leon's user avatar
  • 2,165
0 votes
0 answers
39 views

My colleague can build our project, while I get the following linker errors: 26>gtest.lib(gtest-all.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match ...
Pietro's user avatar
  • 13.5k
0 votes
1 answer
69 views

I am using the WillByDefault(testing::Throw(...)) trick to terminate the test early, as described in https://stackoverflow.com/a/79534623/2894535 However, it seems to randomly trigger in some cases, ...
Dominik Kaszewski's user avatar
0 votes
1 answer
130 views

I'm dealing with code that should be unit-tested with gtest and I can't quite understand the following Right now I have two class constructors: // Base constructor ClassName::ClassName(ConfigLib ...
4lll0w_3v1l's user avatar
1 vote
0 answers
256 views

I get an errors when trying to work with INSTANTIATE_TEST_SUITE_P. The minimum non-working example that I got is: #include "pch.h" class SimpleTest : public ::testing::TestWithParam<int&...
Xaoc's user avatar
  • 11
5 votes
1 answer
89 views

I want to test a function where one of its mocks should return alternating values many times. So e.g. I need something like this: EXPECT_CALL(my_mock, foo(_)) .WillOnce(Return(A)) .WillOnce(...
slingeraap's user avatar
2 votes
1 answer
106 views

I have the following logic in one of my tests: EXPECT_TRUE(a == x || b == y); Is there a neat way to rewrite it to EXPECT_EQ so that I can see the values a, b, x, y in the failing test's output? If ...
Dominik Kaszewski's user avatar
5 votes
1 answer
444 views

Is there an equivalent to ASSERT_* for EXPECT_CALL, which ends the test on first uninteresting/unmatched call? I am using gtest+gmock to test HW register programming sequences, so all EXPECT_CALL are ...
Dominik Kaszewski's user avatar
0 votes
1 answer
83 views

I use async logging and, in cases where I cannot debug with debugger attached, I'm forced to update my code to flush logs on each statement. Something like LOG("something"); LOG_FLUSH(); ...
Pavel P's user avatar
  • 17.3k

15 30 50 per page
1
2 3 4 5
193