/** * tests/t00014/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("t00014") { using namespace clanguml::test; auto [config, db, diagram, model] = CHECK_CLASS_MODEL("t00014", "t00014_class"); CHECK_CLASS_DIAGRAM(*config, diagram, *model, [](const auto &src) { REQUIRE(!src.contains("type-parameter-")); REQUIRE(IsClassTemplate(src, "A")); REQUIRE(IsClassTemplate(src, "A")); REQUIRE(IsClassTemplate(src, "A>")); REQUIRE(IsClassTemplate(src, "A")); // TODO: Figure out how to handle the same templates with different // template // parameter names // REQUIRE(puml, !IsClassTemplate("A", "long,U")); REQUIRE(IsClassTemplate(src, "A")); REQUIRE(IsClassTemplate(src, "A")); REQUIRE(IsClassTemplate(src, "A")); REQUIRE(IsClassTemplate(src, "A")); REQUIRE(IsClassTemplate(src, "A")); REQUIRE(IsClassTemplate(src, "A")); REQUIRE(IsClassTemplate(src, "A")); REQUIRE(IsClassTemplate(src, "A")); REQUIRE(IsClass(src, "B")); REQUIRE(IsClassTemplate(src, "R")); REQUIRE(IsField(src, "R", "bapair", "PairPairBA")); REQUIRE(IsField(src, "R", "abool", "APtr")); REQUIRE( IsField(src, "R", "aboolfloat", "AAPtr")); REQUIRE(IsField(src, "R", "afloat", "ASharedPtr")); REQUIRE( IsField(src, "R", "boolstring", "A")); REQUIRE( IsField(src, "R", "floatstring", "AStringPtr")); REQUIRE(IsField(src, "R", "atfloat", "AAPtr")); REQUIRE(IsField(src, "R", "intstring", "AIntString")); REQUIRE(IsField(src, "R", "stringstring", "AStringString")); REQUIRE( IsField(src, "R", "bstringstring", "BStringString")); REQUIRE(IsField(src, "R", "bs", "BVector")); REQUIRE( IsField(src, "R", "cb", "SimpleCallback")); #if LLVM_VERSION_MAJOR >= 16 REQUIRE(IsField( src, "R", "gcb", "GenericCallback")); #else REQUIRE( IsField(src, "R", "gcb", "GenericCallback")); #endif REQUIRE(IsField(src, "R", "vcb", "VoidCallback")); REQUIRE( !IsClassTemplate(src, "std::std::function")); REQUIRE(IsInstantiation(src, "A", "A")); REQUIRE(IsInstantiation(src, "A", "A")); REQUIRE(IsInstantiation(src, "A", "A")); REQUIRE(IsInstantiation(src, "A", "A")); // REQUIRE(puml, !IsInstantiation(_A("A"), // _A("A"))); REQUIRE(IsInstantiation(src, "A", "A")); REQUIRE(IsInstantiation(src, "A", "A")); REQUIRE(IsInstantiation(src, "A", "A")); REQUIRE(IsInstantiation(src, "A", "A")); REQUIRE( IsInstantiation(src, "A", "A")); REQUIRE( IsInstantiation(src, "A", "A")); REQUIRE( IsInstantiation(src, "A", "A")); REQUIRE(IsInstantiation(src, "A>", "A>")); REQUIRE(IsInstantiation( src, "A", "A>")); REQUIRE(IsAggregation(src, "R", "B", "vps")); REQUIRE(IsAggregation(src, "R", "B", "bapair")); REQUIRE( IsAggregation(src, "R", "A", "aboolfloat")); REQUIRE(IsAggregation(src, "R", "A", "bapair")); REQUIRE(IsAggregation( src, "R", "A", "aboolfloat")); REQUIRE(IsAggregation(src, "R", "A", "atfloat")); REQUIRE( IsAggregation(src, "R", "A", "atfloat")); REQUIRE( IsAssociation(src, "R", "A", "afloat")); REQUIRE(IsAggregation( src, "R", "A", "boolstring")); REQUIRE(IsAggregation(src, "R", "A>", "floatstring")); REQUIRE(IsDependency(src, "R", "A")); REQUIRE(IsDependency(src, "R", "A")); }); }