Added JSON test case stubs for all class diagram test cases
This commit is contained in:
@@ -27,99 +27,102 @@ TEST_CASE("t00056", "[test-case][class]")
|
||||
auto model = generate_class_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t00056_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, IsConcept(_A("greater_than_simple<T,L>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("greater_than_with_requires<T,P>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("max_four_bytes<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("iterable<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("has_value_type<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("convertible_to_string<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("iterable_with_value_type<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("iterable_or_small_value_type<T>")));
|
||||
|
||||
// Check if all classes exist
|
||||
REQUIRE_THAT(puml, IsConcept(_A("greater_than_simple<T,L>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("greater_than_with_requires<T,P>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("max_four_bytes<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("iterable<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("has_value_type<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("convertible_to_string<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("iterable_with_value_type<T>")));
|
||||
REQUIRE_THAT(puml, IsConcept(_A("iterable_or_small_value_type<T>")));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(_A("greater_than_with_requires<T,P>"),
|
||||
"sizeof (l) > sizeof (r)"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(
|
||||
_A("greater_than_with_requires<T,P>"), "sizeof (l) > sizeof (r)"));
|
||||
|
||||
REQUIRE_THAT(
|
||||
puml, IsConceptRequirement(_A("iterable<T>"), "container.begin()"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsConceptRequirement(_A("iterable<T>"), "container.end()"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsConceptRequirement(_A("iterable<T>"), "container.begin()"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsConceptRequirement(_A("iterable<T>"), "container.end()"));
|
||||
|
||||
#ifdef _MSC_VER
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(
|
||||
_A("convertible_to_string<T>"), "std::string({s})"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(
|
||||
_A("convertible_to_string<T>"), "std::string({s})"));
|
||||
#else
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(_A("convertible_to_string<T>"), "std::string{s}"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(
|
||||
_A("convertible_to_string<T>"), "std::string{s}"));
|
||||
#endif
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(
|
||||
_A("convertible_to_string<T>"), "{std::to_string(s)} noexcept"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(_A("convertible_to_string<T>"),
|
||||
"{std::to_string(s)} -> std::same_as<std::string>"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(_A("convertible_to_string<T>"),
|
||||
"{std::to_string(s)} noexcept"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConceptRequirement(_A("convertible_to_string<T>"),
|
||||
"{std::to_string(s)} -> std::same_as<std::string>"));
|
||||
|
||||
// Check if class templates exist
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "max_four_bytes T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("C", "convertible_to_string T"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsClassTemplate("D", "iterable T1,T2,iterable T3,T4,T5"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("E", "T1,T2,T3"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("F", "T1,T2,T3"));
|
||||
// Check if class templates exist
|
||||
REQUIRE_THAT(puml, IsClassTemplate("A", "max_four_bytes T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("C", "convertible_to_string T"));
|
||||
REQUIRE_THAT(
|
||||
puml, IsClassTemplate("D", "iterable T1,T2,iterable T3,T4,T5"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("E", "T1,T2,T3"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("F", "T1,T2,T3"));
|
||||
|
||||
// Check if all relationships exist
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("A<max_four_bytes T>"), _A("max_four_bytes<T>"), "T"));
|
||||
// Check if all relationships exist
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(
|
||||
_A("A<max_four_bytes T>"), _A("max_four_bytes<T>"), "T"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||
_A("max_four_bytes<T>"), "T2"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||
_A("max_four_bytes<T>"), "T5"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||
_A("iterable<T>"), "T1"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||
_A("iterable<T>"), "T3"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||
_A("max_four_bytes<T>"), "T2"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||
_A("max_four_bytes<T>"), "T5"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||
_A("iterable<T>"), "T1"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("D<iterable T1,T2,iterable T3,T4,T5>"),
|
||||
_A("iterable<T>"), "T3"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(
|
||||
_A("iterable_with_value_type<T>"), _A("has_value_type<T>"), "T"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("iterable_with_value_type<T>"),
|
||||
_A("has_value_type<T>"), "T"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("iterable_or_small_value_type<T>"),
|
||||
_A("max_four_bytes<T>"), "T"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("iterable_or_small_value_type<T>"),
|
||||
_A("iterable_with_value_type<T>"), "T"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("iterable_or_small_value_type<T>"),
|
||||
_A("max_four_bytes<T>"), "T"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("iterable_or_small_value_type<T>"),
|
||||
_A("iterable_with_value_type<T>"), "T"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(
|
||||
_A("E<T1,T2,T3>"), _A("greater_than_with_requires<T,P>"), "T1,T3"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(_A("E<T1,T2,T3>"),
|
||||
_A("greater_than_with_requires<T,P>"), "T1,T3"));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(
|
||||
_A("F<T1,T2,T3>"), _A("greater_than_simple<T,L>"), "T1,T3"));
|
||||
REQUIRE_THAT(puml,
|
||||
IsConstraint(
|
||||
_A("F<T1,T2,T3>"), _A("greater_than_simple<T,L>"), "T1,T3"));
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(
|
||||
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
{
|
||||
auto j = generate_class_json(diagram, *model);
|
||||
|
||||
auto j = generate_class_json(diagram, *model);
|
||||
using namespace json;
|
||||
|
||||
// REQUIRE(json::IsClass(j, "clanguml::t00014::A<T>"));
|
||||
// REQUIRE(json::IsClass(j, "clanguml::t00014::B"));
|
||||
// REQUIRE(json::IsClass(j, "clanguml::t00014::C"));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user