From e7eadc03a2332c74ad215b33ca176f36845418e4 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Mon, 17 Jun 2024 18:59:23 +0200 Subject: [PATCH] Added context exclude filter with relationships option test case (#274) --- tests/t00078/test_case.h | 4 ++++ tests/t00079/.clang-uml | 17 +++++++++++++++++ tests/t00079/t00079.cc | 22 ++++++++++++++++++++++ tests/t00079/test_case.h | 36 ++++++++++++++++++++++++++++++++++++ tests/test_cases.cc | 1 + tests/test_cases.yaml | 3 +++ 6 files changed, 83 insertions(+) create mode 100644 tests/t00079/.clang-uml create mode 100644 tests/t00079/t00079.cc create mode 100644 tests/t00079/test_case.h diff --git a/tests/t00078/test_case.h b/tests/t00078/test_case.h index e5e67981..6bddd166 100644 --- a/tests/t00078/test_case.h +++ b/tests/t00078/test_case.h @@ -32,5 +32,9 @@ TEST_CASE("t00078") REQUIRE(!IsClass(src, "B")); REQUIRE(!IsClass(src, "E")); + + REQUIRE(!IsAssociation(src, "A", "E")); + REQUIRE(IsAggregation(src, "A", "D")); + REQUIRE(IsAggregation(src, "C", "A")); }); } \ No newline at end of file diff --git a/tests/t00079/.clang-uml b/tests/t00079/.clang-uml new file mode 100644 index 00000000..3be16355 --- /dev/null +++ b/tests/t00079/.clang-uml @@ -0,0 +1,17 @@ +diagrams: + t00079_class: + type: class + glob: + - t00079.cc + include: + namespaces: + - clanguml::t00079 + exclude: + context: + - match: + radius: 1 + pattern: clanguml::t00079::A + relationships: + - inheritance + - aggregation + using_namespace: clanguml::t00079 \ No newline at end of file diff --git a/tests/t00079/t00079.cc b/tests/t00079/t00079.cc new file mode 100644 index 00000000..e76a25be --- /dev/null +++ b/tests/t00079/t00079.cc @@ -0,0 +1,22 @@ +namespace clanguml { +namespace t00079 { + +struct Base { }; + +struct D { }; +struct E { }; +struct A : public Base { + D d; + E *e; +}; + +struct B { + A *a; +}; + +struct C { + A a; +}; + +} +} \ No newline at end of file diff --git a/tests/t00079/test_case.h b/tests/t00079/test_case.h new file mode 100644 index 00000000..30dd66ea --- /dev/null +++ b/tests/t00079/test_case.h @@ -0,0 +1,36 @@ +/** + * tests/t00079/test_case.h + * + * Copyright (c) 2021-2024 Bartek Kryza + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +TEST_CASE("t00079") +{ + using namespace clanguml::test; + using namespace std::string_literals; + + auto [config, db, diagram, model] = + CHECK_CLASS_MODEL("t00079", "t00079_class"); + + CHECK_CLASS_DIAGRAM(*config, diagram, *model, [](const auto &src) { + REQUIRE(!IsClass(src, "Base")); + REQUIRE(!IsClass(src, "A")); + REQUIRE(!IsClass(src, "C")); + REQUIRE(!IsClass(src, "D")); + + REQUIRE(IsClass(src, "B")); + REQUIRE(IsClass(src, "E")); + }); +} \ No newline at end of file diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 4a563559..c9103c2c 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -552,6 +552,7 @@ void CHECK_INCLUDE_DIAGRAM(const clanguml::config::config &config, #include "t00076/test_case.h" #include "t00077/test_case.h" #include "t00078/test_case.h" +#include "t00079/test_case.h" /// /// Sequence diagram tests diff --git a/tests/test_cases.yaml b/tests/test_cases.yaml index e0b024b0..fd624f3b 100644 --- a/tests/test_cases.yaml +++ b/tests/test_cases.yaml @@ -231,6 +231,9 @@ test_cases: - name: t00078 title: Test case for context diagram with relationships option description: + - name: t00079 + title: Test case for context diagram exclude filter with relationships option + description: Sequence diagrams: - name: t20001 title: Basic sequence diagram test case