If you can't get your solution to compile, for example by receiving an unresolved externals error, take a look at the answer section and recreate the steps listed there.
Our example header:
#pragma once
#include <string>
std::string testfunc();
Our example sourcefile:
#include "to_test.h"
std::string testfunc()
{
return "test worked";
}
After creating our example project, we wanna check some things on our list beforehand.
#include "pch.h"
#include "../to_test.h"
TEST(test, TestName)
{
//This Test will work
EXPECT_TRUE(testfunc() == "test worked");
//This Test will fail
EXPECT_TRUE(testfunc() == "test not worked");
}
We can then right-click our solution and rebuild it. After that we can choose our GTest-1 Project as the Startproject via right-clicking it and then debug it as usual. The Terminal popping up should look sorta like this:
DISCLAIMER: This definietly isn't the only way to do this.. if someone cares to correct me i would highly appreciate it:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.