I'm trying to make use of boost unit test suite.
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE main_test_module
#include <boost/test/unit_test.hpp>
#include <boost/test/unit_test_suite.hpp>
.... // introducing some functions and variables here
BOOST_AUTO_TEST_CASE(fileComparatorTestCase)
{
Logger() << "Testing file comparator";
bool res;
res = compare(file1Path, file1Path);
BOOST_REQUIRE_EQUAL(res, true);
res = compare(file2Path, file2Path);
BOOST_REQUIRE_EQUAL(res, true);
res = compare(file1Path, file3Path);
BOOST_REQUIRE_EQUAL(res, false);
res = compare(file1Path, file2Path);
BOOST_REQUIRE_EQUAL(res, false);
Logger() << "Ended testing file comparator";
}
I'm also linking boost_unit_test_framework library. This code compiles fine, but when I'm trying to run the testrunner, it fails with following error:
Running 1 test case...
unknown location(0): fatal error in "fileComparatorTestCase": std::exception: No such file or directory
any ideas on how to fix it?
Apparently, either
Logger()
can't open the output location for writing; orcompare
function you're testing, checks for the existence of the files/paths you pass.Try commenting stuff until you find the culprit. If the exception arises from Boost, usually more extensive exception information is available. Otherwise, the source code, or perhaps tricks such as
strace
can tell you what's happening.