Fixed generating relationships from function template arguments

This commit is contained in:
Bartek Kryza
2022-06-05 12:16:44 +02:00
parent 891caa8ecb
commit fdd5495940
4 changed files with 39 additions and 14 deletions

View File

@@ -39,13 +39,14 @@ template <class T> using ASharedPtr = std::shared_ptr<A<double, T>>;
template <class T, class U>
using AAPtr = std::unique_ptr<std::pair<A<double, T>, A<long, U>>>;
template <typename... T> using GeneralCallback = std::function<void(T..., int)>;
using VoidCallback = GeneralCallback<>;
template <typename T> using GeneralCallback = std::function<void(T, int)>;
using VoidCallback = GeneralCallback<void *>;
using BVector = std::vector<B>;
using BVector2 = BVector;
using AIntString = AString<int>;
using ACharString = AString<char>;
using AStringString = AString<std::string>;
using BStringString = AStringString;
@@ -66,7 +67,7 @@ protected:
public:
BVector2 bs2;
GeneralCallback<AIntString> cb;
GeneralCallback<ACharString> cb;
VoidCallback vcb;
VectorPtr<B> vps;
};

View File

@@ -45,6 +45,7 @@ TEST_CASE("t00014", "[test-case][class]")
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", "char,std::string"));
REQUIRE_THAT(puml, IsClass(_A("B")));
REQUIRE_THAT(puml, IsField<Private>("bapair", "PairPairBA<bool>"));
@@ -59,7 +60,7 @@ TEST_CASE("t00014", "[test-case][class]")
REQUIRE_THAT(puml, IsField<Protected>("bs", "BVector"));
REQUIRE_THAT(puml, IsField<Public>("cb", "GeneralCallback<AIntString>"));
REQUIRE_THAT(puml, IsField<Public>("cb", "GeneralCallback<ACharString>"));
REQUIRE_THAT(puml, IsField<Public>("vcb", "VoidCallback"));
REQUIRE_THAT(
@@ -79,6 +80,8 @@ TEST_CASE("t00014", "[test-case][class]")
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::unique_ptr<std::string>>"),
@@ -100,6 +103,7 @@ TEST_CASE("t00014", "[test-case][class]")
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>")));
save_puml(
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);