Look s like you have confused two different things.
Quoted example refers to situation where actual tests has been written using some library like: CTest, Google Test, Boost.Test. Using this tools you have to write separate code which tests production code (you can read about TDD - Test driven development).
You have included a list of text files which are feed to standard input using for test cases on sites like: SPOJ, Hackerrank and so on. On this sites different programing languages can be used. To verify correctness of provided solution standard input and output is used. This is a quick simple way to verify correctness of programs created in almost any language, but this solution is not very usable in real life software development.
AFAIK there is no tool which can help you to do it quickly.
By refactoring your code you can take advantage of one of the tools and at the same time use those files.
int problemSolver(std::istream& in, std::ostream& out)
{
}
#ifndef TESTING_MODE
int main()
{
return problemSolver(std::cin, std::cout);
}
#else
TEST(ProblemSolverTest, input1)
{
std::istringstream in{ load_file("Test_input_1.txt") };
std::ostringstream out;
ASSERT_EQ(problemSolver(in, out), 0);
auto result = out.str();
ASSERT_EQ(result, load_file("Test_output_1.txt"));
}
...
#endif // TESTING_MODE