Added sequence diagram JSON test matchers
This commit is contained in:
@@ -95,14 +95,42 @@ void generator::generate_call(const message &m, nlohmann::json &parent) const
|
||||
|
||||
msg["name"] = message;
|
||||
msg["type"] = "message";
|
||||
msg["from"]["name"] = from.value().full_name(false);
|
||||
msg["from"]["id"] = std::to_string(from.value().id());
|
||||
msg["from"]["activity_name"] = from.value().full_name(false);
|
||||
msg["from"]["activity_id"] = std::to_string(from.value().id());
|
||||
msg["to"]["activity_id"] = std::to_string(to.value().id());
|
||||
msg["to"]["activity_name"] = to.value().full_name(false);
|
||||
|
||||
if (from.value().type_name() == "method") {
|
||||
const auto &class_participant =
|
||||
m_model.get_participant<model::method>(from.value().id()).value();
|
||||
|
||||
msg["from"]["participant_id"] =
|
||||
std::to_string(class_participant.class_id());
|
||||
msg["from"]["participant_name"] =
|
||||
m_model.get_participant<model::class_>(class_participant.class_id())
|
||||
.value()
|
||||
.full_name(false);
|
||||
}
|
||||
else if (from.value().type_name() == "function" ||
|
||||
from.value().type_name() == "function_template") {
|
||||
if (m_config.combine_free_functions_into_file_participants()) {
|
||||
const auto &file_participant =
|
||||
m_model.get_participant<model::function>(from.value().id())
|
||||
.value();
|
||||
msg["from"]["participant_id"] =
|
||||
std::to_string(common::to_id(file_participant.file()));
|
||||
msg["from"]["participant_name"] = file_participant.file_relative();
|
||||
}
|
||||
else {
|
||||
msg["from"]["participant_id"] = std::to_string(from.value().id());
|
||||
msg["from"]["participant_name"] = from.value().full_name(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (to.value().type_name() == "method") {
|
||||
const auto &class_participant =
|
||||
m_model.get_participant<model::method>(to.value().id()).value();
|
||||
|
||||
msg["to"]["participant_id"] =
|
||||
std::to_string(class_participant.class_id());
|
||||
msg["to"]["participant_name"] =
|
||||
@@ -110,13 +138,20 @@ void generator::generate_call(const message &m, nlohmann::json &parent) const
|
||||
.value()
|
||||
.full_name(false);
|
||||
}
|
||||
else if (to.value().type_name() == "function" &&
|
||||
m_config.combine_free_functions_into_file_participants()) {
|
||||
const auto &file_participant =
|
||||
m_model.get_participant<model::function>(to.value().id()).value();
|
||||
msg["to"]["participant_id"] =
|
||||
std::to_string(common::to_id(file_participant.file()));
|
||||
msg["to"]["participant_name"] = file_participant.file_relative();
|
||||
else if (to.value().type_name() == "function" ||
|
||||
to.value().type_name() == "function_template") {
|
||||
if (m_config.combine_free_functions_into_file_participants()) {
|
||||
const auto &file_participant =
|
||||
m_model.get_participant<model::function>(to.value().id())
|
||||
.value();
|
||||
msg["to"]["participant_id"] =
|
||||
std::to_string(common::to_id(file_participant.file()));
|
||||
msg["to"]["participant_name"] = file_participant.file_relative();
|
||||
}
|
||||
else {
|
||||
msg["to"]["participant_id"] = std::to_string(to.value().id());
|
||||
msg["to"]["participant_name"] = to.value().full_name(false);
|
||||
}
|
||||
}
|
||||
|
||||
msg["source_location"] =
|
||||
|
||||
@@ -69,8 +69,10 @@ void generator::generate_call(const message &m, std::ostream &ostr) const
|
||||
render_mode = model::function::message_render_mode::no_arguments;
|
||||
|
||||
if (to.value().type_name() == "method") {
|
||||
message = dynamic_cast<const model::function &>(to.value())
|
||||
.message_name(render_mode);
|
||||
const auto &f = dynamic_cast<const model::method &>(to.value());
|
||||
const std::string_view style = f.is_static() ? "__" : "";
|
||||
message =
|
||||
fmt::format("{}{}{}", style, f.message_name(render_mode), style);
|
||||
}
|
||||
else if (m_config.combine_free_functions_into_file_participants()) {
|
||||
if (to.value().type_name() == "function") {
|
||||
|
||||
@@ -185,7 +185,7 @@ std::string method::message_name(message_render_mode mode) const
|
||||
{
|
||||
constexpr auto kAbbreviatedMethodArgumentsLength{15};
|
||||
|
||||
const std::string style = is_static() ? "__" : "";
|
||||
const std::string style = "";
|
||||
|
||||
if (mode == message_render_mode::no_arguments) {
|
||||
return fmt::format("{}{}(){}{}", style, method_name(),
|
||||
|
||||
@@ -31,36 +31,43 @@ TEST_CASE("t20001", "[test-case][sequence]")
|
||||
REQUIRE(model->should_include("clanguml::t20001::A"));
|
||||
REQUIRE(!model->should_include("clanguml::t20001::detail::C"));
|
||||
REQUIRE(!model->should_include("std::vector"));
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "add3(int,int,int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), "add(int,int)"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("A"), _A("detail::C"), "add(int,int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), "__log_result(int)__"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "__log_result(int)__"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "add3(int,int,int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), "add(int,int)"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("A"), _A("detail::C"), "add(int,int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), "__log_result(int)__"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "__log_result(int)__"));
|
||||
REQUIRE_THAT(puml, HasComment("t20001 test diagram of type sequence"));
|
||||
|
||||
REQUIRE_THAT(puml, HasComment("t20001 test diagram of type sequence"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
using namespace json;
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
REQUIRE(IsFunctionParticipant(j, "tmain()"));
|
||||
REQUIRE(IsClassParticipant(j, "A"));
|
||||
REQUIRE(IsClassParticipant(j, "B"));
|
||||
|
||||
REQUIRE(j["participants"][0]["name"] == "clanguml::t20001::tmain()");
|
||||
REQUIRE(j["participants"][1]["name"] == "clanguml::t20001::A");
|
||||
REQUIRE(j["participants"][2]["name"] == "clanguml::t20001::B");
|
||||
std::vector<int> messages = {
|
||||
FindMessage(j, "tmain()", "A", "add(int,int)"),
|
||||
FindMessage(j, "tmain()", "B", "wrap_add3(int,int,int)"),
|
||||
FindMessage(j, "B", "A", "add3(int,int,int)"),
|
||||
FindMessage(j, "A", "A", "add(int,int)"),
|
||||
FindMessage(j, "A", "A", "log_result(int)"),
|
||||
FindMessage(j, "B", "A", "log_result(int)")};
|
||||
|
||||
auto &messages = j["sequences"][0]["messages"];
|
||||
REQUIRE(messages[0]["name"] == "add(int,int)");
|
||||
REQUIRE(messages[1]["name"] == "wrap_add3(int,int,int)");
|
||||
REQUIRE(messages[2]["name"] == "add3(int,int,int)");
|
||||
REQUIRE(messages[3]["name"] == "add(int,int)");
|
||||
REQUIRE(messages[4]["name"] == "__log_result(int)__");
|
||||
REQUIRE(messages[5]["name"] == "__log_result(int)__");
|
||||
REQUIRE(std::is_sorted(messages.begin(), messages.end()));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,21 +28,37 @@ TEST_CASE("t20002", "[test-case][sequence]")
|
||||
|
||||
REQUIRE(model->name() == "t20002_sequence");
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"), ""));
|
||||
REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"), ""));
|
||||
REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), ""));
|
||||
REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"), ""));
|
||||
REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"), ""));
|
||||
REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), ""));
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
using namespace json;
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
REQUIRE(IsFunctionParticipant(j, "m1()"));
|
||||
REQUIRE(IsFunctionParticipant(j, "m2()"));
|
||||
REQUIRE(IsFunctionParticipant(j, "m3()"));
|
||||
REQUIRE(IsFunctionParticipant(j, "m4()"));
|
||||
|
||||
std::vector<int> messages = {FindMessage(j, "m1()", "m2()", ""),
|
||||
FindMessage(j, "m2()", "m3()", ""),
|
||||
FindMessage(j, "m3()", "m4()", "")};
|
||||
|
||||
REQUIRE(std::is_sorted(messages.begin(), messages.end()));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,22 +27,32 @@ TEST_CASE("t20003", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20003_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("m1<T>(T)"), _A("m2<T>(T)"), ""));
|
||||
REQUIRE_THAT(puml, HasCall(_A("m2<T>(T)"), _A("m3<T>(T)"), ""));
|
||||
REQUIRE_THAT(puml, HasCall(_A("m3<T>(T)"), _A("m4<T>(T)"), ""));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("m1<T>(T)"), _A("m2<T>(T)"), ""));
|
||||
REQUIRE_THAT(puml, HasCall(_A("m2<T>(T)"), _A("m3<T>(T)"), ""));
|
||||
REQUIRE_THAT(puml, HasCall(_A("m3<T>(T)"), _A("m4<T>(T)"), ""));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
std::vector<int> messages = {FindMessage(j, "m1<T>(T)", "m2<T>(T)", ""),
|
||||
FindMessage(j, "m2<T>(T)", "m3<T>(T)", ""),
|
||||
FindMessage(j, "m3<T>(T)", "m4<T>(T)", "")};
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
REQUIRE(std::is_sorted(messages.begin(), messages.end()));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,40 +27,59 @@ TEST_CASE("t20004", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20004_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1<float>(float)"), ""));
|
||||
REQUIRE_THAT(
|
||||
puml, !HasCall(_A("m1<float>(float)"), _A("m1<float>(float)"), ""));
|
||||
REQUIRE_THAT(
|
||||
puml, !HasCall(_A("m1<float>(float)"), _A("m1<float>(float)"), ""));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1<float>(float)"), ""));
|
||||
REQUIRE_THAT(
|
||||
puml, !HasCall(_A("m1<float>(float)"), _A("m1<float>(float)"), ""));
|
||||
REQUIRE_THAT(
|
||||
puml, !HasCall(_A("m1<float>(float)"), _A("m1<float>(float)"), ""));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("main()"), _A("m1<unsigned long>(unsigned long)"), ""));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("m1<unsigned long>(unsigned long)"),
|
||||
_A("m4<unsigned long>(unsigned long)"), ""));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("main()"), _A("m1<unsigned long>(unsigned long)"), ""));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("m1<unsigned long>(unsigned long)"),
|
||||
_A("m4<unsigned long>(unsigned long)"), ""));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("main()"), _A("m1<std::string>(std::string)"), ""));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("m1<std::string>(std::string)"),
|
||||
_A("m2<std::string>(std::string)"), ""));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("main()"), _A("m1<std::string>(std::string)"), ""));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("m1<std::string>(std::string)"),
|
||||
_A("m2<std::string>(std::string)"), ""));
|
||||
REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1<int>(int)"), ""));
|
||||
REQUIRE_THAT(puml, HasCall(_A("m1<int>(int)"), _A("m2<int>(int)"), ""));
|
||||
REQUIRE_THAT(puml, HasCall(_A("m2<int>(int)"), _A("m3<int>(int)"), ""));
|
||||
REQUIRE_THAT(puml, HasCall(_A("m3<int>(int)"), _A("m4<int>(int)"), ""));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1<int>(int)"), ""));
|
||||
REQUIRE_THAT(puml, HasCall(_A("m1<int>(int)"), _A("m2<int>(int)"), ""));
|
||||
REQUIRE_THAT(puml, HasCall(_A("m2<int>(int)"), _A("m3<int>(int)"), ""));
|
||||
REQUIRE_THAT(puml, HasCall(_A("m3<int>(int)"), _A("m4<int>(int)"), ""));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
std::vector<int> messages = {
|
||||
FindMessage(j, "main()", "m1<float>(float)", ""),
|
||||
FindMessage(j, "main()", "m1<unsigned long>(unsigned long)", ""),
|
||||
FindMessage(j, "m1<unsigned long>(unsigned long)",
|
||||
"m4<unsigned long>(unsigned long)", ""),
|
||||
FindMessage(j, "main()", "m1<std::string>(std::string)", ""),
|
||||
FindMessage(j, "m1<std::string>(std::string)",
|
||||
"m2<std::string>(std::string)", ""),
|
||||
FindMessage(j, "main()", "m1<int>(int)", ""),
|
||||
FindMessage(j, "m1<int>(int)", "m2<int>(int)", ""),
|
||||
FindMessage(j, "m2<int>(int)", "m3<int>(int)", ""),
|
||||
FindMessage(j, "m3<int>(int)", "m4<int>(int)", "")};
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
REQUIRE(std::is_sorted(messages.begin(), messages.end()));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -28,22 +28,28 @@ TEST_CASE("t20005", "[test-case][sequence]")
|
||||
|
||||
REQUIRE(model->name() == "t20005_sequence");
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasEntrypoint(_A("C<T>"), "c(T)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("C<T>"), _A("B<T>"), "b(T)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<T>"), _A("A<T>"), "a(T)"));
|
||||
REQUIRE_THAT(puml, HasExitpoint(_A("C<T>")));
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasEntrypoint(_A("C<T>"), "c(T)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("C<T>"), _A("B<T>"), "b(T)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<T>"), _A("A<T>"), "a(T)"));
|
||||
REQUIRE_THAT(puml, HasExitpoint(_A("C<T>")));
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
using namespace json;
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,53 +27,62 @@ TEST_CASE("t20006", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20006_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<int>"), "b(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<int>"), _A("A<int>"), "a1(int)"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<int>"), "b(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<int>"), _A("A<int>"), "a1(int)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"), _A("B<std::string>"), "b(std::string)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(
|
||||
_A("B<std::string>"), _A("A<std::string>"), "a2(std::string)"));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("tmain()"), _A("B<std::string>"), "b(std::string)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("B<std::string>"), _A("A<std::string>"), "a2(std::string)"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("tmain()"), _A("BB<int,int>"), "bb1(int,int)"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("BB<int,int>"), _A("AA<int>"), "aa1(int)"));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("tmain()"), _A("BB<int,int>"), "bb1(int,int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("BB<int,int>"), _A("AA<int>"), "aa1(int)"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("tmain()"), _A("BB<int,int>"), "bb2(int,int)"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("BB<int,int>"), _A("AA<int>"), "aa2(int)"));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("tmain()"), _A("BB<int,int>"), "bb2(int,int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("BB<int,int>"), _A("AA<int>"), "aa2(int)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"), _A("BB<int,std::string>"),
|
||||
"bb1(int,std::string)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("BB<int,std::string>"), _A("AA<int>"), "aa2(int)"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(
|
||||
_A("tmain()"), _A("BB<int,std::string>"), "bb1(int,std::string)"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("BB<int,std::string>"), _A("AA<int>"), "aa2(int)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"), _A("BB<int,std::string>"),
|
||||
"bb2(int,std::string)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("BB<int,std::string>"), _A("AA<int>"), "aa1(int)"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(
|
||||
_A("tmain()"), _A("BB<int,std::string>"), "bb2(int,std::string)"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("BB<int,std::string>"), _A("AA<int>"), "aa1(int)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"), _A("BB<int,float>"), "bb1(int,float)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(
|
||||
_A("BB<int,float>"), _A("BB<int,float>"), "bb2(int,float)"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("BB<int,float>"), _A("AA<int>"), "aa2(int)"));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("tmain()"), _A("BB<int,float>"), "bb1(int,float)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("BB<int,float>"), _A("BB<int,float>"), "bb2(int,float)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("BB<int,float>"), _A("AA<int>"), "aa2(int)"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,28 +27,33 @@ TEST_CASE("t20007", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20007_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"), _A("Adder<int,int>"), "add(int &&,int &&)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"), _A("Adder<int,float,double>"),
|
||||
"add(int &&,float &&,double &&)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"),
|
||||
_A("Adder<std::string,std::string,std::string>"),
|
||||
"add(std::string &&,std::string &&,std::string &&)"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"), _A("Adder<int,int>"), "add(int &&,int &&)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"), _A("Adder<int,float,double>"),
|
||||
"add(int &&,float &&,double &&)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"), _A("Adder<std::string,std::string,std::string>"),
|
||||
"add(std::string &&,std::string &&,std::string &&)"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,35 +27,41 @@ TEST_CASE("t20008", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20008_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<int>"), "b(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<int>"), _A("A<int>"), "a1(int)"));
|
||||
// REQUIRE_THAT(puml, !HasCall(_A("B<int>"), _A("A<int>"),
|
||||
// "a2(int)")); REQUIRE_THAT(puml, !HasCall(_A("B<int>"),
|
||||
// _A("A<int>"), "a3(int)"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<int>"), "b(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<int>"), _A("A<int>"), "a1(int)"));
|
||||
// REQUIRE_THAT(puml, !HasCall(_A("B<int>"), _A("A<int>"), "a2(int)"));
|
||||
// REQUIRE_THAT(puml, !HasCall(_A("B<int>"), _A("A<int>"), "a3(int)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"), _A("B<const char *>"), "b(const char *)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("B<const char *>"), _A("A<const char *>"),
|
||||
"a2(const char *)"));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("tmain()"), _A("B<const char *>"), "b(const char *)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(
|
||||
_A("B<const char *>"), _A("A<const char *>"), "a2(const char *)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"), _A("B<std::string>"), "b(std::string)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(
|
||||
_A("B<std::string>"), _A("A<std::string>"), "a3(std::string)"));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("tmain()"), _A("B<std::string>"), "b(std::string)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("B<std::string>"), _A("A<std::string>"), "a3(std::string)"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,29 +27,34 @@ TEST_CASE("t20009", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20009_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"), _A("B<std::string>"), "b(std::string)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(
|
||||
_A("B<std::string>"), _A("A<std::string>"), "a(std::string)"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("tmain()"), _A("B<std::string>"), "b(std::string)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("B<std::string>"), _A("A<std::string>"), "a(std::string)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<int>"), "b(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<int>"), _A("A<int>"), "a(int)"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<int>"), "b(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<int>"), _A("A<int>"), "a(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<float>"), "b(float)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<float>"), _A("A<float>"), "a(float)"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<float>"), "b(float)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<float>"), _A("A<float>"), "a(float)"));
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,31 +27,35 @@ TEST_CASE("t20010", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20010_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<int>"), "b1()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<int>"), _A("A"), "a1()"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<int>"), "b1()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<int>"), _A("A"), "a1()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<int>"), "b2()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<int>"), _A("A"), "a2()"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<int>"), "b2()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<int>"), _A("A"), "a2()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<int>"), "b3()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<int>"), _A("A"), "a3()"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<int>"), "b3()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<int>"), _A("A"), "a3()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<int>"), "b4()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<int>"), _A("A"), "a4()"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<int>"), "b4()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<int>"), _A("A"), "a4()"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,27 +27,41 @@ TEST_CASE("t20011", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20011_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a(int)"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "b(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "c(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "d(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "b(int)"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "b(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "c(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "d(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "b(int)"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
REQUIRE(IsFunctionParticipant(j, "tmain()"));
|
||||
REQUIRE(IsClassParticipant(j, "A"));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
std::vector<int> messages = {FindMessage(j, "tmain()", "A", "a(int)"),
|
||||
FindMessage(j, "A", "A", "a(int)"),
|
||||
FindMessage(j, "tmain()", "A", "b(int)"),
|
||||
FindMessage(j, "A", "A", "c(int)")};
|
||||
|
||||
REQUIRE(std::is_sorted(messages.begin(), messages.end()));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,60 +27,64 @@ TEST_CASE("t20012", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20012_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"),
|
||||
_A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"),
|
||||
"operator()()"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"),
|
||||
_A("A"), "a()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "aa()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "aaa()"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"),
|
||||
_A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"),
|
||||
"operator()()"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"),
|
||||
_A("A"), "a()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "aa()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "aaa()"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"),
|
||||
_A("B"), "b()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "bb()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "bbb()"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"),
|
||||
_A("B"), "b()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "bb()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "bbb()"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)"),
|
||||
_A("C"), "c()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "cc()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc()"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)"),
|
||||
_A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"),
|
||||
"operator()()"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)"),
|
||||
_A("C"), "c()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "cc()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc()"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:79:20)"),
|
||||
_A("tmain()::(lambda ../../tests/t20012/t20012.cc:66:20)"),
|
||||
"operator()()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc()"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc()"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"),
|
||||
_A("R<R::(lambda ../../tests/t20012/t20012.cc:85:9)>"), "r()"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("R<R::(lambda ../../tests/t20012/t20012.cc:85:9)>"),
|
||||
_A("tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)"),
|
||||
"operator()()"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)"),
|
||||
_A("C"), "c()"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"),
|
||||
_A("R<R::(lambda ../../tests/t20012/t20012.cc:85:9)>"), "r()"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("R<R::(lambda ../../tests/t20012/t20012.cc:85:9)>"),
|
||||
_A("tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)"),
|
||||
"operator()()"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:85:9)"),
|
||||
_A("C"), "c()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("D"), "add5(int)"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("D"), "add5(int)"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,29 +27,35 @@ TEST_CASE("t20013", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20013_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(double)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(double)"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(double)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(double)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain(int,char **)"), _A("B"), "b(const char *)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a3(const char *)"));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(const char *)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a3(const char *)"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,28 +27,33 @@ TEST_CASE("t20014", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20014_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1(int,int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int,int)"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1(int,int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int,int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2(int,int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(int,int)"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2(int,int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(int,int)"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("tmain()"), _A("C<B,int>"), "c1(int,int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("C<B,int>"), _A("B"), "b1(int,int)"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("C<B,int>"), "c1(int,int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("C<B,int>"), _A("B"), "b1(int,int)"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,30 +27,34 @@ TEST_CASE("t20015", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20015_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"), _A("B"),
|
||||
"setup_a(std::shared_ptr<detail::A> &)"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_x(int)"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_y(int)"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_z(int)"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(
|
||||
_A("tmain()"), _A("B"), "setup_a(std::shared_ptr<detail::A> &)"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_x(int)"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_y(int)"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_z(int)"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_x(int)"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_y(int)"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_z(int)"));
|
||||
|
||||
REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_x(int)"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_y(int)"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_z(int)"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,25 +27,29 @@ TEST_CASE("t20016", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20016_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<long>"), "b1(long)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<long>"), _A("A"), "a1(int)"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<long>"), "b1(long)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<long>"), _A("A"), "a1(int)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<long>"), "b2(long)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<long>"), _A("A"), "a2(const long &)"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B<long>"), "b2(long)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B<long>"), _A("A"), "a2(const long &)"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,32 +27,37 @@ TEST_CASE("t20017", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20017_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasEntrypoint(_A("t20017.cc"), "tmain()"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a1(int,int)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a2(int,int)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a3(int,int)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("t20017.cc"), _A("include/t20017_b.h"), "b1(int,int)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(
|
||||
_A("t20017.cc"), _A("include/t20017_b.h"), "b2<int>(int,int)"));
|
||||
REQUIRE_THAT(puml, HasExitpoint(_A("t20017.cc")));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasEntrypoint(_A("t20017.cc"), "tmain()"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a1(int,int)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a2(int,int)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a3(int,int)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("t20017.cc"), _A("include/t20017_b.h"), "b1(int,int)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("t20017.cc"), _A("include/t20017_b.h"), "b2<int>(int,int)"));
|
||||
REQUIRE_THAT(puml, HasExitpoint(_A("t20017.cc")));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -28,34 +28,40 @@ TEST_CASE("t20018", "[test-case][sequence]")
|
||||
|
||||
REQUIRE(model->name() == "t20018_sequence");
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("tmain()"), _A("Answer<Factorial<5>,120>"), "__print()__"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("Answer<Factorial<5>,120>"), _A("Factorial<5>"),
|
||||
"__print(int)__"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("Factorial<5>"), _A("Factorial<4>"), "__print(int)__"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("Factorial<4>"), _A("Factorial<3>"), "__print(int)__"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("Factorial<3>"), _A("Factorial<2>"), "__print(int)__"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("Factorial<2>"), _A("Factorial<1>"), "__print(int)__"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("Factorial<1>"), _A("Factorial<0>"), "__print(int)__"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(
|
||||
_A("tmain()"), _A("Answer<Factorial<5>,120>"), "__print()__"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("Answer<Factorial<5>,120>"), _A("Factorial<5>"),
|
||||
"__print(int)__"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("Factorial<5>"), _A("Factorial<4>"), "__print(int)__"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("Factorial<4>"), _A("Factorial<3>"), "__print(int)__"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("Factorial<3>"), _A("Factorial<2>"), "__print(int)__"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("Factorial<2>"), _A("Factorial<1>"), "__print(int)__"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("Factorial<1>"), _A("Factorial<0>"), "__print(int)__"));
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
using namespace json;
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -28,23 +28,28 @@ TEST_CASE("t20019", "[test-case][sequence]")
|
||||
|
||||
REQUIRE(model->name() == "t20019_sequence");
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("Base<D1>"), "name()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("Base<D1>"), _A("D1"), "impl()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("Base<D2>"), "name()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("Base<D2>"), _A("D2"), "impl()"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("Base<D1>"), "name()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("Base<D1>"), _A("D1"), "impl()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("Base<D2>"), "name()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("Base<D2>"), _A("D2"), "impl()"));
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
using namespace json;
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,34 +27,38 @@ TEST_CASE("t20020", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20020_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a1()"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a3()"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a1()"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a3()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "log()"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "log()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("C"), "c1()"));
|
||||
REQUIRE_THAT(puml, HasCallInControlCondition(_A("C"), _A("C"), "c2()"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c3(int)"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("C"), "c1()"));
|
||||
REQUIRE_THAT(puml, HasCallInControlCondition(_A("C"), _A("C"), "c2()"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c3(int)"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,41 +27,46 @@ TEST_CASE("t20021", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20021_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a1()"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a3()"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a1()"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a3()"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("B"), "b1()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()"));
|
||||
|
||||
REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("B"), "b1()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c1()"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c2()"));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c1()"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c2()"));
|
||||
// TODO: Why is this not working?
|
||||
// REQUIRE_THAT(
|
||||
// puml, HasCallInControlCondition(_A("tmain()"), _A("C"),
|
||||
// "c3()"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c4()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "c5()"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCallInControlCondition(_A("tmain()"), _A("C"), "contents()"));
|
||||
|
||||
// TODO: Why is this not working?
|
||||
// REQUIRE_THAT(
|
||||
// puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c3()"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c4()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "c5()"));
|
||||
REQUIRE_THAT(
|
||||
puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "contents()"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,22 +27,26 @@ TEST_CASE("t20022", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20022_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("B"), "b()"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("B"), "b()"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,25 +27,29 @@ TEST_CASE("t20023", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20023_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a1()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a2()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a3()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a4()"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a1()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a2()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a3()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a4()"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,30 +27,34 @@ TEST_CASE("t20024", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20024_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "select(enum_a)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a0()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a1()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a2()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a3()"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "select(enum_a)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a0()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a1()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a2()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a3()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "select(colors)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "red()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "orange()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "green()"));
|
||||
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "select(colors)"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "red()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "orange()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "green()"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,25 +27,29 @@ TEST_CASE("t20025", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20025_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "a1()"));
|
||||
// REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "a2()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("add(int,int)"), ""));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("add2(int,int)"), ""));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "a1()"));
|
||||
// REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "a2()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("add(int,int)"), ""));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("add2(int,int)"), ""));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,21 +27,25 @@ TEST_CASE("t20026", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20026_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,23 +27,27 @@ TEST_CASE("t20027", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20027_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "aa()"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "aaa()"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "aa()"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "aaa()"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,25 +27,29 @@ TEST_CASE("t20028", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20028_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "b()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "c()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "d()"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("B"), "e()"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "b()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "c()"));
|
||||
REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "d()"));
|
||||
REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("B"), "e()"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(j == nlohmann::json::parse(expected_json));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -27,38 +27,47 @@ TEST_CASE("t20029", "[test-case][sequence]")
|
||||
auto model = generate_sequence_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t20029_sequence");
|
||||
{
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
|
||||
auto puml = generate_sequence_puml(diagram, *model);
|
||||
AliasMatcher _A(puml);
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
|
||||
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("tmain()"), _A("ConnectionPool"), "connect()"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCallInControlCondition(_A("tmain()"),
|
||||
_A("Encoder<Retrier<ConnectionPool>>"),
|
||||
"send(std::string &&)"));
|
||||
|
||||
// Check if all calls exist
|
||||
REQUIRE_THAT(
|
||||
puml, HasCall(_A("tmain()"), _A("ConnectionPool"), "connect()"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCallInControlCondition(_A("tmain()"),
|
||||
_A("Encoder<Retrier<ConnectionPool>>"), "send(std::string &&)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("Encoder<Retrier<ConnectionPool>>"),
|
||||
_A("Encoder<Retrier<ConnectionPool>>"),
|
||||
"encode(std::string &&)"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("Encoder<Retrier<ConnectionPool>>"),
|
||||
_A("Encoder<Retrier<ConnectionPool>>"), "encode(std::string &&)"));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("Encoder<Retrier<ConnectionPool>>"),
|
||||
_A("encode_b64(std::string &&)"), ""));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
HasCall(_A("Encoder<Retrier<ConnectionPool>>"),
|
||||
_A("encode_b64(std::string &&)"), ""));
|
||||
REQUIRE_THAT(puml,
|
||||
HasCallInControlCondition(_A("Retrier<ConnectionPool>"),
|
||||
_A("ConnectionPool"), "send(const std::string &)"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
HasCallInControlCondition(_A("Retrier<ConnectionPool>"),
|
||||
_A("ConnectionPool"), "send(const std::string &)"));
|
||||
REQUIRE_THAT(puml,
|
||||
!HasCall(
|
||||
_A("ConnectionPool"), _A("ConnectionPool"), "connect_impl()"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
!HasCall(_A("ConnectionPool"), _A("ConnectionPool"), "connect_impl()"));
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
{
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
|
||||
auto j = generate_sequence_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
@@ -631,6 +631,20 @@ std::optional<nlohmann::json> get_element(
|
||||
return {};
|
||||
}
|
||||
|
||||
std::optional<nlohmann::json> get_participant(
|
||||
const nlohmann::json &j, const std::string &name)
|
||||
{
|
||||
if (!j.contains("participants"))
|
||||
return {};
|
||||
|
||||
for (const nlohmann::json &e : j["participants"]) {
|
||||
if (e["name"] == name)
|
||||
return {e};
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
auto get_relationship(const nlohmann::json &j, const nlohmann::json &from,
|
||||
const nlohmann::json &to, const std::string &type)
|
||||
{
|
||||
@@ -825,6 +839,82 @@ bool IsInnerClass(
|
||||
return rel != j["relationships"].end();
|
||||
}
|
||||
|
||||
bool IsParticipant(
|
||||
const nlohmann::json &j, const std::string &name, const std::string &type)
|
||||
{
|
||||
auto p = get_participant(j, expand_name(j, name));
|
||||
|
||||
return p && (p->at("type") == type);
|
||||
}
|
||||
|
||||
bool IsFunctionParticipant(const nlohmann::json &j, const std::string &name)
|
||||
{
|
||||
return IsParticipant(j, name, "function");
|
||||
}
|
||||
|
||||
bool IsClassParticipant(const nlohmann::json &j, const std::string &name)
|
||||
{
|
||||
return IsParticipant(j, name, "class");
|
||||
}
|
||||
|
||||
bool IsFileParticipant(const nlohmann::json &j, const std::string &name)
|
||||
{
|
||||
return IsParticipant(j, name, "file");
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
int find_message_nested(const nlohmann::json &j, const std::string &from,
|
||||
const std::string &to, const std::string &msg, const nlohmann::json &from_p,
|
||||
const nlohmann::json &to_p, int &count)
|
||||
{
|
||||
const auto &messages = j["messages"];
|
||||
|
||||
int res{-1};
|
||||
|
||||
for (const auto &m : messages) {
|
||||
if (m.contains("branches")) {
|
||||
for (const auto &b : m["branches"]) {
|
||||
auto nested_res =
|
||||
find_message_nested(b, from, to, msg, from_p, to_p, count);
|
||||
|
||||
if (nested_res >= 0)
|
||||
return nested_res;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((m["from"]["participant_id"] == from_p["id"]) &&
|
||||
(m["to"]["participant_id"] == to_p["id"]) && (m["name"] == msg))
|
||||
return count;
|
||||
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
int FindMessage(const nlohmann::json &j, const std::string &from,
|
||||
const std::string &to, const std::string &msg)
|
||||
{
|
||||
auto from_p = get_participant(j, expand_name(j, from));
|
||||
auto to_p = get_participant(j, expand_name(j, to));
|
||||
|
||||
// TODO: support diagrams with multiple sequences...
|
||||
const auto &sequence_0 = j["sequences"][0];
|
||||
|
||||
int count{0};
|
||||
|
||||
auto res = detail::find_message_nested(
|
||||
sequence_0, from, to, msg, *from_p, *to_p, count);
|
||||
|
||||
if (res >= 0)
|
||||
return res;
|
||||
|
||||
throw std::runtime_error(
|
||||
fmt::format("No such message {} {} {}", from, to, msg));
|
||||
}
|
||||
|
||||
} // namespace json
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user