/** @file
$Id$
$Date$
$Author$
@copy © Marc Wäckerlin
@license LGPL, see file COPYING
$Log$
Revision 1.1 2005/02/18 15:53:56 marc
initial release
1 2 3 4 5 6 7 8
5678901234567890123456789012345678901234567890123456789012345678901234567890
*/
#include
#include
#include
#include
#include
#include
#include
class DynamicLibraryTest: public CppUnit::TestFixture {
public:
void Load() {
mrw::DynamicLibrary lib("libdynamiclibrary_testlib");
int(*test1)(int) = (int(*)(int))lib.symbol("test1");
CPPUNIT_ASSERT_EQUAL(4, (*test1)(2));
}
void LoadError() {
mrw::DynamicLibrary lib("DASist-Sicher_Keine_DynamischePHIPLIOTEEK!!!");
}
CPPUNIT_TEST_SUITE(DynamicLibraryTest);
CPPUNIT_TEST(Load);
CPPUNIT_TEST_EXCEPTION(LoadError, mrw::DynamicLibrary::failure);
CPPUNIT_TEST_SUITE_END();
};
CPPUNIT_TEST_SUITE_REGISTRATION(DynamicLibraryTest);
int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1;
} catch (std::exception& e) {
std::cerr<<"***Exception: "<