Fixed handling of relative paths in configuration files (#69)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# CHANGELOG
|
||||
|
||||
* Fixed relative paths in config files to be relative to the parent of
|
||||
the configuration file by default (#69)
|
||||
* Added command line option (--dump-config) to print effective config (#77)
|
||||
* Added support for building with Microsoft Visual Studio
|
||||
|
||||
|
||||
@@ -123,16 +123,18 @@ std::string inheritable_diagram_options::simplify_template_type(
|
||||
return full_name;
|
||||
}
|
||||
|
||||
std::vector<std::string> diagram::get_translation_units(
|
||||
const std::filesystem::path &root_directory) const
|
||||
std::vector<std::string> diagram::get_translation_units() const
|
||||
{
|
||||
std::vector<std::string> translation_units{};
|
||||
|
||||
for (const auto &g : glob()) {
|
||||
const auto matches = glob::glob(g, root_directory);
|
||||
std::string glob_path =
|
||||
fmt::format("{}/{}", relative_to().string(), g.c_str());
|
||||
|
||||
auto matches = glob::glob(glob_path, true, false);
|
||||
|
||||
for (const auto &match : matches) {
|
||||
const auto path =
|
||||
std::filesystem::canonical(root_directory / match);
|
||||
const auto path = std::filesystem::canonical(relative_to() / match);
|
||||
translation_units.emplace_back(path.string());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,8 +170,7 @@ struct diagram : public inheritable_diagram_options {
|
||||
|
||||
virtual common::model::diagram_t type() const = 0;
|
||||
|
||||
std::vector<std::string> get_translation_units(
|
||||
const std::filesystem::path &root_directory) const;
|
||||
std::vector<std::string> get_translation_units() const;
|
||||
|
||||
void initialize_type_aliases();
|
||||
|
||||
@@ -268,7 +267,8 @@ YAML::Emitter &operator<<(YAML::Emitter &out, const option<T> &o)
|
||||
return out;
|
||||
}
|
||||
|
||||
config load(const std::string &config_file);
|
||||
config load(const std::string &config_file,
|
||||
std::optional<bool> paths_relative_to_pwd = {});
|
||||
} // namespace config
|
||||
|
||||
namespace common::model {
|
||||
|
||||
@@ -571,7 +571,30 @@ template <> struct convert<config> {
|
||||
} // namespace YAML
|
||||
|
||||
namespace clanguml::config {
|
||||
config load(const std::string &config_file)
|
||||
|
||||
namespace {
|
||||
void resolve_option_path(YAML::Node &doc, const std::string &option)
|
||||
{
|
||||
std::filesystem::path relative_to_path{
|
||||
doc["relative_to"].as<std::string>()};
|
||||
|
||||
assert(relative_to_path.is_absolute());
|
||||
|
||||
std::filesystem::path option_path{doc[option].as<std::string>()};
|
||||
|
||||
if (option_path.is_absolute())
|
||||
return;
|
||||
|
||||
option_path = relative_to_path / option_path.string();
|
||||
option_path = option_path.lexically_normal();
|
||||
option_path.make_preferred();
|
||||
|
||||
doc[option] = option_path.string();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
config load(
|
||||
const std::string &config_file, std::optional<bool> paths_relative_to_pwd)
|
||||
{
|
||||
try {
|
||||
YAML::Node doc = YAML::LoadFile(config_file);
|
||||
@@ -583,6 +606,32 @@ config load(const std::string &config_file)
|
||||
doc.force_insert(
|
||||
"__parent_path", config_file_path.parent_path().string());
|
||||
|
||||
//
|
||||
// If no relative_to path is specified in the config, make all paths
|
||||
// resolvable against the parent directory of the .clang-uml config
|
||||
// file, or against the $PWD if it was specified so in the command
|
||||
// line
|
||||
//
|
||||
if (!doc["relative_to"]) {
|
||||
bool paths_relative_to_config_file = true;
|
||||
if (doc["paths_relative_to_config_file"] &&
|
||||
!doc["paths_relative_to_config_file"].as<bool>())
|
||||
paths_relative_to_config_file = false;
|
||||
if (paths_relative_to_pwd && *paths_relative_to_pwd)
|
||||
paths_relative_to_config_file = false;
|
||||
|
||||
if (paths_relative_to_config_file)
|
||||
doc["relative_to"] = config_file_path.parent_path().string();
|
||||
else
|
||||
doc["relative_to"] = std::filesystem::current_path().string();
|
||||
}
|
||||
|
||||
//
|
||||
// Resolve common path-like config options relative to `relative_to`
|
||||
//
|
||||
resolve_option_path(doc, "output_directory");
|
||||
resolve_option_path(doc, "compilation_database_dir");
|
||||
|
||||
// If the current directory is also a git repository,
|
||||
// load some config values, which can be included in the
|
||||
// generated diagrams
|
||||
|
||||
38
src/main.cc
38
src/main.cc
@@ -158,9 +158,9 @@ int main(int argc, const char *argv[])
|
||||
CLI::App app{"Clang-based PlantUML diagram generator for C++"};
|
||||
|
||||
std::string config_path{".clang-uml"};
|
||||
std::string compilation_database_dir{};
|
||||
std::optional<std::string> compilation_database_dir{};
|
||||
std::vector<std::string> diagram_names{};
|
||||
std::optional<std::string> output_directory;
|
||||
std::optional<std::string> output_directory{};
|
||||
unsigned int thread_count{0};
|
||||
bool show_version{false};
|
||||
int verbose{0};
|
||||
@@ -172,6 +172,7 @@ int main(int argc, const char *argv[])
|
||||
std::optional<std::string> add_package_diagram;
|
||||
std::optional<std::string> add_include_diagram;
|
||||
bool dump_config{false};
|
||||
std::optional<bool> paths_relative_to_pwd{};
|
||||
|
||||
app.add_option(
|
||||
"-c,--config", config_path, "Location of configuration file");
|
||||
@@ -200,6 +201,9 @@ int main(int argc, const char *argv[])
|
||||
"Add include diagram config");
|
||||
app.add_flag(
|
||||
"--dump-config", dump_config, "Print effective config to stdout");
|
||||
app.add_flag("--paths-relative-to-pwd", paths_relative_to_pwd,
|
||||
"If true, all paths in configuration files are relative to the $PWD "
|
||||
"instead of actual location of `.clang-uml` file.");
|
||||
|
||||
CLI11_PARSE(app, argc, argv);
|
||||
|
||||
@@ -241,7 +245,7 @@ int main(int argc, const char *argv[])
|
||||
|
||||
clanguml::config::config config;
|
||||
try {
|
||||
config = clanguml::config::load(config_path);
|
||||
config = clanguml::config::load(config_path, paths_relative_to_pwd);
|
||||
}
|
||||
catch (std::runtime_error &e) {
|
||||
LOG_ERROR(e.what());
|
||||
@@ -253,15 +257,18 @@ int main(int argc, const char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (dump_config) {
|
||||
print_config(config);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LOG_INFO("Loaded clang-uml config from {}", config_path);
|
||||
|
||||
if (!compilation_database_dir.empty()) {
|
||||
config.compilation_database_dir.set(compilation_database_dir);
|
||||
//
|
||||
// Override selected config options from command line
|
||||
//
|
||||
if (compilation_database_dir) {
|
||||
config.compilation_database_dir.set(
|
||||
util::ensure_path_is_absolute(compilation_database_dir.value()));
|
||||
}
|
||||
if (output_directory) {
|
||||
config.output_directory.set(
|
||||
util::ensure_path_is_absolute(output_directory.value()));
|
||||
}
|
||||
|
||||
LOG_INFO("Loading compilation database from {} directory",
|
||||
@@ -271,6 +278,11 @@ int main(int argc, const char *argv[])
|
||||
if (output_directory)
|
||||
od = output_directory.value();
|
||||
|
||||
if (dump_config) {
|
||||
print_config(config);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!ensure_output_directory_exists(od))
|
||||
return 1;
|
||||
|
||||
@@ -433,8 +445,6 @@ void find_translation_units_for_diagrams(
|
||||
const std::vector<std::string> &compilation_database_files,
|
||||
std::map<std::string, std::vector<std::string>> &translation_units_map)
|
||||
{
|
||||
const auto current_directory = std::filesystem::current_path();
|
||||
|
||||
for (const auto &[name, diagram] : config.diagrams) {
|
||||
// If there are any specific diagram names provided on the command line,
|
||||
// and this diagram is not in that list - skip it
|
||||
@@ -450,7 +460,7 @@ void find_translation_units_for_diagrams(
|
||||
// configuration
|
||||
else {
|
||||
const std::vector<std::string> translation_units =
|
||||
diagram->get_translation_units(current_directory);
|
||||
diagram->get_translation_units();
|
||||
|
||||
std::vector<std::string> valid_translation_units{};
|
||||
std::copy_if(compilation_database_files.begin(),
|
||||
@@ -563,6 +573,8 @@ int create_config_file()
|
||||
int add_config_diagram(clanguml::common::model::diagram_t type,
|
||||
const std::string &config_file_path, const std::string &name)
|
||||
{
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
fs::path config_file{config_file_path};
|
||||
|
||||
if (!fs::exists(config_file)) {
|
||||
|
||||
@@ -317,4 +317,17 @@ std::string path_to_url(const std::filesystem::path &p)
|
||||
return fmt::format("{}", fmt::join(path_tokens, "/"));
|
||||
}
|
||||
|
||||
std::filesystem::path ensure_path_is_absolute(
|
||||
const std::filesystem::path &p, const std::filesystem::path &root)
|
||||
{
|
||||
if (p.is_absolute())
|
||||
return p;
|
||||
|
||||
auto result = root / p;
|
||||
result = result.lexically_normal();
|
||||
result.make_preferred();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace clanguml::util
|
||||
|
||||
@@ -250,4 +250,17 @@ std::size_t hash_seed(std::size_t seed);
|
||||
*/
|
||||
std::string path_to_url(const std::filesystem::path &p);
|
||||
|
||||
/**
|
||||
* @brief Ensure path is absolute.
|
||||
*
|
||||
* If path is absolute, return the p. If path is not absolute, make it
|
||||
* absolute with respect to root directory.
|
||||
*
|
||||
* @param p Path to modify
|
||||
* @param root Root against which the path should be made absolute
|
||||
* @return Absolute path
|
||||
*/
|
||||
std::filesystem::path ensure_path_is_absolute(const std::filesystem::path &p,
|
||||
const std::filesystem::path &root = std::filesystem::current_path());
|
||||
|
||||
} // namespace clanguml::util
|
||||
@@ -73,6 +73,5 @@ TEST_CASE("t00002", "[test-case][class]")
|
||||
clanguml::util::get_git_commit()),
|
||||
"This is class B"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -65,6 +65,5 @@ TEST_CASE("t00003", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, (IsField<Private>("b_", "int")));
|
||||
REQUIRE_THAT(puml, (IsField<Private>("c_", "int")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,5 @@ TEST_CASE("t00004", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsClass(_A("detail::D::DD")));
|
||||
REQUIRE_THAT(puml, IsEnum(_A("detail::D::AA")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -66,6 +66,5 @@ TEST_CASE("t00005", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("J"), "+j"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "+k"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -76,6 +76,5 @@ TEST_CASE("t00006", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("NN"), "+ns"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("NNN"), "+ns"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,5 @@ TEST_CASE("t00007", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("C"), "+c"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,5 @@ TEST_CASE("t00008", "[test-case][class]")
|
||||
// REQUIRE_THAT(puml, IsField(Public("bool (*)(int, int) comparator")));
|
||||
REQUIRE_THAT(puml, (IsField<Public>("comparator", "CMP")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,5 @@ TEST_CASE("t00009", "[test-case][class]")
|
||||
REQUIRE_THAT(puml,
|
||||
IsAssociation(_A("B"), _A("A<std::vector<std::string>>"), "+avector"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,5 @@ TEST_CASE("t00010", "[test-case][class]")
|
||||
puml, IsAggregation(_A("B<T>"), _A("A<T,std::string>"), "+astring"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("C"), _A("B<int>"), "+aintstring"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,5 @@ TEST_CASE("t00011", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsFriend<Public>(_A("A"), _A("B")));
|
||||
// REQUIRE_THAT(puml, IsFriend(_A("A"), _A("D<T>")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,5 @@ TEST_CASE("t00012", "[test-case][class]")
|
||||
_A("C<std::map<int,"
|
||||
"std::vector<std::vector<std::vector<std::string>>>>,3,3,3>")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -62,6 +62,5 @@ TEST_CASE("t00013", "[test-case][class]")
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("G<T,Args...>"), _A("G<int,float,std::string>")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -114,6 +114,5 @@ TEST_CASE("t00014", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A<char,std::string>")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A<wchar_t,std::string>")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,5 @@ TEST_CASE("t00015", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns3::ns1::ns2::Anon")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("ns3::B")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,5 @@ TEST_CASE("t00016", "[test-case][class]")
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("is_numeric<>"), _A("is_numeric<float>")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,5 @@ TEST_CASE("t00017", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("J"), "-j"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "-k"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,5 @@ TEST_CASE("t00018", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsDependency(_A("impl::widget"), _A("widget")));
|
||||
REQUIRE_THAT(puml, !IsDependency(_A("widget"), _A("widget")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -54,6 +54,5 @@ TEST_CASE("t00019", "[test-case][class]")
|
||||
|
||||
REQUIRE_THAT(puml, !IsAggregation(_A("A"), _A("Base"), "+layers"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,5 @@ TEST_CASE("t00020", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsClass(_A("Factory1")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Factory2")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,5 @@ TEST_CASE("t00021", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsClass(_A("Visitor2")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Visitor3")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,5 @@ TEST_CASE("t00022", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsClass(_A("A1")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("A2")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,5 @@ TEST_CASE("t00023", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsClass(_A("StrategyA")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("StrategyB")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,5 @@ TEST_CASE("t00024", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Target2")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Proxy")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,5 @@ TEST_CASE("t00025", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsDependency(_A("Proxy<Target1>"), _A("Target1")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("Proxy<Target2>"), _A("Target2")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,5 @@ TEST_CASE("t00026", "[test-case][class]")
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("Caretaker<T>"), _A("Caretaker<std::string>")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -54,6 +54,5 @@ TEST_CASE("t00027", "[test-case][class]")
|
||||
REQUIRE_THAT(
|
||||
puml, IsAggregation(_A("Window"), _A("Text<Color>"), "+description"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -55,6 +55,5 @@ note.)";
|
||||
REQUIRE_THAT(puml, !HasNote(_A("G"), "left", "G class note."));
|
||||
REQUIRE_THAT(puml, HasNote(_A("R"), "right", "R class note."));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -53,6 +53,5 @@ TEST_CASE("t00029", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, !IsAggregation(_A("R"), _A("G3"), "+g3"));
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G4"), "+g4"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,5 @@ TEST_CASE("t00030", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "+ddd", "", "1"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("E"), "+eee", "", "1"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -53,6 +53,5 @@ TEST_CASE("t00031", "[test-case][class]")
|
||||
IsAssociationWithStyle(
|
||||
_A("R"), _A("D"), "+ddd", "#blue,plain,thickness=16"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,5 @@ TEST_CASE("t00032", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("B"), _A("Overload<TBase,int,A,B,C>")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("Overload<TBase,int,A,B,C>")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -54,6 +54,5 @@ TEST_CASE("t00033", "[test-case][class]")
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("A<T>"), _A("A<B<std::unique_ptr<C<D>>>>")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,5 @@ TEST_CASE("t00034", "[test-case][class]")
|
||||
REQUIRE_THAT(
|
||||
puml, IsInstantiation(_A("drop_void<T>"), _A("drop_void<Void>")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,5 @@ TEST_CASE("t00035", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "right", _A("Right")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "down", _A("Bottom")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,5 @@ TEST_CASE("t00036", "[test-case][class]")
|
||||
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("B"), _A("A<int>"), "+a_int"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,5 @@ TEST_CASE("t00037", "[test-case][class]")
|
||||
puml, IsAggregation(_A("ST"), _A("ST::(dimensions)"), "+dimensions"));
|
||||
REQUIRE_THAT(puml, IsAggregation(_A("ST"), _A("ST::(units)"), "-units"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -91,6 +91,5 @@ TEST_CASE("t00038", "[test-case][class]")
|
||||
_A("map<std::integral_constant<thirdparty::ns1::color_t,"
|
||||
"thirdparty::ns1::color_t::red>>")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -63,6 +63,5 @@ TEST_CASE("t00039", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsClassTemplate("ns3::FE", "T,M"));
|
||||
REQUIRE_THAT(puml, IsClassTemplate("ns3::FFF", "T,M,N"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,5 @@ TEST_CASE("t00040", "[test-case][class]")
|
||||
|
||||
REQUIRE_THAT(puml, !IsDependency(_A("R"), _A("A")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -62,6 +62,5 @@ TEST_CASE("t00041", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("ns1::N"), _A("ns1::NN")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("ns1::N"), _A("ns1::NM")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,5 @@ TEST_CASE("t00042", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsClassTemplate("B", "T,K"));
|
||||
REQUIRE_THAT(puml, !IsClassTemplate("C", "T"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -62,6 +62,5 @@ TEST_CASE("t00043", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsDependency(_A("I"), _A("H")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("J"), _A("I")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,5 @@ TEST_CASE("t00044", "[test-case][class]")
|
||||
// Check dependants filter<void(int), bool>
|
||||
// REQUIRE_THAT(puml, IsClassTemplate("signal_handler", "Ret,Args...,A"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -64,6 +64,5 @@ TEST_CASE("t00045", "[test-case][class]")
|
||||
// TODO:
|
||||
// REQUIRE_THAT(puml, IsFriend<Public>(_A("ns1::ns2::R"), _A("AAAA<T>")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,6 @@ TEST_CASE("t00046", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsClass(_A("R")));
|
||||
|
||||
REQUIRE_THAT(puml, IsField<Public>("i", "std::vector<std::uint8_t>"));
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,5 @@ TEST_CASE("t00047", "[test-case][class]")
|
||||
REQUIRE_THAT(puml,
|
||||
IsClassTemplate("conditional_t", "std::false_type,Result,Tail..."));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
@@ -48,6 +48,5 @@ TEST_CASE("t00048", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("A")));
|
||||
REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("B")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
@@ -56,6 +56,5 @@ TEST_CASE("t00049", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<thestring>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("A<T>"), _A("A<intmap>")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
@@ -53,6 +53,5 @@ TEST_CASE("t00050", "[test-case][class]")
|
||||
REQUIRE_THAT(puml, HasNote(_A("G"), "bottom"));
|
||||
REQUIRE_THAT(puml, HasNote(_A("G"), "right"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
@@ -46,6 +46,5 @@ TEST_CASE("t20001", "[test-case][sequence]")
|
||||
|
||||
REQUIRE_THAT(puml, HasComment("t20001 test diagram of type sequence"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,5 @@ TEST_CASE("t20002", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,5 @@ TEST_CASE("t20003", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -56,6 +56,5 @@ TEST_CASE("t20004", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -39,6 +39,5 @@ TEST_CASE("t20005", "[test-case][sequence]")
|
||||
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);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
@@ -69,6 +69,5 @@ TEST_CASE("t20006", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -44,6 +44,5 @@ TEST_CASE("t20007", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -51,6 +51,5 @@ TEST_CASE("t20008", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -45,6 +45,5 @@ TEST_CASE("t20009", "[test-case][sequence]")
|
||||
|
||||
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);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
@@ -47,6 +47,5 @@ TEST_CASE("t20010", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -43,6 +43,5 @@ TEST_CASE("t20011", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -76,6 +76,5 @@ TEST_CASE("t20012", "[test-case][sequence]")
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -45,6 +45,5 @@ TEST_CASE("t20013", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -44,6 +44,5 @@ TEST_CASE("t20014", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -46,6 +46,5 @@ TEST_CASE("t20015", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -41,6 +41,5 @@ TEST_CASE("t20016", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -48,6 +48,5 @@ TEST_CASE("t20017", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -51,6 +51,5 @@ TEST_CASE("t20018", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -40,6 +40,5 @@ TEST_CASE("t20019", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -50,6 +50,5 @@ TEST_CASE("t20020", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -57,6 +57,5 @@ TEST_CASE("t20021", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -38,6 +38,5 @@ TEST_CASE("t20022", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -41,6 +41,5 @@ TEST_CASE("t20023", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -46,6 +46,5 @@ TEST_CASE("t20024", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -41,6 +41,5 @@ TEST_CASE("t20025", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -37,6 +37,5 @@ TEST_CASE("t20026", "[test-case][sequence]")
|
||||
// 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);
|
||||
}
|
||||
@@ -39,6 +39,5 @@ TEST_CASE("t20027", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -41,6 +41,5 @@ TEST_CASE("t20028", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -56,6 +56,5 @@ TEST_CASE("t20029", "[test-case][sequence]")
|
||||
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);
|
||||
}
|
||||
@@ -64,6 +64,5 @@ TEST_CASE("t30001", "[test-case][package]")
|
||||
|
||||
REQUIRE_THAT(puml, HasComment("t30001 test diagram of type package"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -69,6 +69,5 @@ TEST_CASE("t30002", "[test-case][package]")
|
||||
REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A16")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A17")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,5 @@ TEST_CASE("t30003", "[test-case][package]")
|
||||
REQUIRE_THAT(puml, IsDeprecated(_A("ns2_v0_9_0")));
|
||||
REQUIRE_THAT(puml, IsDeprecated(_A("ns3")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,5 @@ TEST_CASE("t30004", "[test-case][package]")
|
||||
REQUIRE_THAT(puml, !IsPackage("DDD"));
|
||||
REQUIRE_THAT(puml, IsPackage("EEE"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,5 @@ TEST_CASE("t30005", "[test-case][package]")
|
||||
REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("AAA")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("CCC"), _A("AAA")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,5 @@ TEST_CASE("t30006", "[test-case][package]")
|
||||
REQUIRE_THAT(puml, IsDependency(_A("A"), _A("B")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("A"), _A("C")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,5 @@ TEST_CASE("t30007", "[test-case][package]")
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("C"), "up", _A("AA")));
|
||||
REQUIRE_THAT(puml, IsLayoutHint(_A("C"), "left", _A("B")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,5 @@ TEST_CASE("t30008", "[test-case][package]")
|
||||
REQUIRE_THAT(puml, IsDependency(_A("E"), _A("D")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("F"), _A("E")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,5 @@ TEST_CASE("t40001", "[test-case][include]")
|
||||
|
||||
REQUIRE_THAT(puml, HasComment("t40001 test diagram of type include"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -79,6 +79,5 @@ TEST_CASE("t40002", "[test-case][include]")
|
||||
clanguml::util::get_git_commit()),
|
||||
"lib2.h"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,5 @@ TEST_CASE("t40003", "[test-case][include]")
|
||||
REQUIRE_THAT(puml, IsFile("t5.h"));
|
||||
REQUIRE_THAT(puml, !IsFile("t6.h"));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,5 @@ TEST_CASE("t90000", "[test-case][config]")
|
||||
REQUIRE_THAT(puml, IsClass(_A("Foo")));
|
||||
REQUIRE_THAT(puml, IsClass(_A("Boo")));
|
||||
|
||||
save_puml(
|
||||
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ std::pair<clanguml::config::config,
|
||||
std::unique_ptr<clang::tooling::CompilationDatabase>>
|
||||
load_config(const std::string &test_name)
|
||||
{
|
||||
auto config = clanguml::config::load(test_name + "/.clang-uml");
|
||||
auto config = clanguml::config::load(test_name + "/.clang-uml", true);
|
||||
|
||||
std::string err{};
|
||||
auto compilation_database =
|
||||
@@ -62,7 +62,7 @@ generate_sequence_diagram(clang::tooling::CompilationDatabase &db,
|
||||
auto model = clanguml::common::generators::plantuml::generate<diagram_model,
|
||||
diagram_config, diagram_visitor>(db, diagram->name,
|
||||
dynamic_cast<clanguml::config::sequence_diagram &>(*diagram),
|
||||
diagram->get_translation_units(std::filesystem::current_path()));
|
||||
diagram->get_translation_units());
|
||||
|
||||
return model;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ std::unique_ptr<clanguml::class_diagram::model::diagram> generate_class_diagram(
|
||||
auto model = clanguml::common::generators::plantuml::generate<diagram_model,
|
||||
diagram_config, diagram_visitor>(db, diagram->name,
|
||||
dynamic_cast<diagram_config &>(*diagram),
|
||||
diagram->get_translation_units(std::filesystem::current_path()));
|
||||
diagram->get_translation_units());
|
||||
|
||||
return model;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ generate_package_diagram(clang::tooling::CompilationDatabase &db,
|
||||
return clanguml::common::generators::plantuml::generate<diagram_model,
|
||||
diagram_config, diagram_visitor>(db, diagram->name,
|
||||
dynamic_cast<diagram_config &>(*diagram),
|
||||
diagram->get_translation_units(std::filesystem::current_path()));
|
||||
diagram->get_translation_units());
|
||||
}
|
||||
|
||||
std::unique_ptr<clanguml::include_diagram::model::diagram>
|
||||
@@ -117,7 +117,7 @@ generate_include_diagram(clang::tooling::CompilationDatabase &db,
|
||||
return clanguml::common::generators::plantuml::generate<diagram_model,
|
||||
diagram_config, diagram_visitor>(db, diagram->name,
|
||||
dynamic_cast<diagram_config &>(*diagram),
|
||||
diagram->get_translation_units(std::filesystem::current_path()));
|
||||
diagram->get_translation_units());
|
||||
}
|
||||
|
||||
std::string generate_sequence_puml(
|
||||
|
||||
@@ -228,6 +228,18 @@ TEST_CASE("Test path_to_url", "[unit-test]")
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_CASE("Test ensure_path_is_absolute", "[unit-test]")
|
||||
{
|
||||
using namespace clanguml::util;
|
||||
|
||||
CHECK(ensure_path_is_absolute("a/b/c", "/tmp").string() == "/tmp/a/b/c");
|
||||
CHECK(ensure_path_is_absolute("/a/b/c", "/tmp").string() == "/a/b/c");
|
||||
CHECK(ensure_path_is_absolute("", "/tmp").string() == "/tmp/");
|
||||
CHECK(ensure_path_is_absolute(".", "/tmp").string() == "/tmp/");
|
||||
CHECK(ensure_path_is_absolute("..", "/tmp").string() == "/");
|
||||
CHECK(ensure_path_is_absolute("/", "/tmp").string() == "/");
|
||||
}
|
||||
|
||||
TEST_CASE("Test hash_seed", "[unit-test]")
|
||||
{
|
||||
using namespace clanguml::util;
|
||||
|
||||
Reference in New Issue
Block a user