Added aliased template handling
This commit is contained in:
@@ -45,8 +45,8 @@ TEST_CASE("t00008", "[test-case][class]")
|
||||
// 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, CMP, int N"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T, C<>"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,P,CMP,int N"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T,C<>"));
|
||||
|
||||
REQUIRE_THAT(puml, IsField(Public("T value")));
|
||||
REQUIRE_THAT(puml, IsField(Public("T* pointer")));
|
||||
|
||||
@@ -42,17 +42,17 @@ TEST_CASE("t00010", "[test-case][class]")
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T, P"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,P"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T"));
|
||||
|
||||
REQUIRE_THAT(puml, IsField(Public("A<T,std::string> astring")));
|
||||
REQUIRE_THAT(puml, IsField(Public("B<int> aintstring")));
|
||||
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T, P>"), _A("A<T, std::string>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T,P>"), _A("A<T,std::string>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("B<T>"), _A("B<int>")));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, IsComposition(_A("B<T>"), _A("A<T, std::string>"), "astring"));
|
||||
puml, IsComposition(_A("B<T>"), _A("A<T,std::string>"), "astring"));
|
||||
REQUIRE_THAT(puml, IsComposition(_A("C"), _A("B<int>"), "aintstring"));
|
||||
|
||||
save_puml(
|
||||
|
||||
@@ -42,17 +42,15 @@ TEST_CASE("t00012", "[test-case][class]")
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T, Ts..."));
|
||||
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("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...>"),
|
||||
IsInstantiation(_A("C<T,int Is...>"),
|
||||
_A("C<std::map<int,"
|
||||
"std::vector<std::vector<std::vector<std::string>>>>, 3, 3, "
|
||||
"3>")));
|
||||
"std::vector<std::vector<std::vector<std::string>>>>,3,3,3>")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory + "/" + diagram->name + ".puml", puml);
|
||||
|
||||
@@ -5,7 +5,12 @@
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
* These should not be include as they are not
|
||||
* in ns clanguml::t00014
|
||||
*/
|
||||
template <typename T> struct clanguml_t00014_A {
|
||||
T value;
|
||||
};
|
||||
@@ -22,15 +27,25 @@ template <typename T, typename P> struct A {
|
||||
|
||||
template <typename T> using AString = A<T, std::string>;
|
||||
|
||||
struct B {
|
||||
std::string value;
|
||||
};
|
||||
|
||||
using BVector = std::vector<B>;
|
||||
using BVector2 = BVector;
|
||||
|
||||
using AIntString = AString<int>;
|
||||
using AStringString = AString<std::string>;
|
||||
using BStringString = AStringString;
|
||||
|
||||
class R {
|
||||
using BStringString = AStringString;
|
||||
//clang-uml: tinst A<T, std::string>
|
||||
A<bool, std::string> boolstring;
|
||||
AString<float> floatstring;
|
||||
AIntString intstring;
|
||||
BStringString stringstring;
|
||||
AStringString stringstring;
|
||||
BVector bs;
|
||||
BVector2 bs2;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,26 +40,23 @@ TEST_CASE("t00014", "[test-case][class]")
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T, P"));
|
||||
/*
|
||||
REQUIRE_THAT(puml, IsClass(_A("B")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("C")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("D")));
|
||||
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, IsComposition(_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, IsClassTemplate("A", "T,P"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "T,std::string"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "bool,std::string"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("AString", "float"));
|
||||
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T,P>"), _A("A<T,std::string>")));
|
||||
// TODO
|
||||
// REQUIRE_THAT(puml, IsInstantiation(_A("A<T,std::string>"),
|
||||
// _A("A<bool,std::string>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("A<T,std::string>"), _A("AString<float>")));
|
||||
REQUIRE_THAT(
|
||||
puml, IsComposition(_A("R"), _A("A<bool,std::string>"), "boolstring"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsComposition(_A("R"), _A("AString<float>"), "floatstring"));
|
||||
REQUIRE_THAT(puml, IsComposition(_A("R"), _A("B"), "bs"));
|
||||
REQUIRE_THAT(puml, IsComposition(_A("R"), _A("B"), "bs2"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory + "/" + diagram->name + ".puml", puml);
|
||||
|
||||
Reference in New Issue
Block a user