Refactored sequence diagrams test cases (#266)

This commit is contained in:
Bartek Kryza
2024-05-20 21:56:54 +02:00
parent 4b5cfa7b48
commit 387b46f683
16 changed files with 40 additions and 3000 deletions

View File

@@ -26,83 +26,27 @@ TEST_CASE("t20030")
CHECK_SEQUENCE_DIAGRAM(config, diagram, *model, [](const auto &src) {
REQUIRE(MessageOrder(src,
{
//
// "clanguml::t20030::tmain(int)"
//
{"tmain(int)", "magic()", ""}, //
{"tmain(int)", "A", "A(int)"}, //
{"tmain(int)", "A", "operator+=(int)"}, //
{"A", "A", "add(int)"}, //
{"tmain(bool,int)", "A", "A()"}, //
// {"A", "A", "create()"}, //
// {"tmain(bool,int)", "A", "A()"}, //
// {"A", "A", "create()"}, //
// {"tmain(bool,int)", "A", "operator+=(int)"},
// //
// {"A", "A", "add(int)"}, //
// {"tmain(bool,int)", "A", "operator=(const A
// &)"}, //
// {"A", "A", "set(int)"}, //
// {"tmain(bool,int)", "A", "value() const"} //
//
// "clanguml::t20030::tmain(bool,int)"
//
{"tmain(bool,int)", "A", "A()"}, //
{"A", "A", "create()"}, //
{"tmain(bool,int)", "A", "A()"}, //
{"A", "A", "create()"}, //
{"tmain(bool,int)", "A", "operator+=(int)"}, //
//
{"A", "A", "add(int)"}, //
{"tmain(bool,int)", "A", "operator=(const A &)"}, //
{"A", "A", "set(int)"}, //
{"tmain(bool,int)", "A", "value() const"} //
}));
});
/*
{
auto src = generate_sequence_puml(diagram, *model);
AliasMatcher _A(src);
REQUIRE_THAT(src, StartsWith("@startuml"));
REQUIRE_THAT(src, EndsWith("@enduml\n"));
// Check if all calls exist
REQUIRE_THAT(src, HasCall(_A("tmain(int)"), _A("magic()"), ""));
REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "create()"));
REQUIRE_THAT(
src, HasCall(_A("tmain(int)"), _A("A"), "operator+=(int)"));
REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "add(int)"));
REQUIRE_THAT(src, HasCall(_A("tmain(bool,int)"), _A("A"), "A()"));
REQUIRE_THAT(
src, HasCall(_A("tmain(bool,int)"), _A("A"),
"operator+=(int)")); REQUIRE_THAT(src, HasCall(_A("A"), _A("A"),
"add(int)")); REQUIRE_THAT(src, HasCall(_A("tmain(bool,int)"), _A("A"),
"operator=(const A &)")); REQUIRE_THAT(src, HasCall(_A("A"), _A("A"),
"set(int)")); REQUIRE_THAT(src, HasCall(_A("tmain(bool,int)"), _A("A"),
"value()"));
save_puml(config.output_directory(), diagram->name + ".puml", src);
}
{
auto j = generate_sequence_json(diagram, *model);
using namespace json;
save_json(config.output_directory(), diagram->name + ".json", j);
}
{
auto src = generate_sequence_mermaid(diagram, *model);
mermaid::SequenceDiagramAliasMatcher _A(src);
using mermaid::HasCall;
REQUIRE_THAT(src, HasCall(_A("tmain(int)"), _A("magic()"), ""));
REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "create()"));
REQUIRE_THAT(
src, HasCall(_A("tmain(int)"), _A("A"), "operator+=(int)"));
REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "add(int)"));
REQUIRE_THAT(src, HasCall(_A("tmain(bool,int)"), _A("A"), "A()"));
REQUIRE_THAT(
src, HasCall(_A("tmain(bool,int)"), _A("A"),
"operator+=(int)")); REQUIRE_THAT(src, HasCall(_A("A"), _A("A"),
"add(int)")); REQUIRE_THAT(src, HasCall(_A("tmain(bool,int)"), _A("A"),
"operator=(const A &)")); REQUIRE_THAT(src, HasCall(_A("A"), _A("A"),
"set(int)")); REQUIRE_THAT(src, HasCall(_A("tmain(bool,int)"), _A("A"),
"value()"));
save_mermaid(config.output_directory(), diagram->name + ".mmd",
src);
}*/
}