diff --git a/src/common/generators/json/generator.cc b/src/common/generators/json/generator.cc
index 209acbc4..a36ace46 100644
--- a/src/common/generators/json/generator.cc
+++ b/src/common/generators/json/generator.cc
@@ -61,6 +61,7 @@ void to_json(nlohmann::json &j, const template_parameter &c)
if (c.default_value())
j["default"] = c.default_value().value();
j["is_variadic"] = c.is_variadic();
+ j["template_parameters"] = c.template_params();
}
void to_json(nlohmann::json &j, const relationship &c)
diff --git a/tests/t00002/test_case.h b/tests/t00002/test_case.h
index 84a4e86a..a4f5e69f 100644
--- a/tests/t00002/test_case.h
+++ b/tests/t00002/test_case.h
@@ -91,7 +91,7 @@ TEST_CASE("t00002", "[test-case][class]")
REQUIRE(IsBaseClass(j, "C", "D"));
REQUIRE(IsMethod(j, "A", "foo_a"));
REQUIRE(IsMethod(j, "C", "foo_c"));
- REQUIRE(IsMember(j, "E", "as", "std::vector"));
+ REQUIRE(IsField(j, "E", "as", "std::vector"));
REQUIRE(IsAssociation(j, "D", "A", "as"));
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
diff --git a/tests/t00009/test_case.h b/tests/t00009/test_case.h
index 99e00aa2..cbcae450 100644
--- a/tests/t00009/test_case.h
+++ b/tests/t00009/test_case.h
@@ -61,7 +61,15 @@ TEST_CASE("t00009", "[test-case][class]")
using namespace json;
- REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClassTemplate(j, "A"));
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "A>"));
+
+ REQUIRE(IsField(j, "A", "value", "T"));
+ REQUIRE(IsField(j, "B", "aint", "A"));
+ REQUIRE(IsField(j, "B", "astring", "A *"));
+ REQUIRE(IsField(j, "B", "avector", "A> &"));
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
diff --git a/tests/t00010/test_case.h b/tests/t00010/test_case.h
index 4a30f573..b527ab49 100644
--- a/tests/t00010/test_case.h
+++ b/tests/t00010/test_case.h
@@ -56,6 +56,14 @@ TEST_CASE("t00010", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClassTemplate(j, "A"));
+ REQUIRE(IsClassTemplate(j, "B"));
+ REQUIRE(IsClass(j, "B"));
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "B"));
+
+ REQUIRE(IsField(j, "C", "aintstring", "B"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00011/test_case.h b/tests/t00011/test_case.h
index 5dea69df..99eabbdb 100644
--- a/tests/t00011/test_case.h
+++ b/tests/t00011/test_case.h
@@ -51,6 +51,11 @@ TEST_CASE("t00011", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "B"));
+ REQUIRE(IsClassTemplate(j, "D"));
+ REQUIRE(IsFriend(j, "A", "B"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00012/test_case.h b/tests/t00012/test_case.h
index 432a0fa5..0d3d4d59 100644
--- a/tests/t00012/test_case.h
+++ b/tests/t00012/test_case.h
@@ -54,6 +54,14 @@ TEST_CASE("t00012", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClassTemplate(j, "A"));
+ REQUIRE(IsClassTemplate(j, "B"));
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j,
+ "C>>>"
+ ",3,3,3>"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00013/test_case.h b/tests/t00013/test_case.h
index 97ca85e3..40f8b2dc 100644
--- a/tests/t00013/test_case.h
+++ b/tests/t00013/test_case.h
@@ -73,6 +73,19 @@ TEST_CASE("t00013", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "B"));
+ REQUIRE(IsClass(j, "C"));
+ REQUIRE(IsClass(j, "D"));
+ REQUIRE(IsInstantiation(j, "E", "E"));
+ REQUIRE(IsDependency(j, "R", "A"));
+ REQUIRE(IsDependency(j, "R", "B"));
+ REQUIRE(IsDependency(j, "R", "C"));
+ REQUIRE(IsDependency(j, "R", "D"));
+ REQUIRE(IsDependency(j, "D", "R"));
+ REQUIRE(IsDependency(j, "R", "E"));
+ REQUIRE(IsInstantiation(j, "G", "G"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00015/test_case.h b/tests/t00015/test_case.h
index 6cc1a493..f66322b5 100644
--- a/tests/t00015/test_case.h
+++ b/tests/t00015/test_case.h
@@ -49,6 +49,12 @@ TEST_CASE("t00015", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "ns1::A"));
+ REQUIRE(IsClass(j, "ns1::ns2_v0_9_0::A"));
+ REQUIRE(IsClass(j, "ns1::Anon"));
+ REQUIRE(IsClass(j, "ns3::ns1::ns2::Anon"));
+ REQUIRE(IsClass(j, "ns3::B"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00016/test_case.h b/tests/t00016/test_case.h
index 44a20380..f4b4d806 100644
--- a/tests/t00016/test_case.h
+++ b/tests/t00016/test_case.h
@@ -58,6 +58,12 @@ TEST_CASE("t00016", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClassTemplate(j, "is_numeric<>"));
+ REQUIRE(IsClass(j, "is_numeric"));
+ REQUIRE(IsClass(j, "is_numeric"));
+ REQUIRE(IsClass(j, "is_numeric"));
+ REQUIRE(IsClass(j, "is_numeric"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00017/test_case.h b/tests/t00017/test_case.h
index b76ca620..41db6e1e 100644
--- a/tests/t00017/test_case.h
+++ b/tests/t00017/test_case.h
@@ -76,6 +76,19 @@ TEST_CASE("t00017", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "B"));
+ REQUIRE(IsClass(j, "C"));
+ REQUIRE(IsClass(j, "D"));
+ REQUIRE(IsClass(j, "E"));
+ REQUIRE(IsClass(j, "F"));
+ REQUIRE(IsClass(j, "G"));
+ REQUIRE(IsClass(j, "H"));
+ REQUIRE(IsClass(j, "I"));
+ REQUIRE(IsClass(j, "J"));
+ REQUIRE(IsClass(j, "K"));
+ REQUIRE(IsClass(j, "R"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00018/test_case.h b/tests/t00018/test_case.h
index 1c67633b..37c7bdaa 100644
--- a/tests/t00018/test_case.h
+++ b/tests/t00018/test_case.h
@@ -50,6 +50,10 @@ TEST_CASE("t00018", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "widget"));
+ REQUIRE(IsClass(j, "impl::widget"));
+ REQUIRE(IsDependency(j, "impl::widget", "widget"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00019/test_case.h b/tests/t00019/test_case.h
index 3874dd5d..db7bdcca 100644
--- a/tests/t00019/test_case.h
+++ b/tests/t00019/test_case.h
@@ -65,6 +65,11 @@ TEST_CASE("t00019", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "Base"));
+ REQUIRE(IsClassTemplate(j, "Layer1"));
+ REQUIRE(IsClassTemplate(j, "Layer2"));
+ REQUIRE(IsClassTemplate(j, "Layer3"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00020/test_case.h b/tests/t00020/test_case.h
index 570d7fc7..299658d7 100644
--- a/tests/t00020/test_case.h
+++ b/tests/t00020/test_case.h
@@ -53,6 +53,12 @@ TEST_CASE("t00020", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "ProductA1"));
+ REQUIRE(IsClass(j, "ProductA2"));
+ REQUIRE(IsClass(j, "ProductB1"));
+ REQUIRE(IsClass(j, "ProductB2"));
+ REQUIRE(IsAbstractClass(j, "AbstractFactory"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00021/test_case.h b/tests/t00021/test_case.h
index 6df1349e..76ed85f7 100644
--- a/tests/t00021/test_case.h
+++ b/tests/t00021/test_case.h
@@ -51,6 +51,10 @@ TEST_CASE("t00021", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "Visitor1"));
+ REQUIRE(IsClass(j, "Visitor2"));
+ REQUIRE(IsAbstractClass(j, "Item"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00022/test_case.h b/tests/t00022/test_case.h
index 15a2fbe1..8602735a 100644
--- a/tests/t00022/test_case.h
+++ b/tests/t00022/test_case.h
@@ -47,6 +47,10 @@ TEST_CASE("t00022", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A1"));
+ REQUIRE(IsClass(j, "A2"));
+ REQUIRE(IsAbstractClass(j, "A"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00023/test_case.h b/tests/t00023/test_case.h
index 1bb05f03..0d926df9 100644
--- a/tests/t00023/test_case.h
+++ b/tests/t00023/test_case.h
@@ -47,6 +47,10 @@ TEST_CASE("t00023", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "StrategyA"));
+ REQUIRE(IsClass(j, "StrategyB"));
+ REQUIRE(IsAbstractClass(j, "Strategy"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00024/test_case.h b/tests/t00024/test_case.h
index ca123ce0..c0e924a4 100644
--- a/tests/t00024/test_case.h
+++ b/tests/t00024/test_case.h
@@ -51,6 +51,13 @@ TEST_CASE("t00024", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "Target1"));
+ REQUIRE(IsClass(j, "Target2"));
+ REQUIRE(IsAbstractClass(j, "Target"));
+ REQUIRE(IsBaseClass(j, "Target", "Target1"));
+ REQUIRE(IsBaseClass(j, "Target", "Target2"));
+ REQUIRE(IsBaseClass(j, "Target", "Proxy"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00025/test_case.h b/tests/t00025/test_case.h
index 8d915bd6..bd15af94 100644
--- a/tests/t00025/test_case.h
+++ b/tests/t00025/test_case.h
@@ -61,6 +61,12 @@ TEST_CASE("t00025", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "Target1"));
+ REQUIRE(IsClass(j, "Target2"));
+ REQUIRE(IsClassTemplate(j, "Proxy"));
+ REQUIRE(IsDependency(j, "Proxy", "Target1"));
+ REQUIRE(IsDependency(j, "Proxy", "Target2"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00026/test_case.h b/tests/t00026/test_case.h
index 5ce6fde7..014d2ef8 100644
--- a/tests/t00026/test_case.h
+++ b/tests/t00026/test_case.h
@@ -52,6 +52,10 @@ TEST_CASE("t00026", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClassTemplate(j, "Memento"));
+ REQUIRE(IsClassTemplate(j, "Originator"));
+ REQUIRE(IsInstantiation(j, "Originator", "Originator"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00027/test_case.h b/tests/t00027/test_case.h
index 0c36648c..2b20e682 100644
--- a/tests/t00027/test_case.h
+++ b/tests/t00027/test_case.h
@@ -65,6 +65,17 @@ TEST_CASE("t00027", "[test-case][class]")
using namespace json;
+ REQUIRE(IsAbstractClass(j, "Shape"));
+ REQUIRE(IsAbstractClass(j, "ShapeDecorator"));
+
+ REQUIRE(IsClassTemplate(j, "Line...>"));
+ REQUIRE(IsInstantiation(
+ j, "Line...>", "Line"));
+ REQUIRE(IsInstantiation(j, "Line...>",
+ "Line"));
+ REQUIRE(IsAggregation(
+ j, "Window", "Text", "description"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00029/test_case.h b/tests/t00029/test_case.h
index 3648bad4..ac067148 100644
--- a/tests/t00029/test_case.h
+++ b/tests/t00029/test_case.h
@@ -62,6 +62,8 @@ TEST_CASE("t00029", "[test-case][class]")
using namespace json;
+ REQUIRE(IsAggregation(j, "R", "G1", "g1"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00030/test_case.h b/tests/t00030/test_case.h
index 64b1525f..f3dc105f 100644
--- a/tests/t00030/test_case.h
+++ b/tests/t00030/test_case.h
@@ -57,6 +57,8 @@ TEST_CASE("t00030", "[test-case][class]")
using namespace json;
+ REQUIRE(IsAggregation(j, "R", "C", "ccc"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00031/test_case.h b/tests/t00031/test_case.h
index 5ec06b4b..c8b26bf1 100644
--- a/tests/t00031/test_case.h
+++ b/tests/t00031/test_case.h
@@ -62,6 +62,9 @@ TEST_CASE("t00031", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClassTemplate(j, "C"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00032/test_case.h b/tests/t00032/test_case.h
index 882b3442..ba36785b 100644
--- a/tests/t00032/test_case.h
+++ b/tests/t00032/test_case.h
@@ -62,6 +62,10 @@ TEST_CASE("t00032", "[test-case][class]")
using namespace json;
+ REQUIRE(IsBaseClass(j, "A",
+ "Overload"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00033/test_case.h b/tests/t00033/test_case.h
index eb36b8b8..350c366e 100644
--- a/tests/t00033/test_case.h
+++ b/tests/t00033/test_case.h
@@ -63,6 +63,14 @@ TEST_CASE("t00033", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j,
+ "A>>>"));
+ REQUIRE(IsDependency(j,
+ "A>>>",
+ "B>>"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00034/test_case.h b/tests/t00034/test_case.h
index 496aeaf4..2b56baa1 100644
--- a/tests/t00034/test_case.h
+++ b/tests/t00034/test_case.h
@@ -55,6 +55,9 @@ TEST_CASE("t00034", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClassTemplate(j, "lift_void"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00035/test_case.h b/tests/t00035/test_case.h
index 945dbb09..5b8e1021 100644
--- a/tests/t00035/test_case.h
+++ b/tests/t00035/test_case.h
@@ -55,6 +55,12 @@ TEST_CASE("t00035", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "Top"));
+ REQUIRE(IsClass(j, "Bottom"));
+ REQUIRE(IsClass(j, "Center"));
+ REQUIRE(IsClass(j, "Left"));
+ REQUIRE(IsClass(j, "Right"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00037/test_case.h b/tests/t00037/test_case.h
index efec5642..e3b20bd8 100644
--- a/tests/t00037/test_case.h
+++ b/tests/t00037/test_case.h
@@ -53,6 +53,12 @@ TEST_CASE("t00037", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "ST"));
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "ST::(units)"));
+ REQUIRE(IsClass(j, "ST::(dimensions)"));
+ REQUIRE(IsAggregation(j, "ST", "ST::(dimensions)", "dimensions"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00038/test_case.h b/tests/t00038/test_case.h
index c959ec60..b253ef73 100644
--- a/tests/t00038/test_case.h
+++ b/tests/t00038/test_case.h
@@ -104,6 +104,10 @@ TEST_CASE("t00038", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "B"));
+ REQUIRE(IsClass(j, "C"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00039/test_case.h b/tests/t00039/test_case.h
index 824a37f8..e3871e20 100644
--- a/tests/t00039/test_case.h
+++ b/tests/t00039/test_case.h
@@ -71,6 +71,19 @@ TEST_CASE("t00039", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "AA"));
+ REQUIRE(IsClass(j, "AAA"));
+ REQUIRE(IsBaseClass(j, "C", "CD"));
+ REQUIRE(IsBaseClass(j, "D", "CD"));
+ REQUIRE(IsBaseClass(j, "E", "DE"));
+ REQUIRE(IsBaseClass(j, "D", "DE"));
+ REQUIRE(IsBaseClass(j, "C", "CDE"));
+ REQUIRE(IsBaseClass(j, "D", "CDE"));
+ REQUIRE(IsBaseClass(j, "E", "CDE"));
+
+ REQUIRE(IsClassTemplate(j, "ns3::F"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00040/test_case.h b/tests/t00040/test_case.h
index 5e7f94c8..7d58e4b6 100644
--- a/tests/t00040/test_case.h
+++ b/tests/t00040/test_case.h
@@ -53,6 +53,10 @@ TEST_CASE("t00040", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "AA"));
+ REQUIRE(IsClass(j, "AAA"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00041/test_case.h b/tests/t00041/test_case.h
index 27caf88a..88c1e483 100644
--- a/tests/t00041/test_case.h
+++ b/tests/t00041/test_case.h
@@ -72,6 +72,16 @@ TEST_CASE("t00041", "[test-case][class]")
using namespace json;
+ REQUIRE(!IsClass(j, "A"));
+ REQUIRE(!IsClass(j, "AA"));
+ REQUIRE(!IsClass(j, "AAA"));
+ REQUIRE(IsClass(j, "D"));
+ REQUIRE(IsClass(j, "E"));
+ REQUIRE(IsClass(j, "F"));
+ REQUIRE(IsClass(j, "R"));
+
+ REQUIRE(IsAssociation(j, "D", "RR", "rr"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00042/test_case.h b/tests/t00042/test_case.h
index c490c158..3b662d5c 100644
--- a/tests/t00042/test_case.h
+++ b/tests/t00042/test_case.h
@@ -48,6 +48,9 @@ TEST_CASE("t00042", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClassTemplate(j, "A"));
+ REQUIRE(IsClassTemplate(j, "B"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00043/test_case.h b/tests/t00043/test_case.h
index 6a93e301..58f1ca9f 100644
--- a/tests/t00043/test_case.h
+++ b/tests/t00043/test_case.h
@@ -71,6 +71,20 @@ TEST_CASE("t00043", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "dependants::A"));
+ REQUIRE(IsClass(j, "dependants::B"));
+ REQUIRE(IsClass(j, "dependants::C"));
+ REQUIRE(IsClass(j, "dependants::D"));
+ REQUIRE(IsClass(j, "dependants::BB"));
+ REQUIRE(IsClass(j, "dependants::E"));
+ REQUIRE(IsDependency(j, "dependants::B", "dependants::A"));
+
+ REQUIRE(IsClass(j, "dependencies::G"));
+ REQUIRE(IsClass(j, "dependencies::GG"));
+ REQUIRE(IsClass(j, "dependencies::H"));
+ REQUIRE(IsDependency(j, "dependencies::J", "dependencies::I"));
+ REQUIRE(IsDependency(j, "dependencies::H", "dependencies::G"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00045/test_case.h b/tests/t00045/test_case.h
index cf4487fc..249ce321 100644
--- a/tests/t00045/test_case.h
+++ b/tests/t00045/test_case.h
@@ -75,6 +75,17 @@ TEST_CASE("t00045", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "ns1::A"));
+ REQUIRE(IsClass(j, "ns1::ns2::A"));
+ REQUIRE(IsClass(j, "ns1::ns2::B"));
+ REQUIRE(IsClass(j, "ns1::ns2::C"));
+ REQUIRE(IsClass(j, "ns1::ns2::D"));
+ REQUIRE(IsClass(j, "ns1::ns2::E"));
+ REQUIRE(IsClass(j, "ns1::ns2::R"));
+
+ REQUIRE(IsBaseClass(j, "ns1::ns2::A", "ns1::ns2::B"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00046/test_case.h b/tests/t00046/test_case.h
index a85e2241..3ab43551 100644
--- a/tests/t00046/test_case.h
+++ b/tests/t00046/test_case.h
@@ -51,6 +51,11 @@ TEST_CASE("t00046", "[test-case][class]")
using namespace json;
+ REQUIRE(get_element(j, "A").value()["type"] == "class");
+ REQUIRE(get_element(j, "AA").value()["type"] == "class");
+ REQUIRE(get_element(j, "ns1::A").value()["type"] == "class");
+ REQUIRE(get_element(j, "ns1::ns2::D").value()["type"] == "class");
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
diff --git a/tests/t00047/test_case.h b/tests/t00047/test_case.h
index 52542829..ae1e89f0 100644
--- a/tests/t00047/test_case.h
+++ b/tests/t00047/test_case.h
@@ -50,6 +50,11 @@ TEST_CASE("t00047", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClassTemplate(j, "conditional_t"));
+ REQUIRE(IsClass(j, "conditional_t"));
+ REQUIRE(IsClass(j, "conditional_t"));
+ REQUIRE(IsClass(j, "conditional_t"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
\ No newline at end of file
diff --git a/tests/t00048/test_case.h b/tests/t00048/test_case.h
index 04123d4d..6a3d2492 100644
--- a/tests/t00048/test_case.h
+++ b/tests/t00048/test_case.h
@@ -56,6 +56,13 @@ TEST_CASE("t00048", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "B"));
+ REQUIRE(IsClass(j, "ATemplate"));
+ REQUIRE(IsClass(j, "BTemplate"));
+ REQUIRE(IsBaseClass(j, "Base", "A"));
+ REQUIRE(IsBaseClass(j, "Base", "B"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
\ No newline at end of file
diff --git a/tests/t00049/test_case.h b/tests/t00049/test_case.h
index 29a829a8..fc7c5a41 100644
--- a/tests/t00049/test_case.h
+++ b/tests/t00049/test_case.h
@@ -64,6 +64,10 @@ TEST_CASE("t00049", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "R"));
+ REQUIRE(IsClassTemplate(j, "A"));
+ REQUIRE(IsInstantiation(j, "A", "A"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
\ No newline at end of file
diff --git a/tests/t00050/test_case.h b/tests/t00050/test_case.h
index 1088ef7f..d68c0fb6 100644
--- a/tests/t00050/test_case.h
+++ b/tests/t00050/test_case.h
@@ -61,6 +61,12 @@ TEST_CASE("t00050", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "B"));
+ REQUIRE(IsClass(j, "C"));
+ REQUIRE(IsClass(j, "utils::D"));
+ REQUIRE(IsEnum(j, "E"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
\ No newline at end of file
diff --git a/tests/t00051/test_case.h b/tests/t00051/test_case.h
index da79c3e0..6fb6d73a 100644
--- a/tests/t00051/test_case.h
+++ b/tests/t00051/test_case.h
@@ -84,6 +84,10 @@ TEST_CASE("t00051", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsInnerClass(j, "A", "A::custom_thread1"));
+ REQUIRE(IsInnerClass(j, "A", "A::custom_thread2"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
\ No newline at end of file
diff --git a/tests/t00052/test_case.h b/tests/t00052/test_case.h
index 1aad88a9..b15b080a 100644
--- a/tests/t00052/test_case.h
+++ b/tests/t00052/test_case.h
@@ -56,6 +56,9 @@ TEST_CASE("t00052", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClassTemplate(j, "B"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
\ No newline at end of file
diff --git a/tests/t00053/test_case.h b/tests/t00053/test_case.h
index bc9c6176..71edfe48 100644
--- a/tests/t00053/test_case.h
+++ b/tests/t00053/test_case.h
@@ -61,6 +61,22 @@ TEST_CASE("t00053", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "a"));
+ REQUIRE(IsClass(j, "b"));
+ REQUIRE(IsClass(j, "c"));
+ REQUIRE(IsClass(j, "d"));
+ REQUIRE(IsClass(j, "e"));
+ REQUIRE(IsClass(j, "f"));
+ REQUIRE(IsClass(j, "g"));
+
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "B"));
+ REQUIRE(IsClass(j, "C"));
+ REQUIRE(IsClass(j, "D"));
+ REQUIRE(IsClass(j, "E"));
+ REQUIRE(IsClass(j, "F"));
+ REQUIRE(IsClass(j, "G"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
\ No newline at end of file
diff --git a/tests/t00054/test_case.h b/tests/t00054/test_case.h
index 6a19036b..b7cdecd9 100644
--- a/tests/t00054/test_case.h
+++ b/tests/t00054/test_case.h
@@ -65,6 +65,26 @@ TEST_CASE("t00054", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "a"));
+ REQUIRE(IsClass(j, "b"));
+ REQUIRE(IsClass(j, "detail::c"));
+ REQUIRE(IsClass(j, "detail::d"));
+ REQUIRE(IsClass(j, "detail::e"));
+ REQUIRE(IsClass(j, "f"));
+ REQUIRE(IsClass(j, "g"));
+
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "B"));
+ REQUIRE(IsClass(j, "detail2::C"));
+ REQUIRE(IsClass(j, "detail2::detail3::D"));
+ REQUIRE(IsClass(j, "detail2::detail3::E"));
+ REQUIRE(IsClass(j, "detail2::F"));
+ REQUIRE(IsClass(j, "G"));
+
+ REQUIRE(IsEnum(j, "detail4::i"));
+ REQUIRE(IsEnum(j, "detail4::h"));
+ REQUIRE(IsEnum(j, "detail4::j"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
\ No newline at end of file
diff --git a/tests/t00055/test_case.h b/tests/t00055/test_case.h
index 0d93b424..44247877 100644
--- a/tests/t00055/test_case.h
+++ b/tests/t00055/test_case.h
@@ -66,6 +66,17 @@ TEST_CASE("t00055", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "B"));
+ REQUIRE(IsClass(j, "C"));
+ REQUIRE(IsClass(j, "D"));
+ REQUIRE(IsClass(j, "E"));
+ REQUIRE(IsClass(j, "F"));
+ REQUIRE(IsClass(j, "G"));
+ REQUIRE(IsClass(j, "H"));
+ REQUIRE(IsClass(j, "I"));
+ REQUIRE(IsClass(j, "J"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
\ No newline at end of file
diff --git a/tests/t00056/test_case.h b/tests/t00056/test_case.h
index aa4b4798..5e6ddd6d 100644
--- a/tests/t00056/test_case.h
+++ b/tests/t00056/test_case.h
@@ -123,6 +123,15 @@ TEST_CASE("t00056", "[test-case][class]")
using namespace json;
+ REQUIRE(IsConcept(j, "greater_than_simple"));
+ REQUIRE(IsConcept(j, "greater_than_with_requires"));
+ REQUIRE(IsConcept(j, "max_four_bytes"));
+ REQUIRE(IsConcept(j, "iterable"));
+ REQUIRE(IsConcept(j, "has_value_type"));
+ REQUIRE(IsConcept(j, "convertible_to_string"));
+ REQUIRE(IsConcept(j, "iterable_with_value_type"));
+ REQUIRE(IsConcept(j, "iterable_or_small_value_type"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
\ No newline at end of file
diff --git a/tests/t00057/test_case.h b/tests/t00057/test_case.h
index a378eec3..9f01a0f7 100644
--- a/tests/t00057/test_case.h
+++ b/tests/t00057/test_case.h
@@ -65,6 +65,13 @@ TEST_CASE("t00057", "[test-case][class]")
using namespace json;
+ REQUIRE(get_element(j, "t00057_A").value()["type"] == "class");
+ REQUIRE(get_element(j, "t00057_B").value()["type"] == "class");
+ REQUIRE(get_element(j, "t00057_C").value()["type"] == "class");
+ REQUIRE(get_element(j, "t00057_D").value()["type"] == "class");
+ REQUIRE(get_element(j, "t00057_E").value()["type"] == "class");
+ REQUIRE(get_element(j, "t00057_R").value()["type"] == "class");
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
\ No newline at end of file
diff --git a/tests/t00058/test_case.h b/tests/t00058/test_case.h
index 6221ee30..198f9aba 100644
--- a/tests/t00058/test_case.h
+++ b/tests/t00058/test_case.h
@@ -75,6 +75,10 @@ TEST_CASE("t00058", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(
+ j, "B>"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
\ No newline at end of file
diff --git a/tests/t00059/test_case.h b/tests/t00059/test_case.h
index e92d6a7f..0ec40ec7 100644
--- a/tests/t00059/test_case.h
+++ b/tests/t00059/test_case.h
@@ -95,6 +95,10 @@ TEST_CASE("t00059", "[test-case][class]")
using namespace json;
+ REQUIRE(IsConcept(j, "fruit_c"));
+ REQUIRE(IsConcept(j, "apple_c"));
+ REQUIRE(IsConcept(j, "orange_c"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
\ No newline at end of file
diff --git a/tests/t00060/test_case.h b/tests/t00060/test_case.h
index 6708787a..5af2f9e9 100644
--- a/tests/t00060/test_case.h
+++ b/tests/t00060/test_case.h
@@ -55,6 +55,13 @@ TEST_CASE("t00060", "[test-case][class]")
using namespace json;
+ REQUIRE(IsClass(j, "A"));
+ REQUIRE(IsClass(j, "B"));
+ REQUIRE(IsClass(j, "C"));
+ REQUIRE(IsClass(j, "D"));
+ REQUIRE(!IsClass(j, "E"));
+ REQUIRE(!IsClass(j, "F"));
+
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
}
}
\ No newline at end of file
diff --git a/tests/test_cases.h b/tests/test_cases.h
index 663b6acb..7ec35cda 100644
--- a/tests/test_cases.h
+++ b/tests/test_cases.h
@@ -611,10 +611,12 @@ ContainsMatcher IsDeprecated(std::string const &str,
}
namespace json {
-namespace detail {
std::optional get_element(
const nlohmann::json &j, const std::string &name)
{
+ if (!j.contains("elements"))
+ return {};
+
for (const nlohmann::json &e : j["elements"]) {
if (e["display_name"] == name)
return {e};
@@ -642,14 +644,13 @@ auto get_relationship(const nlohmann::json &j, const nlohmann::json &from,
auto get_relationship(const nlohmann::json &j, const std::string &from,
const std::string &to, const std::string &type)
{
- auto source = detail::get_element(j, from);
- auto destination = detail::get_element(j, to);
+ auto source = get_element(j, from);
+ auto destination = get_element(j, to);
if (!(source && destination))
return j["relationships"].end();
- return detail::get_relationship(
- j, source->at("id"), destination->at("id"), type);
+ return get_relationship(j, source->at("id"), destination->at("id"), type);
}
std::string expand_name(const nlohmann::json &j, const std::string &name)
@@ -662,36 +663,47 @@ std::string expand_name(const nlohmann::json &j, const std::string &name)
return fmt::format("{}::{}", j["using_namespace"].get(), name);
}
-} // namespace detail
bool IsClass(const nlohmann::json &j, const std::string &name)
{
- auto e = detail::get_element(j, detail::expand_name(j, name));
+ auto e = get_element(j, expand_name(j, name));
return e && e->at("type") == "class";
}
+bool IsAbstractClass(const nlohmann::json &j, const std::string &name)
+{
+ auto e = get_element(j, expand_name(j, name));
+ return e && (e->at("type") == "class") && (e->at("is_abstract") == true);
+}
+
bool IsClassTemplate(const nlohmann::json &j, const std::string &name)
{
- auto e = detail::get_element(j, detail::expand_name(j, name));
+ auto e = get_element(j, expand_name(j, name));
return e && e->at("type") == "class" && e->at("is_template") == true;
}
+bool IsConcept(const nlohmann::json &j, const std::string &name)
+{
+ auto e = get_element(j, expand_name(j, name));
+ return e && e->at("type") == "concept";
+}
+
bool IsEnum(const nlohmann::json &j, const std::string &name)
{
- auto e = detail::get_element(j, detail::expand_name(j, name));
+ auto e = get_element(j, expand_name(j, name));
return e && e->at("type") == "enum";
}
bool IsPackage(const nlohmann::json &j, const std::string &name)
{
- auto e = detail::get_element(j, detail::expand_name(j, name));
+ auto e = get_element(j, expand_name(j, name));
return e && e->at("type") == "namespace";
}
bool IsBaseClass(const nlohmann::json &j, const std::string &base,
const std::string &subclass)
{
- auto sc = detail::get_element(j, detail::expand_name(j, subclass));
+ auto sc = get_element(j, expand_name(j, subclass));
if (!sc)
return false;
@@ -699,14 +711,14 @@ bool IsBaseClass(const nlohmann::json &j, const std::string &base,
const nlohmann::json &bases = (*sc)["bases"];
return std::find_if(bases.begin(), bases.end(), [&](const auto &it) {
- return it["name"] == detail::expand_name(j, base);
+ return it["name"] == expand_name(j, base);
}) != bases.end();
}
bool IsMethod(
const nlohmann::json &j, const std::string &cls, const std::string &name)
{
- auto sc = detail::get_element(j, detail::expand_name(j, cls));
+ auto sc = get_element(j, expand_name(j, cls));
if (!sc)
return false;
@@ -718,10 +730,10 @@ bool IsMethod(
}) != methods.end();
}
-bool IsMember(const nlohmann::json &j, const std::string &cls,
+bool IsField(const nlohmann::json &j, const std::string &cls,
const std::string &name, const std::string &type)
{
- auto sc = detail::get_element(j, detail::expand_name(j, cls));
+ auto sc = get_element(j, expand_name(j, cls));
if (!sc)
return false;
@@ -736,8 +748,8 @@ bool IsMember(const nlohmann::json &j, const std::string &cls,
bool IsAssociation(nlohmann::json j, const std::string &from,
const std::string &to, const std::string &label = "")
{
- auto rel = detail::get_relationship(j, detail::expand_name(j, from),
- detail::expand_name(j, to), "association");
+ auto rel = get_relationship(
+ j, expand_name(j, from), expand_name(j, to), "association");
if (rel == j["relationships"].end())
return false;
@@ -751,8 +763,8 @@ bool IsAssociation(nlohmann::json j, const std::string &from,
bool IsComposition(nlohmann::json j, const std::string &from,
const std::string &to, const std::string &label = "")
{
- auto rel = detail::get_relationship(j, detail::expand_name(j, from),
- detail::expand_name(j, to), "composition");
+ auto rel = get_relationship(
+ j, expand_name(j, from), expand_name(j, to), "composition");
if (rel == j["relationships"].end())
return false;
@@ -766,8 +778,8 @@ bool IsComposition(nlohmann::json j, const std::string &from,
bool IsAggregation(nlohmann::json j, const std::string &from,
const std::string &to, const std::string &label = "")
{
- auto rel = detail::get_relationship(j, detail::expand_name(j, from),
- detail::expand_name(j, to), "aggregation");
+ auto rel = get_relationship(
+ j, expand_name(j, from), expand_name(j, to), "aggregation");
if (rel == j["relationships"].end())
return false;
@@ -781,8 +793,8 @@ bool IsAggregation(nlohmann::json j, const std::string &from,
bool IsDependency(
nlohmann::json j, const std::string &from, const std::string &to)
{
- auto rel = detail::get_relationship(j, detail::expand_name(j, from),
- detail::expand_name(j, to), "aggregation");
+ auto rel = get_relationship(
+ j, expand_name(j, from), expand_name(j, to), "dependency");
return rel != j["relationships"].end();
}
@@ -790,8 +802,16 @@ bool IsDependency(
bool IsInstantiation(
nlohmann::json j, const std::string &from, const std::string &to)
{
- auto rel = detail::get_relationship(j, detail::expand_name(j, to),
- detail::expand_name(j, from), "instantiation");
+ auto rel = get_relationship(
+ j, expand_name(j, to), expand_name(j, from), "instantiation");
+
+ return rel != j["relationships"].end();
+}
+
+bool IsFriend(nlohmann::json j, const std::string &from, const std::string &to)
+{
+ auto rel = get_relationship(
+ j, expand_name(j, from), expand_name(j, to), "friendship");
return rel != j["relationships"].end();
}
@@ -799,8 +819,8 @@ bool IsInstantiation(
bool IsInnerClass(
nlohmann::json j, const std::string &from, const std::string &to)
{
- auto rel = detail::get_relationship(j, detail::expand_name(j, to),
- detail::expand_name(j, from), "containment");
+ auto rel = get_relationship(
+ j, expand_name(j, to), expand_name(j, from), "containment");
return rel != j["relationships"].end();
}