Added context exclude filter with relationships option test case (#274)

This commit is contained in:
Bartek Kryza
2024-06-17 18:59:23 +02:00
parent 6952c3296d
commit e7eadc03a2
6 changed files with 83 additions and 0 deletions

View File

@@ -32,5 +32,9 @@ TEST_CASE("t00078")
REQUIRE(!IsClass(src, "B")); REQUIRE(!IsClass(src, "B"));
REQUIRE(!IsClass(src, "E")); REQUIRE(!IsClass(src, "E"));
REQUIRE(!IsAssociation<Public>(src, "A", "E"));
REQUIRE(IsAggregation<Public>(src, "A", "D"));
REQUIRE(IsAggregation<Public>(src, "C", "A"));
}); });
} }

17
tests/t00079/.clang-uml Normal file
View File

@@ -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

22
tests/t00079/t00079.cc Normal file
View File

@@ -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;
};
}
}

36
tests/t00079/test_case.h Normal file
View File

@@ -0,0 +1,36 @@
/**
* tests/t00079/test_case.h
*
* Copyright (c) 2021-2024 Bartek Kryza <bkryza@gmail.com>
*
* 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"));
});
}

View File

@@ -552,6 +552,7 @@ void CHECK_INCLUDE_DIAGRAM(const clanguml::config::config &config,
#include "t00076/test_case.h" #include "t00076/test_case.h"
#include "t00077/test_case.h" #include "t00077/test_case.h"
#include "t00078/test_case.h" #include "t00078/test_case.h"
#include "t00079/test_case.h"
/// ///
/// Sequence diagram tests /// Sequence diagram tests

View File

@@ -231,6 +231,9 @@ test_cases:
- name: t00078 - name: t00078
title: Test case for context diagram with relationships option title: Test case for context diagram with relationships option
description: description:
- name: t00079
title: Test case for context diagram exclude filter with relationships option
description:
Sequence diagrams: Sequence diagrams:
- name: t20001 - name: t20001
title: Basic sequence diagram test case title: Basic sequence diagram test case