Updated template instantiation test case with variadic function template

This commit is contained in:
Bartek Kryza
2022-06-05 12:39:50 +02:00
parent ae44728fc5
commit f12e322c72
3 changed files with 18 additions and 7 deletions

View File

@@ -167,13 +167,16 @@ 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 SimpleCallback = std::function<void(T, int)>;
template <typename... T> using GenericCallback = std::function<void(T..., int)>;
using VoidCallback = GenericCallback<void *>;
using BVector = std::vector<B>;
using BVector2 = BVector;
using AIntString = AString<int>;
using ACharString = AString<char>;
using AWCharString = AString<wchar_t>;
using AStringString = AString<std::string>;
using BStringString = AStringString;
@@ -194,7 +197,8 @@ protected:
public:
BVector2 bs2;
GeneralCallback<AIntString> cb;
SimpleCallback<ACharString> cb;
GenericCallback<AWCharString> gcb;
VoidCallback vcb;
VectorPtr<B> vps;
};

View File

@@ -39,14 +39,16 @@ 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<void *>;
template <typename T> using SimpleCallback = std::function<void(T, int)>;
template <typename... T> using GenericCallback = std::function<void(T..., int)>;
using VoidCallback = GenericCallback<void *>;
using BVector = std::vector<B>;
using BVector2 = BVector;
using AIntString = AString<int>;
using ACharString = AString<char>;
using AWCharString = AString<wchar_t>;
using AStringString = AString<std::string>;
using BStringString = AStringString;
@@ -67,7 +69,8 @@ protected:
public:
BVector2 bs2;
GeneralCallback<ACharString> cb;
SimpleCallback<ACharString> cb;
GenericCallback<AWCharString> gcb;
VoidCallback vcb;
VectorPtr<B> vps;
};

View File

@@ -60,7 +60,8 @@ TEST_CASE("t00014", "[test-case][class]")
REQUIRE_THAT(puml, IsField<Protected>("bs", "BVector"));
REQUIRE_THAT(puml, IsField<Public>("cb", "GeneralCallback<ACharString>"));
REQUIRE_THAT(puml, IsField<Public>("cb", "SimpleCallback<ACharString>"));
REQUIRE_THAT(puml, IsField<Public>("gcb", "GenericCallback<AWCharString>"));
REQUIRE_THAT(puml, IsField<Public>("vcb", "VoidCallback"));
REQUIRE_THAT(
@@ -82,6 +83,8 @@ TEST_CASE("t00014", "[test-case][class]")
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>>"),
@@ -104,6 +107,7 @@ TEST_CASE("t00014", "[test-case][class]")
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);