middle of porting; unstable, don't checkout; refs #1
This commit is contained in:
47
src/mrw/dynamiclibrary_test.cpp
Normal file
47
src/mrw/dynamiclibrary_test.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
/** @file
|
||||
|
||||
$Id$
|
||||
|
||||
$Date$
|
||||
$Author$
|
||||
|
||||
@copy © Marc Wäckerlin
|
||||
@license LGPL, see file <a href="license.html">COPYING</a>
|
||||
|
||||
$Log$
|
||||
Revision 1.1 2005/02/18 15:53:56 marc
|
||||
initial release
|
||||
|
||||
|
||||
1 2 3 4 5 6 7 8
|
||||
5678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
*/
|
||||
|
||||
#include <mrw/dynamiclibrary.hpp>
|
||||
#include <cppunit/TestFixture.h>
|
||||
#include <cppunit/ui/text/TestRunner.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include <cppunit/extensions/TestFactoryRegistry.h>
|
||||
|
||||
class DynamicLibraryTest: public CppUnit::TestFixture {
|
||||
public:
|
||||
void Load() {
|
||||
mrw::DynamicLibrary lib("libdynamiclibrary_testlib");
|
||||
int(*test1)(int) = (int(*)(int))lib.symbol("test1");
|
||||
CPPUNIT_ASSERT((*test1)(2)==4);
|
||||
}
|
||||
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() {
|
||||
CppUnit::TextUi::TestRunner runner;
|
||||
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
|
||||
return runner.run() ? 0 : 1;
|
||||
}
|
Reference in New Issue
Block a user