Added JSON test case stubs for all class diagram test cases

This commit is contained in:
Bartek Kryza
2023-03-21 00:37:42 +01:00
parent b412f46fb2
commit c59fbfa565
64 changed files with 2189 additions and 1390 deletions

View File

@@ -27,31 +27,40 @@ TEST_CASE("t00050", "[test-case][class]")
auto model = generate_class_diagram(*db, diagram);
REQUIRE(model->name() == "t00050_class");
{
auto puml = generate_class_puml(diagram, *model);
AliasMatcher _A(puml);
auto puml = generate_class_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 classes exist
REQUIRE_THAT(puml, IsClass(_A("A")));
REQUIRE_THAT(puml, IsClass(_A("B")));
REQUIRE_THAT(puml, IsClass(_A("C")));
REQUIRE_THAT(puml, IsClass(_A("utils::D")));
REQUIRE_THAT(puml, IsEnum(_A("E")));
// Check if all classes exist
REQUIRE_THAT(puml, IsClass(_A("A")));
REQUIRE_THAT(puml, IsClass(_A("B")));
REQUIRE_THAT(puml, IsClass(_A("C")));
REQUIRE_THAT(puml, IsClass(_A("utils::D")));
REQUIRE_THAT(puml, IsEnum(_A("E")));
REQUIRE_THAT(puml, HasNote(_A("A"), "left"));
REQUIRE_THAT(puml, HasNote(_A("A"), "right"));
REQUIRE_THAT(puml, HasNote(_A("B"), "top"));
REQUIRE_THAT(puml, HasNote(_A("C"), "top"));
REQUIRE_THAT(puml, HasNote(_A("utils::D"), "top"));
REQUIRE_THAT(puml, !HasNote(_A("E"), "bottom"));
REQUIRE_THAT(puml, !HasNote(_A("NoComment"), "top"));
REQUIRE_THAT(puml, HasNote(_A("F<T,V,int N>"), "top"));
REQUIRE_THAT(puml, HasNote(_A("G"), "top"));
REQUIRE_THAT(puml, HasNote(_A("G"), "bottom"));
REQUIRE_THAT(puml, HasNote(_A("G"), "right"));
REQUIRE_THAT(puml, HasNote(_A("A"), "left"));
REQUIRE_THAT(puml, HasNote(_A("A"), "right"));
REQUIRE_THAT(puml, HasNote(_A("B"), "top"));
REQUIRE_THAT(puml, HasNote(_A("C"), "top"));
REQUIRE_THAT(puml, HasNote(_A("utils::D"), "top"));
REQUIRE_THAT(puml, !HasNote(_A("E"), "bottom"));
REQUIRE_THAT(puml, !HasNote(_A("NoComment"), "top"));
REQUIRE_THAT(puml, HasNote(_A("F<T,V,int N>"), "top"));
REQUIRE_THAT(puml, HasNote(_A("G"), "top"));
REQUIRE_THAT(puml, HasNote(_A("G"), "bottom"));
REQUIRE_THAT(puml, HasNote(_A("G"), "right"));
save_puml(
config.output_directory() + "/" + diagram->name + ".puml", puml);
}
{
auto j = generate_class_json(diagram, *model);
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
using namespace json;
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}