I am attempting to write commonly used functionality for testing into a separate dll. When I do this, I will get test failed reports as expected, but the final report will say the test passed.
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from MyFoo
[ RUN ] MyFoo.fooTest
C:\Foo\Foo.cpp(2): error: Value of: false
Actual: false
Expected: true
[ OK ] MyFoo.fooTest (0 ms)
[----------] 1 test from MyFoo(0 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (0 ms total)
[ PASSED ] 1 test.
As you can see, the test failed, but the report says it passed.
This is a simple example of my exported function:
// Foo.dll
// Foo.h
FOO_EXPORT void Foo();
// Foo.cpp
#include <Foo.h>
#include <gtest/gtest.h>
void Foo()
{
EXPECT_TRUE(false);
}
This is a simple example of my gtest executable:
// TestMyFoo.exe
#include <Foo.h>
#include <gtest/gtest.h>
TEST(MyFoo, fooTest)
{
Foo();
}
Is there something I'm doing incorrectly when it comes to exporting a google test? Am I allowed to even do this(please say yes)?
Aucun commentaire:
Enregistrer un commentaire