Add more advanced mode diagram filter test cases

This commit is contained in:
Bartek Kryza
2024-07-09 18:22:40 +02:00
parent 01c6264923
commit cadbeba82c
14 changed files with 433 additions and 5 deletions

16
tests/t00083/.clang-uml Normal file
View File

@@ -0,0 +1,16 @@
diagrams:
t00083_class:
type: class
glob:
- t00083.cc
generate_packages: true
filter_mode: advanced
exclude:
anyof:
subclasses:
- clanguml::t00083::ns1::nsA::A1
namespaces:
- clanguml::t00083::ns2::nsB
context:
- clanguml::t00083::ns3::nsC::B3
using_namespace: clanguml::t00083

30
tests/t00083/t00083.cc Normal file
View File

@@ -0,0 +1,30 @@
namespace clanguml::t00083 {
namespace ns1 {
namespace nsA {
struct A1 { };
struct B1 : public A1 { };
struct C1 : public B1 { };
struct D1 { };
}
}
namespace ns2 {
namespace nsB {
struct A2 { };
struct B2 : public A2 { };
struct C2 : public B2 { };
}
}
namespace ns3 {
namespace nsC {
struct A3 { };
struct B3 : public A3 { };
struct C3 : public B3 { };
struct D3 { };
}
}
namespace ns4 {
namespace nsD {
struct A4 { };
}
}
}

46
tests/t00083/test_case.h Normal file
View File

@@ -0,0 +1,46 @@
/**
* tests/t00083/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("t00083")
{
using namespace clanguml::test;
using namespace std::string_literals;
auto [config, db, diagram, model] =
CHECK_CLASS_MODEL("t00083", "t00083_class");
CHECK_CLASS_DIAGRAM(*config, diagram, *model, [](const auto &src) {
REQUIRE(!IsClass(src, {"ns1::nsA", "A1"}));
REQUIRE(!IsClass(src, {"ns1::nsA", "B1"}));
REQUIRE(!IsClass(src, {"ns1::nsA", "C1"}));
REQUIRE(IsClass(src, {"ns1::nsA", "D1"}));
REQUIRE(!IsClass(src, {"ns2::nsB", "A2"}));
REQUIRE(!IsClass(src, {"ns2::nsB", "B2"}));
REQUIRE(!IsClass(src, {"ns2::nsB", "C2"}));
REQUIRE(!IsClass(src, {"ns3::nsC", "A3"}));
REQUIRE(!IsClass(src, {"ns3::nsC", "B3"}));
REQUIRE(!IsClass(src, {"ns3::nsC", "C3"}));
REQUIRE(IsClass(src, {"ns3::nsC", "D3"}));
REQUIRE(IsNamespacePackage(src, "ns4"s));
REQUIRE(IsClass(src, {"ns4::nsD", "A4"}));
});
}