Initial refactor to cppast
This commit is contained in:
@@ -31,7 +31,7 @@ target_link_libraries(test_util
|
||||
PRIVATE
|
||||
${LIBCLANG_LIBRARIES}
|
||||
${YAML_CPP_LIBRARIES}
|
||||
spdlog::spdlog clang-umllib)
|
||||
spdlog::spdlog clang-umllib cppast)
|
||||
|
||||
|
||||
add_executable(test_cases
|
||||
@@ -42,7 +42,7 @@ target_link_libraries(test_cases
|
||||
PRIVATE
|
||||
${LIBCLANG_LIBRARIES}
|
||||
${YAML_CPP_LIBRARIES}
|
||||
spdlog::spdlog clang-umllib)
|
||||
spdlog::spdlog clang-umllib cppast)
|
||||
|
||||
foreach(TEST_CASE_CONFIG ${TEST_CASE_CONFIGS})
|
||||
file(RELATIVE_PATH
|
||||
|
||||
@@ -56,7 +56,7 @@ TEST_CASE("t00003", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsField(Public("int public_member")));
|
||||
REQUIRE_THAT(puml, IsField(Protected("int protected_member")));
|
||||
REQUIRE_THAT(puml, IsField(Private("int private_member")));
|
||||
REQUIRE_THAT(puml, IsField(Static(Public("unsigned long auto_member"))));
|
||||
REQUIRE_THAT(puml, IsField(Static(Public("unsigned long const auto_member"))));
|
||||
|
||||
REQUIRE_THAT(puml, IsField(Private("int a")));
|
||||
REQUIRE_THAT(puml, IsField(Private("int b")));
|
||||
|
||||
@@ -58,8 +58,8 @@ TEST_CASE("t00005", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
|
||||
REQUIRE_THAT(puml, IsField(Public("int some_int")));
|
||||
REQUIRE_THAT(puml, IsField(Public("int * some_int_pointer")));
|
||||
REQUIRE_THAT(puml, IsField(Public("int ** some_int_pointer_pointer")));
|
||||
REQUIRE_THAT(puml, IsField(Public("int* some_int_pointer")));
|
||||
REQUIRE_THAT(puml, IsField(Public("int** some_int_pointer_pointer")));
|
||||
|
||||
REQUIRE_THAT(puml, IsComposition(_A("R"), _A("A"), "a"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "b"));
|
||||
|
||||
@@ -19,7 +19,20 @@
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
std::pair<clanguml::config::config, compilation_database> load_config(
|
||||
std::pair<clanguml::config::config, cppast::libclang_compilation_database>
|
||||
load_config(const std::string &test_name)
|
||||
{
|
||||
auto config = clanguml::config::load(test_name + "/.clanguml");
|
||||
|
||||
// auto db = clanguml::cx::compilation_database::from_directory(
|
||||
// config.compilation_database_dir);
|
||||
|
||||
cppast::libclang_compilation_database db(config.compilation_database_dir);
|
||||
|
||||
return std::make_pair(std::move(config), std::move(db));
|
||||
}
|
||||
|
||||
std::pair<clanguml::config::config, compilation_database> load_config2(
|
||||
const std::string &test_name)
|
||||
{
|
||||
auto config = clanguml::config::load(test_name + "/.clanguml");
|
||||
@@ -42,7 +55,7 @@ clanguml::model::sequence_diagram::diagram generate_sequence_diagram(
|
||||
}
|
||||
|
||||
clanguml::model::class_diagram::diagram generate_class_diagram(
|
||||
compilation_database &db,
|
||||
cppast::libclang_compilation_database &db,
|
||||
std::shared_ptr<clanguml::config::diagram> diagram)
|
||||
{
|
||||
auto diagram_model =
|
||||
@@ -134,7 +147,7 @@ using clanguml::test::matchers::Static;
|
||||
//
|
||||
// Sequence diagram tests
|
||||
//
|
||||
#include "t20001/test_case.h"
|
||||
//#include "t20001/test_case.h"
|
||||
|
||||
//
|
||||
// Other tests (e.g. configuration file)
|
||||
|
||||
@@ -43,7 +43,9 @@ using Catch::Matchers::VectorContains;
|
||||
using clanguml::cx::compilation_database;
|
||||
using namespace clanguml::util;
|
||||
|
||||
std::pair<clanguml::config::config, compilation_database> load_config(
|
||||
std::pair<clanguml::config::config, cppast::libclang_compilation_database>
|
||||
load_config(const std::string &test_name);
|
||||
std::pair<clanguml::config::config, compilation_database> load_config2(
|
||||
const std::string &test_name);
|
||||
|
||||
clanguml::model::sequence_diagram::diagram generate_sequence_diagram(
|
||||
|
||||
Reference in New Issue
Block a user