| 1 |
#include <utility> |
| 2 |
|
| 3 |
#include <catch2/catch_all.hpp> |
| 4 |
|
| 5 |
#include <gvc++/GVContext.h> |
| 6 |
|
| 7 |
TEST_CASE("GVContext can be constructed without built-in plugins and its " |
| 8 |
"underlying C data structure can be retrieved") { |
| 9 |
GVC::GVContext gvc; |
| 10 |
REQUIRE(gvc.c_struct() != nullptr); |
| 11 |
} |
| 12 |
|
| 13 |
TEST_CASE("GVContext can be constructed with built-in plugins and its " |
| 14 |
"underlying C data structure can be retrieved") { |
| 15 |
const auto demand_loading = false; |
| 16 |
GVC::GVContext gvc{lt_preloaded_symbols, demand_loading}; |
| 17 |
REQUIRE(gvc.c_struct() != nullptr); |
| 18 |
} |
| 19 |
|
| 20 |
TEST_CASE("GVContext can be move constructed") { |
| 21 |
GVC::GVContext gvc; |
| 22 |
const auto c_ptr = gvc.c_struct(); |
| 23 |
REQUIRE(c_ptr != nullptr); |
| 24 |
auto other{std::move(gvc)}; |
| 25 |
REQUIRE(other.c_struct() == c_ptr); |
| 26 |
} |
| 27 |
|
| 28 |
TEST_CASE("GVContext can be move assigned") { |
| 29 |
GVC::GVContext gvc; |
| 30 |
const auto c_ptr = gvc.c_struct(); |
| 31 |
REQUIRE(c_ptr != nullptr); |
| 32 |
auto other = GVC::GVContext(); |
| 33 |
const auto other_c_ptr = other.c_struct(); |
| 34 |
REQUIRE(other_c_ptr != nullptr); |
| 35 |
REQUIRE(other_c_ptr != c_ptr); |
| 36 |
other = std::move(gvc); |
| 37 |
REQUIRE(other.c_struct() == c_ptr); |
| 38 |
} |