File: test_GVContext_construction.cpp

package info (click to toggle)
graphviz 14.1.1-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 139,440 kB
  • sloc: ansic: 142,129; cpp: 11,960; python: 7,770; makefile: 4,043; yacc: 3,030; xml: 2,972; tcl: 2,495; sh: 1,388; objc: 1,159; java: 560; lex: 423; perl: 243; awk: 156; pascal: 139; php: 58; ruby: 49; cs: 31; sed: 1
file content (38 lines) | stat: -rw-r--r-- 1,105 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <utility>

#include <catch2/catch_all.hpp>

#include <gvc++/GVContext.h>

TEST_CASE("GVContext can be constructed without built-in plugins and its "
          "underlying C data structure can be retrieved") {
  GVC::GVContext gvc;
  REQUIRE(gvc.c_struct() != nullptr);
}

TEST_CASE("GVContext can be constructed with built-in plugins and its "
          "underlying C data structure can be retrieved") {
  const auto demand_loading = false;
  GVC::GVContext gvc{lt_preloaded_symbols, demand_loading};
  REQUIRE(gvc.c_struct() != nullptr);
}

TEST_CASE("GVContext can be move constructed") {
  GVC::GVContext gvc;
  const auto c_ptr = gvc.c_struct();
  REQUIRE(c_ptr != nullptr);
  auto other{std::move(gvc)};
  REQUIRE(other.c_struct() == c_ptr);
}

TEST_CASE("GVContext can be move assigned") {
  GVC::GVContext gvc;
  const auto c_ptr = gvc.c_struct();
  REQUIRE(c_ptr != nullptr);
  auto other = GVC::GVContext();
  const auto other_c_ptr = other.c_struct();
  REQUIRE(other_c_ptr != nullptr);
  REQUIRE(other_c_ptr != c_ptr);
  other = std::move(gvc);
  REQUIRE(other.c_struct() == c_ptr);
}