This commit is contained in:
Bartek Kryza
2022-09-05 21:24:41 +02:00
parent 9280155d40
commit 511c8d0f65
6 changed files with 102 additions and 1 deletions

14
tests/t20003/.clang-uml Normal file
View File

@@ -0,0 +1,14 @@
compilation_database_dir: ..
output_directory: puml
diagrams:
t20003_sequence:
type: sequence
glob:
- ../../tests/t20003/t20003.cc
include:
namespaces:
- clanguml::t20003
using_namespace:
- clanguml::t20003
start_from:
- function: "clanguml::t20003::m1<T>()"

16
tests/t20003/t20003.cc Normal file
View File

@@ -0,0 +1,16 @@
#include <algorithm>
#include <numeric>
#include <vector>
namespace clanguml {
namespace t20003 {
template <typename T> void m4(T p) { }
template <typename T> void m3(T p) { m4<T>(); }
template <typename T> void m2(T p) { m3<T>(p); }
template <typename T> void m1(T p) { m2<T>(p); }
}
}

42
tests/t20003/test_case.h Normal file
View File

@@ -0,0 +1,42 @@
/**
* tests/t20003/test_case.cc
*
* Copyright (c) 2021-2022 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("t20003", "[test-case][sequence]")
{
auto [config, db] = load_config("t20003");
auto diagram = config.diagrams["t20003_sequence"];
REQUIRE(diagram->name == "t20003_sequence");
auto model = generate_sequence_diagram(*db, diagram);
REQUIRE(model->name() == "t20003_sequence");
auto puml = generate_sequence_puml(diagram, *model);
REQUIRE_THAT(puml, StartsWith("@startuml"));
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
REQUIRE_THAT(puml, HasFunctionCall("m1<T>", "m2<T>"));
REQUIRE_THAT(puml, HasFunctionCall("m2<T>", "m3<T>"));
REQUIRE_THAT(puml, HasFunctionCall("m3<T>", "m4<T>"));
save_puml(
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
}

View File

@@ -249,6 +249,7 @@ using namespace clanguml::test::matchers;
///
#include "t20001/test_case.h"
#include "t20002/test_case.h"
#include "t20003/test_case.h"
///
/// Package diagram tests