Я пытаюсь использовать boost.test
на удаленной системе с boost 1.33.1. На моем компьютере этот маленький пример из http://www.boost.org/doc/libs/1_42_0/libs/test/doc/html/tutorials/hello-the-testing-world.html работы:проблема с boost.test со старой версией
#define BOOST_TEST_MODULE MyTest
#include <boost/test/included/unit_test.hpp> // I've changed here
int add(int i, int j) { return i+j; }
BOOST_AUTO_TEST_CASE(my_test) // <--- line 7
{
// seven ways to detect and report the same error:
BOOST_CHECK(add(2,2) == 4); // #1 continues on error
BOOST_REQUIRE(add(2,2) == 4); // #2 throws on error
if(add(2,2) != 4)
BOOST_ERROR("Ouch..."); // #3 continues on error
if(add(2,2) != 4)
BOOST_FAIL("Ouch..."); // #4 throws on error
if(add(2,2) != 4) throw "Ouch..."; // #5 throws on error
BOOST_CHECK_MESSAGE(add(2,2) == 4, // #6 continues on error
"add(..) result: " << add(2,2));
BOOST_CHECK_EQUAL(add(2,2), 4); // #7 continues on error
}
но на удаленной системе файл unit_test.hpp
не существует. На моем компьютере файл unit_test_framework.hpp
просто:
// deprecated
#include <boost/test/included/unit_test.hpp>
и присутствует на главной системе. Поэтому я попытался изменить включаемые в:
#include <boost/test/included/unit_test_framework.hpp>
но компилятор говорит:
main.cpp:7: error: expected constructor, destructor, or type conversion before ‘(’ token
что это? Как его решить?
На какой системе вы изменили включают? – 2010-12-06 18:03:58
Не могли бы вы рассказать, какая версия boost установлена на вашей удаленной системе? – jopasserat 2010-12-06 18:11:46