36 #include <boost/test/unit_test.hpp> 37 #include <boost/filesystem.hpp> 80 BOOST_CHECK_NO_THROW(
delete l);
85 BOOST_CHECK_NO_THROW(
delete l);
94 BOOST_CHECK_NO_THROW(l1.
load());
97 BOOST_CHECK_NO_THROW(l1.
load());
110 BOOST_CHECK_NO_THROW(l1.
unload());
114 BOOST_CHECK_NO_THROW(l2.unload());
118 BOOST_CHECK_NO_THROW(l3.unload());
135 BOOST_CHECK(!l2.isLoaded());
139 BOOST_CHECK(!l3.isLoaded());
149 BOOST_CHECK(l1.
getFileName().compare(fileName) == 0);
171 std::string name(
"terralib_unittest_core_lib_function");
176 #if TE_PLATFORM == TE_PLATFORMCODE_MSWINDOWS 182 #elif TE_PLATFORM == TE_PLATFORMCODE_LINUX 185 #elif TE_PLATFORM == TE_PLATFORMCODE_APPLE 189 #error "Platform not supported yet! Please contact terralib-team@dpi.inpe.br" 192 std::string trueName = prefix + name + suffix;
194 BOOST_CHECK(nname.compare(trueName) == 0);
199 #if TE_PLATFORM == TE_PLATFORMCODE_MSWINDOWS 214 BOOST_CHECK_THROW(
te::core::Library::addSearchDir(
"X:/funcate/kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"),
te::core::LibraryInvalidSearchPathException);
236 BOOST_CHECK_NO_THROW(l.
load());
248 BOOST_AUTO_TEST_SUITE_END()
A class for handling shared libraries.
An exception indicating an error when loading a shared library.
Specific exception types for Library Manager.
static void addSearchDir(const std::string &dir_name)
Add the informed dir to the path used by the operational system to lookup for shared libraries...
void unload()
Force the unload of the shared library from memory.
A class for handling shared libraries (DLLs, SO, DyLibs).
Proxy file for the real file terralib_defines.h.
static const std::string g_shared_library_name(te::core::Library::getNativeName("terralib_unittest_core_lib_function"))
static void resetSearchPath()
Comes back the application lookup path to the original state, before any add_search_dir has been call...
void * getAddress(const char *symbol) const
Return the address where the given symbol is loaded into memory.
const std::string & getFileName() const
Return the shared library file name as informed in the constructor.
BOOST_AUTO_TEST_SUITE(lib_test_case) BOOST_AUTO_TEST_CASE(test_constructor)
TECOREEXPORT std::string FindInTerraLibPath(const std::string &path)
Returns the path relative to a directory or file in the context of TerraLib.
static const std::string g_shared_library_path(te::core::FindInTerraLibPath("example"))
An exception indicating an error when adding a given path to the operational system search library pa...
BOOST_AUTO_TEST_CASE(test_destructor)
An exception indicating an error when searching for a given symbol in a shared library.
bool isLoaded() const
Return true if the shared library is loaded otherwise return false.
void load()
Load the shared library to memory.
static std::string getNativeName(const std::string &name)
Given a shared library name without file extensions, prefixes and nor suffixes it will construct a li...
An execption indicating an error when the library name is empty.