Updated diagram filters test cases and docs
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# CHANGELOG
|
||||
|
||||
* Added method type diagram filter (#145)
|
||||
* Added default method grouping and sorting in class diagrams (#36)
|
||||
* Improved generation of method attributes (e.g. constexpr, noexcept) (#142)
|
||||
|
||||
### 0.3.6
|
||||
* Added generation of packages in class and package diagrams from
|
||||
filesystem directories (#144)
|
||||
|
||||
@@ -131,6 +131,28 @@ This filter allows to include or exclude all parents (base classes) of a given c
|
||||
|
||||
This filter allows to include or exclude specializations and instantiations of a specific template from the diagram.
|
||||
|
||||
## `access`
|
||||
|
||||
This filter allows to include or exclude class methods and members based on their access scope, allowed values are:
|
||||
|
||||
* `public`
|
||||
* `protected`
|
||||
* `private`
|
||||
|
||||
## `method_types`
|
||||
|
||||
This filter allows to include or exclude various method types from the class diagram, allowed values are:
|
||||
* constructor
|
||||
* destructor
|
||||
* assignment
|
||||
* operator
|
||||
* defaulted
|
||||
* deleted
|
||||
* static
|
||||
|
||||
This filter is independent of the `access` filter, which controls which methods
|
||||
are included based on access scope (e.g. `public`).
|
||||
|
||||
## `dependants` and `dependencies`
|
||||
|
||||
These filters allow to specify that only dependants or dependencies of a given class should be included in the diagram.
|
||||
|
||||
@@ -256,7 +256,7 @@ method_type_filter::method_type_filter(
|
||||
}
|
||||
|
||||
tvl::value_t method_type_filter::match(
|
||||
const diagram &d, const class_diagram::model::class_method &m) const
|
||||
const diagram & /*d*/, const class_diagram::model::class_method &m) const
|
||||
{
|
||||
return tvl::any_of(
|
||||
method_types_.begin(), method_types_.end(), [&m](auto mt) {
|
||||
|
||||
@@ -18,3 +18,15 @@ diagrams:
|
||||
paths:
|
||||
- sequence_diagram
|
||||
- util/error.h
|
||||
method_type_include_test:
|
||||
type: class
|
||||
include:
|
||||
method_types:
|
||||
- constructor
|
||||
- operator
|
||||
method_type_exclude_test:
|
||||
type: class
|
||||
exclude:
|
||||
method_types:
|
||||
- deleted
|
||||
- destructor
|
||||
@@ -34,7 +34,6 @@ TEST_CASE("Test diagram paths filter", "[unit-test]")
|
||||
|
||||
auto cfg = clanguml::config::load("./test_config_data/filters.yml");
|
||||
|
||||
CHECK(cfg.diagrams.size() == 1);
|
||||
auto &config = *cfg.diagrams["include_test"];
|
||||
clanguml::include_diagram::model::diagram diagram;
|
||||
|
||||
@@ -52,3 +51,56 @@ TEST_CASE("Test diagram paths filter", "[unit-test]")
|
||||
CHECK_FALSE(filter.should_include(
|
||||
make_path("sequence_diagram/visitor/translation_unit_visitor.h")));
|
||||
}
|
||||
|
||||
TEST_CASE("Test method_types include filter", "[unit-test]")
|
||||
{
|
||||
using clanguml::class_diagram::model::class_method;
|
||||
using clanguml::common::model::access_t;
|
||||
using clanguml::common::model::diagram_filter;
|
||||
using clanguml::common::model::source_file;
|
||||
|
||||
auto cfg = clanguml::config::load("./test_config_data/filters.yml");
|
||||
|
||||
auto &config = *cfg.diagrams["method_type_include_test"];
|
||||
clanguml::class_diagram::model::diagram diagram;
|
||||
|
||||
diagram_filter filter(diagram, config);
|
||||
|
||||
class_method cm{access_t::kPublic, "A", ""};
|
||||
cm.is_constructor(true);
|
||||
|
||||
CHECK(filter.should_include(cm));
|
||||
|
||||
cm.is_constructor(false);
|
||||
cm.is_destructor(true);
|
||||
|
||||
CHECK(!filter.should_include(cm));
|
||||
}
|
||||
|
||||
TEST_CASE("Test method_types exclude filter", "[unit-test]")
|
||||
{
|
||||
using clanguml::class_diagram::model::class_method;
|
||||
using clanguml::common::model::access_t;
|
||||
using clanguml::common::model::diagram_filter;
|
||||
using clanguml::common::model::source_file;
|
||||
|
||||
auto cfg = clanguml::config::load("./test_config_data/filters.yml");
|
||||
|
||||
auto &config = *cfg.diagrams["method_type_exclude_test"];
|
||||
clanguml::class_diagram::model::diagram diagram;
|
||||
|
||||
diagram_filter filter(diagram, config);
|
||||
|
||||
class_method cm{access_t::kPublic, "A", ""};
|
||||
|
||||
CHECK(filter.should_include(cm));
|
||||
|
||||
cm.is_constructor(true);
|
||||
|
||||
CHECK(filter.should_include(cm));
|
||||
|
||||
cm.is_constructor(false);
|
||||
cm.is_destructor(true);
|
||||
|
||||
CHECK(!filter.should_include(cm));
|
||||
}
|
||||
Reference in New Issue
Block a user