googletest Questions
2
Solved
I have researched a lot about gtest/gmock but none of them gave me the right answer. I'm new to C++ so any help would be really appreciated.
Ofris asked 29/10, 2019 at 2:29
12
Solved
I have recently been sold on using CMake for compiling my C++ projects, and would now like to start writing some unit tests for my code. I have decided to use the Google Test utility to help with t...
Directoire asked 14/12, 2011 at 16:11
7
I want to specify an expectation that a value is between an upper and lower bound, inclusively.
Google Test provides LT,LE,GT,GE, but no way of testing a range that I can see. You could use EXPECT...
Torbernite asked 23/2, 2014 at 18:10
2
Solved
Googletest (gtest) seems to be an immensely popular unit test framework and I'd like to learn how to build it stand-alone on the g++ compiler, simply and easily, so I can test small libraries and o...
Jezreel asked 4/5, 2022 at 5:30
14
Solved
Debian does not provide any precompiled packages for gTest anymore. They suggest you integrate the framework into your project's makefile. But I want to keep my makefile clean. How do I set up gTes...
Housemother asked 22/11, 2012 at 13:38
2
Is it possible to verify the message thrown by an exception? Currently one can do:
ASSERT_THROW(statement, exception_type)
which is all fine and good but no where can I find a way to test e.what...
Perpetual asked 12/9, 2013 at 21:20
4
Solved
Is there in GoogleTest something like:
ASSERT_EQ_ONE_OF_TWO(TestValue, Value1, Value2)
which tests if TestValue == Value1 || TestValue == Value2?
This variant:
ASSERT_TRUE(TestValue == Value1 ...
Nitrous asked 5/8, 2015 at 6:13
3
Solved
I'm in need to test C++ code - and I've decided to use Google's testing framework.
I need to make sure that a test doesn't hang due to a new bug.
In the .NET testing framework it's possible to add ...
Outrelief asked 5/6, 2013 at 14:8
7
Solved
My need is simple. I have to compile and use googletest on windows using MinGW with msys. Has anyone some experience doing this?
Thanks for answers.
Kimbell asked 9/3, 2011 at 15:45
7
I am new to gmock, so I want to know how can I stub simple C function called in a function under test for Unit Testing.
Example:
int func(int a)
{
boolean find;
// Some code
find = func_1();
...
Elroy asked 13/8, 2015 at 13:2
4
Solved
I'm currently trying to use googletest with MinGW and -std=c++0x but it complains that _stricmp is not declared in this scope which it doesn't when I do not use -std=c++0x.
I have no idea what _str...
Babb asked 10/6, 2011 at 21:16
4
Solved
Introduction
I am writing tests on Eigen matrices using Google's testing framework Google-Mock, as already discussed in another question.
With the following code I was able to add a custom Matche...
Clotilda asked 5/8, 2014 at 19:41
5
Solved
What would be the proper way to access an external test file for the unit test of a c++ project? I am using CMake and Gtest.
This is a sample of the directory structure.
Project
-src
-test (uni...
Fruition asked 8/8, 2014 at 19:42
2
Solved
I use cmake to build my project and conan to install Google Test as dependency:
conanfile.txt
[requires]
gtest/1.7.0@lasote/stable
[generators]
cmake
[imports]
bin, *.dll -> ./build/bin
lib,...
Roehm asked 31/12, 2016 at 12:16
4
Solved
I've configured visual studio for google test. Then I've written some simple google test cases in vs2010, as You can see below:
TEST(simpleTest, test1){
float base = 4.f;
float exponent = 1.f;
...
Rectrix asked 5/11, 2013 at 21:0
6
Solved
With Google test I want to specify a Test fixture for use in different test cases.
The fixture shall allocate and deallocate objects of the class TheClass and its data management class TheClassData...
Clementeclementi asked 5/7, 2016 at 15:31
1
Our team uses Google Test for automated testing. Most of our tests pass consistently, but a few seem to fail ~5% of the time due to race conditions, network time-outs, etc.
We would like the abilit...
Marcum asked 16/11, 2022 at 18:1
3
Solved
I want the c++ unit test written in google test displayed in the VS 2019 test explorer.
The tests are setup correctly and can be executed. The results are shown in the VS debug console/commandline-...
Binoculars asked 28/9, 2020 at 9:8
2
Solved
I have a template class of type
<size_t N>
class Line {
...
};
How could I could I create a test for several instances of this class? e.g. Line<1>, Line<2>, ...
I have checked the ...
Obstipation asked 7/2, 2018 at 16:57
5
Solved
Have some code:
EXPECT_NE(nullptr,ptr);
And I get the following compilation error:
'operator <<' is ambiguous
could be 'std::basic_ostream<char,std::char_traits<char>> &s...
Chanticleer asked 13/2, 2019 at 16:27
2
Solved
I am trying to test my C library with google test but I'm having trouble mocking functions with the fff.h framework. This is my file structure:
.
├── Makefile.am
├── configure.ac
├── include
│ ├...
Germanism asked 11/12, 2019 at 14:26
1
I'm trying to validate a GoogleTest (gtest) XML output file, and for that I need the schema/XSD for the gtest format.
I've searched online, and could not find anything. A lot seems to point at the...
Pattani asked 12/5, 2015 at 13:39
2
How do I setup GoogleTest for my native C++ code on Android with CMake? The Android NDK comes bundled with googletest but instructions are available only for Android.mk (here). How do I port the An...
Quizzical asked 19/4, 2017 at 18:12
3
How can I use googletest to test a function that relies on user input via std::cin?
For the example below, I'm looking for whatever code would allow me to add "2\n" to the std::cin stream so that ...
Figurate asked 5/12, 2017 at 23:20
1
I'm new to Google test and I'm trying to write a unit test for a function that returns void and takes no arguments but the function has an if condition which checks on structure values, and I need ...
Nonprofit asked 2/9, 2022 at 10:29
© 2022 - 2024 — McMap. All rights reserved.