All checks were successful
Linux unit tests / unit-tests (push) Successful in 30s
30 lines
738 B
C++
30 lines
738 B
C++
#include "test_support.hpp"
|
|
|
|
#include <izo/DynamicLibrary.hpp>
|
|
|
|
#include <utility>
|
|
|
|
int main() {
|
|
std::string error;
|
|
auto missing = izo::LoadDynamicLibrary("/izo/does/not/exist.so", &error);
|
|
CHECK(!missing);
|
|
CHECK(!error.empty());
|
|
|
|
error.clear();
|
|
auto library = izo::LoadDynamicLibrary("libc.so.6", &error);
|
|
CHECK(library);
|
|
CHECK(library.Symbol("getpid", &error) != nullptr);
|
|
error.clear();
|
|
CHECK(library.Symbol("izo_missing_symbol", &error) == nullptr);
|
|
CHECK(!error.empty());
|
|
|
|
auto moved = std::move(library);
|
|
CHECK(!library);
|
|
CHECK(moved);
|
|
moved.Reset();
|
|
CHECK(!moved);
|
|
error.clear();
|
|
CHECK(moved.Symbol("getpid", &error) == nullptr);
|
|
CHECK(!error.empty());
|
|
}
|