C++: google test Inconclusive test not run
#include <gtest/gtest.h>
double add(double x, double y)
{
return x + y;
}
TEST(AddTest, PositiveNos)
{
EXPECT_EQ(3, add(1, 2));
}
int main(int argc, char* argv[])
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Above is my source code for testing and gtest failed to run tests.
Anyone knows how to solve it?
Thanks a lot!
Please sign in to leave a comment.
Hello,
The error message is clear - R++ can't execute a static library (a lib file). Looks like your project is set to produce a static library, not an executable.
Thanks for your help.
But when I change back to executable configuration type, the code cannot build successfully. Errors as following:
Is that gtest version problem? I installed google test using visual studio build in plugins.
Thank you very much!
Hey,
The error message is pretty clear again - just look at the first error. Looks like you're trying to use GTest library built with Visual Studio 2013, while compiling your project with Visual Studio 2015. The easiest way to use GTest is to fuse all source files into a single file, and include it into your project to avoid compiling the GTest library yourself. Please take a look at https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#fusing-google-test-source-files for instructions.