Added calls through pointers and references in template instantiation sequence diagram test case
This commit is contained in:
@@ -31,10 +31,27 @@ template <typename T, typename F> struct BB {
|
||||
};
|
||||
|
||||
template <typename T> struct BB<T, std::string> {
|
||||
void bb1(T t, std::string f) { aa_.aa2(t); }
|
||||
void bb2(T t, std::string f) { aa_.aa1(t); }
|
||||
void bb1(T t, std::string f) { aa_->aa2(t); }
|
||||
void bb2(T t, std::string f) { aa_->aa1(t); }
|
||||
|
||||
AA<T> aa_;
|
||||
BB<T, std::string>(AA<T> *aa)
|
||||
: aa_{aa}
|
||||
{
|
||||
}
|
||||
|
||||
AA<T> *aa_;
|
||||
};
|
||||
|
||||
template <typename T> struct BB<T, float> {
|
||||
void bb1(T t, float f) { bb2(t, f); }
|
||||
void bb2(T t, float f) { aa_.aa2(t); }
|
||||
|
||||
BB<T, float>(AA<T> &aa)
|
||||
: aa_{aa}
|
||||
{
|
||||
}
|
||||
|
||||
AA<T> &aa_;
|
||||
};
|
||||
|
||||
void tmain()
|
||||
@@ -46,13 +63,17 @@ void tmain()
|
||||
bstring.b("bstring");
|
||||
|
||||
BB<int, int> bbint;
|
||||
BB<int, std::string> bbstring;
|
||||
AA<int> aaint;
|
||||
BB<int, std::string> bbstring{&aaint};
|
||||
BB<int, float> bbfloat{aaint};
|
||||
|
||||
bbint.bb1(1, 1);
|
||||
bbint.bb2(2, 2);
|
||||
|
||||
bbstring.bb1(1, "calling aa2");
|
||||
bbstring.bb2(1, "calling aa1");
|
||||
|
||||
bbfloat.bb1(1, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,11 @@ TEST_CASE("t20006", "[test-case][sequence]")
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("BB<int,std::string>"), _A("AA<int>"), "aa1"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("BB<int,float>"), "bb1"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("BB<int,float>"), _A("BB<int,float>"), "bb2"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("BB<int,float>"), _A("AA<int>"), "aa2"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
Reference in New Issue
Block a user