Added JSON test case stubs for all class diagram test cases
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
namespace clanguml::class_diagram::model {
|
namespace clanguml::class_diagram::model {
|
||||||
using nlohmann::json;
|
using nlohmann::json;
|
||||||
|
|
||||||
void to_json(nlohmann::json &j, const class_element &c)
|
void to_json(nlohmann::json &j, const class_element &c)
|
||||||
{
|
{
|
||||||
j["name"] = c.name();
|
j["name"] = c.name();
|
||||||
@@ -113,6 +114,11 @@ generator::generator(diagram_config &config, diagram_model &model)
|
|||||||
|
|
||||||
void generator::generate(std::ostream &ostr) const
|
void generator::generate(std::ostream &ostr) const
|
||||||
{
|
{
|
||||||
|
if (m_config.using_namespace)
|
||||||
|
json_["using_namespace"] = m_config.using_namespace().to_string();
|
||||||
|
json_["name"] = m_model.name();
|
||||||
|
json_["diagram_type"] = "class";
|
||||||
|
|
||||||
json_["elements"] = std::vector<nlohmann::json>{};
|
json_["elements"] = std::vector<nlohmann::json>{};
|
||||||
json_["relationships"] = std::vector<nlohmann::json>{};
|
json_["relationships"] = std::vector<nlohmann::json>{};
|
||||||
|
|
||||||
@@ -120,9 +126,6 @@ void generator::generate(std::ostream &ostr) const
|
|||||||
|
|
||||||
generate_relationships(json_);
|
generate_relationships(json_);
|
||||||
|
|
||||||
json_["name"] = m_model.name();
|
|
||||||
json_["diagram_type"] = "class";
|
|
||||||
|
|
||||||
ostr << json_;
|
ostr << json_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ public:
|
|||||||
void generate_relationships(const package &p, nlohmann::json &parent) const;
|
void generate_relationships(const package &p, nlohmann::json &parent) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::string render_name(std::string name) const;
|
||||||
|
|
||||||
mutable nlohmann::json json_;
|
mutable nlohmann::json json_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -296,6 +296,7 @@ bool translation_unit_visitor::VisitClassTemplateDecl(
|
|||||||
const auto id = common::to_id(cls_full_name);
|
const auto id = common::to_id(cls_full_name);
|
||||||
|
|
||||||
c_ptr->set_id(id);
|
c_ptr->set_id(id);
|
||||||
|
c_ptr->is_template(true);
|
||||||
|
|
||||||
set_ast_local_id(cls->getID(), id);
|
set_ast_local_id(cls->getID(), id);
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,15 @@
|
|||||||
namespace clanguml::common::model {
|
namespace clanguml::common::model {
|
||||||
using nlohmann::json;
|
using nlohmann::json;
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
std::string render_name(std::string name)
|
||||||
|
{
|
||||||
|
util::replace_all(name, "##", "::");
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
void to_json(nlohmann::json &j, const source_location &sl)
|
void to_json(nlohmann::json &j, const source_location &sl)
|
||||||
{
|
{
|
||||||
j = json{{"file", sl.file_relative()}, {"line", sl.line()}};
|
j = json{{"file", sl.file_relative()}, {"line", sl.line()}};
|
||||||
@@ -28,9 +37,10 @@ void to_json(nlohmann::json &j, const source_location &sl)
|
|||||||
|
|
||||||
void to_json(nlohmann::json &j, const element &c)
|
void to_json(nlohmann::json &j, const element &c)
|
||||||
{
|
{
|
||||||
j = json{{"id", std::to_string(c.id())}, {"name", c.name()},
|
j = json{{"id", std::to_string(c.id())},
|
||||||
|
{"name", detail::render_name(c.name())},
|
||||||
{"namespace", c.get_namespace().to_string()}, {"type", c.type_name()},
|
{"namespace", c.get_namespace().to_string()}, {"type", c.type_name()},
|
||||||
{"display_name", c.full_name(false)}};
|
{"display_name", detail::render_name(c.full_name(false))}};
|
||||||
|
|
||||||
if (const auto &comment = c.comment(); comment)
|
if (const auto &comment = c.comment(); comment)
|
||||||
j["comment"] = comment.value();
|
j["comment"] = comment.value();
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ TEST_CASE("t00002", "[test-case][class]")
|
|||||||
REQUIRE(model->should_include({"clanguml", "t00002"}, "A"));
|
REQUIRE(model->should_include({"clanguml", "t00002"}, "A"));
|
||||||
REQUIRE(!model->should_include({"std"}, "vector"));
|
REQUIRE(!model->should_include({"std"}, "vector"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -73,22 +74,26 @@ TEST_CASE("t00002", "[test-case][class]")
|
|||||||
clanguml::util::get_git_commit()),
|
clanguml::util::get_git_commit()),
|
||||||
"This is class B"));
|
"This is class B"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
auto j = generate_class_json(diagram, *model);
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00002::A"));
|
using namespace json;
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00002::B"));
|
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00002::C"));
|
|
||||||
REQUIRE(json::IsBaseClass(j, "clanguml::t00002::A", "clanguml::t00002::B"));
|
|
||||||
REQUIRE(json::IsBaseClass(j, "clanguml::t00002::A", "clanguml::t00002::C"));
|
|
||||||
REQUIRE(json::IsBaseClass(j, "clanguml::t00002::B", "clanguml::t00002::D"));
|
|
||||||
REQUIRE(json::IsBaseClass(j, "clanguml::t00002::C", "clanguml::t00002::D"));
|
|
||||||
REQUIRE(json::IsMethod(j, "clanguml::t00002::A", "foo_a"));
|
|
||||||
REQUIRE(json::IsMethod(j, "clanguml::t00002::C", "foo_c"));
|
|
||||||
|
|
||||||
REQUIRE(json::IsAssociation(
|
REQUIRE(IsClass(j, "A"));
|
||||||
j, "clanguml::t00002::D", "clanguml::t00002::A", "as"));
|
REQUIRE(IsClass(j, "B"));
|
||||||
|
REQUIRE(IsClass(j, "C"));
|
||||||
|
REQUIRE(IsBaseClass(j, "A", "B"));
|
||||||
|
REQUIRE(IsBaseClass(j, "A", "C"));
|
||||||
|
REQUIRE(IsBaseClass(j, "B", "D"));
|
||||||
|
REQUIRE(IsBaseClass(j, "C", "D"));
|
||||||
|
REQUIRE(IsMethod(j, "A", "foo_a"));
|
||||||
|
REQUIRE(IsMethod(j, "C", "foo_c"));
|
||||||
|
REQUIRE(IsMember(j, "E", "as", "std::vector<A *>"));
|
||||||
|
REQUIRE(IsAssociation(j, "D", "A", "as"));
|
||||||
|
|
||||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -33,6 +33,7 @@ TEST_CASE("t00003", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00003_class");
|
REQUIRE(model->name() == "t00003_class");
|
||||||
REQUIRE(model->should_include(std::string("clanguml::t00003::A")));
|
REQUIRE(model->should_include(std::string("clanguml::t00003::A")));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -48,7 +49,8 @@ TEST_CASE("t00003", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, (IsMethod<Public>("basic_method")));
|
REQUIRE_THAT(puml, (IsMethod<Public>("basic_method")));
|
||||||
REQUIRE_THAT(puml, (IsMethod<Public, Static>("static_method", "int")));
|
REQUIRE_THAT(puml, (IsMethod<Public, Static>("static_method", "int")));
|
||||||
REQUIRE_THAT(puml, (IsMethod<Public, Const>("const_method")));
|
REQUIRE_THAT(puml, (IsMethod<Public, Const>("const_method")));
|
||||||
REQUIRE_THAT(puml, (IsMethod<Public>("default_int", "int", "int i = 12")));
|
REQUIRE_THAT(
|
||||||
|
puml, (IsMethod<Public>("default_int", "int", "int i = 12")));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
(IsMethod<Public>("default_string", "std::string",
|
(IsMethod<Public>("default_string", "std::string",
|
||||||
"int i, std::string s = \"abc\"")));
|
"int i, std::string s = \"abc\"")));
|
||||||
@@ -58,28 +60,33 @@ TEST_CASE("t00003", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, (IsField<Public>("public_member", "int")));
|
REQUIRE_THAT(puml, (IsField<Public>("public_member", "int")));
|
||||||
REQUIRE_THAT(puml, (IsField<Protected>("protected_member", "int")));
|
REQUIRE_THAT(puml, (IsField<Protected>("protected_member", "int")));
|
||||||
REQUIRE_THAT(puml, (IsField<Private>("private_member", "int")));
|
REQUIRE_THAT(puml, (IsField<Private>("private_member", "int")));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(puml,
|
||||||
puml, (IsField<Public, Static>("auto_member", "const unsigned long")));
|
(IsField<Public, Static>("auto_member", "const unsigned long")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, (IsField<Private>("a_", "int")));
|
REQUIRE_THAT(puml, (IsField<Private>("a_", "int")));
|
||||||
REQUIRE_THAT(puml, (IsField<Private>("b_", "int")));
|
REQUIRE_THAT(puml, (IsField<Private>("b_", "int")));
|
||||||
REQUIRE_THAT(puml, (IsField<Private>("c_", "int")));
|
REQUIRE_THAT(puml, (IsField<Private>("c_", "int")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
auto j = generate_class_json(diagram, *model);
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00003::A"));
|
using namespace json;
|
||||||
REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "A"));
|
|
||||||
REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "~A"));
|
|
||||||
REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "basic_method"));
|
|
||||||
REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "static_method"));
|
|
||||||
REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "const_method"));
|
|
||||||
REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "default_int"));
|
|
||||||
REQUIRE(json::IsMethod(j, "clanguml::t00003::A", "default_string"));
|
|
||||||
|
|
||||||
REQUIRE(
|
REQUIRE(IsClass(j, "A"));
|
||||||
!json::IsDependency(j, "clanguml::t00002::A", "clanguml::t00002::A"));
|
REQUIRE(IsMethod(j, "A", "A"));
|
||||||
|
REQUIRE(IsMethod(j, "A", "~A"));
|
||||||
|
REQUIRE(IsMethod(j, "A", "basic_method"));
|
||||||
|
REQUIRE(IsMethod(j, "A", "static_method"));
|
||||||
|
REQUIRE(IsMethod(j, "A", "const_method"));
|
||||||
|
REQUIRE(IsMethod(j, "A", "default_int"));
|
||||||
|
REQUIRE(IsMethod(j, "A", "default_string"));
|
||||||
|
|
||||||
|
REQUIRE(!IsDependency(j, "A", "A"));
|
||||||
|
|
||||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ TEST_CASE("t00004", "[test-case][class]")
|
|||||||
REQUIRE(model->should_include("clanguml::t00004::A::AA"));
|
REQUIRE(model->should_include("clanguml::t00004::A::AA"));
|
||||||
REQUIRE(model->should_include("clanguml::t00004::A:::AAA"));
|
REQUIRE(model->should_include("clanguml::t00004::A:::AAA"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -59,7 +60,8 @@ TEST_CASE("t00004", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsInnerClass(_A("C::AA"), _A("C::AA::CCC")));
|
REQUIRE_THAT(puml, IsInnerClass(_A("C::AA"), _A("C::AA::CCC")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsInnerClass(_A("C<T>"), _A("C::B<V>")));
|
REQUIRE_THAT(puml, IsInnerClass(_A("C<T>"), _A("C::B<V>")));
|
||||||
REQUIRE_THAT(puml, IsAggregation(_A("C<T>"), _A("C::B<int>"), "+b_int"));
|
REQUIRE_THAT(
|
||||||
|
puml, IsAggregation(_A("C<T>"), _A("C::B<int>"), "+b_int"));
|
||||||
REQUIRE_THAT(puml, !IsInnerClass(_A("C<T>"), _A("C::B")));
|
REQUIRE_THAT(puml, !IsInnerClass(_A("C<T>"), _A("C::B")));
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("C::B<V>"), _A("C::B<int>")));
|
REQUIRE_THAT(puml, IsInstantiation(_A("C::B<V>"), _A("C::B<int>")));
|
||||||
|
|
||||||
@@ -67,5 +69,30 @@ TEST_CASE("t00004", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClass(_A("detail::D::DD")));
|
REQUIRE_THAT(puml, IsClass(_A("detail::D::DD")));
|
||||||
REQUIRE_THAT(puml, IsEnum(_A("detail::D::AA")));
|
REQUIRE_THAT(puml, IsEnum(_A("detail::D::AA")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
REQUIRE(IsClass(j, "A"));
|
||||||
|
REQUIRE(IsClass(j, "A::AA"));
|
||||||
|
REQUIRE(IsClass(j, "A::AA::AAA"));
|
||||||
|
REQUIRE(IsEnum(j, "B::AA"));
|
||||||
|
REQUIRE(IsEnum(j, "A::AA::Lights"));
|
||||||
|
REQUIRE(IsInnerClass(j, "A", "A::AA"));
|
||||||
|
REQUIRE(IsInnerClass(j, "A::AA", "A::AA::AAA"));
|
||||||
|
REQUIRE(IsInnerClass(j, "A::AA", "A::AA::Lights"));
|
||||||
|
|
||||||
|
REQUIRE(IsClassTemplate(j, "C<T>"));
|
||||||
|
|
||||||
|
REQUIRE(IsClass(j, "detail::D"));
|
||||||
|
REQUIRE(IsClass(j, "detail::D::DD"));
|
||||||
|
REQUIRE(IsEnum(j, "detail::D::AA"));
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ TEST_CASE("t00005", "[test-case][class]")
|
|||||||
REQUIRE(model->should_include("clanguml::t00005::C"));
|
REQUIRE(model->should_include("clanguml::t00005::C"));
|
||||||
REQUIRE(model->should_include("clanguml::t00005::D"));
|
REQUIRE(model->should_include("clanguml::t00005::D"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -52,7 +53,8 @@ TEST_CASE("t00005", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE_THAT(puml, (IsField<Public>("some_int", "int")));
|
REQUIRE_THAT(puml, (IsField<Public>("some_int", "int")));
|
||||||
REQUIRE_THAT(puml, (IsField<Public>("some_int_pointer", "int *")));
|
REQUIRE_THAT(puml, (IsField<Public>("some_int_pointer", "int *")));
|
||||||
REQUIRE_THAT(puml, (IsField<Public>("some_int_pointer_pointer", "int **")));
|
REQUIRE_THAT(
|
||||||
|
puml, (IsField<Public>("some_int_pointer_pointer", "int **")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "+a"));
|
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "+a"));
|
||||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b"));
|
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b"));
|
||||||
@@ -66,5 +68,40 @@ TEST_CASE("t00005", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("J"), "+j"));
|
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("J"), "+j"));
|
||||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "+k"));
|
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "+k"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
REQUIRE(IsClass(j, "A"));
|
||||||
|
REQUIRE(IsClass(j, "B"));
|
||||||
|
REQUIRE(IsClass(j, "C"));
|
||||||
|
REQUIRE(IsClass(j, "D"));
|
||||||
|
REQUIRE(IsClass(j, "E"));
|
||||||
|
REQUIRE(IsClass(j, "F"));
|
||||||
|
REQUIRE(IsClass(j, "G"));
|
||||||
|
REQUIRE(IsClass(j, "H"));
|
||||||
|
REQUIRE(IsClass(j, "I"));
|
||||||
|
REQUIRE(IsClass(j, "J"));
|
||||||
|
REQUIRE(IsClass(j, "K"));
|
||||||
|
REQUIRE(IsClass(j, "R"));
|
||||||
|
|
||||||
|
REQUIRE(IsAggregation(j, "R", "A", "a"));
|
||||||
|
REQUIRE(IsAssociation(j, "R", "B", "b"));
|
||||||
|
REQUIRE(IsAssociation(j, "R", "C", "c"));
|
||||||
|
REQUIRE(IsAssociation(j, "R", "D", "d"));
|
||||||
|
REQUIRE(IsAssociation(j, "R", "E", "e"));
|
||||||
|
REQUIRE(IsAggregation(j, "R", "F", "f"));
|
||||||
|
REQUIRE(IsAssociation(j, "R", "G", "g"));
|
||||||
|
REQUIRE(IsAssociation(j, "R", "H", "h"));
|
||||||
|
REQUIRE(IsAssociation(j, "R", "I", "i"));
|
||||||
|
REQUIRE(IsAssociation(j, "R", "J", "j"));
|
||||||
|
REQUIRE(IsAssociation(j, "R", "K", "k"));
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ TEST_CASE("t00006", "[test-case][class]")
|
|||||||
REQUIRE(model->should_include("clanguml::t00006::D"));
|
REQUIRE(model->should_include("clanguml::t00006::D"));
|
||||||
REQUIRE(model->should_include("clanguml::t00006::E"));
|
REQUIRE(model->should_include("clanguml::t00006::E"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -57,13 +58,15 @@ TEST_CASE("t00006", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClass(_A("NNN")));
|
REQUIRE_THAT(puml, IsClass(_A("NNN")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsInstantiation(_A("custom_container<T>"), _A("custom_container<E>")));
|
IsInstantiation(
|
||||||
|
_A("custom_container<T>"), _A("custom_container<E>")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "+a"));
|
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "+a"));
|
||||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b"));
|
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b"));
|
||||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("C"), "+c"));
|
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("C"), "+c"));
|
||||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "+d"));
|
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "+d"));
|
||||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("custom_container<E>"), "+e"));
|
REQUIRE_THAT(
|
||||||
|
puml, IsAggregation(_A("R"), _A("custom_container<E>"), "+e"));
|
||||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("F"), "+f"));
|
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("F"), "+f"));
|
||||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G"), "+g"));
|
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G"), "+g"));
|
||||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("H"), "+h"));
|
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("H"), "+h"));
|
||||||
@@ -76,5 +79,37 @@ TEST_CASE("t00006", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("NN"), "+ns"));
|
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("NN"), "+ns"));
|
||||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("NNN"), "+ns"));
|
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("NNN"), "+ns"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
REQUIRE(IsClass(j, "A"));
|
||||||
|
REQUIRE(IsClass(j, "B"));
|
||||||
|
REQUIRE(IsClass(j, "C"));
|
||||||
|
REQUIRE(IsClass(j, "D"));
|
||||||
|
REQUIRE(IsClass(j, "E"));
|
||||||
|
REQUIRE(IsClass(j, "F"));
|
||||||
|
REQUIRE(IsClass(j, "G"));
|
||||||
|
REQUIRE(IsClass(j, "H"));
|
||||||
|
REQUIRE(IsClass(j, "I"));
|
||||||
|
REQUIRE(IsClass(j, "J"));
|
||||||
|
REQUIRE(IsClass(j, "K"));
|
||||||
|
REQUIRE(IsClass(j, "L"));
|
||||||
|
REQUIRE(IsClass(j, "M"));
|
||||||
|
REQUIRE(IsClass(j, "N"));
|
||||||
|
REQUIRE(IsClass(j, "NN"));
|
||||||
|
REQUIRE(IsClass(j, "NNN"));
|
||||||
|
|
||||||
|
REQUIRE(IsAggregation(
|
||||||
|
j, "R", "custom_container<clanguml::t00006::E>", "e"));
|
||||||
|
REQUIRE(IsInstantiation(
|
||||||
|
j, "custom_container<T>", "custom_container<clanguml::t00006::E>"));
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ TEST_CASE("t00007", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00007_class");
|
REQUIRE(model->name() == "t00007_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -42,5 +43,22 @@ TEST_CASE("t00007", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b"));
|
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b"));
|
||||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("C"), "+c"));
|
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("C"), "+c"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
REQUIRE(IsClass(j, "A"));
|
||||||
|
REQUIRE(IsClass(j, "B"));
|
||||||
|
REQUIRE(IsClass(j, "C"));
|
||||||
|
REQUIRE(IsClass(j, "R"));
|
||||||
|
REQUIRE(IsAggregation(j, "R", "A", "a"));
|
||||||
|
REQUIRE(IsAssociation(j, "R", "B", "b"));
|
||||||
|
REQUIRE(IsAssociation(j, "R", "C", "c"));
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,14 +28,15 @@ TEST_CASE("t00008", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00008_class");
|
REQUIRE(model->name() == "t00008_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||||
// TODO: add option to resolve using declared types
|
// TODO: add option to resolve using declared types
|
||||||
// REQUIRE_THAT(puml, IsClassTemplate("A", "T, P, bool (*)(int, int), int
|
// REQUIRE_THAT(puml, IsClassTemplate("A", "T, P, bool (*)(int, int),
|
||||||
// N"));
|
// int N"));
|
||||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,P=T,CMP=nullptr,int N=3"));
|
REQUIRE_THAT(puml, IsClassTemplate("A", "T,P=T,CMP=nullptr,int N=3"));
|
||||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T,C<>"));
|
REQUIRE_THAT(puml, IsClassTemplate("B", "T,C<>"));
|
||||||
|
|
||||||
@@ -55,5 +56,19 @@ TEST_CASE("t00008", "[test-case][class]")
|
|||||||
IsInstantiation(
|
IsInstantiation(
|
||||||
_A("E::nested_template<ET>"), _A("E::nested_template<char>")));
|
_A("E::nested_template<ET>"), _A("E::nested_template<char>")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
REQUIRE(IsClassTemplate(
|
||||||
|
j, "A<T,P=T,clanguml::t00008::CMP=nullptr,int N=3>"));
|
||||||
|
REQUIRE(IsClassTemplate(j, "E::nested_template<ET>"));
|
||||||
|
REQUIRE(IsClass(j, "E::nested_template<char>"));
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ TEST_CASE("t00009", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00009_class");
|
REQUIRE(model->name() == "t00009_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -39,8 +40,8 @@ TEST_CASE("t00009", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, (IsField<Public>("value", "T")));
|
REQUIRE_THAT(puml, (IsField<Public>("value", "T")));
|
||||||
REQUIRE_THAT(puml, (IsField<Public>("aint", "A<int>")));
|
REQUIRE_THAT(puml, (IsField<Public>("aint", "A<int>")));
|
||||||
REQUIRE_THAT(puml, (IsField<Public>("astring", "A<std::string> *")));
|
REQUIRE_THAT(puml, (IsField<Public>("astring", "A<std::string> *")));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(puml,
|
||||||
puml, (IsField<Public>("avector", "A<std::vector<std::string>> &")));
|
(IsField<Public>("avector", "A<std::vector<std::string>> &")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<int>")));
|
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<int>")));
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<std::string>")));
|
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<std::string>")));
|
||||||
@@ -49,7 +50,19 @@ TEST_CASE("t00009", "[test-case][class]")
|
|||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsAssociation(_A("B"), _A("A<std::string>"), "+astring"));
|
puml, IsAssociation(_A("B"), _A("A<std::string>"), "+astring"));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsAssociation(_A("B"), _A("A<std::vector<std::string>>"), "+avector"));
|
IsAssociation(
|
||||||
|
_A("B"), _A("A<std::vector<std::string>>"), "+avector"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
REQUIRE(IsClass(j, "A<T>"));
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ TEST_CASE("t00010", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00010_class");
|
REQUIRE(model->name() == "t00010_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -39,12 +40,22 @@ TEST_CASE("t00010", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, (IsField<Public>("astring", "A<T,std::string>")));
|
REQUIRE_THAT(puml, (IsField<Public>("astring", "A<T,std::string>")));
|
||||||
REQUIRE_THAT(puml, (IsField<Public>("aintstring", "B<int>")));
|
REQUIRE_THAT(puml, (IsField<Public>("aintstring", "B<int>")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T,P>"), _A("A<T,std::string>")));
|
REQUIRE_THAT(
|
||||||
|
puml, IsInstantiation(_A("A<T,P>"), _A("A<T,std::string>")));
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("B<T>"), _A("B<int>")));
|
REQUIRE_THAT(puml, IsInstantiation(_A("B<T>"), _A("B<int>")));
|
||||||
|
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(puml,
|
||||||
puml, IsAggregation(_A("B<T>"), _A("A<T,std::string>"), "+astring"));
|
IsAggregation(_A("B<T>"), _A("A<T,std::string>"), "+astring"));
|
||||||
REQUIRE_THAT(puml, IsAggregation(_A("C"), _A("B<int>"), "+aintstring"));
|
REQUIRE_THAT(puml, IsAggregation(_A("C"), _A("B<int>"), "+aintstring"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ TEST_CASE("t00011", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00011_class");
|
REQUIRE(model->name() == "t00011_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -42,5 +43,14 @@ TEST_CASE("t00011", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsFriend<Public>(_A("A"), _A("B")));
|
REQUIRE_THAT(puml, IsFriend<Public>(_A("A"), _A("B")));
|
||||||
// REQUIRE_THAT(puml, IsFriend(_A("A"), _A("D<T>")));
|
// REQUIRE_THAT(puml, IsFriend(_A("A"), _A("D<T>")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ TEST_CASE("t00012", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00012_class");
|
REQUIRE(model->name() == "t00012_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -37,11 +38,22 @@ TEST_CASE("t00012", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClassTemplate("B", "int... Is"));
|
REQUIRE_THAT(puml, IsClassTemplate("B", "int... Is"));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("B<int... Is>"), _A("B<3,2,1>")));
|
REQUIRE_THAT(puml, IsInstantiation(_A("B<int... Is>"), _A("B<3,2,1>")));
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("B<int... Is>"), _A("B<1,1,1,1>")));
|
REQUIRE_THAT(
|
||||||
|
puml, IsInstantiation(_A("B<int... Is>"), _A("B<1,1,1,1>")));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsInstantiation(_A("C<T,int... Is>"),
|
IsInstantiation(_A("C<T,int... Is>"),
|
||||||
_A("C<std::map<int,"
|
_A("C<std::map<int,"
|
||||||
"std::vector<std::vector<std::vector<std::string>>>>,3,3,3>")));
|
"std::vector<std::vector<std::vector<std::string>>>>,3,3,"
|
||||||
|
"3>")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ TEST_CASE("t00013", "[test-case][class]")
|
|||||||
REQUIRE(model->should_include("clanguml::t00013::B"));
|
REQUIRE(model->should_include("clanguml::t00013::B"));
|
||||||
REQUIRE(model->should_include("ABCD::F"));
|
REQUIRE(model->should_include("ABCD::F"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -56,11 +57,22 @@ TEST_CASE("t00013", "[test-case][class]")
|
|||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsAggregation(_A("R"), _A("E<std::string>"), "-estring"));
|
puml, IsAggregation(_A("R"), _A("E<std::string>"), "-estring"));
|
||||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("ABCD::F<T>")));
|
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("ABCD::F<T>")));
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("ABCD::F<T>"), _A("ABCD::F<int>")));
|
REQUIRE_THAT(
|
||||||
|
puml, IsInstantiation(_A("ABCD::F<T>"), _A("ABCD::F<int>")));
|
||||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("ABCD::F<int>")));
|
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("ABCD::F<int>")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsInstantiation(_A("G<T,Args...>"), _A("G<int,float,std::string>")));
|
IsInstantiation(
|
||||||
|
_A("G<T,Args...>"), _A("G<int,float,std::string>")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00014", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00014_class");
|
REQUIRE(model->name() == "t00014_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00014::B"));
|
REQUIRE(model->should_include("clanguml::t00014::B"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -36,9 +37,11 @@ TEST_CASE("t00014", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,P"));
|
REQUIRE_THAT(puml, IsClassTemplate("A", "T,P"));
|
||||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,std::string"));
|
REQUIRE_THAT(puml, IsClassTemplate("A", "T,std::string"));
|
||||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,std::unique_ptr<std::string>"));
|
REQUIRE_THAT(
|
||||||
|
puml, IsClassTemplate("A", "T,std::unique_ptr<std::string>"));
|
||||||
REQUIRE_THAT(puml, IsClassTemplate("A", "double,T"));
|
REQUIRE_THAT(puml, IsClassTemplate("A", "double,T"));
|
||||||
// TODO: Figure out how to handle the same templates with different template
|
// TODO: Figure out how to handle the same templates with different
|
||||||
|
// template
|
||||||
// parameter names
|
// parameter names
|
||||||
// REQUIRE_THAT(puml, !IsClassTemplate("A", "long,U"));
|
// REQUIRE_THAT(puml, !IsClassTemplate("A", "long,U"));
|
||||||
REQUIRE_THAT(puml, IsClassTemplate("A", "long,T"));
|
REQUIRE_THAT(puml, IsClassTemplate("A", "long,T"));
|
||||||
@@ -55,25 +58,31 @@ TEST_CASE("t00014", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsField<Private>("abool", "APtr<bool>"));
|
REQUIRE_THAT(puml, IsField<Private>("abool", "APtr<bool>"));
|
||||||
REQUIRE_THAT(puml, IsField<Private>("aboolfloat", "AAPtr<bool,float>"));
|
REQUIRE_THAT(puml, IsField<Private>("aboolfloat", "AAPtr<bool,float>"));
|
||||||
REQUIRE_THAT(puml, IsField<Private>("afloat", "ASharedPtr<float>"));
|
REQUIRE_THAT(puml, IsField<Private>("afloat", "ASharedPtr<float>"));
|
||||||
REQUIRE_THAT(puml, IsField<Private>("boolstring", "A<bool,std::string>"));
|
REQUIRE_THAT(
|
||||||
REQUIRE_THAT(puml, IsField<Private>("floatstring", "AStringPtr<float>"));
|
puml, IsField<Private>("boolstring", "A<bool,std::string>"));
|
||||||
|
REQUIRE_THAT(
|
||||||
|
puml, IsField<Private>("floatstring", "AStringPtr<float>"));
|
||||||
REQUIRE_THAT(puml, IsField<Private>("intstring", "AIntString"));
|
REQUIRE_THAT(puml, IsField<Private>("intstring", "AIntString"));
|
||||||
REQUIRE_THAT(puml, IsField<Private>("stringstring", "AStringString"));
|
REQUIRE_THAT(puml, IsField<Private>("stringstring", "AStringString"));
|
||||||
REQUIRE_THAT(puml, IsField<Private>("bstringstring", "BStringString"));
|
REQUIRE_THAT(puml, IsField<Private>("bstringstring", "BStringString"));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsField<Protected>("bs", "BVector"));
|
REQUIRE_THAT(puml, IsField<Protected>("bs", "BVector"));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsField<Public>("cb", "SimpleCallback<ACharString>"));
|
REQUIRE_THAT(
|
||||||
|
puml, IsField<Public>("cb", "SimpleCallback<ACharString>"));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsField<Public>("gcb", "GenericCallback<R::AWCharString>"));
|
puml, IsField<Public>("gcb", "GenericCallback<R::AWCharString>"));
|
||||||
REQUIRE_THAT(puml, IsField<Public>("vcb", "VoidCallback"));
|
REQUIRE_THAT(puml, IsField<Public>("vcb", "VoidCallback"));
|
||||||
|
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(puml,
|
||||||
puml, !IsClassTemplate("std::std::function", "void(T...,int),int)"));
|
!IsClassTemplate("std::std::function", "void(T...,int),int)"));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T,P>"), _A("A<T,std::string>")));
|
REQUIRE_THAT(
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<long,T>"), _A("A<long,float>")));
|
puml, IsInstantiation(_A("A<T,P>"), _A("A<T,std::string>")));
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<long,T>"), _A("A<long,bool>")));
|
REQUIRE_THAT(
|
||||||
|
puml, IsInstantiation(_A("A<long,T>"), _A("A<long,float>")));
|
||||||
|
REQUIRE_THAT(
|
||||||
|
puml, IsInstantiation(_A("A<long,T>"), _A("A<long,bool>")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T,P>"), _A("A<long,T>")));
|
REQUIRE_THAT(puml, IsInstantiation(_A("A<T,P>"), _A("A<long,T>")));
|
||||||
// REQUIRE_THAT(puml, !IsInstantiation(_A("A<long,T>"),
|
// REQUIRE_THAT(puml, !IsInstantiation(_A("A<long,T>"),
|
||||||
@@ -83,56 +92,64 @@ TEST_CASE("t00014", "[test-case][class]")
|
|||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsInstantiation(_A("A<double,T>"), _A("A<double,bool>")));
|
puml, IsInstantiation(_A("A<double,T>"), _A("A<double,bool>")));
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T,P>"), _A("A<double,T>")));
|
REQUIRE_THAT(puml, IsInstantiation(_A("A<T,P>"), _A("A<double,T>")));
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T,P>"), _A("A<T,std::string>")));
|
REQUIRE_THAT(
|
||||||
|
puml, IsInstantiation(_A("A<T,P>"), _A("A<T,std::string>")));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsInstantiation(_A("A<T,std::string>"), _A("A<bool,std::string>")));
|
IsInstantiation(_A("A<T,std::string>"), _A("A<bool,std::string>")));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsInstantiation(_A("A<T,std::string>"), _A("A<char,std::string>")));
|
IsInstantiation(_A("A<T,std::string>"), _A("A<char,std::string>")));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsInstantiation(_A("A<T,std::string>"), _A("A<wchar_t,std::string>")));
|
IsInstantiation(
|
||||||
|
_A("A<T,std::string>"), _A("A<wchar_t,std::string>")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsInstantiation(_A("A<T,std::unique_ptr<std::string>>"),
|
IsInstantiation(_A("A<T,std::unique_ptr<std::string>>"),
|
||||||
_A("A<float,std::unique_ptr<std::string>>")));
|
_A("A<float,std::unique_ptr<std::string>>")));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsInstantiation(_A("A<T,P>"), _A("A<T,std::unique_ptr<std::string>>")));
|
IsInstantiation(
|
||||||
|
_A("A<T,P>"), _A("A<T,std::unique_ptr<std::string>>")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "+vps"));
|
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "+vps"));
|
||||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "-bapair"));
|
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "-bapair"));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsAggregation(_A("R"), _A("A<long,float>"), "-aboolfloat"));
|
puml, IsAggregation(_A("R"), _A("A<long,float>"), "-aboolfloat"));
|
||||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A<long,bool>"), "-bapair"));
|
REQUIRE_THAT(
|
||||||
|
puml, IsAggregation(_A("R"), _A("A<long,bool>"), "-bapair"));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsAggregation(_A("R"), _A("A<double,bool>"), "-aboolfloat"));
|
puml, IsAggregation(_A("R"), _A("A<double,bool>"), "-aboolfloat"));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsAssociation(_A("R"), _A("A<double,float>"), "-afloat"));
|
puml, IsAssociation(_A("R"), _A("A<double,float>"), "-afloat"));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(puml,
|
||||||
puml, IsAggregation(_A("R"), _A("A<bool,std::string>"), "-boolstring"));
|
IsAggregation(_A("R"), _A("A<bool,std::string>"), "-boolstring"));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsAggregation(_A("R"), _A("A<float,std::unique_ptr<std::string>>"),
|
IsAggregation(_A("R"), _A("A<float,std::unique_ptr<std::string>>"),
|
||||||
"-floatstring"));
|
"-floatstring"));
|
||||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A<char,std::string>")));
|
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A<char,std::string>")));
|
||||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A<wchar_t,std::string>")));
|
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A<wchar_t,std::string>")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
auto j = generate_class_json(diagram, *model);
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<T,P>"));
|
using namespace json;
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<T,std::string>"));
|
|
||||||
REQUIRE(json::IsClass(
|
REQUIRE(json::IsClass(j, "A<T,P>"));
|
||||||
j, "clanguml::t00014::A<T,std::unique_ptr<std::string>>"));
|
REQUIRE(json::IsClass(j, "A<T,std::string>"));
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<double,T>"));
|
REQUIRE(json::IsClass(j, "A<T,std::unique_ptr<std::string>>"));
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<long,T>"));
|
REQUIRE(json::IsClass(j, "A<double,T>"));
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<long,bool>"));
|
REQUIRE(json::IsClass(j, "A<long,T>"));
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<double,bool>"));
|
REQUIRE(json::IsClass(j, "A<long,bool>"));
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<long,float>"));
|
REQUIRE(json::IsClass(j, "A<double,bool>"));
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<double,bool>"));
|
REQUIRE(json::IsClass(j, "A<long,float>"));
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<double,float>"));
|
REQUIRE(json::IsClass(j, "A<double,bool>"));
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<bool,std::string>"));
|
REQUIRE(json::IsClass(j, "A<double,float>"));
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<std::string,std::string>"));
|
REQUIRE(json::IsClass(j, "A<bool,std::string>"));
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<char,std::string>"));
|
REQUIRE(json::IsClass(j, "A<std::string,std::string>"));
|
||||||
REQUIRE(json::IsClass(j, "clanguml::t00014::B"));
|
REQUIRE(json::IsClass(j, "A<char,std::string>"));
|
||||||
|
REQUIRE(json::IsClass(j, "B"));
|
||||||
|
|
||||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00015", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00015_class");
|
REQUIRE(model->name() == "t00015_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00015::ns1::ns2::A"));
|
REQUIRE(model->should_include("clanguml::t00015::ns1::ns2::A"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -40,5 +41,14 @@ TEST_CASE("t00015", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClass(_A("ns3::ns1::ns2::Anon")));
|
REQUIRE_THAT(puml, IsClass(_A("ns3::ns1::ns2::Anon")));
|
||||||
REQUIRE_THAT(puml, IsClass(_A("ns3::B")));
|
REQUIRE_THAT(puml, IsClass(_A("ns3::B")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00016", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00016_class");
|
REQUIRE(model->name() == "t00016_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00016::is_numeric"));
|
REQUIRE(model->should_include("clanguml::t00016::is_numeric"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -49,5 +50,14 @@ TEST_CASE("t00016", "[test-case][class]")
|
|||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric<float>")));
|
puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric<float>")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ TEST_CASE("t00017", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00017_class");
|
REQUIRE(model->name() == "t00017_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -67,5 +68,14 @@ TEST_CASE("t00017", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("J"), "-j"));
|
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("J"), "-j"));
|
||||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "-k"));
|
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "-k"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ TEST_CASE("t00018", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00018_class");
|
REQUIRE(model->name() == "t00018_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00018::widget"));
|
REQUIRE(model->should_include("clanguml::t00018::widget"));
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -42,5 +42,14 @@ TEST_CASE("t00018", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsDependency(_A("impl::widget"), _A("widget")));
|
REQUIRE_THAT(puml, IsDependency(_A("impl::widget"), _A("widget")));
|
||||||
REQUIRE_THAT(puml, !IsDependency(_A("widget"), _A("widget")));
|
REQUIRE_THAT(puml, !IsDependency(_A("widget"), _A("widget")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ TEST_CASE("t00019", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00019_class");
|
REQUIRE(model->name() == "t00019_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -41,18 +42,29 @@ TEST_CASE("t00019", "[test-case][class]")
|
|||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsBaseClass(_A("Layer3<Base>"), _A("Layer2<Layer3<Base>>")));
|
puml, IsBaseClass(_A("Layer3<Base>"), _A("Layer2<Layer3<Base>>")));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsBaseClass(
|
IsBaseClass(_A("Layer2<Layer3<Base>>"),
|
||||||
_A("Layer2<Layer3<Base>>"), _A("Layer1<Layer2<Layer3<Base>>>")));
|
_A("Layer1<Layer2<Layer3<Base>>>")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsAggregation(_A("A"), _A("Layer1<Layer2<Layer3<Base>>>"), "+layers"));
|
IsAggregation(
|
||||||
|
_A("A"), _A("Layer1<Layer2<Layer3<Base>>>"), "+layers"));
|
||||||
|
|
||||||
|
REQUIRE_THAT(puml,
|
||||||
|
!IsAggregation(_A("A"), _A("Layer2<Layer3<Base>>"), "+layers"));
|
||||||
|
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, !IsAggregation(_A("A"), _A("Layer2<Layer3<Base>>"), "+layers"));
|
puml, !IsAggregation(_A("A"), _A("Layer3<Base>"), "+layers"));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, !IsAggregation(_A("A"), _A("Layer3<Base>"), "+layers"));
|
|
||||||
|
|
||||||
REQUIRE_THAT(puml, !IsAggregation(_A("A"), _A("Base"), "+layers"));
|
REQUIRE_THAT(puml, !IsAggregation(_A("A"), _A("Base"), "+layers"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00020", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00020_class");
|
REQUIRE(model->name() == "t00020_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00020::ProductA"));
|
REQUIRE(model->should_include("clanguml::t00020::ProductA"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -44,5 +45,14 @@ TEST_CASE("t00020", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClass(_A("Factory1")));
|
REQUIRE_THAT(puml, IsClass(_A("Factory1")));
|
||||||
REQUIRE_THAT(puml, IsClass(_A("Factory2")));
|
REQUIRE_THAT(puml, IsClass(_A("Factory2")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00021", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00021_class");
|
REQUIRE(model->name() == "t00021_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00021::Visitor"));
|
REQUIRE(model->should_include("clanguml::t00021::Visitor"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -42,5 +43,14 @@ TEST_CASE("t00021", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClass(_A("Visitor2")));
|
REQUIRE_THAT(puml, IsClass(_A("Visitor2")));
|
||||||
REQUIRE_THAT(puml, IsClass(_A("Visitor3")));
|
REQUIRE_THAT(puml, IsClass(_A("Visitor3")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00022", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00022_class");
|
REQUIRE(model->name() == "t00022_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00022::A"));
|
REQUIRE(model->should_include("clanguml::t00022::A"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -38,5 +39,14 @@ TEST_CASE("t00022", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClass(_A("A1")));
|
REQUIRE_THAT(puml, IsClass(_A("A1")));
|
||||||
REQUIRE_THAT(puml, IsClass(_A("A2")));
|
REQUIRE_THAT(puml, IsClass(_A("A2")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00023", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00023_class");
|
REQUIRE(model->name() == "t00023_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00023::Visitor"));
|
REQUIRE(model->should_include("clanguml::t00023::Visitor"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -38,5 +39,14 @@ TEST_CASE("t00023", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClass(_A("StrategyA")));
|
REQUIRE_THAT(puml, IsClass(_A("StrategyA")));
|
||||||
REQUIRE_THAT(puml, IsClass(_A("StrategyB")));
|
REQUIRE_THAT(puml, IsClass(_A("StrategyB")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00024", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00024_class");
|
REQUIRE(model->name() == "t00024_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00024::A"));
|
REQUIRE(model->should_include("clanguml::t00024::A"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -42,5 +43,14 @@ TEST_CASE("t00024", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Target2")));
|
REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Target2")));
|
||||||
REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Proxy")));
|
REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Proxy")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00025", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00025_class");
|
REQUIRE(model->name() == "t00025_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00025::A"));
|
REQUIRE(model->should_include("clanguml::t00025::A"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -37,8 +38,10 @@ TEST_CASE("t00025", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClass(_A("Target1")));
|
REQUIRE_THAT(puml, IsClass(_A("Target1")));
|
||||||
REQUIRE_THAT(puml, IsClass(_A("Target2")));
|
REQUIRE_THAT(puml, IsClass(_A("Target2")));
|
||||||
REQUIRE_THAT(puml, IsClassTemplate("Proxy", "T"));
|
REQUIRE_THAT(puml, IsClassTemplate("Proxy", "T"));
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("Proxy<T>"), _A("Proxy<Target1>")));
|
REQUIRE_THAT(
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("Proxy<T>"), _A("Proxy<Target2>")));
|
puml, IsInstantiation(_A("Proxy<T>"), _A("Proxy<Target1>")));
|
||||||
|
REQUIRE_THAT(
|
||||||
|
puml, IsInstantiation(_A("Proxy<T>"), _A("Proxy<Target2>")));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsAggregation(_A("ProxyHolder"), _A("Proxy<Target1>"), "+proxy1"));
|
IsAggregation(_A("ProxyHolder"), _A("Proxy<Target1>"), "+proxy1"));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
@@ -50,5 +53,14 @@ TEST_CASE("t00025", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsDependency(_A("Proxy<Target1>"), _A("Target1")));
|
REQUIRE_THAT(puml, IsDependency(_A("Proxy<Target1>"), _A("Target1")));
|
||||||
REQUIRE_THAT(puml, IsDependency(_A("Proxy<Target2>"), _A("Target2")));
|
REQUIRE_THAT(puml, IsDependency(_A("Proxy<Target2>"), _A("Target2")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00026", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00026_class");
|
REQUIRE(model->name() == "t00026_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00026::A"));
|
REQUIRE(model->should_include("clanguml::t00026::A"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -38,9 +39,19 @@ TEST_CASE("t00026", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClassTemplate("Originator", "T"));
|
REQUIRE_THAT(puml, IsClassTemplate("Originator", "T"));
|
||||||
REQUIRE_THAT(puml, IsClassTemplate("Caretaker", "T"));
|
REQUIRE_THAT(puml, IsClassTemplate("Caretaker", "T"));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsInstantiation(_A("Originator<T>"), _A("Originator<std::string>")));
|
IsInstantiation(
|
||||||
|
_A("Originator<T>"), _A("Originator<std::string>")));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsInstantiation(_A("Caretaker<T>"), _A("Caretaker<std::string>")));
|
IsInstantiation(_A("Caretaker<T>"), _A("Caretaker<std::string>")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00027", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00027_class");
|
REQUIRE(model->name() == "t00027_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00027::A"));
|
REQUIRE(model->should_include("clanguml::t00027::A"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -38,21 +39,32 @@ TEST_CASE("t00027", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsAbstractClass(_A("ShapeDecorator")));
|
REQUIRE_THAT(puml, IsAbstractClass(_A("ShapeDecorator")));
|
||||||
REQUIRE_THAT(puml, IsClassTemplate("Line", "T<>..."));
|
REQUIRE_THAT(puml, IsClassTemplate("Line", "T<>..."));
|
||||||
REQUIRE_THAT(puml, IsClassTemplate("Text", "T<>..."));
|
REQUIRE_THAT(puml, IsClassTemplate("Text", "T<>..."));
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("Line<T<>...>"), _A("Line<Color>")));
|
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsInstantiation(_A("Line<T<>...>"), _A("Line<Color,Weight>")));
|
puml, IsInstantiation(_A("Line<T<>...>"), _A("Line<Color>")));
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("Text<T<>...>"), _A("Text<Color>")));
|
REQUIRE_THAT(puml,
|
||||||
|
IsInstantiation(_A("Line<T<>...>"), _A("Line<Color,Weight>")));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsInstantiation(_A("Text<T<>...>"), _A("Text<Color,Weight>")));
|
puml, IsInstantiation(_A("Text<T<>...>"), _A("Text<Color>")));
|
||||||
|
REQUIRE_THAT(puml,
|
||||||
|
IsInstantiation(_A("Text<T<>...>"), _A("Text<Color,Weight>")));
|
||||||
|
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(puml,
|
||||||
puml, IsAggregation(_A("Window"), _A("Line<Color,Weight>"), "+border"));
|
IsAggregation(_A("Window"), _A("Line<Color,Weight>"), "+border"));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsAggregation(_A("Window"), _A("Line<Color>"), "+divider"));
|
puml, IsAggregation(_A("Window"), _A("Line<Color>"), "+divider"));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(puml,
|
||||||
puml, IsAggregation(_A("Window"), _A("Text<Color,Weight>"), "+title"));
|
IsAggregation(_A("Window"), _A("Text<Color,Weight>"), "+title"));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(puml,
|
||||||
puml, IsAggregation(_A("Window"), _A("Text<Color>"), "+description"));
|
IsAggregation(_A("Window"), _A("Text<Color>"), "+description"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00028", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00028_class");
|
REQUIRE(model->name() == "t00028_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00028::A"));
|
REQUIRE(model->should_include("clanguml::t00028::A"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -50,16 +51,27 @@ D
|
|||||||
class
|
class
|
||||||
note.)";
|
note.)";
|
||||||
REQUIRE_THAT(puml, HasNote(_A("D"), "left", d_note));
|
REQUIRE_THAT(puml, HasNote(_A("D"), "left", d_note));
|
||||||
REQUIRE_THAT(puml, HasNote(_A("E<T>"), "left", "E template class note."));
|
REQUIRE_THAT(
|
||||||
|
puml, HasNote(_A("E<T>"), "left", "E template class note."));
|
||||||
REQUIRE_THAT(puml, HasNote(_A("F"), "bottom", "F enum note."));
|
REQUIRE_THAT(puml, HasNote(_A("F"), "bottom", "F enum note."));
|
||||||
REQUIRE_THAT(puml, !HasNote(_A("G"), "left", "G class note."));
|
REQUIRE_THAT(puml, !HasNote(_A("G"), "left", "G class note."));
|
||||||
REQUIRE_THAT(puml, HasNote(_A("R"), "right", "R class note."));
|
REQUIRE_THAT(puml, HasNote(_A("R"), "right", "R class note."));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
HasMemberNote(_A("R"), "aaa", "left", "R contains an instance of A."));
|
HasMemberNote(
|
||||||
|
_A("R"), "aaa", "left", "R contains an instance of A."));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, !HasMemberNote(_A("R"), "bbb", "right", "R class note."));
|
puml, !HasMemberNote(_A("R"), "bbb", "right", "R class note."));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, HasMemberNote(_A("R"), "ccc", "left", "Reference to C."));
|
puml, HasMemberNote(_A("R"), "ccc", "left", "Reference to C."));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00029", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00029_class");
|
REQUIRE(model->name() == "t00029_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00029::A"));
|
REQUIRE(model->should_include("clanguml::t00029::A"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -53,5 +54,14 @@ TEST_CASE("t00029", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, !IsAggregation(_A("R"), _A("G3"), "+g3"));
|
REQUIRE_THAT(puml, !IsAggregation(_A("R"), _A("G3"), "+g3"));
|
||||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G4"), "+g4"));
|
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G4"), "+g4"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00030", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00030_class");
|
REQUIRE(model->name() == "t00030_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00030::A"));
|
REQUIRE(model->should_include("clanguml::t00030::A"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -41,10 +42,21 @@ TEST_CASE("t00030", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("A"), "+aaa"));
|
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("A"), "+aaa"));
|
||||||
REQUIRE_THAT(puml, IsComposition(_A("R"), _A("B"), "+bbb", "0..1", "1..*"));
|
REQUIRE_THAT(
|
||||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("C"), "+ccc", "0..1", "1..5"));
|
puml, IsComposition(_A("R"), _A("B"), "+bbb", "0..1", "1..*"));
|
||||||
|
REQUIRE_THAT(
|
||||||
|
puml, IsAggregation(_A("R"), _A("C"), "+ccc", "0..1", "1..5"));
|
||||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "+ddd", "", "1"));
|
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "+ddd", "", "1"));
|
||||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("E"), "+eee", "", "1"));
|
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("E"), "+eee", "", "1"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00031", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00031_class");
|
REQUIRE(model->name() == "t00031_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00031::A"));
|
REQUIRE(model->should_include("clanguml::t00031::A"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -53,5 +54,14 @@ TEST_CASE("t00031", "[test-case][class]")
|
|||||||
IsAssociationWithStyle(
|
IsAssociationWithStyle(
|
||||||
_A("R"), _A("D"), "+ddd", "#blue,plain,thickness=16"));
|
_A("R"), _A("D"), "+ddd", "#blue,plain,thickness=16"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ TEST_CASE("t00032", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00032_class");
|
REQUIRE(model->name() == "t00032_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00032::A"));
|
REQUIRE(model->should_include("clanguml::t00032::A"));
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -47,9 +47,21 @@ TEST_CASE("t00032", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("Overload<T,L,Ts...>")));
|
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("Overload<T,L,Ts...>")));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsBaseClass(_A("TBase"), _A("Overload<TBase,int,A,B,C>")));
|
puml, IsBaseClass(_A("TBase"), _A("Overload<TBase,int,A,B,C>")));
|
||||||
REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("Overload<TBase,int,A,B,C>")));
|
REQUIRE_THAT(
|
||||||
REQUIRE_THAT(puml, IsBaseClass(_A("B"), _A("Overload<TBase,int,A,B,C>")));
|
puml, IsBaseClass(_A("A"), _A("Overload<TBase,int,A,B,C>")));
|
||||||
REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("Overload<TBase,int,A,B,C>")));
|
REQUIRE_THAT(
|
||||||
|
puml, IsBaseClass(_A("B"), _A("Overload<TBase,int,A,B,C>")));
|
||||||
|
REQUIRE_THAT(
|
||||||
|
puml, IsBaseClass(_A("C"), _A("Overload<TBase,int,A,B,C>")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00033", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00033_class");
|
REQUIRE(model->name() == "t00033_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00033::A"));
|
REQUIRE(model->should_include("clanguml::t00033::A"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -42,8 +43,8 @@ TEST_CASE("t00033", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsDependency(
|
IsDependency(_A("A<B<std::unique_ptr<C<D>>>>"),
|
||||||
_A("A<B<std::unique_ptr<C<D>>>>"), _A("B<std::unique_ptr<C<D>>>")));
|
_A("B<std::unique_ptr<C<D>>>")));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsDependency(_A("B<std::unique_ptr<C<D>>>"), _A("C<D>")));
|
puml, IsDependency(_A("B<std::unique_ptr<C<D>>>"), _A("C<D>")));
|
||||||
REQUIRE_THAT(puml, IsDependency(_A("C<D>"), _A("D")));
|
REQUIRE_THAT(puml, IsDependency(_A("C<D>"), _A("D")));
|
||||||
@@ -51,8 +52,17 @@ TEST_CASE("t00033", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsInstantiation(_A("C<T>"), _A("C<D>")));
|
REQUIRE_THAT(puml, IsInstantiation(_A("C<T>"), _A("C<D>")));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsInstantiation(_A("B<T>"), _A("B<std::unique_ptr<C<D>>>")));
|
puml, IsInstantiation(_A("B<T>"), _A("B<std::unique_ptr<C<D>>>")));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(puml,
|
||||||
puml, IsInstantiation(_A("A<T>"), _A("A<B<std::unique_ptr<C<D>>>>")));
|
IsInstantiation(_A("A<T>"), _A("A<B<std::unique_ptr<C<D>>>>")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00034", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00034_class");
|
REQUIRE(model->name() == "t00034_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00034::A"));
|
REQUIRE(model->should_include("clanguml::t00034::A"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -46,5 +47,14 @@ TEST_CASE("t00034", "[test-case][class]")
|
|||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsInstantiation(_A("drop_void<T>"), _A("drop_void<Void>")));
|
puml, IsInstantiation(_A("drop_void<T>"), _A("drop_void<Void>")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00035", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00035_class");
|
REQUIRE(model->name() == "t00035_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00035::A"));
|
REQUIRE(model->should_include("clanguml::t00035::A"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -46,5 +47,14 @@ TEST_CASE("t00035", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "right", _A("Right")));
|
REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "right", _A("Right")));
|
||||||
REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "down", _A("Bottom")));
|
REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "down", _A("Bottom")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ TEST_CASE("t00036", "[test-case][class]")
|
|||||||
auto model = generate_class_diagram(*db, diagram);
|
auto model = generate_class_diagram(*db, diagram);
|
||||||
|
|
||||||
REQUIRE(model->name() == "t00036_class");
|
REQUIRE(model->name() == "t00036_class");
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -45,14 +45,24 @@ TEST_CASE("t00036", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE_THAT(puml, IsAggregation(_A("B"), _A("A<int>"), "+a_int"));
|
REQUIRE_THAT(puml, IsAggregation(_A("B"), _A("A<int>"), "+a_int"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
auto j = generate_class_json(diagram, *model);
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
// REQUIRE(json::IsClass(j, "clanguml::t00036::A<T>"));
|
using namespace json;
|
||||||
// REQUIRE(json::IsClass(j, "clanguml::t00036::A<int>"));
|
|
||||||
// REQUIRE(json::IsClass(j, "clanguml::t00036::B"));
|
REQUIRE(IsClass(j, "ns1::ns11::A<T>"));
|
||||||
// REQUIRE(json::IsClass(j, "clanguml::t00036::C"));
|
REQUIRE(IsClass(j, "ns1::ns11::A<int>"));
|
||||||
|
REQUIRE(IsClass(j, "ns1::ns11::ns111::B"));
|
||||||
|
REQUIRE(IsClass(j, "ns2::ns22::C"));
|
||||||
|
REQUIRE(IsEnum(j, "ns1::E"));
|
||||||
|
REQUIRE(IsPackage(j, "ns1"));
|
||||||
|
REQUIRE(IsPackage(j, "ns1::ns11"));
|
||||||
|
REQUIRE(IsPackage(j, "ns1::ns11::ns111"));
|
||||||
|
REQUIRE(IsPackage(j, "ns2"));
|
||||||
|
|
||||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00037", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00037_class");
|
REQUIRE(model->name() == "t00037_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -39,9 +40,19 @@ TEST_CASE("t00037", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||||
REQUIRE_THAT(puml, IsClass(_A("ST::(units)")));
|
REQUIRE_THAT(puml, IsClass(_A("ST::(units)")));
|
||||||
REQUIRE_THAT(puml, IsClass(_A("ST::(dimensions)")));
|
REQUIRE_THAT(puml, IsClass(_A("ST::(dimensions)")));
|
||||||
|
REQUIRE_THAT(puml,
|
||||||
|
IsAggregation(_A("ST"), _A("ST::(dimensions)"), "+dimensions"));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsAggregation(_A("ST"), _A("ST::(dimensions)"), "+dimensions"));
|
puml, IsAggregation(_A("ST"), _A("ST::(units)"), "-units"));
|
||||||
REQUIRE_THAT(puml, IsAggregation(_A("ST"), _A("ST::(units)"), "-units"));
|
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00038", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00038_class");
|
REQUIRE(model->name() == "t00038_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -57,7 +58,8 @@ TEST_CASE("t00038", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsInstantiation(_A("map<T>"),
|
IsInstantiation(_A("map<T>"),
|
||||||
_A("map<std::map<key_t,std::vector<std::integral_constant<property_"
|
_A("map<std::map<key_t,std::vector<std::integral_constant<"
|
||||||
|
"property_"
|
||||||
"t,property_t::property_c>>>>")));
|
"t,property_t::property_c>>>>")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
@@ -72,17 +74,20 @@ TEST_CASE("t00038", "[test-case][class]")
|
|||||||
_A("property_t")));
|
_A("property_t")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsDependency(_A("map<std::map<key_t,std::vector<std::integral_constant<"
|
IsDependency(
|
||||||
|
_A("map<std::map<key_t,std::vector<std::integral_constant<"
|
||||||
"property_t,property_t::property_c>>>>"),
|
"property_t,property_t::property_c>>>>"),
|
||||||
_A("property_t")));
|
_A("property_t")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsDependency(_A("map<std::map<key_t,std::vector<std::integral_constant<"
|
IsDependency(
|
||||||
|
_A("map<std::map<key_t,std::vector<std::integral_constant<"
|
||||||
"property_t,property_t::property_c>>>>"),
|
"property_t,property_t::property_c>>>>"),
|
||||||
_A("key_t")));
|
_A("key_t")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsDependency(_A("map<std::integral_constant<thirdparty::ns1::color_t,"
|
IsDependency(
|
||||||
|
_A("map<std::integral_constant<thirdparty::ns1::color_t,"
|
||||||
"thirdparty::ns1::color_t::red>>"),
|
"thirdparty::ns1::color_t::red>>"),
|
||||||
_A("thirdparty::ns1::color_t")));
|
_A("thirdparty::ns1::color_t")));
|
||||||
|
|
||||||
@@ -91,5 +96,14 @@ TEST_CASE("t00038", "[test-case][class]")
|
|||||||
_A("map<std::integral_constant<thirdparty::ns1::color_t,"
|
_A("map<std::integral_constant<thirdparty::ns1::color_t,"
|
||||||
"thirdparty::ns1::color_t::red>>")));
|
"thirdparty::ns1::color_t::red>>")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ TEST_CASE("t00039", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(diagram->name == "t00039_class");
|
REQUIRE(diagram->name == "t00039_class");
|
||||||
REQUIRE(diagram->generate_packages() == false);
|
REQUIRE(diagram->generate_packages() == false);
|
||||||
|
|
||||||
auto model = generate_class_diagram(*db, diagram);
|
auto model = generate_class_diagram(*db, diagram);
|
||||||
|
|
||||||
REQUIRE(model->name() == "t00039_class");
|
REQUIRE(model->name() == "t00039_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -63,5 +63,14 @@ TEST_CASE("t00039", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClassTemplate("ns3::FE", "T,M"));
|
REQUIRE_THAT(puml, IsClassTemplate("ns3::FE", "T,M"));
|
||||||
REQUIRE_THAT(puml, IsClassTemplate("ns3::FFF", "T,M,N"));
|
REQUIRE_THAT(puml, IsClassTemplate("ns3::FFF", "T,M,N"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ TEST_CASE("t00040", "[test-case][class]")
|
|||||||
auto model = generate_class_diagram(*db, diagram);
|
auto model = generate_class_diagram(*db, diagram);
|
||||||
|
|
||||||
REQUIRE(model->name() == "t00040_class");
|
REQUIRE(model->name() == "t00040_class");
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -45,5 +45,14 @@ TEST_CASE("t00040", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE_THAT(puml, !IsDependency(_A("R"), _A("A")));
|
REQUIRE_THAT(puml, !IsDependency(_A("R"), _A("A")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ TEST_CASE("t00041", "[test-case][class]")
|
|||||||
auto model = generate_class_diagram(*db, diagram);
|
auto model = generate_class_diagram(*db, diagram);
|
||||||
|
|
||||||
REQUIRE(model->name() == "t00041_class");
|
REQUIRE(model->name() == "t00041_class");
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -64,5 +64,14 @@ TEST_CASE("t00041", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsBaseClass(_A("ns1::N"), _A("ns1::NN")));
|
REQUIRE_THAT(puml, IsBaseClass(_A("ns1::N"), _A("ns1::NN")));
|
||||||
REQUIRE_THAT(puml, IsBaseClass(_A("ns1::N"), _A("ns1::NM")));
|
REQUIRE_THAT(puml, IsBaseClass(_A("ns1::N"), _A("ns1::NM")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00042", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00042_class");
|
REQUIRE(model->name() == "t00042_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -39,5 +40,14 @@ TEST_CASE("t00042", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T,K"));
|
REQUIRE_THAT(puml, IsClassTemplate("B", "T,K"));
|
||||||
REQUIRE_THAT(puml, !IsClassTemplate("C", "T"));
|
REQUIRE_THAT(puml, !IsClassTemplate("C", "T"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00043", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00043_class");
|
REQUIRE(model->name() == "t00043_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -62,5 +63,14 @@ TEST_CASE("t00043", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsDependency(_A("I"), _A("H")));
|
REQUIRE_THAT(puml, IsDependency(_A("I"), _A("H")));
|
||||||
REQUIRE_THAT(puml, IsDependency(_A("J"), _A("I")));
|
REQUIRE_THAT(puml, IsDependency(_A("J"), _A("I")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ TEST_CASE("t00044", "[test-case][class]")
|
|||||||
auto model = generate_class_diagram(*db, diagram);
|
auto model = generate_class_diagram(*db, diagram);
|
||||||
|
|
||||||
REQUIRE(model->name() == "t00044_class");
|
REQUIRE(model->name() == "t00044_class");
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -37,7 +37,17 @@ TEST_CASE("t00044", "[test-case][class]")
|
|||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// Check dependants filter<void(int), bool>
|
// Check dependants filter<void(int), bool>
|
||||||
// REQUIRE_THAT(puml, IsClassTemplate("signal_handler", "Ret,Args...,A"));
|
// REQUIRE_THAT(puml, IsClassTemplate("signal_handler",
|
||||||
|
// "Ret,Args...,A"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ TEST_CASE("t00045", "[test-case][class]")
|
|||||||
REQUIRE(model->name() == "t00045_class");
|
REQUIRE(model->name() == "t00045_class");
|
||||||
REQUIRE(model->should_include("clanguml::t00045::ns1::ns2::A"));
|
REQUIRE(model->should_include("clanguml::t00045::ns1::ns2::A"));
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -54,7 +55,8 @@ TEST_CASE("t00045", "[test-case][class]")
|
|||||||
puml, IsAssociation(_A("ns1::ns2::R"), _A("ns1::A"), "+ns1_a"));
|
puml, IsAssociation(_A("ns1::ns2::R"), _A("ns1::A"), "+ns1_a"));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsAssociation(_A("ns1::ns2::R"), _A("ns1::ns2::A"), "+ns1_ns2_a"));
|
IsAssociation(_A("ns1::ns2::R"), _A("ns1::ns2::A"), "+ns1_ns2_a"));
|
||||||
REQUIRE_THAT(puml, IsAssociation(_A("ns1::ns2::R"), _A("A"), "+root_a"));
|
REQUIRE_THAT(
|
||||||
|
puml, IsAssociation(_A("ns1::ns2::R"), _A("A"), "+root_a"));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsDependency(_A("ns1::ns2::R"), _A("AA")));
|
REQUIRE_THAT(puml, IsDependency(_A("ns1::ns2::R"), _A("AA")));
|
||||||
|
|
||||||
@@ -62,7 +64,17 @@ TEST_CASE("t00045", "[test-case][class]")
|
|||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, !IsFriend<Public>(_A("ns1::ns2::R"), _A("ns1::ns2::AAA")));
|
puml, !IsFriend<Public>(_A("ns1::ns2::R"), _A("ns1::ns2::AAA")));
|
||||||
// TODO:
|
// TODO:
|
||||||
// REQUIRE_THAT(puml, IsFriend<Public>(_A("ns1::ns2::R"), _A("AAAA<T>")));
|
// REQUIRE_THAT(puml, IsFriend<Public>(_A("ns1::ns2::R"),
|
||||||
|
// _A("AAAA<T>")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ TEST_CASE("t00046", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00046_class");
|
REQUIRE(model->name() == "t00046_class");
|
||||||
REQUIRE(model->should_include("ns1::ns2::A"));
|
REQUIRE(model->should_include("ns1::ns2::A"));
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -43,5 +43,14 @@ TEST_CASE("t00046", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE_THAT(puml, IsField<Public>("i", "std::vector<std::uint8_t>"));
|
REQUIRE_THAT(puml, IsField<Public>("i", "std::vector<std::uint8_t>"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ TEST_CASE("t00047", "[test-case][class]")
|
|||||||
auto model = generate_class_diagram(*db, diagram);
|
auto model = generate_class_diagram(*db, diagram);
|
||||||
|
|
||||||
REQUIRE(model->name() == "t00047_class");
|
REQUIRE(model->name() == "t00047_class");
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -42,5 +42,14 @@ TEST_CASE("t00047", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsClassTemplate("conditional_t", "std::false_type,Result,Tail..."));
|
IsClassTemplate("conditional_t", "std::false_type,Result,Tail..."));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ TEST_CASE("t00048", "[test-case][class]")
|
|||||||
auto model = generate_class_diagram(*db, diagram);
|
auto model = generate_class_diagram(*db, diagram);
|
||||||
|
|
||||||
REQUIRE(model->name() == "t00048_class");
|
REQUIRE(model->name() == "t00048_class");
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -48,5 +48,14 @@ TEST_CASE("t00048", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("A")));
|
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("A")));
|
||||||
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("B")));
|
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("B")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ TEST_CASE("t00049", "[test-case][class]")
|
|||||||
auto model = generate_class_diagram(*db, diagram);
|
auto model = generate_class_diagram(*db, diagram);
|
||||||
|
|
||||||
REQUIRE(model->name() == "t00049_class");
|
REQUIRE(model->name() == "t00049_class");
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -56,5 +56,14 @@ TEST_CASE("t00049", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<thestring>")));
|
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<thestring>")));
|
||||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<intmap>")));
|
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<intmap>")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ TEST_CASE("t00050", "[test-case][class]")
|
|||||||
auto model = generate_class_diagram(*db, diagram);
|
auto model = generate_class_diagram(*db, diagram);
|
||||||
|
|
||||||
REQUIRE(model->name() == "t00050_class");
|
REQUIRE(model->name() == "t00050_class");
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -53,5 +53,14 @@ TEST_CASE("t00050", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, HasNote(_A("G"), "bottom"));
|
REQUIRE_THAT(puml, HasNote(_A("G"), "bottom"));
|
||||||
REQUIRE_THAT(puml, HasNote(_A("G"), "right"));
|
REQUIRE_THAT(puml, HasNote(_A("G"), "right"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,7 @@ TEST_CASE("t00051", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00051_class");
|
REQUIRE(model->name() == "t00051_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -50,8 +51,8 @@ TEST_CASE("t00051", "[test-case][class]")
|
|||||||
"B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at "
|
"B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at "
|
||||||
"../../tests/t00051/t00051.cc:43:27)>")));
|
"../../tests/t00051/t00051.cc:43:27)>")));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
(IsMethod<Private>(
|
(IsMethod<Private>("get_function",
|
||||||
"get_function", "(lambda at ../../tests/t00051/t00051.cc:48:16)")));
|
"(lambda at ../../tests/t00051/t00051.cc:48:16)")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsClassTemplate("B", "F,FF=F"));
|
REQUIRE_THAT(puml, IsClassTemplate("B", "F,FF=F"));
|
||||||
REQUIRE_THAT(puml, (IsMethod<Public>("f", "void")));
|
REQUIRE_THAT(puml, (IsMethod<Public>("f", "void")));
|
||||||
@@ -64,13 +65,25 @@ TEST_CASE("t00051", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsInstantiation(_A("B<F,FF=F>"),
|
IsInstantiation(_A("B<F,FF=F>"),
|
||||||
_A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at "
|
_A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda "
|
||||||
|
"at "
|
||||||
"../../tests/t00051/t00051.cc:43:27)>")));
|
"../../tests/t00051/t00051.cc:43:27)>")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsDependency(_A("A"),
|
IsDependency(_A("A"),
|
||||||
_A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at "
|
_A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda "
|
||||||
|
"at "
|
||||||
"../../tests/t00051/t00051.cc:43:27)>")));
|
"../../tests/t00051/t00051.cc:43:27)>")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,7 @@ TEST_CASE("t00052", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00052_class");
|
REQUIRE(model->name() == "t00052_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -42,9 +43,19 @@ TEST_CASE("t00052", "[test-case][class]")
|
|||||||
|
|
||||||
// Check if all methods exist
|
// Check if all methods exist
|
||||||
REQUIRE_THAT(puml, (IsMethod<Public>("a<T>", "T", "T p")));
|
REQUIRE_THAT(puml, (IsMethod<Public>("a<T>", "T", "T p")));
|
||||||
REQUIRE_THAT(puml, (IsMethod<Public>("aa<F,Q>", "void", "F && f, Q q")));
|
REQUIRE_THAT(
|
||||||
|
puml, (IsMethod<Public>("aa<F,Q>", "void", "F && f, Q q")));
|
||||||
REQUIRE_THAT(puml, (IsMethod<Public>("b", "T", "T t")));
|
REQUIRE_THAT(puml, (IsMethod<Public>("b", "T", "T t")));
|
||||||
REQUIRE_THAT(puml, (IsMethod<Public>("bb<F>", "T", "F && f, T t")));
|
REQUIRE_THAT(puml, (IsMethod<Public>("bb<F>", "T", "F && f, T t")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,7 @@ TEST_CASE("t00053", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00053_class");
|
REQUIRE(model->name() == "t00053_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -51,5 +52,15 @@ TEST_CASE("t00053", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClass(_A("F")));
|
REQUIRE_THAT(puml, IsClass(_A("F")));
|
||||||
REQUIRE_THAT(puml, IsClass(_A("G")));
|
REQUIRE_THAT(puml, IsClass(_A("G")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,7 @@ TEST_CASE("t00054", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00054_class");
|
REQUIRE(model->name() == "t00054_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -55,5 +56,15 @@ TEST_CASE("t00054", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsEnum(_A("h")));
|
REQUIRE_THAT(puml, IsEnum(_A("h")));
|
||||||
REQUIRE_THAT(puml, IsEnum(_A("j")));
|
REQUIRE_THAT(puml, IsEnum(_A("j")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,7 @@ TEST_CASE("t00055", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00055_class");
|
REQUIRE(model->name() == "t00055_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -56,5 +57,15 @@ TEST_CASE("t00055", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsLayoutHint(_A("F"), "down", _A("H")));
|
REQUIRE_THAT(puml, IsLayoutHint(_A("F"), "down", _A("H")));
|
||||||
REQUIRE_THAT(puml, IsLayoutHint(_A("H"), "down", _A("J")));
|
REQUIRE_THAT(puml, IsLayoutHint(_A("H"), "down", _A("J")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ TEST_CASE("t00056", "[test-case][class]")
|
|||||||
auto model = generate_class_diagram(*db, diagram);
|
auto model = generate_class_diagram(*db, diagram);
|
||||||
|
|
||||||
REQUIRE(model->name() == "t00056_class");
|
REQUIRE(model->name() == "t00056_class");
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -45,8 +45,8 @@ TEST_CASE("t00056", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsConcept(_A("iterable_or_small_value_type<T>")));
|
REQUIRE_THAT(puml, IsConcept(_A("iterable_or_small_value_type<T>")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsConceptRequirement(
|
IsConceptRequirement(_A("greater_than_with_requires<T,P>"),
|
||||||
_A("greater_than_with_requires<T,P>"), "sizeof (l) > sizeof (r)"));
|
"sizeof (l) > sizeof (r)"));
|
||||||
|
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsConceptRequirement(_A("iterable<T>"), "container.begin()"));
|
puml, IsConceptRequirement(_A("iterable<T>"), "container.begin()"));
|
||||||
@@ -59,11 +59,12 @@ TEST_CASE("t00056", "[test-case][class]")
|
|||||||
_A("convertible_to_string<T>"), "std::string({s})"));
|
_A("convertible_to_string<T>"), "std::string({s})"));
|
||||||
#else
|
#else
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsConceptRequirement(_A("convertible_to_string<T>"), "std::string{s}"));
|
IsConceptRequirement(
|
||||||
|
_A("convertible_to_string<T>"), "std::string{s}"));
|
||||||
#endif
|
#endif
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsConceptRequirement(
|
IsConceptRequirement(_A("convertible_to_string<T>"),
|
||||||
_A("convertible_to_string<T>"), "{std::to_string(s)} noexcept"));
|
"{std::to_string(s)} noexcept"));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsConceptRequirement(_A("convertible_to_string<T>"),
|
IsConceptRequirement(_A("convertible_to_string<T>"),
|
||||||
"{std::to_string(s)} -> std::same_as<std::string>"));
|
"{std::to_string(s)} -> std::same_as<std::string>"));
|
||||||
@@ -79,7 +80,8 @@ TEST_CASE("t00056", "[test-case][class]")
|
|||||||
|
|
||||||
// Check if all relationships exist
|
// Check if all relationships exist
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsConstraint(_A("A<max_four_bytes T>"), _A("max_four_bytes<T>"), "T"));
|
IsConstraint(
|
||||||
|
_A("A<max_four_bytes T>"), _A("max_four_bytes<T>"), "T"));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||||
@@ -95,8 +97,8 @@ TEST_CASE("t00056", "[test-case][class]")
|
|||||||
_A("iterable<T>"), "T3"));
|
_A("iterable<T>"), "T3"));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsConstraint(
|
IsConstraint(_A("iterable_with_value_type<T>"),
|
||||||
_A("iterable_with_value_type<T>"), _A("has_value_type<T>"), "T"));
|
_A("has_value_type<T>"), "T"));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsConstraint(_A("iterable_or_small_value_type<T>"),
|
IsConstraint(_A("iterable_or_small_value_type<T>"),
|
||||||
@@ -106,20 +108,21 @@ TEST_CASE("t00056", "[test-case][class]")
|
|||||||
_A("iterable_with_value_type<T>"), "T"));
|
_A("iterable_with_value_type<T>"), "T"));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsConstraint(
|
IsConstraint(_A("E<T1,T2,T3>"),
|
||||||
_A("E<T1,T2,T3>"), _A("greater_than_with_requires<T,P>"), "T1,T3"));
|
_A("greater_than_with_requires<T,P>"), "T1,T3"));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsConstraint(
|
IsConstraint(
|
||||||
_A("F<T1,T2,T3>"), _A("greater_than_simple<T,L>"), "T1,T3"));
|
_A("F<T1,T2,T3>"), _A("greater_than_simple<T,L>"), "T1,T3"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
{
|
||||||
auto j = generate_class_json(diagram, *model);
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
// REQUIRE(json::IsClass(j, "clanguml::t00014::A<T>"));
|
using namespace json;
|
||||||
// REQUIRE(json::IsClass(j, "clanguml::t00014::B"));
|
|
||||||
// REQUIRE(json::IsClass(j, "clanguml::t00014::C"));
|
|
||||||
|
|
||||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -27,7 +27,7 @@ TEST_CASE("t00057", "[test-case][class]")
|
|||||||
auto model = generate_class_diagram(*db, diagram);
|
auto model = generate_class_diagram(*db, diagram);
|
||||||
|
|
||||||
REQUIRE(model->name() == "t00057_class");
|
REQUIRE(model->name() == "t00057_class");
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -56,5 +56,15 @@ TEST_CASE("t00057", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsAggregation(_A("t00057_E"), _A("t00057_E::(height)"), "+height"));
|
IsAggregation(_A("t00057_E"), _A("t00057_E::(height)"), "+height"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,7 @@ TEST_CASE("t00058", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00058_class");
|
REQUIRE(model->name() == "t00058_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -35,24 +36,24 @@ TEST_CASE("t00058", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsClassTemplate("A", "int,int,double,std::string"));
|
REQUIRE_THAT(puml, IsClassTemplate("A", "int,int,double,std::string"));
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(puml,
|
||||||
puml, IsClassTemplate("B", "int,std::string,int,double,A<int,int>"));
|
IsClassTemplate("B", "int,std::string,int,double,A<int,int>"));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsConcept(_A("same_as_first_type<T,Args...>")));
|
REQUIRE_THAT(puml, IsConcept(_A("same_as_first_type<T,Args...>")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsConstraint(_A("A<T,Args...>"), _A("same_as_first_type<T,Args...>"),
|
IsConstraint(_A("A<T,Args...>"),
|
||||||
"T,Args..."));
|
_A("same_as_first_type<T,Args...>"), "T,Args..."));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsConstraint(_A("B<T,P,Args...>"), _A("same_as_first_type<T,Args...>"),
|
IsConstraint(_A("B<T,P,Args...>"),
|
||||||
"T,Args..."));
|
_A("same_as_first_type<T,Args...>"), "T,Args..."));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsAggregation(_A("R"), _A("A<int,int,double,std::string>"), "+aa"));
|
IsAggregation(_A("R"), _A("A<int,int,double,std::string>"), "+aa"));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsAggregation(
|
IsAggregation(_A("R"),
|
||||||
_A("R"), _A("B<int,std::string,int,double,A<int,int>>"), "+bb"));
|
_A("B<int,std::string,int,double,A<int,int>>"), "+bb"));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsInstantiation(
|
IsInstantiation(
|
||||||
@@ -62,8 +63,18 @@ TEST_CASE("t00058", "[test-case][class]")
|
|||||||
_A("B<int,std::string,int,double,A<int,int>>")));
|
_A("B<int,std::string,int,double,A<int,int>>")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsDependency(
|
IsDependency(_A("same_as_first_type<T,Args...>"),
|
||||||
_A("same_as_first_type<T,Args...>"), _A("first_type<T,Args...>")));
|
_A("first_type<T,Args...>")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,7 @@ TEST_CASE("t00059", "[test-case][class]")
|
|||||||
|
|
||||||
REQUIRE(model->name() == "t00059_class");
|
REQUIRE(model->name() == "t00059_class");
|
||||||
|
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -38,8 +39,10 @@ TEST_CASE("t00059", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsConcept(_A("apple_c<T>")));
|
REQUIRE_THAT(puml, IsConcept(_A("apple_c<T>")));
|
||||||
REQUIRE_THAT(puml, IsConcept(_A("orange_c<T>")));
|
REQUIRE_THAT(puml, IsConcept(_A("orange_c<T>")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml, IsConstraint(_A("apple_c<T>"), _A("fruit_c<T>"), "T"));
|
REQUIRE_THAT(
|
||||||
REQUIRE_THAT(puml, IsConstraint(_A("orange_c<T>"), _A("fruit_c<T>"), "T"));
|
puml, IsConstraint(_A("apple_c<T>"), _A("fruit_c<T>"), "T"));
|
||||||
|
REQUIRE_THAT(
|
||||||
|
puml, IsConstraint(_A("orange_c<T>"), _A("fruit_c<T>"), "T"));
|
||||||
|
|
||||||
REQUIRE_THAT(
|
REQUIRE_THAT(
|
||||||
puml, IsConceptRequirement(_A("apple_c<T>"), "t.get_sweetness()"));
|
puml, IsConceptRequirement(_A("apple_c<T>"), "t.get_sweetness()"));
|
||||||
@@ -56,25 +59,25 @@ TEST_CASE("t00059", "[test-case][class]")
|
|||||||
puml, IsClassTemplate("fruit_factory", "apple_c TA,orange_c TO"));
|
puml, IsClassTemplate("fruit_factory", "apple_c TA,orange_c TO"));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsDependency(
|
IsDependency(_A("fruit_factory<gala_apple,valencia_orange>"),
|
||||||
_A("fruit_factory<gala_apple,valencia_orange>"), _A("gala_apple")));
|
_A("gala_apple")));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsDependency(_A("fruit_factory<gala_apple,valencia_orange>"),
|
IsDependency(_A("fruit_factory<gala_apple,valencia_orange>"),
|
||||||
_A("valencia_orange")));
|
_A("valencia_orange")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsDependency(
|
IsDependency(_A("fruit_factory<empire_apple,lima_orange>"),
|
||||||
_A("fruit_factory<empire_apple,lima_orange>"), _A("empire_apple")));
|
_A("empire_apple")));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsDependency(
|
IsDependency(_A("fruit_factory<empire_apple,lima_orange>"),
|
||||||
_A("fruit_factory<empire_apple,lima_orange>"), _A("lima_orange")));
|
_A("lima_orange")));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsAggregation(_A("R"), _A("fruit_factory<gala_apple,valencia_orange>"),
|
IsAggregation(_A("R"),
|
||||||
"+factory_1"));
|
_A("fruit_factory<gala_apple,valencia_orange>"), "+factory_1"));
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsAggregation(_A("R"), _A("fruit_factory<empire_apple,lima_orange>"),
|
IsAggregation(_A("R"),
|
||||||
"+factory_2"));
|
_A("fruit_factory<empire_apple,lima_orange>"), "+factory_2"));
|
||||||
|
|
||||||
REQUIRE_THAT(puml,
|
REQUIRE_THAT(puml,
|
||||||
IsInstantiation(_A("fruit_factory<apple_c TA,orange_c TO>"),
|
IsInstantiation(_A("fruit_factory<apple_c TA,orange_c TO>"),
|
||||||
@@ -83,5 +86,15 @@ TEST_CASE("t00059", "[test-case][class]")
|
|||||||
IsInstantiation(_A("fruit_factory<apple_c TA,orange_c TO>"),
|
IsInstantiation(_A("fruit_factory<apple_c TA,orange_c TO>"),
|
||||||
_A("fruit_factory<empire_apple,lima_orange>")));
|
_A("fruit_factory<empire_apple,lima_orange>")));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ TEST_CASE("t00060", "[test-case][class]")
|
|||||||
auto model = generate_class_diagram(*db, diagram);
|
auto model = generate_class_diagram(*db, diagram);
|
||||||
|
|
||||||
REQUIRE(model->name() == "t00060_class");
|
REQUIRE(model->name() == "t00060_class");
|
||||||
|
{
|
||||||
auto puml = generate_class_puml(diagram, *model);
|
auto puml = generate_class_puml(diagram, *model);
|
||||||
AliasMatcher _A(puml);
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
@@ -46,5 +46,15 @@ TEST_CASE("t00060", "[test-case][class]")
|
|||||||
REQUIRE_THAT(puml, IsClassTemplate("G", "T"));
|
REQUIRE_THAT(puml, IsClassTemplate("G", "T"));
|
||||||
REQUIRE_THAT(puml, IsClassTemplate("H", "T,P"));
|
REQUIRE_THAT(puml, IsClassTemplate("H", "T,P"));
|
||||||
|
|
||||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto j = generate_class_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -209,6 +209,17 @@ ContainsMatcher HasExitpoint(std::string const &to,
|
|||||||
CasedString(fmt::format("[<-- {}", to), caseSensitivity));
|
CasedString(fmt::format("[<-- {}", to), caseSensitivity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string _NS(std::string_view s)
|
||||||
|
{
|
||||||
|
return fmt::format(
|
||||||
|
"clanguml::{}::{}", Catch::getResultCapture().getCurrentTestName(), s);
|
||||||
|
}
|
||||||
|
|
||||||
|
class NamespaceWrapper {
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
struct AliasMatcher {
|
struct AliasMatcher {
|
||||||
AliasMatcher(const std::string &puml_)
|
AliasMatcher(const std::string &puml_)
|
||||||
: puml{split(puml_, "\n")}
|
: puml{split(puml_, "\n")}
|
||||||
@@ -601,10 +612,21 @@ ContainsMatcher IsDeprecated(std::string const &str,
|
|||||||
|
|
||||||
namespace json {
|
namespace json {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
auto get_element(const nlohmann::json &j, const std::string &name)
|
std::optional<nlohmann::json> get_element(
|
||||||
|
const nlohmann::json &j, const std::string &name)
|
||||||
{
|
{
|
||||||
return std::find_if(j["elements"].begin(), j["elements"].end(),
|
for (const nlohmann::json &e : j["elements"]) {
|
||||||
[&](const auto &it) { return it["display_name"] == name; });
|
if (e["display_name"] == name)
|
||||||
|
return {e};
|
||||||
|
|
||||||
|
if (e["type"] == "namespace") {
|
||||||
|
auto maybe_e = get_element(e, name);
|
||||||
|
if (maybe_e)
|
||||||
|
return maybe_e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto get_relationship(const nlohmann::json &j, const nlohmann::json &from,
|
auto get_relationship(const nlohmann::json &j, const nlohmann::json &from,
|
||||||
@@ -620,43 +642,73 @@ auto get_relationship(const nlohmann::json &j, const nlohmann::json &from,
|
|||||||
auto get_relationship(const nlohmann::json &j, const std::string &from,
|
auto get_relationship(const nlohmann::json &j, const std::string &from,
|
||||||
const std::string &to, const std::string &type)
|
const std::string &to, const std::string &type)
|
||||||
{
|
{
|
||||||
auto from_it = detail::get_element(j, from);
|
auto source = detail::get_element(j, from);
|
||||||
auto to_it = detail::get_element(j, to);
|
auto destination = detail::get_element(j, to);
|
||||||
|
|
||||||
if (from_it == j["elements"].end() || to_it == j["elements"].end())
|
if (!(source && destination))
|
||||||
return j["relationships"].end();
|
return j["relationships"].end();
|
||||||
|
|
||||||
return detail::get_relationship(
|
return detail::get_relationship(
|
||||||
j, from_it->at("id"), to_it->at("id"), type);
|
j, source->at("id"), destination->at("id"), type);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string expand_name(const nlohmann::json &j, const std::string &name)
|
||||||
|
{
|
||||||
|
if (!j.contains("using_namespace"))
|
||||||
|
return name;
|
||||||
|
|
||||||
|
if (name.find("::") == 0)
|
||||||
|
return name;
|
||||||
|
|
||||||
|
return fmt::format("{}::{}", j["using_namespace"].get<std::string>(), name);
|
||||||
}
|
}
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
bool IsClass(const nlohmann::json &j, const std::string &name)
|
bool IsClass(const nlohmann::json &j, const std::string &name)
|
||||||
{
|
{
|
||||||
return detail::get_element(j, name) != j["elements"].end();
|
auto e = detail::get_element(j, detail::expand_name(j, name));
|
||||||
|
return e && e->at("type") == "class";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsClassTemplate(const nlohmann::json &j, const std::string &name)
|
||||||
|
{
|
||||||
|
auto e = detail::get_element(j, detail::expand_name(j, name));
|
||||||
|
return e && e->at("type") == "class" && e->at("is_template") == true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsEnum(const nlohmann::json &j, const std::string &name)
|
||||||
|
{
|
||||||
|
auto e = detail::get_element(j, detail::expand_name(j, name));
|
||||||
|
return e && e->at("type") == "enum";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsPackage(const nlohmann::json &j, const std::string &name)
|
||||||
|
{
|
||||||
|
auto e = detail::get_element(j, detail::expand_name(j, name));
|
||||||
|
return e && e->at("type") == "namespace";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsBaseClass(const nlohmann::json &j, const std::string &base,
|
bool IsBaseClass(const nlohmann::json &j, const std::string &base,
|
||||||
const std::string &subclass)
|
const std::string &subclass)
|
||||||
{
|
{
|
||||||
auto sc = detail::get_element(j, subclass);
|
auto sc = detail::get_element(j, detail::expand_name(j, subclass));
|
||||||
|
|
||||||
if (sc == j["elements"].end())
|
if (!sc)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const nlohmann::json &bases = (*sc)["bases"];
|
const nlohmann::json &bases = (*sc)["bases"];
|
||||||
|
|
||||||
return std::find_if(bases.begin(), bases.end(), [&](const auto &it) {
|
return std::find_if(bases.begin(), bases.end(), [&](const auto &it) {
|
||||||
return it["name"] == base;
|
return it["name"] == detail::expand_name(j, base);
|
||||||
}) != bases.end();
|
}) != bases.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsMethod(
|
bool IsMethod(
|
||||||
const nlohmann::json &j, const std::string &cls, const std::string &name)
|
const nlohmann::json &j, const std::string &cls, const std::string &name)
|
||||||
{
|
{
|
||||||
auto sc = detail::get_element(j, cls);
|
auto sc = detail::get_element(j, detail::expand_name(j, cls));
|
||||||
|
|
||||||
if (sc == j["elements"].end())
|
if (!sc)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const nlohmann::json &methods = (*sc)["methods"];
|
const nlohmann::json &methods = (*sc)["methods"];
|
||||||
@@ -666,10 +718,26 @@ bool IsMethod(
|
|||||||
}) != methods.end();
|
}) != methods.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsMember(const nlohmann::json &j, const std::string &cls,
|
||||||
|
const std::string &name, const std::string &type)
|
||||||
|
{
|
||||||
|
auto sc = detail::get_element(j, detail::expand_name(j, cls));
|
||||||
|
|
||||||
|
if (!sc)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const nlohmann::json &members = (*sc)["members"];
|
||||||
|
|
||||||
|
return std::find_if(members.begin(), members.end(), [&](const auto &it) {
|
||||||
|
return it["name"] == name && it["type"] == type;
|
||||||
|
}) != members.end();
|
||||||
|
}
|
||||||
|
|
||||||
bool IsAssociation(nlohmann::json j, const std::string &from,
|
bool IsAssociation(nlohmann::json j, const std::string &from,
|
||||||
const std::string &to, const std::string &label = "")
|
const std::string &to, const std::string &label = "")
|
||||||
{
|
{
|
||||||
auto rel = detail::get_relationship(j, from, to, "association");
|
auto rel = detail::get_relationship(j, detail::expand_name(j, from),
|
||||||
|
detail::expand_name(j, to), "association");
|
||||||
|
|
||||||
if (rel == j["relationships"].end())
|
if (rel == j["relationships"].end())
|
||||||
return false;
|
return false;
|
||||||
@@ -683,7 +751,8 @@ bool IsAssociation(nlohmann::json j, const std::string &from,
|
|||||||
bool IsComposition(nlohmann::json j, const std::string &from,
|
bool IsComposition(nlohmann::json j, const std::string &from,
|
||||||
const std::string &to, const std::string &label = "")
|
const std::string &to, const std::string &label = "")
|
||||||
{
|
{
|
||||||
auto rel = detail::get_relationship(j, from, to, "composition");
|
auto rel = detail::get_relationship(j, detail::expand_name(j, from),
|
||||||
|
detail::expand_name(j, to), "composition");
|
||||||
|
|
||||||
if (rel == j["relationships"].end())
|
if (rel == j["relationships"].end())
|
||||||
return false;
|
return false;
|
||||||
@@ -697,7 +766,8 @@ bool IsComposition(nlohmann::json j, const std::string &from,
|
|||||||
bool IsAggregation(nlohmann::json j, const std::string &from,
|
bool IsAggregation(nlohmann::json j, const std::string &from,
|
||||||
const std::string &to, const std::string &label = "")
|
const std::string &to, const std::string &label = "")
|
||||||
{
|
{
|
||||||
auto rel = detail::get_relationship(j, from, to, "aggregation");
|
auto rel = detail::get_relationship(j, detail::expand_name(j, from),
|
||||||
|
detail::expand_name(j, to), "aggregation");
|
||||||
|
|
||||||
if (rel == j["relationships"].end())
|
if (rel == j["relationships"].end())
|
||||||
return false;
|
return false;
|
||||||
@@ -711,7 +781,26 @@ bool IsAggregation(nlohmann::json j, const std::string &from,
|
|||||||
bool IsDependency(
|
bool IsDependency(
|
||||||
nlohmann::json j, const std::string &from, const std::string &to)
|
nlohmann::json j, const std::string &from, const std::string &to)
|
||||||
{
|
{
|
||||||
auto rel = detail::get_relationship(j, from, to, "aggregation");
|
auto rel = detail::get_relationship(j, detail::expand_name(j, from),
|
||||||
|
detail::expand_name(j, to), "aggregation");
|
||||||
|
|
||||||
|
return rel != j["relationships"].end();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsInstantiation(
|
||||||
|
nlohmann::json j, const std::string &from, const std::string &to)
|
||||||
|
{
|
||||||
|
auto rel = detail::get_relationship(j, detail::expand_name(j, to),
|
||||||
|
detail::expand_name(j, from), "instantiation");
|
||||||
|
|
||||||
|
return rel != j["relationships"].end();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsInnerClass(
|
||||||
|
nlohmann::json j, const std::string &from, const std::string &to)
|
||||||
|
{
|
||||||
|
auto rel = detail::get_relationship(j, detail::expand_name(j, to),
|
||||||
|
detail::expand_name(j, from), "containment");
|
||||||
|
|
||||||
return rel != j["relationships"].end();
|
return rel != j["relationships"].end();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user