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 {
|
||||
using nlohmann::json;
|
||||
|
||||
void to_json(nlohmann::json &j, const class_element &c)
|
||||
{
|
||||
j["name"] = c.name();
|
||||
@@ -113,6 +114,11 @@ generator::generator(diagram_config &config, diagram_model &model)
|
||||
|
||||
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_["relationships"] = std::vector<nlohmann::json>{};
|
||||
|
||||
@@ -120,9 +126,6 @@ void generator::generate(std::ostream &ostr) const
|
||||
|
||||
generate_relationships(json_);
|
||||
|
||||
json_["name"] = m_model.name();
|
||||
json_["diagram_type"] = "class";
|
||||
|
||||
ostr << json_;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +84,8 @@ public:
|
||||
void generate_relationships(const package &p, nlohmann::json &parent) const;
|
||||
|
||||
private:
|
||||
std::string render_name(std::string name) const;
|
||||
|
||||
mutable nlohmann::json json_;
|
||||
};
|
||||
|
||||
|
||||
@@ -296,6 +296,7 @@ bool translation_unit_visitor::VisitClassTemplateDecl(
|
||||
const auto id = common::to_id(cls_full_name);
|
||||
|
||||
c_ptr->set_id(id);
|
||||
c_ptr->is_template(true);
|
||||
|
||||
set_ast_local_id(cls->getID(), id);
|
||||
|
||||
|
||||
@@ -21,6 +21,15 @@
|
||||
namespace clanguml::common::model {
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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()},
|
||||
{"display_name", c.full_name(false)}};
|
||||
{"display_name", detail::render_name(c.full_name(false))}};
|
||||
|
||||
if (const auto &comment = c.comment(); comment)
|
||||
j["comment"] = comment.value();
|
||||
|
||||
@@ -38,57 +38,62 @@ TEST_CASE("t00002", "[test-case][class]")
|
||||
REQUIRE(model->should_include({"clanguml", "t00002"}, "A"));
|
||||
REQUIRE(!model->should_include({"std"}, "vector"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("B")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("C")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("B"), _A("D")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("D")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public, Abstract>("foo_a")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public, Abstract>("foo_c")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("B")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("C")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("B"), _A("D")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("D")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public, Abstract>("foo_a")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public, Abstract>("foo_c")));
|
||||
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("D"), _A("A"), "-as"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("D"), _A("A"), "-as"));
|
||||
|
||||
REQUIRE_THAT(puml, HasNote(_A("A"), "left", "This is class A"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("B"), "top", "This is class B"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("A"), "left", "This is class A"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("B"), "top", "This is class B"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
HasLink(_A("A"),
|
||||
fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/"
|
||||
"t00002/t00002.cc#L7",
|
||||
clanguml::util::get_git_commit()),
|
||||
"This is class A"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasLink(_A("A"),
|
||||
fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/"
|
||||
"t00002/t00002.cc#L7",
|
||||
clanguml::util::get_git_commit()),
|
||||
"This is class A"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
HasLink(_A("B"),
|
||||
fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/"
|
||||
"t00002/t00002.cc#L16",
|
||||
clanguml::util::get_git_commit()),
|
||||
"This is class B"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasLink(_A("B"),
|
||||
fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/"
|
||||
"t00002/t00002.cc#L16",
|
||||
clanguml::util::get_git_commit()),
|
||||
"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);
|
||||
using namespace json;
|
||||
|
||||
REQUIRE(json::IsClass(j, "clanguml::t00002::A"));
|
||||
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(IsClass(j, "A"));
|
||||
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"));
|
||||
|
||||
REQUIRE(json::IsAssociation(
|
||||
j, "clanguml::t00002::D", "clanguml::t00002::A", "as"));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -33,53 +33,60 @@ TEST_CASE("t00003", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00003_class");
|
||||
REQUIRE(model->should_include(std::string("clanguml::t00003::A")));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
|
||||
REQUIRE_THAT(puml, !IsDependency(_A("A"), _A("A")));
|
||||
REQUIRE_THAT(puml, !IsDependency(_A("A"), _A("A")));
|
||||
|
||||
REQUIRE_THAT(puml, (IsMethod<Public, Default>("A")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public, Default>("~A")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public, Default>("A")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public, Default>("~A")));
|
||||
|
||||
REQUIRE_THAT(puml, (IsMethod<Public>("basic_method")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public, Static>("static_method", "int")));
|
||||
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_string", "std::string",
|
||||
"int i, std::string s = \"abc\"")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public>("basic_method")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public, Static>("static_method", "int")));
|
||||
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_string", "std::string",
|
||||
"int i, std::string s = \"abc\"")));
|
||||
|
||||
REQUIRE_THAT(puml, (IsMethod<Protected>("protected_method")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Private>("private_method")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("public_member", "int")));
|
||||
REQUIRE_THAT(puml, (IsField<Protected>("protected_member", "int")));
|
||||
REQUIRE_THAT(puml, (IsField<Private>("private_member", "int")));
|
||||
REQUIRE_THAT(
|
||||
puml, (IsField<Public, Static>("auto_member", "const unsigned long")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Protected>("protected_method")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Private>("private_method")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("public_member", "int")));
|
||||
REQUIRE_THAT(puml, (IsField<Protected>("protected_member", "int")));
|
||||
REQUIRE_THAT(puml, (IsField<Private>("private_member", "int")));
|
||||
REQUIRE_THAT(puml,
|
||||
(IsField<Public, Static>("auto_member", "const unsigned long")));
|
||||
|
||||
REQUIRE_THAT(puml, (IsField<Private>("a_", "int")));
|
||||
REQUIRE_THAT(puml, (IsField<Private>("b_", "int")));
|
||||
REQUIRE_THAT(puml, (IsField<Private>("c_", "int")));
|
||||
REQUIRE_THAT(puml, (IsField<Private>("a_", "int")));
|
||||
REQUIRE_THAT(puml, (IsField<Private>("b_", "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"));
|
||||
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"));
|
||||
using namespace json;
|
||||
|
||||
REQUIRE(
|
||||
!json::IsDependency(j, "clanguml::t00002::A", "clanguml::t00002::A"));
|
||||
REQUIRE(IsClass(j, "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"));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
REQUIRE(!IsDependency(j, "A", "A"));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,37 +35,64 @@ TEST_CASE("t00004", "[test-case][class]")
|
||||
REQUIRE(model->should_include("clanguml::t00004::A::AA"));
|
||||
REQUIRE(model->should_include("clanguml::t00004::A:::AAA"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A::AA")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A::AA::AAA")));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("B::AA")));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("A::AA::Lights")));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("A::AA")));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("A::AA"), _A("A::AA::AAA")));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("A::AA"), _A("A::AA::Lights")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A::AA")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A::AA::AAA")));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("B::AA")));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("A::AA::Lights")));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("A::AA")));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("A::AA"), _A("A::AA::AAA")));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("A::AA"), _A("A::AA::Lights")));
|
||||
|
||||
REQUIRE_THAT(puml, (IsMethod<Public, Const>("foo")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public, Const>("foo2")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public, Const>("foo")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public, Const>("foo2")));
|
||||
|
||||
REQUIRE_THAT(puml, IsClassTemplate("C", "T"));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("C<T>"), _A("C::AA")));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("C::AA"), _A("C::AA::AAA")));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("C<T>"), _A("C::CC")));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("C::AA"), _A("C::AA::CCC")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("C", "T"));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("C<T>"), _A("C::AA")));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("C::AA"), _A("C::AA::AAA")));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("C<T>"), _A("C::CC")));
|
||||
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, IsAggregation(_A("C<T>"), _A("C::B<int>"), "+b_int"));
|
||||
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, IsInnerClass(_A("C<T>"), _A("C::B<V>")));
|
||||
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, IsInstantiation(_A("C::B<V>"), _A("C::B<int>")));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("detail::D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("detail::D::DD")));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("detail::D::AA")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("detail::D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("detail::D::DD")));
|
||||
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,39 +32,76 @@ TEST_CASE("t00005", "[test-case][class]")
|
||||
REQUIRE(model->should_include("clanguml::t00005::C"));
|
||||
REQUIRE(model->should_include("clanguml::t00005::D"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("H")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("I")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("J")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("K")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("H")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("I")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("J")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("K")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
|
||||
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_pointer", "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_pointer", "int **")));
|
||||
|
||||
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("C"), "+c"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "+d"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("E"), "+e"));
|
||||
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("H"), "+h"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("I"), "+i"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("J"), "+j"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "+k"));
|
||||
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("C"), "+c"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "+d"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("E"), "+e"));
|
||||
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("H"), "+h"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("I"), "+i"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("J"), "+j"));
|
||||
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,47 +34,82 @@ TEST_CASE("t00006", "[test-case][class]")
|
||||
REQUIRE(model->should_include("clanguml::t00006::D"));
|
||||
REQUIRE(model->should_include("clanguml::t00006::E"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("H")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("I")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("J")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("K")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("L")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("M")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("N")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("NN")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("NNN")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("H")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("I")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("J")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("K")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("L")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("M")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("N")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("NN")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("NNN")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("custom_container<T>"), _A("custom_container<E>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(
|
||||
_A("custom_container<T>"), _A("custom_container<E>")));
|
||||
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "+a"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("C"), "+c"));
|
||||
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("F"), "+f"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G"), "+g"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("H"), "+h"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("I"), "+i"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("J"), "+j"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "+k"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("L"), "+lm"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("M"), "+lm"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("N"), "+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("A"), "+a"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("C"), "+c"));
|
||||
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("F"), "+f"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G"), "+g"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("H"), "+h"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("I"), "+i"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("J"), "+j"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "+k"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("L"), "+lm"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("M"), "+lm"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("N"), "+ns"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("NN"), "+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,19 +28,37 @@ TEST_CASE("t00007", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00007_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
|
||||
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("C"), "+c"));
|
||||
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("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,32 +28,47 @@ TEST_CASE("t00008", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00008_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// TODO: add option to resolve using declared types
|
||||
// REQUIRE_THAT(puml, IsClassTemplate("A", "T, P, bool (*)(int, int), int
|
||||
// N"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,P=T,CMP=nullptr,int N=3"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T,C<>"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// TODO: add option to resolve using declared types
|
||||
// REQUIRE_THAT(puml, IsClassTemplate("A", "T, P, bool (*)(int, int),
|
||||
// int N"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,P=T,CMP=nullptr,int N=3"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T,C<>"));
|
||||
|
||||
REQUIRE_THAT(puml, (IsField<Public>("value", "T")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("pointer", "T *")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("reference", "T &")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("values", "std::vector<P>")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("ints", "std::array<int,N>")));
|
||||
// TODO: add option to resolve using declared types
|
||||
// REQUIRE_THAT(puml, IsField(Public("bool (*)(int, int) comparator")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("comparator", "CMP")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("value", "T")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("pointer", "T *")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("reference", "T &")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("values", "std::vector<P>")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("ints", "std::array<int,N>")));
|
||||
// TODO: add option to resolve using declared types
|
||||
// REQUIRE_THAT(puml, IsField(Public("bool (*)(int, int) comparator")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("comparator", "CMP")));
|
||||
|
||||
REQUIRE_THAT(puml, !IsClass(_A("E::nested_template")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("E::nested_template", "ET"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("E::nested_template", "char"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(
|
||||
_A("E::nested_template<ET>"), _A("E::nested_template<char>")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("E::nested_template")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("E::nested_template", "ET"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("E::nested_template", "char"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(
|
||||
_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,28 +28,41 @@ TEST_CASE("t00009", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00009_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
|
||||
REQUIRE_THAT(puml, (IsField<Public>("value", "T")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("aint", "A<int>")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("astring", "A<std::string> *")));
|
||||
REQUIRE_THAT(
|
||||
puml, (IsField<Public>("avector", "A<std::vector<std::string>> &")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("value", "T")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("aint", "A<int>")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("astring", "A<std::string> *")));
|
||||
REQUIRE_THAT(puml,
|
||||
(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<std::string>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<int>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<std::string>")));
|
||||
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("B"), _A("A<int>"), "+aint"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsAssociation(_A("B"), _A("A<std::string>"), "+astring"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAssociation(_A("B"), _A("A<std::vector<std::string>>"), "+avector"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("B"), _A("A<int>"), "+aint"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsAssociation(_A("B"), _A("A<std::string>"), "+astring"));
|
||||
REQUIRE_THAT(puml,
|
||||
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,23 +28,34 @@ TEST_CASE("t00010", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00010_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,P"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,P"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T"));
|
||||
|
||||
REQUIRE_THAT(puml, (IsField<Public>("astring", "A<T,std::string>")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("aintstring", "B<int>")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("astring", "A<T,std::string>")));
|
||||
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("B<T>"), _A("B<int>")));
|
||||
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, 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("B<T>"), _A("A<T,std::string>"), "+astring"));
|
||||
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,19 +28,29 @@ TEST_CASE("t00011", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00011_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("external::C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D<T>")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("external::C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D<T>")));
|
||||
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("B"), _A("A")));
|
||||
REQUIRE_THAT(puml, IsFriend<Public>(_A("A"), _A("B")));
|
||||
// REQUIRE_THAT(puml, IsFriend(_A("A"), _A("D<T>")));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("B"), _A("A")));
|
||||
REQUIRE_THAT(puml, IsFriend<Public>(_A("A"), _A("B")));
|
||||
// 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,20 +28,32 @@ TEST_CASE("t00012", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00012_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,Ts..."));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "int... Is"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,Ts..."));
|
||||
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<1,1,1,1>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("C<T,int... Is>"),
|
||||
_A("C<std::map<int,"
|
||||
"std::vector<std::vector<std::vector<std::string>>>>,3,3,3>")));
|
||||
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("C<T,int... Is>"),
|
||||
_A("C<std::map<int,"
|
||||
"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,36 +31,48 @@ TEST_CASE("t00013", "[test-case][class]")
|
||||
REQUIRE(model->should_include("clanguml::t00013::B"));
|
||||
REQUIRE(model->should_include("ABCD::F"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("E", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("G", "T,Args..."));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("E", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("G", "T,Args..."));
|
||||
|
||||
REQUIRE_THAT(puml, !IsDependency(_A("R"), _A("R")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("B")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("C")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("D")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("D"), _A("R")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("E<T>")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("E<int>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("E<T>"), _A("E<int>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("E<T>"), _A("E<std::string>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsAggregation(_A("R"), _A("E<std::string>"), "-estring"));
|
||||
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, IsDependency(_A("R"), _A("ABCD::F<int>")));
|
||||
REQUIRE_THAT(puml, !IsDependency(_A("R"), _A("R")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("B")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("C")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("D")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("D"), _A("R")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("E<T>")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("E<int>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("E<T>"), _A("E<int>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("E<T>"), _A("E<std::string>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsAggregation(_A("R"), _A("E<std::string>"), "-estring"));
|
||||
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, IsDependency(_A("R"), _A("ABCD::F<int>")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("G<T,Args...>"), _A("G<int,float,std::string>")));
|
||||
REQUIRE_THAT(puml,
|
||||
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,110 +29,127 @@ TEST_CASE("t00014", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00014_class");
|
||||
REQUIRE(model->should_include("clanguml::t00014::B"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,P"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,std::string"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,std::unique_ptr<std::string>"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "double,T"));
|
||||
// TODO: Figure out how to handle the same templates with different template
|
||||
// parameter names
|
||||
// REQUIRE_THAT(puml, !IsClassTemplate("A", "long,U"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "long,T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "long,bool"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "double,bool"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "long,float"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "double,float"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "bool,std::string"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "std::string,std::string"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "char,std::string"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,P"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,std::string"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsClassTemplate("A", "T,std::unique_ptr<std::string>"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "double,T"));
|
||||
// TODO: Figure out how to handle the same templates with different
|
||||
// template
|
||||
// parameter names
|
||||
// REQUIRE_THAT(puml, !IsClassTemplate("A", "long,U"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "long,T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "long,bool"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "double,bool"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "long,float"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "double,float"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "bool,std::string"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "std::string,std::string"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "char,std::string"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
|
||||
REQUIRE_THAT(puml, IsField<Private>("bapair", "PairPairBA<bool>"));
|
||||
REQUIRE_THAT(puml, IsField<Private>("abool", "APtr<bool>"));
|
||||
REQUIRE_THAT(puml, IsField<Private>("aboolfloat", "AAPtr<bool,float>"));
|
||||
REQUIRE_THAT(puml, IsField<Private>("afloat", "ASharedPtr<float>"));
|
||||
REQUIRE_THAT(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>("stringstring", "AStringString"));
|
||||
REQUIRE_THAT(puml, IsField<Private>("bstringstring", "BStringString"));
|
||||
REQUIRE_THAT(puml, IsField<Private>("bapair", "PairPairBA<bool>"));
|
||||
REQUIRE_THAT(puml, IsField<Private>("abool", "APtr<bool>"));
|
||||
REQUIRE_THAT(puml, IsField<Private>("aboolfloat", "AAPtr<bool,float>"));
|
||||
REQUIRE_THAT(puml, IsField<Private>("afloat", "ASharedPtr<float>"));
|
||||
REQUIRE_THAT(
|
||||
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>("stringstring", "AStringString"));
|
||||
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>("gcb", "GenericCallback<R::AWCharString>"));
|
||||
REQUIRE_THAT(puml, IsField<Public>("vcb", "VoidCallback"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsField<Public>("cb", "SimpleCallback<ACharString>"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsField<Public>("gcb", "GenericCallback<R::AWCharString>"));
|
||||
REQUIRE_THAT(puml, IsField<Public>("vcb", "VoidCallback"));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, !IsClassTemplate("std::std::function", "void(T...,int),int)"));
|
||||
REQUIRE_THAT(puml,
|
||||
!IsClassTemplate("std::std::function", "void(T...,int),int)"));
|
||||
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T,P>"), _A("A<T,std::string>")));
|
||||
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<T,std::string>")));
|
||||
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<long,T>"),
|
||||
// _A("A<long,U>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("A<double,T>"), _A("A<double,float>")));
|
||||
REQUIRE_THAT(
|
||||
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<T,std::string>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("A<T,std::string>"), _A("A<bool,std::string>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("A<T,std::string>"), _A("A<char,std::string>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("A<T,std::string>"), _A("A<wchar_t,std::string>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T,P>"), _A("A<long,T>")));
|
||||
// REQUIRE_THAT(puml, !IsInstantiation(_A("A<long,T>"),
|
||||
// _A("A<long,U>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("A<double,T>"), _A("A<double,float>")));
|
||||
REQUIRE_THAT(
|
||||
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<T,std::string>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("A<T,std::string>"), _A("A<bool,std::string>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("A<T,std::string>"), _A("A<char,std::string>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(
|
||||
_A("A<T,std::string>"), _A("A<wchar_t,std::string>")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("A<T,std::unique_ptr<std::string>>"),
|
||||
_A("A<float,std::unique_ptr<std::string>>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("A<T,P>"), _A("A<T,std::unique_ptr<std::string>>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("A<T,std::unique_ptr<std::string>>"),
|
||||
_A("A<float,std::unique_ptr<std::string>>")));
|
||||
REQUIRE_THAT(puml,
|
||||
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"), "-bapair"));
|
||||
REQUIRE_THAT(
|
||||
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<double,bool>"), "-aboolfloat"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsAssociation(_A("R"), _A("A<double,float>"), "-afloat"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsAggregation(_A("R"), _A("A<bool,std::string>"), "-boolstring"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("R"), _A("A<float,std::unique_ptr<std::string>>"),
|
||||
"-floatstring"));
|
||||
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, IsAggregation(_A("R"), _A("B"), "+vps"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "-bapair"));
|
||||
REQUIRE_THAT(
|
||||
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<double,bool>"), "-aboolfloat"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsAssociation(_A("R"), _A("A<double,float>"), "-afloat"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("R"), _A("A<bool,std::string>"), "-boolstring"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("R"), _A("A<float,std::unique_ptr<std::string>>"),
|
||||
"-floatstring"));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A<char,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);
|
||||
using namespace json;
|
||||
|
||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<T,P>"));
|
||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<T,std::string>"));
|
||||
REQUIRE(json::IsClass(
|
||||
j, "clanguml::t00014::A<T,std::unique_ptr<std::string>>"));
|
||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<double,T>"));
|
||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<long,T>"));
|
||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<long,bool>"));
|
||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<double,bool>"));
|
||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<long,float>"));
|
||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<double,bool>"));
|
||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<double,float>"));
|
||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<bool,std::string>"));
|
||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<std::string,std::string>"));
|
||||
REQUIRE(json::IsClass(j, "clanguml::t00014::A<char,std::string>"));
|
||||
REQUIRE(json::IsClass(j, "clanguml::t00014::B"));
|
||||
REQUIRE(json::IsClass(j, "A<T,P>"));
|
||||
REQUIRE(json::IsClass(j, "A<T,std::string>"));
|
||||
REQUIRE(json::IsClass(j, "A<T,std::unique_ptr<std::string>>"));
|
||||
REQUIRE(json::IsClass(j, "A<double,T>"));
|
||||
REQUIRE(json::IsClass(j, "A<long,T>"));
|
||||
REQUIRE(json::IsClass(j, "A<long,bool>"));
|
||||
REQUIRE(json::IsClass(j, "A<double,bool>"));
|
||||
REQUIRE(json::IsClass(j, "A<long,float>"));
|
||||
REQUIRE(json::IsClass(j, "A<double,bool>"));
|
||||
REQUIRE(json::IsClass(j, "A<double,float>"));
|
||||
REQUIRE(json::IsClass(j, "A<bool,std::string>"));
|
||||
REQUIRE(json::IsClass(j, "A<std::string,std::string>"));
|
||||
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,16 +29,26 @@ TEST_CASE("t00015", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00015_class");
|
||||
REQUIRE(model->should_include("clanguml::t00015::ns1::ns2::A"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::ns2_v0_9_0::A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::Anon")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns3::ns1::ns2::Anon")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns3::B")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::ns2_v0_9_0::A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::Anon")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns3::ns1::ns2::Anon")));
|
||||
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,25 +29,35 @@ TEST_CASE("t00016", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00016_class");
|
||||
REQUIRE(model->should_include("clanguml::t00016::is_numeric"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("is_numeric", ""));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "int"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "bool"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "char"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "float"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("is_numeric", ""));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "int"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "bool"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "char"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "float"));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric<int>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric<bool>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric<char>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric<float>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric<int>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric<bool>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric<char>")));
|
||||
REQUIRE_THAT(
|
||||
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,44 +28,54 @@ TEST_CASE("t00017", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00017_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("H")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("I")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("J")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("K")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("H")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("I")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("J")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("K")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
|
||||
REQUIRE_THAT(puml, (IsField<Private>("some_int", "int")));
|
||||
REQUIRE_THAT(puml, (IsField<Private>("some_int_pointer", "int *")));
|
||||
REQUIRE_THAT(
|
||||
puml, (IsField<Private>("some_int_pointer_pointer", "int **")));
|
||||
REQUIRE_THAT(puml, (IsField<Private>("some_int", "int")));
|
||||
REQUIRE_THAT(puml, (IsField<Private>("some_int_pointer", "int *")));
|
||||
REQUIRE_THAT(
|
||||
puml, (IsField<Private>("some_int_pointer_pointer", "int **")));
|
||||
|
||||
// Relationship members should not be rendered as part of this testcase
|
||||
REQUIRE_THAT(puml, !(IsField<Private>("a", _A("A"))));
|
||||
REQUIRE_THAT(puml, !(IsField<Private>("b", _A("B"))));
|
||||
// Relationship members should not be rendered as part of this testcase
|
||||
REQUIRE_THAT(puml, !(IsField<Private>("a", _A("A"))));
|
||||
REQUIRE_THAT(puml, !(IsField<Private>("b", _A("B"))));
|
||||
|
||||
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("C"), "-c"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "-d"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("E"), "-e"));
|
||||
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("H"), "-h"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("I"), "-i"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("J"), "-j"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "-k"));
|
||||
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("C"), "-c"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "-d"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("E"), "-e"));
|
||||
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("H"), "-h"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("I"), "-i"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("J"), "-j"));
|
||||
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,19 +28,28 @@ TEST_CASE("t00018", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00018_class");
|
||||
REQUIRE(model->should_include("clanguml::t00018::widget"));
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("widget")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("impl::widget")));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("widget")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("impl::widget")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsAggregation(_A("widget"), _A("impl::widget"), "-pImpl"));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("impl::widget"), _A("widget")));
|
||||
REQUIRE_THAT(puml, !IsDependency(_A("widget"), _A("widget")));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, IsAggregation(_A("widget"), _A("impl::widget"), "-pImpl"));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("impl::widget"), _A("widget")));
|
||||
REQUIRE_THAT(puml, !IsDependency(_A("widget"), _A("widget")));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
{
|
||||
auto j = generate_class_json(diagram, *model);
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
using namespace json;
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,31 +28,43 @@ TEST_CASE("t00019", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00019_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Base")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Layer1", "LowerLayer"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Layer2", "LowerLayer"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Layer3", "LowerLayer"));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("Layer3<Base>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsBaseClass(_A("Layer3<Base>"), _A("Layer2<Layer3<Base>>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsBaseClass(
|
||||
_A("Layer2<Layer3<Base>>"), _A("Layer1<Layer2<Layer3<Base>>>")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Base")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Layer1", "LowerLayer"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Layer2", "LowerLayer"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Layer3", "LowerLayer"));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("Layer3<Base>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsBaseClass(_A("Layer3<Base>"), _A("Layer2<Layer3<Base>>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsBaseClass(_A("Layer2<Layer3<Base>>"),
|
||||
_A("Layer1<Layer2<Layer3<Base>>>")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("A"), _A("Layer1<Layer2<Layer3<Base>>>"), "+layers"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(
|
||||
_A("A"), _A("Layer1<Layer2<Layer3<Base>>>"), "+layers"));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, !IsAggregation(_A("A"), _A("Layer2<Layer3<Base>>"), "+layers"));
|
||||
REQUIRE_THAT(puml,
|
||||
!IsAggregation(_A("A"), _A("Layer2<Layer3<Base>>"), "+layers"));
|
||||
|
||||
REQUIRE_THAT(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,20 +29,30 @@ TEST_CASE("t00020", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00020_class");
|
||||
REQUIRE(model->should_include("clanguml::t00020::ProductA"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("ProductA")));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("ProductB")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ProductA1")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ProductA2")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ProductB1")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ProductB2")));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("AbstractFactory")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Factory1")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Factory2")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("ProductA")));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("ProductB")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ProductA1")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ProductA2")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ProductB1")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ProductB2")));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("AbstractFactory")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Factory1")));
|
||||
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,18 +29,28 @@ TEST_CASE("t00021", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00021_class");
|
||||
REQUIRE(model->should_include("clanguml::t00021::Visitor"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("Item")));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("Visitor")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Visitor1")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Visitor2")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Visitor3")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("Item")));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("Visitor")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Visitor1")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Visitor2")));
|
||||
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,14 +29,24 @@ TEST_CASE("t00022", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00022_class");
|
||||
REQUIRE(model->should_include("clanguml::t00022::A"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A1")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A2")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A1")));
|
||||
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,14 +29,24 @@ TEST_CASE("t00023", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00023_class");
|
||||
REQUIRE(model->should_include("clanguml::t00023::Visitor"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("Strategy")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("StrategyA")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("StrategyB")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("Strategy")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("StrategyA")));
|
||||
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,18 +29,28 @@ TEST_CASE("t00024", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00024_class");
|
||||
REQUIRE(model->should_include("clanguml::t00024::A"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("Target")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Target1")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Target2")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Proxy")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Target1")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Target2")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Proxy")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("Target")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Target1")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Target2")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Proxy")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Target1")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Target2")));
|
||||
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,26 +29,38 @@ TEST_CASE("t00025", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00025_class");
|
||||
REQUIRE(model->should_include("clanguml::t00025::A"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Target1")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Target2")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Proxy", "T"));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("Proxy<T>"), _A("Proxy<Target1>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("Proxy<T>"), _A("Proxy<Target2>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("ProxyHolder"), _A("Proxy<Target1>"), "+proxy1"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("ProxyHolder"), _A("Proxy<Target2>"), "+proxy2"));
|
||||
REQUIRE_THAT(
|
||||
puml, !IsAggregation(_A("ProxyHolder"), _A("Target1"), "+proxy1"));
|
||||
REQUIRE_THAT(
|
||||
puml, !IsAggregation(_A("ProxyHolder"), _A("Target2"), "+proxy2"));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("Proxy<Target1>"), _A("Target1")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("Proxy<Target2>"), _A("Target2")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Target1")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Target2")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Proxy", "T"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("Proxy<T>"), _A("Proxy<Target1>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("Proxy<T>"), _A("Proxy<Target2>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("ProxyHolder"), _A("Proxy<Target1>"), "+proxy1"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("ProxyHolder"), _A("Proxy<Target2>"), "+proxy2"));
|
||||
REQUIRE_THAT(
|
||||
puml, !IsAggregation(_A("ProxyHolder"), _A("Target1"), "+proxy1"));
|
||||
REQUIRE_THAT(
|
||||
puml, !IsAggregation(_A("ProxyHolder"), _A("Target2"), "+proxy2"));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("Proxy<Target1>"), _A("Target1")));
|
||||
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,18 +29,29 @@ TEST_CASE("t00026", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00026_class");
|
||||
REQUIRE(model->should_include("clanguml::t00026::A"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Memento", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Originator", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Caretaker", "T"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("Originator<T>"), _A("Originator<std::string>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("Caretaker<T>"), _A("Caretaker<std::string>")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Memento", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Originator", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Caretaker", "T"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(
|
||||
_A("Originator<T>"), _A("Originator<std::string>")));
|
||||
REQUIRE_THAT(puml,
|
||||
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,30 +29,42 @@ TEST_CASE("t00027", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00027_class");
|
||||
REQUIRE(model->should_include("clanguml::t00027::A"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("Shape")));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("ShapeDecorator")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Line", "T<>..."));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Text", "T<>..."));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("Line<T<>...>"), _A("Line<Color>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("Line<T<>...>"), _A("Line<Color,Weight>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("Text<T<>...>"), _A("Text<Color>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("Text<T<>...>"), _A("Text<Color,Weight>")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("Shape")));
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("ShapeDecorator")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Line", "T<>..."));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Text", "T<>..."));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("Line<T<>...>"), _A("Line<Color>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("Line<T<>...>"), _A("Line<Color,Weight>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("Text<T<>...>"), _A("Text<Color>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("Text<T<>...>"), _A("Text<Color,Weight>")));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, IsAggregation(_A("Window"), _A("Line<Color,Weight>"), "+border"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsAggregation(_A("Window"), _A("Line<Color>"), "+divider"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsAggregation(_A("Window"), _A("Text<Color,Weight>"), "+title"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsAggregation(_A("Window"), _A("Text<Color>"), "+description"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("Window"), _A("Line<Color,Weight>"), "+border"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsAggregation(_A("Window"), _A("Line<Color>"), "+divider"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("Window"), _A("Text<Color,Weight>"), "+title"));
|
||||
REQUIRE_THAT(puml,
|
||||
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,37 +29,49 @@ TEST_CASE("t00028", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00028_class");
|
||||
REQUIRE(model->should_include("clanguml::t00028::A"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("E", "T"));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
REQUIRE_THAT(puml, HasNote(_A("A"), "top", "A class note."));
|
||||
REQUIRE_THAT(puml, HasNote(_A("B"), "left", "B class note."));
|
||||
REQUIRE_THAT(puml, HasNote(_A("C"), "bottom", "C class note."));
|
||||
const auto d_note = R"(
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("E", "T"));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
REQUIRE_THAT(puml, HasNote(_A("A"), "top", "A class note."));
|
||||
REQUIRE_THAT(puml, HasNote(_A("B"), "left", "B class note."));
|
||||
REQUIRE_THAT(puml, HasNote(_A("C"), "bottom", "C class note."));
|
||||
const auto d_note = R"(
|
||||
D
|
||||
class
|
||||
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("F"), "bottom", "F enum note."));
|
||||
REQUIRE_THAT(puml, !HasNote(_A("G"), "left", "G class note."));
|
||||
REQUIRE_THAT(puml, HasNote(_A("R"), "right", "R class note."));
|
||||
REQUIRE_THAT(puml,
|
||||
HasMemberNote(_A("R"), "aaa", "left", "R contains an instance of A."));
|
||||
REQUIRE_THAT(
|
||||
puml, !HasMemberNote(_A("R"), "bbb", "right", "R class note."));
|
||||
REQUIRE_THAT(
|
||||
puml, HasMemberNote(_A("R"), "ccc", "left", "Reference to C."));
|
||||
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("F"), "bottom", "F enum note."));
|
||||
REQUIRE_THAT(puml, !HasNote(_A("G"), "left", "G class note."));
|
||||
REQUIRE_THAT(puml, HasNote(_A("R"), "right", "R class note."));
|
||||
REQUIRE_THAT(puml,
|
||||
HasMemberNote(
|
||||
_A("R"), "aaa", "left", "R contains an instance of A."));
|
||||
REQUIRE_THAT(
|
||||
puml, !HasMemberNote(_A("R"), "bbb", "right", "R class note."));
|
||||
REQUIRE_THAT(
|
||||
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,29 +29,39 @@ TEST_CASE("t00029", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00029_class");
|
||||
REQUIRE(model->should_include("clanguml::t00029::A"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("C", "T"));
|
||||
REQUIRE_THAT(puml, !IsClassTemplate("D", "T"));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("E")));
|
||||
REQUIRE_THAT(puml, !IsEnum(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G1")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G2")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G3")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G4")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("C", "T"));
|
||||
REQUIRE_THAT(puml, !IsClassTemplate("D", "T"));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("E")));
|
||||
REQUIRE_THAT(puml, !IsEnum(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G1")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G2")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G3")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G4")));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("G1"), "+g1"));
|
||||
REQUIRE_THAT(puml, !IsAggregation(_A("R"), _A("G2"), "+g2"));
|
||||
REQUIRE_THAT(puml, !IsAggregation(_A("R"), _A("G3"), "+g3"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G4"), "+g4"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("G1"), "+g1"));
|
||||
REQUIRE_THAT(puml, !IsAggregation(_A("R"), _A("G2"), "+g2"));
|
||||
REQUIRE_THAT(puml, !IsAggregation(_A("R"), _A("G3"), "+g3"));
|
||||
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,22 +29,34 @@ TEST_CASE("t00030", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00030_class");
|
||||
REQUIRE(model->should_include("clanguml::t00030::A"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("A"), "+aaa"));
|
||||
REQUIRE_THAT(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, IsAggregation(_A("R"), _A("E"), "+eee", "", "1"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("A"), "+aaa"));
|
||||
REQUIRE_THAT(
|
||||
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, 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,29 +29,39 @@ TEST_CASE("t00031", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00031_class");
|
||||
REQUIRE(model->should_include("clanguml::t00031::A"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("C", "T"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("C", "T"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsAssociationWithStyle(
|
||||
_A("R"), _A("A"), "+aaa", "#red,dashed,thickness=2"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsCompositionWithStyle(
|
||||
_A("R"), _A("B"), "+bbb", "#green,dashed,thickness=4"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregationWithStyle(
|
||||
_A("R"), _A("C<int>"), "+ccc", "#blue,dotted,thickness=8"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAssociationWithStyle(
|
||||
_A("R"), _A("D"), "+ddd", "#blue,plain,thickness=16"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAssociationWithStyle(
|
||||
_A("R"), _A("A"), "+aaa", "#red,dashed,thickness=2"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsCompositionWithStyle(
|
||||
_A("R"), _A("B"), "+bbb", "#green,dashed,thickness=4"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregationWithStyle(
|
||||
_A("R"), _A("C<int>"), "+ccc", "#blue,dotted,thickness=8"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAssociationWithStyle(
|
||||
_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,28 +28,40 @@ TEST_CASE("t00032", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00032_class");
|
||||
REQUIRE(model->should_include("clanguml::t00032::A"));
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Base")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("TBase")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("Base")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("TBase")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Overload", "T,L,Ts..."));
|
||||
|
||||
REQUIRE_THAT(puml, IsClassTemplate("Overload", "T,L,Ts..."));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("Overload<T,L,Ts...>")));
|
||||
REQUIRE_THAT(
|
||||
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(
|
||||
puml, IsBaseClass(_A("B"), _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("Base"), _A("Overload<T,L,Ts...>")));
|
||||
REQUIRE_THAT(
|
||||
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(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);
|
||||
}
|
||||
{
|
||||
auto j = generate_class_json(diagram, *model);
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
using namespace json;
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,30 +29,40 @@ TEST_CASE("t00033", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00033_class");
|
||||
REQUIRE(model->should_include("clanguml::t00033::A"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("C", "T"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("C", "T"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(
|
||||
_A("A<B<std::unique_ptr<C<D>>>>"), _A("B<std::unique_ptr<C<D>>>")));
|
||||
REQUIRE_THAT(
|
||||
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("A<B<std::unique_ptr<C<D>>>>"),
|
||||
_A("B<std::unique_ptr<C<D>>>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsDependency(_A("B<std::unique_ptr<C<D>>>"), _A("C<D>")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("C<D>"), _A("D")));
|
||||
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("C<T>"), _A("C<D>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("B<T>"), _A("B<std::unique_ptr<C<D>>>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("A<T>"), _A("A<B<std::unique_ptr<C<D>>>>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("C<T>"), _A("C<D>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("B<T>"), _A("B<std::unique_ptr<C<D>>>")));
|
||||
REQUIRE_THAT(puml,
|
||||
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,22 +29,32 @@ TEST_CASE("t00034", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00034_class");
|
||||
REQUIRE(model->should_include("clanguml::t00034::A"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, IsClassTemplate("lift_void", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("drop_void", "T"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Void")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("lift_void", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("drop_void", "T"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Void")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("lift_void<T>"), _A("lift_void<void>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("drop_void<T>"), _A("drop_void<Void>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("lift_void<T>"), _A("lift_void<void>")));
|
||||
REQUIRE_THAT(
|
||||
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,22 +29,32 @@ TEST_CASE("t00035", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00035_class");
|
||||
REQUIRE(model->should_include("clanguml::t00035::A"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("Top")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Bottom")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Center")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Left")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Right")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Top")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Bottom")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Center")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Left")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Right")));
|
||||
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "up", _A("Top")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "left", _A("Left")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "right", _A("Right")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "down", _A("Bottom")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "up", _A("Top")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "left", _A("Left")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "right", _A("Right")));
|
||||
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,31 +28,41 @@ TEST_CASE("t00036", "[test-case][class]")
|
||||
auto model = generate_class_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t00036_class");
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "int"));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsPackage("ns111"));
|
||||
REQUIRE_THAT(puml, IsPackage("ns22"));
|
||||
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "int"));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsPackage("ns111"));
|
||||
REQUIRE_THAT(puml, IsPackage("ns22"));
|
||||
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);
|
||||
}
|
||||
{
|
||||
auto j = generate_class_json(diagram, *model);
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
using namespace json;
|
||||
|
||||
auto j = generate_class_json(diagram, *model);
|
||||
REQUIRE(IsClass(j, "ns1::ns11::A<T>"));
|
||||
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"));
|
||||
|
||||
// REQUIRE(json::IsClass(j, "clanguml::t00036::A<T>"));
|
||||
// REQUIRE(json::IsClass(j, "clanguml::t00036::A<int>"));
|
||||
// REQUIRE(json::IsClass(j, "clanguml::t00036::B"));
|
||||
// REQUIRE(json::IsClass(j, "clanguml::t00036::C"));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,19 +29,30 @@ TEST_CASE("t00037", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00037_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("ST")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ST::(units)")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ST::(dimensions)")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsAggregation(_A("ST"), _A("ST::(dimensions)"), "+dimensions"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("ST"), _A("ST::(units)"), "-units"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ST")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ST::(units)")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ST::(dimensions)")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("ST"), _A("ST::(dimensions)"), "+dimensions"));
|
||||
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,67 +29,81 @@ TEST_CASE("t00038", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00038_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("thirdparty::ns1::E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("key_t")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("map", "T"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsClassTemplate("map",
|
||||
"std::integral_constant<property_t,property_t::property_a>"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsClassTemplate("map",
|
||||
"std::vector<std::integral_constant<property_t,property_t::"
|
||||
"property_b>>"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsClassTemplate("map",
|
||||
"std::map<key_t,std::vector<std::integral_constant<property_t,"
|
||||
"property_t::property_c>>>"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("thirdparty::ns1::E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("key_t")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("map", "T"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsClassTemplate("map",
|
||||
"std::integral_constant<property_t,property_t::property_a>"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsClassTemplate("map",
|
||||
"std::vector<std::integral_constant<property_t,property_t::"
|
||||
"property_b>>"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsClassTemplate("map",
|
||||
"std::map<key_t,std::vector<std::integral_constant<property_t,"
|
||||
"property_t::property_c>>>"));
|
||||
|
||||
REQUIRE_THAT(puml, IsEnum(_A("property_t")));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("property_t")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("map<T>"),
|
||||
_A("map<std::map<key_t,std::vector<std::integral_constant<property_"
|
||||
"t,property_t::property_c>>>>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("map<T>"),
|
||||
_A("map<std::map<key_t,std::vector<std::integral_constant<"
|
||||
"property_"
|
||||
"t,property_t::property_c>>>>")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(_A("map<std::integral_constant<property_t,property_t::"
|
||||
"property_a>>"),
|
||||
_A("property_t")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(_A("map<std::integral_constant<property_t,property_t::"
|
||||
"property_a>>"),
|
||||
_A("property_t")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(_A("map<"
|
||||
"std::vector<std::integral_constant<property_t,"
|
||||
"property_t::property_b>>>"),
|
||||
_A("property_t")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(_A("map<"
|
||||
"std::vector<std::integral_constant<property_t,"
|
||||
"property_t::property_b>>>"),
|
||||
_A("property_t")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(_A("map<std::map<key_t,std::vector<std::integral_constant<"
|
||||
"property_t,property_t::property_c>>>>"),
|
||||
_A("property_t")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(
|
||||
_A("map<std::map<key_t,std::vector<std::integral_constant<"
|
||||
"property_t,property_t::property_c>>>>"),
|
||||
_A("property_t")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(_A("map<std::map<key_t,std::vector<std::integral_constant<"
|
||||
"property_t,property_t::property_c>>>>"),
|
||||
_A("key_t")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(
|
||||
_A("map<std::map<key_t,std::vector<std::integral_constant<"
|
||||
"property_t,property_t::property_c>>>>"),
|
||||
_A("key_t")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(_A("map<std::integral_constant<thirdparty::ns1::color_t,"
|
||||
"thirdparty::ns1::color_t::red>>"),
|
||||
_A("thirdparty::ns1::color_t")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(
|
||||
_A("map<std::integral_constant<thirdparty::ns1::color_t,"
|
||||
"thirdparty::ns1::color_t::red>>"),
|
||||
_A("thirdparty::ns1::color_t")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsBaseClass(_A("thirdparty::ns1::E"),
|
||||
_A("map<std::integral_constant<thirdparty::ns1::color_t,"
|
||||
"thirdparty::ns1::color_t::red>>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsBaseClass(_A("thirdparty::ns1::E"),
|
||||
_A("map<std::integral_constant<thirdparty::ns1::color_t,"
|
||||
"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,44 +24,53 @@ TEST_CASE("t00039", "[test-case][class]")
|
||||
|
||||
REQUIRE(diagram->name == "t00039_class");
|
||||
REQUIRE(diagram->generate_packages() == false);
|
||||
|
||||
auto model = generate_class_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t00039_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("AA")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("AAA")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns2::AAAA")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("AA")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("AA"), _A("AAA")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("AAA"), _A("ns2::AAAA")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("detail::AA")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("AA")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("AAA")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns2::AAAA")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("AA")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("AA"), _A("AAA")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("AAA"), _A("ns2::AAAA")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("detail::AA")));
|
||||
|
||||
REQUIRE_THAT(puml, !IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("ns1::BB")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("ns1::BB")));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("CD")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("D"), _A("CD")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("D"), _A("DE")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("E"), _A("DE")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("CDE")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("D"), _A("CDE")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("E"), _A("CDE")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("CD")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("D"), _A("CD")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("D"), _A("DE")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("E"), _A("DE")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("CDE")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("D"), _A("CDE")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("E"), _A("CDE")));
|
||||
|
||||
REQUIRE_THAT(puml, IsClassTemplate("ns3::F", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("ns3::FF", "T,M"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("ns3::FE", "T,M"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("ns3::FFF", "T,M,N"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("ns3::F", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("ns3::FF", "T,M"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("ns3::FE", "T,M"));
|
||||
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,22 +28,31 @@ TEST_CASE("t00040", "[test-case][class]")
|
||||
auto model = generate_class_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t00040_class");
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("AA")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("AAA")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("AA")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("AA"), _A("AAA")));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("AA")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("AAA")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("AA")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("AA"), _A("AAA")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("B")));
|
||||
|
||||
REQUIRE_THAT(puml, !IsClass(_A("B")));
|
||||
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);
|
||||
}
|
||||
{
|
||||
auto j = generate_class_json(diagram, *model);
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
using namespace json;
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,41 +28,50 @@ TEST_CASE("t00041", "[test-case][class]")
|
||||
auto model = generate_class_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t00041_class");
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("AA")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("AAA")));
|
||||
|
||||
REQUIRE_THAT(puml, !IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("AA")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("AAA")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("B")));
|
||||
|
||||
REQUIRE_THAT(puml, !IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("RR")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("RRR")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("detail::G")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("H")));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("RR")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("RRR")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("detail::G")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("H")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("R"), _A("RR")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("RR"), _A("RRR")));
|
||||
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("R"), _A("RR")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("RR"), _A("RRR")));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("D"), _A("RR"), "+rr"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("RR"), _A("E"), "+e"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("RR"), _A("F"), "+f"));
|
||||
REQUIRE_THAT(puml, !IsDependency(_A("RR"), _A("H")));
|
||||
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("D"), _A("RR"), "+rr"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("RR"), _A("E"), "+e"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("RR"), _A("F"), "+f"));
|
||||
REQUIRE_THAT(puml, !IsDependency(_A("RR"), _A("H")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::N")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::NN")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::NM")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("ns1::N"), _A("ns1::NN")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("ns1::N"), _A("ns1::NM")));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::N")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::NN")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::NM")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("ns1::N"), _A("ns1::NN")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("ns1::N"), _A("ns1::NM")));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
{
|
||||
auto j = generate_class_json(diagram, *model);
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
using namespace json;
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,15 +29,25 @@ TEST_CASE("t00042", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00042_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T,K"));
|
||||
REQUIRE_THAT(puml, !IsClassTemplate("C", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T,K"));
|
||||
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,38 +29,48 @@ TEST_CASE("t00043", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00043_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
// Check dependants filter
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("BB")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("F")));
|
||||
// Check dependants filter
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("BB")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("F")));
|
||||
|
||||
REQUIRE_THAT(puml, IsDependency(_A("B"), _A("A")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("BB"), _A("A")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("C"), _A("B")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("D"), _A("C")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("E"), _A("D")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("B"), _A("A")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("BB"), _A("A")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("C"), _A("B")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("D"), _A("C")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("E"), _A("D")));
|
||||
|
||||
// Check dependencies filter
|
||||
REQUIRE_THAT(puml, IsClass(_A("G")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("GG")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("H")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("HH")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("I")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("J")));
|
||||
// Check dependencies filter
|
||||
REQUIRE_THAT(puml, IsClass(_A("G")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("GG")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("H")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("HH")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("I")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("J")));
|
||||
|
||||
REQUIRE_THAT(puml, IsDependency(_A("H"), _A("G")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("H"), _A("GG")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("I"), _A("H")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("J"), _A("I")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("H"), _A("G")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("H"), _A("GG")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("I"), _A("H")));
|
||||
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,16 +28,26 @@ TEST_CASE("t00044", "[test-case][class]")
|
||||
auto model = generate_class_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t00044_class");
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// TODO:
|
||||
// Check dependants filter<void(int), bool>
|
||||
// REQUIRE_THAT(puml, IsClassTemplate("signal_handler",
|
||||
// "Ret,Args...,A"));
|
||||
|
||||
// TODO:
|
||||
// Check dependants filter<void(int), bool>
|
||||
// REQUIRE_THAT(puml, IsClassTemplate("signal_handler", "Ret,Args...,A"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
{
|
||||
auto j = generate_class_json(diagram, *model);
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
using namespace json;
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,40 +29,52 @@ TEST_CASE("t00045", "[test-case][class]")
|
||||
REQUIRE(model->name() == "t00045_class");
|
||||
REQUIRE(model->should_include("clanguml::t00045::ns1::ns2::A"));
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::R")));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::R")));
|
||||
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("ns1::ns2::A"), _A("ns1::ns2::B")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("ns1::A"), _A("ns1::ns2::C")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("ns1::ns2::A"), _A("ns1::ns2::D")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("ns1::ns2::E")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("ns1::ns2::A"), _A("ns1::ns2::B")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("ns1::A"), _A("ns1::ns2::C")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("ns1::ns2::A"), _A("ns1::ns2::D")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("ns1::ns2::E")));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, IsAssociation(_A("ns1::ns2::R"), _A("ns1::ns2::A"), "+a"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsAssociation(_A("ns1::ns2::R"), _A("ns1::A"), "+ns1_a"));
|
||||
REQUIRE_THAT(puml,
|
||||
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("ns1::ns2::A"), "+a"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsAssociation(_A("ns1::ns2::R"), _A("ns1::A"), "+ns1_a"));
|
||||
REQUIRE_THAT(puml,
|
||||
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, IsDependency(_A("ns1::ns2::R"), _A("AA")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("ns1::ns2::R"), _A("AA")));
|
||||
|
||||
REQUIRE_THAT(puml, IsFriend<Public>(_A("ns1::ns2::R"), _A("AAA")));
|
||||
REQUIRE_THAT(
|
||||
puml, !IsFriend<Public>(_A("ns1::ns2::R"), _A("ns1::ns2::AAA")));
|
||||
// TODO:
|
||||
// REQUIRE_THAT(puml, IsFriend<Public>(_A("ns1::ns2::R"), _A("AAAA<T>")));
|
||||
REQUIRE_THAT(puml, IsFriend<Public>(_A("ns1::ns2::R"), _A("AAA")));
|
||||
REQUIRE_THAT(
|
||||
puml, !IsFriend<Public>(_A("ns1::ns2::R"), _A("ns1::ns2::AAA")));
|
||||
// TODO:
|
||||
// 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,20 +28,29 @@ TEST_CASE("t00046", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00046_class");
|
||||
REQUIRE(model->should_include("ns1::ns2::A"));
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
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);
|
||||
}
|
||||
{
|
||||
auto j = generate_class_json(diagram, *model);
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
using namespace json;
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,20 +27,29 @@ TEST_CASE("t00047", "[test-case][class]")
|
||||
auto model = generate_class_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t00047_class");
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if class templates exist
|
||||
REQUIRE_THAT(puml, IsClassTemplate("conditional_t", "Ts..."));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("conditional_t", "Else"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsClassTemplate("conditional_t", "std::true_type,Result,Tail..."));
|
||||
REQUIRE_THAT(puml,
|
||||
IsClassTemplate("conditional_t", "std::false_type,Result,Tail..."));
|
||||
|
||||
// Check if class templates exist
|
||||
REQUIRE_THAT(puml, IsClassTemplate("conditional_t", "Ts..."));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("conditional_t", "Else"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsClassTemplate("conditional_t", "std::true_type,Result,Tail..."));
|
||||
REQUIRE_THAT(puml,
|
||||
IsClassTemplate("conditional_t", "std::false_type,Result,Tail..."));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
{
|
||||
auto j = generate_class_json(diagram, *model);
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
using namespace json;
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,26 +27,35 @@ TEST_CASE("t00048", "[test-case][class]")
|
||||
auto model = generate_class_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t00048_class");
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("Base")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsAbstractClass(_A("Base")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
// Check if class templates exist
|
||||
REQUIRE_THAT(puml, IsAbstractClassTemplate("BaseTemplate", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("ATemplate", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("BTemplate", "T"));
|
||||
|
||||
// Check if class templates exist
|
||||
REQUIRE_THAT(puml, IsAbstractClassTemplate("BaseTemplate", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("ATemplate", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("BTemplate", "T"));
|
||||
// Check if all inheritance relationships exist
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("A")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("B")));
|
||||
|
||||
// Check if all inheritance relationships exist
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("A")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("B")));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
{
|
||||
auto j = generate_class_json(diagram, *model);
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
using namespace json;
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,34 +27,43 @@ TEST_CASE("t00049", "[test-case][class]")
|
||||
auto model = generate_class_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t00049_class");
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
// Check if class templates exist
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T"));
|
||||
|
||||
// Check if class templates exist
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T"));
|
||||
// Check if all methods exist
|
||||
REQUIRE_THAT(puml, (IsMethod<Public>("get_int_map", "A<intmap>")));
|
||||
REQUIRE_THAT(puml,
|
||||
(IsMethod<Public>("set_int_map", "void", "A<intmap> && int_map")));
|
||||
|
||||
// Check if all methods exist
|
||||
REQUIRE_THAT(puml, (IsMethod<Public>("get_int_map", "A<intmap>")));
|
||||
REQUIRE_THAT(puml,
|
||||
(IsMethod<Public>("set_int_map", "void", "A<intmap> && int_map")));
|
||||
// Check if all fields exist
|
||||
REQUIRE_THAT(puml, (IsField<Public>("a_string", "A<thestring>")));
|
||||
REQUIRE_THAT(
|
||||
puml, (IsField<Public>("a_vector_string", "A<string_vector>")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("a_int_map", "A<intmap>")));
|
||||
|
||||
// Check if all fields exist
|
||||
REQUIRE_THAT(puml, (IsField<Public>("a_string", "A<thestring>")));
|
||||
REQUIRE_THAT(
|
||||
puml, (IsField<Public>("a_vector_string", "A<string_vector>")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("a_int_map", "A<intmap>")));
|
||||
// Check if all relationships exist
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<string_vector>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<thestring>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<intmap>")));
|
||||
|
||||
// Check if all relationships exist
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<string_vector>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<thestring>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<intmap>")));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
{
|
||||
auto j = generate_class_json(diagram, *model);
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
using namespace json;
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,31 +27,40 @@ TEST_CASE("t00050", "[test-case][class]")
|
||||
auto model = generate_class_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t00050_class");
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("utils::D")));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("E")));
|
||||
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("utils::D")));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("E")));
|
||||
REQUIRE_THAT(puml, HasNote(_A("A"), "left"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("A"), "right"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("B"), "top"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("C"), "top"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("utils::D"), "top"));
|
||||
REQUIRE_THAT(puml, !HasNote(_A("E"), "bottom"));
|
||||
REQUIRE_THAT(puml, !HasNote(_A("NoComment"), "top"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("F<T,V,int N>"), "top"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("G"), "top"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("G"), "bottom"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("G"), "right"));
|
||||
|
||||
REQUIRE_THAT(puml, HasNote(_A("A"), "left"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("A"), "right"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("B"), "top"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("C"), "top"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("utils::D"), "top"));
|
||||
REQUIRE_THAT(puml, !HasNote(_A("E"), "bottom"));
|
||||
REQUIRE_THAT(puml, !HasNote(_A("NoComment"), "top"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("F<T,V,int N>"), "top"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("G"), "top"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("G"), "bottom"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("G"), "right"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
{
|
||||
auto j = generate_class_json(diagram, *model);
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
using namespace json;
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -28,49 +28,62 @@ TEST_CASE("t00051", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00051_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("A::custom_thread1")));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("A::custom_thread2")));
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("A::custom_thread1")));
|
||||
REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("A::custom_thread2")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
(IsMethod<Public>("custom_thread1<Function,Args...>", "void",
|
||||
"Function && f, Args &&... args")));
|
||||
REQUIRE_THAT(puml,
|
||||
(IsMethod<Public>("thread", "void",
|
||||
"(lambda at ../../tests/t00051/t00051.cc:59:27) && ")));
|
||||
REQUIRE_THAT(puml,
|
||||
(IsMethod<Private>("start_thread3",
|
||||
"B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at "
|
||||
"../../tests/t00051/t00051.cc:43:27)>")));
|
||||
REQUIRE_THAT(puml,
|
||||
(IsMethod<Private>(
|
||||
"get_function", "(lambda at ../../tests/t00051/t00051.cc:48:16)")));
|
||||
REQUIRE_THAT(puml,
|
||||
(IsMethod<Public>("custom_thread1<Function,Args...>", "void",
|
||||
"Function && f, Args &&... args")));
|
||||
REQUIRE_THAT(puml,
|
||||
(IsMethod<Public>("thread", "void",
|
||||
"(lambda at ../../tests/t00051/t00051.cc:59:27) && ")));
|
||||
REQUIRE_THAT(puml,
|
||||
(IsMethod<Private>("start_thread3",
|
||||
"B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at "
|
||||
"../../tests/t00051/t00051.cc:43:27)>")));
|
||||
REQUIRE_THAT(puml,
|
||||
(IsMethod<Private>("get_function",
|
||||
"(lambda at ../../tests/t00051/t00051.cc:48:16)")));
|
||||
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "F,FF=F"));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public>("f", "void")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public>("ff", "void")));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "F,FF=F"));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public>("f", "void")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public>("ff", "void")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsClassTemplate("B",
|
||||
"(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at "
|
||||
"../../tests/t00051/t00051.cc:43:27)"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsClassTemplate("B",
|
||||
"(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at "
|
||||
"../../tests/t00051/t00051.cc:43:27)"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("B<F,FF=F>"),
|
||||
_A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at "
|
||||
"../../tests/t00051/t00051.cc:43:27)>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("B<F,FF=F>"),
|
||||
_A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda "
|
||||
"at "
|
||||
"../../tests/t00051/t00051.cc:43:27)>")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(_A("A"),
|
||||
_A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at "
|
||||
"../../tests/t00051/t00051.cc:43:27)>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(_A("A"),
|
||||
_A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda "
|
||||
"at "
|
||||
"../../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,23 +28,34 @@ TEST_CASE("t00052", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00052_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
|
||||
// Check if class templates exist
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T"));
|
||||
// Check if class templates exist
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T"));
|
||||
|
||||
// Check if all methods exist
|
||||
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>("b", "T", "T t")));
|
||||
REQUIRE_THAT(puml, (IsMethod<Public>("bb<F>", "T", "F && f, T t")));
|
||||
// Check if all methods exist
|
||||
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>("b", "T", "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,28 +28,39 @@ TEST_CASE("t00053", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00053_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("a")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("b")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("c")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("d")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("e")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("f")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("g")));
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("a")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("b")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("c")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("d")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("e")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("f")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("g")));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("F")));
|
||||
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,32 +28,43 @@ TEST_CASE("t00054", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00054_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("a")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("b")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("c")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("d")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("e")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("f")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("g")));
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("a")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("b")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("c")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("d")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("e")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("f")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("g")));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G")));
|
||||
|
||||
REQUIRE_THAT(puml, IsEnum(_A("i")));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("h")));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("j")));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("i")));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("h")));
|
||||
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,33 +28,44 @@ TEST_CASE("t00055", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00055_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("H")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("I")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("J")));
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("G")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("H")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("I")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("J")));
|
||||
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("A"), "right", _A("C")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("C"), "right", _A("E")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("E"), "right", _A("G")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("G"), "right", _A("I")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("A"), "right", _A("C")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("C"), "right", _A("E")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("E"), "right", _A("G")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("G"), "right", _A("I")));
|
||||
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("B"), "down", _A("D")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("D"), "down", _A("F")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("F"), "down", _A("H")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("H"), "down", _A("J")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("B"), "down", _A("D")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("D"), "down", _A("F")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("F"), "down", _A("H")));
|
||||
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,99 +27,102 @@ TEST_CASE("t00056", "[test-case][class]")
|
||||
auto model = generate_class_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t00056_class");
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsConcept(_A("greater_than_simple<T,L>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("greater_than_with_requires<T,P>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("max_four_bytes<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("iterable<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("has_value_type<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("convertible_to_string<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("iterable_with_value_type<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("iterable_or_small_value_type<T>")));
|
||||
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsConcept(_A("greater_than_simple<T,L>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("greater_than_with_requires<T,P>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("max_four_bytes<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("iterable<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("has_value_type<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("convertible_to_string<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("iterable_with_value_type<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("iterable_or_small_value_type<T>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(_A("greater_than_with_requires<T,P>"),
|
||||
"sizeof (l) > sizeof (r)"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(
|
||||
_A("greater_than_with_requires<T,P>"), "sizeof (l) > sizeof (r)"));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, IsConceptRequirement(_A("iterable<T>"), "container.begin()"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsConceptRequirement(_A("iterable<T>"), "container.end()"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsConceptRequirement(_A("iterable<T>"), "container.begin()"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsConceptRequirement(_A("iterable<T>"), "container.end()"));
|
||||
|
||||
#ifdef _MSC_VER
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(
|
||||
_A("convertible_to_string<T>"), "std::string({s})"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(
|
||||
_A("convertible_to_string<T>"), "std::string({s})"));
|
||||
#else
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(_A("convertible_to_string<T>"), "std::string{s}"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(
|
||||
_A("convertible_to_string<T>"), "std::string{s}"));
|
||||
#endif
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(
|
||||
_A("convertible_to_string<T>"), "{std::to_string(s)} noexcept"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(_A("convertible_to_string<T>"),
|
||||
"{std::to_string(s)} -> std::same_as<std::string>"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(_A("convertible_to_string<T>"),
|
||||
"{std::to_string(s)} noexcept"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(_A("convertible_to_string<T>"),
|
||||
"{std::to_string(s)} -> std::same_as<std::string>"));
|
||||
|
||||
// Check if class templates exist
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "max_four_bytes T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("C", "convertible_to_string T"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsClassTemplate("D", "iterable T1,T2,iterable T3,T4,T5"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("E", "T1,T2,T3"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("F", "T1,T2,T3"));
|
||||
// Check if class templates exist
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "max_four_bytes T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("C", "convertible_to_string T"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsClassTemplate("D", "iterable T1,T2,iterable T3,T4,T5"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("E", "T1,T2,T3"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("F", "T1,T2,T3"));
|
||||
|
||||
// Check if all relationships exist
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("A<max_four_bytes T>"), _A("max_four_bytes<T>"), "T"));
|
||||
// Check if all relationships exist
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(
|
||||
_A("A<max_four_bytes T>"), _A("max_four_bytes<T>"), "T"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||
_A("max_four_bytes<T>"), "T2"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||
_A("max_four_bytes<T>"), "T5"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||
_A("iterable<T>"), "T1"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||
_A("iterable<T>"), "T3"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||
_A("max_four_bytes<T>"), "T2"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||
_A("max_four_bytes<T>"), "T5"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||
_A("iterable<T>"), "T1"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||
_A("iterable<T>"), "T3"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(
|
||||
_A("iterable_with_value_type<T>"), _A("has_value_type<T>"), "T"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("iterable_with_value_type<T>"),
|
||||
_A("has_value_type<T>"), "T"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("iterable_or_small_value_type<T>"),
|
||||
_A("max_four_bytes<T>"), "T"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("iterable_or_small_value_type<T>"),
|
||||
_A("iterable_with_value_type<T>"), "T"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("iterable_or_small_value_type<T>"),
|
||||
_A("max_four_bytes<T>"), "T"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("iterable_or_small_value_type<T>"),
|
||||
_A("iterable_with_value_type<T>"), "T"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(
|
||||
_A("E<T1,T2,T3>"), _A("greater_than_with_requires<T,P>"), "T1,T3"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("E<T1,T2,T3>"),
|
||||
_A("greater_than_with_requires<T,P>"), "T1,T3"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(
|
||||
_A("F<T1,T2,T3>"), _A("greater_than_simple<T,L>"), "T1,T3"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(
|
||||
_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);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(json::IsClass(j, "clanguml::t00014::A<T>"));
|
||||
// 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,34 +27,44 @@ TEST_CASE("t00057", "[test-case][class]")
|
||||
auto model = generate_class_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t00057_class");
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("t00057_A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("t00057_B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("t00057_C")));
|
||||
REQUIRE_THAT(puml, IsUnion(_A("t00057_D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("t00057_E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("t00057_F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("t00057_R")));
|
||||
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("t00057_A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("t00057_B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("t00057_C")));
|
||||
REQUIRE_THAT(puml, IsUnion(_A("t00057_D")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("t00057_E")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("t00057_F")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("t00057_R")));
|
||||
// Check if all relationships exist
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("t00057_R"), _A("t00057_A"), "+a"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("t00057_R"), _A("t00057_B"), "+b"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("t00057_R"), _A("t00057_C"), "+c"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("t00057_R"), _A("t00057_D"), "+d"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("t00057_R"), _A("t00057_E"), "+e"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("t00057_R"), _A("t00057_F"), "+f"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(
|
||||
_A("t00057_E"), _A("t00057_E::(coordinates)"), "+coordinates"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("t00057_E"), _A("t00057_E::(height)"), "+height"));
|
||||
|
||||
// Check if all relationships exist
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("t00057_R"), _A("t00057_A"), "+a"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("t00057_R"), _A("t00057_B"), "+b"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("t00057_R"), _A("t00057_C"), "+c"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("t00057_R"), _A("t00057_D"), "+d"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("t00057_R"), _A("t00057_E"), "+e"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("t00057_R"), _A("t00057_F"), "+f"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(
|
||||
_A("t00057_E"), _A("t00057_E::(coordinates)"), "+coordinates"));
|
||||
REQUIRE_THAT(puml,
|
||||
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,42 +28,53 @@ TEST_CASE("t00058", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00058_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "int,int,double,std::string"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsClassTemplate("B", "int,std::string,int,double,A<int,int>"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "int,int,double,std::string"));
|
||||
REQUIRE_THAT(puml,
|
||||
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,
|
||||
IsConstraint(_A("A<T,Args...>"), _A("same_as_first_type<T,Args...>"),
|
||||
"T,Args..."));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("A<T,Args...>"),
|
||||
_A("same_as_first_type<T,Args...>"), "T,Args..."));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("B<T,P,Args...>"), _A("same_as_first_type<T,Args...>"),
|
||||
"T,Args..."));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("B<T,P,Args...>"),
|
||||
_A("same_as_first_type<T,Args...>"), "T,Args..."));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("R"), _A("A<int,int,double,std::string>"), "+aa"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(
|
||||
_A("R"), _A("B<int,std::string,int,double,A<int,int>>"), "+bb"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("R"), _A("A<int,int,double,std::string>"), "+aa"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("R"),
|
||||
_A("B<int,std::string,int,double,A<int,int>>"), "+bb"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(
|
||||
_A("A<T,Args...>"), _A("A<int,int,double,std::string>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("B<T,P,Args...>"),
|
||||
_A("B<int,std::string,int,double,A<int,int>>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(
|
||||
_A("A<T,Args...>"), _A("A<int,int,double,std::string>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("B<T,P,Args...>"),
|
||||
_A("B<int,std::string,int,double,A<int,int>>")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(
|
||||
_A("same_as_first_type<T,Args...>"), _A("first_type<T,Args...>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(_A("same_as_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,60 +28,73 @@ TEST_CASE("t00059", "[test-case][class]")
|
||||
|
||||
REQUIRE(model->name() == "t00059_class");
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, IsConcept(_A("fruit_c<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("apple_c<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("orange_c<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("fruit_c<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("apple_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(puml, IsConstraint(_A("orange_c<T>"), _A("fruit_c<T>"), "T"));
|
||||
REQUIRE_THAT(
|
||||
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(
|
||||
puml, IsConceptRequirement(_A("apple_c<T>"), "t.get_sweetness()"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsConceptRequirement(_A("apple_c<T>"), "t.get_bitterness()"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsConceptRequirement(_A("apple_c<T>"), "t.get_sweetness()"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsConceptRequirement(_A("apple_c<T>"), "t.get_bitterness()"));
|
||||
|
||||
REQUIRE_THAT(puml, IsClass(_A("gala_apple")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("empire_apple")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("valencia_orange")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("lima_orange")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("gala_apple")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("empire_apple")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("valencia_orange")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("lima_orange")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, IsClassTemplate("fruit_factory", "apple_c TA,orange_c TO"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsClassTemplate("fruit_factory", "apple_c TA,orange_c TO"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(
|
||||
_A("fruit_factory<gala_apple,valencia_orange>"), _A("gala_apple")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(_A("fruit_factory<gala_apple,valencia_orange>"),
|
||||
_A("valencia_orange")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(_A("fruit_factory<gala_apple,valencia_orange>"),
|
||||
_A("gala_apple")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(_A("fruit_factory<gala_apple,valencia_orange>"),
|
||||
_A("valencia_orange")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(
|
||||
_A("fruit_factory<empire_apple,lima_orange>"), _A("empire_apple")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(
|
||||
_A("fruit_factory<empire_apple,lima_orange>"), _A("lima_orange")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(_A("fruit_factory<empire_apple,lima_orange>"),
|
||||
_A("empire_apple")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsDependency(_A("fruit_factory<empire_apple,lima_orange>"),
|
||||
_A("lima_orange")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("R"), _A("fruit_factory<gala_apple,valencia_orange>"),
|
||||
"+factory_1"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("R"), _A("fruit_factory<empire_apple,lima_orange>"),
|
||||
"+factory_2"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("R"),
|
||||
_A("fruit_factory<gala_apple,valencia_orange>"), "+factory_1"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsAggregation(_A("R"),
|
||||
_A("fruit_factory<empire_apple,lima_orange>"), "+factory_2"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("fruit_factory<apple_c TA,orange_c TO>"),
|
||||
_A("fruit_factory<gala_apple,valencia_orange>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("fruit_factory<apple_c TA,orange_c TO>"),
|
||||
_A("fruit_factory<empire_apple,lima_orange>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("fruit_factory<apple_c TA,orange_c TO>"),
|
||||
_A("fruit_factory<gala_apple,valencia_orange>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("fruit_factory<apple_c TA,orange_c TO>"),
|
||||
_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,24 +27,34 @@ TEST_CASE("t00060", "[test-case][class]")
|
||||
auto model = generate_class_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t00060_class");
|
||||
{
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_class_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("F")));
|
||||
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("E")));
|
||||
REQUIRE_THAT(puml, !IsClass(_A("F")));
|
||||
// Check if class templates exist
|
||||
REQUIRE_THAT(puml, IsClassTemplate("G", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("H", "T,P"));
|
||||
|
||||
// Check if class templates exist
|
||||
REQUIRE_THAT(puml, IsClassTemplate("G", "T"));
|
||||
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));
|
||||
}
|
||||
|
||||
std::string _NS(std::string_view s)
|
||||
{
|
||||
return fmt::format(
|
||||
"clanguml::{}::{}", Catch::getResultCapture().getCurrentTestName(), s);
|
||||
}
|
||||
|
||||
class NamespaceWrapper {
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
struct AliasMatcher {
|
||||
AliasMatcher(const std::string &puml_)
|
||||
: puml{split(puml_, "\n")}
|
||||
@@ -601,10 +612,21 @@ ContainsMatcher IsDeprecated(std::string const &str,
|
||||
|
||||
namespace json {
|
||||
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(),
|
||||
[&](const auto &it) { return it["display_name"] == name; });
|
||||
for (const nlohmann::json &e : j["elements"]) {
|
||||
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,
|
||||
@@ -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,
|
||||
const std::string &to, const std::string &type)
|
||||
{
|
||||
auto from_it = detail::get_element(j, from);
|
||||
auto to_it = detail::get_element(j, to);
|
||||
auto source = detail::get_element(j, from);
|
||||
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 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
|
||||
|
||||
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,
|
||||
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;
|
||||
|
||||
const nlohmann::json &bases = (*sc)["bases"];
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
bool IsMethod(
|
||||
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;
|
||||
|
||||
const nlohmann::json &methods = (*sc)["methods"];
|
||||
@@ -666,10 +718,26 @@ bool IsMethod(
|
||||
}) != 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,
|
||||
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())
|
||||
return false;
|
||||
@@ -683,7 +751,8 @@ bool IsAssociation(nlohmann::json j, const std::string &from,
|
||||
bool IsComposition(nlohmann::json j, const std::string &from,
|
||||
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())
|
||||
return false;
|
||||
@@ -697,7 +766,8 @@ bool IsComposition(nlohmann::json j, const std::string &from,
|
||||
bool IsAggregation(nlohmann::json j, const std::string &from,
|
||||
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())
|
||||
return false;
|
||||
@@ -711,7 +781,26 @@ bool IsAggregation(nlohmann::json j, const std::string &from,
|
||||
bool IsDependency(
|
||||
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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user