Added from_to test case with free functions
This commit is contained in:
15
tests/t20035/.clang-uml
Normal file
15
tests/t20035/.clang-uml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
compilation_database_dir: ..
|
||||||
|
output_directory: puml
|
||||||
|
diagrams:
|
||||||
|
t20035_sequence:
|
||||||
|
type: sequence
|
||||||
|
glob:
|
||||||
|
- ../../tests/t20035/t20035.cc
|
||||||
|
include:
|
||||||
|
namespaces:
|
||||||
|
- clanguml::t20035
|
||||||
|
using_namespace:
|
||||||
|
- clanguml::t20035
|
||||||
|
from_to:
|
||||||
|
- [function: "clanguml::t20035::tmain(int,char **)",
|
||||||
|
function: "clanguml::t20035::c(int)"]
|
||||||
14
tests/t20035/t20035.cc
Normal file
14
tests/t20035/t20035.cc
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
namespace clanguml {
|
||||||
|
namespace t20035 {
|
||||||
|
|
||||||
|
int c(int arg) { return arg; }
|
||||||
|
|
||||||
|
int b1(int arg) { return c(arg); }
|
||||||
|
|
||||||
|
int b2(int arg) { return c(arg); }
|
||||||
|
|
||||||
|
int a(int arg) { return b1(arg); }
|
||||||
|
|
||||||
|
int tmain(int argc, char **argv) { return a(argc); }
|
||||||
|
}
|
||||||
|
}
|
||||||
57
tests/t20035/test_case.h
Normal file
57
tests/t20035/test_case.h
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/**
|
||||||
|
* tests/t20035/test_case.h
|
||||||
|
*
|
||||||
|
* Copyright (c) 2021-2023 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("t20035", "[test-case][sequence]")
|
||||||
|
{
|
||||||
|
auto [config, db] = load_config("t20035");
|
||||||
|
|
||||||
|
auto diagram = config.diagrams["t20035_sequence"];
|
||||||
|
|
||||||
|
REQUIRE(diagram->name == "t20035_sequence");
|
||||||
|
|
||||||
|
auto model = generate_sequence_diagram(*db, diagram);
|
||||||
|
|
||||||
|
REQUIRE(model->name() == "t20035_sequence");
|
||||||
|
|
||||||
|
{
|
||||||
|
auto puml = generate_sequence_puml(diagram, *model);
|
||||||
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
|
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||||
|
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||||
|
|
||||||
|
REQUIRE_THAT(puml, HasCall(_A("tmain(int,char **)"), _A("a(int)"), ""));
|
||||||
|
REQUIRE_THAT(puml, HasCall(_A("a(int)"), _A("b1(int)"), ""));
|
||||||
|
REQUIRE_THAT(puml, HasCall(_A("b1(int)"), _A("c(int)"), ""));
|
||||||
|
|
||||||
|
save_puml(
|
||||||
|
config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto j = generate_sequence_json(diagram, *model);
|
||||||
|
|
||||||
|
using namespace json;
|
||||||
|
|
||||||
|
REQUIRE(HasMessageChain(j,
|
||||||
|
{{"tmain(int,char **)", "a(int)", "int"},
|
||||||
|
{"a(int)", "b1(int)", "int"}, {"b1(int)", "c(int)", "int"}}));
|
||||||
|
|
||||||
|
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -348,6 +348,7 @@ using namespace clanguml::test::matchers;
|
|||||||
#include "t20032/test_case.h"
|
#include "t20032/test_case.h"
|
||||||
#include "t20033/test_case.h"
|
#include "t20033/test_case.h"
|
||||||
#include "t20034/test_case.h"
|
#include "t20034/test_case.h"
|
||||||
|
#include "t20035/test_case.h"
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Package diagram tests
|
/// Package diagram tests
|
||||||
|
|||||||
@@ -298,6 +298,12 @@ test_cases:
|
|||||||
- name: t20033
|
- name: t20033
|
||||||
title: Control statement text in sequence diagram test case
|
title: Control statement text in sequence diagram test case
|
||||||
description:
|
description:
|
||||||
|
- name: t20034
|
||||||
|
title: from_to sequence diagram test case
|
||||||
|
description:
|
||||||
|
- name: t20035
|
||||||
|
title: from_to sequence diagram test case with free functions
|
||||||
|
description:
|
||||||
Package diagrams:
|
Package diagrams:
|
||||||
- name: t30001
|
- name: t30001
|
||||||
title: Basic package diagram test case
|
title: Basic package diagram test case
|
||||||
|
|||||||
Reference in New Issue
Block a user