Added handling of template instantiation relationships
This commit is contained in:
@@ -64,11 +64,14 @@ TEST_CASE("Test t00006", "[unit-test]")
|
||||
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, IsComposition(_A("R"), _A("A"), "a"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "b"));
|
||||
REQUIRE_THAT(puml, IsComposition(_A("R"), _A("C"), "c"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "d"));
|
||||
REQUIRE_THAT(puml, IsComposition(_A("R"), _A("E"), "e"));
|
||||
REQUIRE_THAT(puml, IsComposition(_A("R"), _A("custom_container<E>"), "e"));
|
||||
REQUIRE_THAT(puml, IsComposition(_A("R"), _A("F"), "f"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G"), "g"));
|
||||
REQUIRE_THAT(puml, IsComposition(_A("R"), _A("H"), "h"));
|
||||
|
||||
@@ -1,31 +1,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/*
|
||||
@startuml
|
||||
|
||||
class "A<T>" as C_0000000046
|
||||
class C_0000000046 {
|
||||
+T value
|
||||
}
|
||||
|
||||
class "A<int>" as ABC
|
||||
class "A<std::string>" as ABCD
|
||||
|
||||
class "B" as C_0000000047
|
||||
class C_0000000047 {
|
||||
+A<int> aint
|
||||
+A<std::string> astring
|
||||
}
|
||||
|
||||
C_0000000046 <|.. ABC
|
||||
C_0000000046 <|.. ABCD
|
||||
|
||||
ABC <-- C_0000000047 : aint
|
||||
ABCD <-- C_0000000047 : astring
|
||||
|
||||
@enduml
|
||||
*/
|
||||
namespace clanguml {
|
||||
namespace t00009 {
|
||||
|
||||
@@ -37,7 +12,8 @@ public:
|
||||
class B {
|
||||
public:
|
||||
A<int> aint;
|
||||
A<std::string> astring;
|
||||
A<std::string> *astring;
|
||||
A<std::vector<std::string>> &avector;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,18 +47,20 @@ TEST_CASE("Test t00009", "[unit-test]")
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T"));
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
|
||||
/*
|
||||
REQUIRE_THAT(puml, IsField(Public("T value")));
|
||||
REQUIRE_THAT(puml, IsField(Public("T * pointer")));
|
||||
REQUIRE_THAT(puml, IsField(Public("T & reference")));
|
||||
REQUIRE_THAT(puml, IsField(Public("std::vector<P> values")));
|
||||
REQUIRE_THAT(puml, IsField(Public("std::array<int, N> ints")));
|
||||
REQUIRE_THAT(puml, IsField(Public("bool (*)(int, int) comparator")));
|
||||
REQUIRE_THAT(puml, IsField(Public("A<int> aint")));
|
||||
REQUIRE_THAT(puml, IsField(Public("A<std::string> * astring")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsField(Public("A<std::vector<std::string>> & avector")));
|
||||
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T, C<>"));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<int>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<std::string>")));
|
||||
|
||||
REQUIRE_THAT(puml, IsComposition(_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, IsField(Public("C<T> template_template")));
|
||||
*/
|
||||
save_puml(
|
||||
"./" + config.output_directory + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -106,6 +106,7 @@ using clanguml::test::matchers::IsComposition;
|
||||
using clanguml::test::matchers::IsEnum;
|
||||
using clanguml::test::matchers::IsField;
|
||||
using clanguml::test::matchers::IsInnerClass;
|
||||
using clanguml::test::matchers::IsInstantiation;
|
||||
using clanguml::test::matchers::Private;
|
||||
using clanguml::test::matchers::Protected;
|
||||
using clanguml::test::matchers::Public;
|
||||
|
||||
@@ -286,6 +286,13 @@ ContainsMatcher IsAggregation(std::string const &from, std::string const &to,
|
||||
fmt::format("{} o-- {} : {}", from, to, label), caseSensitivity));
|
||||
}
|
||||
|
||||
ContainsMatcher IsInstantiation(std::string const &from, std::string const &to,
|
||||
CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes)
|
||||
{
|
||||
return ContainsMatcher(
|
||||
CasedString(fmt::format("{} ..|> {}", to, from), caseSensitivity));
|
||||
}
|
||||
|
||||
ContainsMatcher IsMethod(std::string const &name,
|
||||
CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user