Added anonymous struct test case
This commit is contained in:
13
tests/t00037/.clang-uml
Normal file
13
tests/t00037/.clang-uml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
compilation_database_dir: ..
|
||||||
|
output_directory: puml
|
||||||
|
diagrams:
|
||||||
|
t00037_class:
|
||||||
|
type: class
|
||||||
|
generate_packages: true
|
||||||
|
glob:
|
||||||
|
- ../../tests/t00037/t00037.cc
|
||||||
|
using_namespace:
|
||||||
|
- clanguml::t00037
|
||||||
|
include:
|
||||||
|
namespaces:
|
||||||
|
- clanguml::t00037
|
||||||
26
tests/t00037/t00037.cc
Normal file
26
tests/t00037/t00037.cc
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
namespace clanguml {
|
||||||
|
namespace t00037 {
|
||||||
|
|
||||||
|
struct ST {
|
||||||
|
struct {
|
||||||
|
double t;
|
||||||
|
double x;
|
||||||
|
double y;
|
||||||
|
double z;
|
||||||
|
} dimensions;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct A {
|
||||||
|
A()
|
||||||
|
{
|
||||||
|
st.dimensions.t = -1;
|
||||||
|
st.dimensions.x = 1;
|
||||||
|
st.dimensions.y = 1;
|
||||||
|
st.dimensions.z = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ST st;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace t00037
|
||||||
|
} // namespace clanguml
|
||||||
44
tests/t00037/test_case.h
Normal file
44
tests/t00037/test_case.h
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* tests/t00037/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("t00037", "[test-case][class]")
|
||||||
|
{
|
||||||
|
auto [config, db] = load_config("t00037");
|
||||||
|
|
||||||
|
auto diagram = config.diagrams["t00037_class"];
|
||||||
|
|
||||||
|
REQUIRE(diagram->name == "t00037_class");
|
||||||
|
REQUIRE(diagram->generate_packages() == true);
|
||||||
|
|
||||||
|
auto model = generate_class_diagram(db, diagram);
|
||||||
|
|
||||||
|
REQUIRE(model.name() == "t00037_class");
|
||||||
|
|
||||||
|
auto puml = generate_class_puml(diagram, model);
|
||||||
|
AliasMatcher _A(puml);
|
||||||
|
|
||||||
|
REQUIRE_THAT(puml, StartsWith("@startuml"));
|
||||||
|
REQUIRE_THAT(puml, EndsWith("@enduml\n"));
|
||||||
|
|
||||||
|
REQUIRE_THAT(puml, IsClass(_A("ST")));
|
||||||
|
REQUIRE_THAT(puml, IsClass(_A("A")));
|
||||||
|
REQUIRE_THAT(puml, IsInnerClass(_A("ST"), _A("<<anonymous>>")));
|
||||||
|
|
||||||
|
save_puml(
|
||||||
|
"./" + config.output_directory() + "/" + diagram->name + ".puml", puml);
|
||||||
|
}
|
||||||
@@ -179,6 +179,7 @@ using namespace clanguml::test::matchers;
|
|||||||
#include "t00034/test_case.h"
|
#include "t00034/test_case.h"
|
||||||
#include "t00035/test_case.h"
|
#include "t00035/test_case.h"
|
||||||
#include "t00036/test_case.h"
|
#include "t00036/test_case.h"
|
||||||
|
#include "t00037/test_case.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Sequence diagram tests
|
// Sequence diagram tests
|
||||||
|
|||||||
@@ -105,6 +105,9 @@ test_cases:
|
|||||||
- name: t00036
|
- name: t00036
|
||||||
title: Class diagram with namespaces generated as packages
|
title: Class diagram with namespaces generated as packages
|
||||||
description:
|
description:
|
||||||
|
- name: t00037
|
||||||
|
title: Anonymous nested struct test case
|
||||||
|
description:
|
||||||
Sequence diagrams:
|
Sequence diagrams:
|
||||||
- name: t20001
|
- name: t20001
|
||||||
title: Basic sequence diagram test case
|
title: Basic sequence diagram test case
|
||||||
|
|||||||
Reference in New Issue
Block a user