Ich versuche, boost.test
auf einem Remote-System mit Boost 1.33.1 zu verwenden. Auf meinem PC dieses kleine Beispiel aus http://www.boost.org/doc/libs/1_42_0/libs/test/doc/html/tutorials/hello-the-testing-world.html funktioniert:Problem mit boost.test mit alter Version
#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
}
aber auf dem Remote-System unit_test.hpp
die Datei nicht existiert. Auf meinem PC unit_test_framework.hpp
die Datei ist einfach:
// deprecated
#include <boost/test/included/unit_test.hpp>
und es ist auf dem Hauptsystem. Also habe ich versucht, die gehören zu ändern:
#include <boost/test/included/unit_test_framework.hpp>
aber der Compiler sagt:
main.cpp:7: error: expected constructor, destructor, or type conversion before ‘(’ token
was ist das? Wie man es löst?
Auf welchem System haben Sie das geändert? einschließen? –
Könnten Sie uns bitte mitteilen, welche Boost-Version auf Ihrem Remote-System installiert ist? – jopasserat
remote: 1.33.1, lokal: 1.36.0 –