All Questions
146
questions
1
vote
3
answers
440
views
How do you create a templated custom matcher with gmock
I wanted to use WhenDynamicCastTo<T>(m) from: https://google.github.io/googletest/reference/matchers.html#pointer-matchers
But the thing I want to dynamic cast is in a shared_ptr and ...
1
vote
0
answers
40
views
Problems keeping CxxTest GUI open
I am trying to run some test cases using CxxTests directly in the terminal and with the GUI enabled. According to documentation,
The default behavior of the GUI is to close the window after the last ...
0
votes
0
answers
45
views
How do unit tests go into the full program?
Sorry if this is a dumb question, I'm not sure how to phrase it, which is probably why I can't find an answer.
When someone uses unit tests, how does that go into the full program?
Say a unit test is ...
0
votes
1
answer
22
views
Valid use of Google Mock? Testing member functions of same class
If I am in a situation where I need to test a public function that might call another member function, is it still a valid test if I mock one function and test the original functionality of the other? ...
0
votes
1
answer
66
views
Benchmarking with QtCreator, how to set iterations?
I'm following https://doc.qt.io/qt-5/qtest-overview.html and I created a benchmark test which I can run within QtCreator.
CONFIG+=sdk_no_version_check
QMAKE_MACOSX_DEPLOYMENT_TARGET = 12.0
QT += ...
0
votes
0
answers
61
views
How to generate Input-Data with Fuzzying for Coverage of disassembled 16bit/DOS game functions?
so im doing reverse engineering of old 16bit real mode, segment/offset dos games (much harder then porting 32bit protected mode programs)
im always using IDA 7.x, Ghidra and some other tools to help ...
4
votes
1
answer
2k
views
How to instruct Google Test to expect std::abort()?
I am using Google Test on code I expect to fail. As part of this failure the code calls a custom assert macro, which contains std::abort().
Unfortunately Google Test's EXPECT_EXIT() is not "...
1
vote
1
answer
849
views
Mock base class function called in derived class; to unit test derived class method. Base class instantiated in derived class constructor
I m new to unit testing and need some help with this. I would like to test my Derived class function which has dependency on base class method.
class Base {
Base(int a_, int b_){
a = a_;
b ...
0
votes
1
answer
1k
views
googletest SetUpTestSuite() does not run
From : https://google.github.io/googletest/advanced.html#sharing-resources-between-tests-in-the-same-test-suite . I am using 1.11 googletest version.
I am trying to utilize this feature in the ...
2
votes
1
answer
2k
views
Variables in Google Test Fixtures
Why TEST_F can access the member variable in a class without using any scopes? e.g.,
class ABC : public ::testing::Test
{
protected:
int a;
int b;
void SetUp()
{
a = ...
0
votes
0
answers
169
views
How to test a singleton generic template to be thread safe?
How do I make Singleton generic template,
and how can I test it?
Right now I am interested in seeing with my own eyes that 2 threads that invoke get_instance() will get the same pointer to the same ...
5
votes
1
answer
978
views
How to properly setup Catch2 tests in a Makefile?
I'm trying to setup tests with Catch2 and setup a testing rule in a Makefile, it's a pre-requisite, I can't use CMake. I'm not sure how to go about that.
For example, I have something along those ...
1
vote
0
answers
72
views
Using Visual Studio's Unit Testing Framework
I am using Visual Studio's Unit Testing Framework (that uses cpp) to test some cases regarding my program.
I am getting error E0304 and get the red squiggly line under Assert:: (see screenshot at the ...
4
votes
1
answer
774
views
How to group CTests together?
I would like to make groups of CTests to improve readability with a structure like this:
How can I do this? My current CMakeLists.txt:
cmake_minimum_required(VERSION 3.20)
project(Test)
set(...
0
votes
1
answer
1k
views
How do you read gcno and gdna files to see test coverage?
I am using gcovr to try to see how much my tests cover the codebase. In fact I have a single super small test so I am expecting gcovr to return a very small number, probably less than a percent.
I ...