Updated test cases documentation

This commit is contained in:
Bartek Kryza
2021-07-25 18:13:56 +02:00
parent cf49fac808
commit 98cf942a9e
31 changed files with 131 additions and 70 deletions

View File

@@ -23,6 +23,7 @@
* [t00022](./test_cases/t00022.md) - Template method pattern
* [t00023](./test_cases/t00023.md) - Strategy pattern
* [t00024](./test_cases/t00024.md) - Proxy pattern
* [t00025](./test_cases/t00025.md) - Template proxy pattern
## Sequence diagrams
* [t20001](./test_cases/t20001.md) - Basic sequence diagram
## Configuration diagrams

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -17,36 +17,6 @@ diagrams:
```
## Source code
File t00018_impl.cc
```cpp
#include "t00018_impl.h"
#include "t00018.h"
namespace clanguml {
namespace t00018 {
namespace impl {
widget::widget(int n)
: n(n)
{
}
void widget::draw(const clanguml::t00018::widget &w) const
{
if (w.shown())
std::cout << "drawing a const widget " << n << '\n';
}
void widget::draw(const clanguml::t00018::widget &w)
{
if (w.shown())
std::cout << "drawing a non-const widget " << n << '\n';
}
}
}
}
```
File t00018_impl.h
```cpp
#pragma once
@@ -131,6 +101,36 @@ widget &widget::operator=(widget &&) = default;
}
}
```
File t00018_impl.cc
```cpp
#include "t00018_impl.h"
#include "t00018.h"
namespace clanguml {
namespace t00018 {
namespace impl {
widget::widget(int n)
: n(n)
{
}
void widget::draw(const clanguml::t00018::widget &w) const
{
if (w.shown())
std::cout << "drawing a const widget " << n << '\n';
}
void widget::draw(const clanguml::t00018::widget &w)
{
if (w.shown())
std::cout << "drawing a non-const widget " << n << '\n';
}
}
}
}
```
## Generated UML diagrams
![t00018_class](./t00018_class.png "Pimpl pattern")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -22,21 +22,25 @@ diagrams:
```
## Source code
File t00019.cc
File t00019_layer2.h
```cpp
#include "t00019_base.h"
#include "t00019_layer1.h"
#include "t00019_layer2.h"
#include "t00019_layer3.h"
#include <memory>
#pragma once
namespace clanguml {
namespace t00019 {
class A {
public:
std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> layers;
template <typename LowerLayer> class Layer2 : public LowerLayer {
using LowerLayer::LowerLayer;
using LowerLayer::m1;
using LowerLayer::m2;
int all_calls_count() const
{
return LowerLayer::m1_calls() + LowerLayer::m2_calls();
}
};
}
}
@@ -94,6 +98,26 @@ template <typename LowerLayer> class Layer1 : public LowerLayer {
}
}
```
File t00019.cc
```cpp
#include "t00019_base.h"
#include "t00019_layer1.h"
#include "t00019_layer2.h"
#include "t00019_layer3.h"
#include <memory>
namespace clanguml {
namespace t00019 {
class A {
public:
std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> layers;
};
}
}
```
File t00019_layer3.h
```cpp
@@ -131,30 +155,6 @@ private:
}
}
```
File t00019_layer2.h
```cpp
#pragma once
namespace clanguml {
namespace t00019 {
template <typename LowerLayer> class Layer2 : public LowerLayer {
using LowerLayer::LowerLayer;
using LowerLayer::m1;
using LowerLayer::m2;
int all_calls_count() const
{
return LowerLayer::m1_calls() + LowerLayer::m2_calls();
}
};
}
}
```
## Generated UML diagrams
![t00019_class](./t00019_class.png "Layercake pattern")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -33,20 +33,20 @@ public:
class Target1 : public Target {
public:
void m1() override { }
void m2() override { }
void m1() override {}
void m2() override {}
};
class Target2 : public Target {
public:
void m1() override { }
void m2() override { }
void m1() override {}
void m2() override {}
};
class Proxy : public Target {
public:
Proxy(std::shared_ptr<Target> target)
: m_target {std::move(target)}
: m_target{std::move(target)}
{
}
void m1() override { m_target->m1(); }
@@ -55,7 +55,6 @@ public:
private:
std::shared_ptr<Target> m_target;
};
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

61
docs/test_cases/t00025.md Normal file
View File

@@ -0,0 +1,61 @@
# t00025 - Template proxy pattern
## Config
```yaml
compilation_database_dir: ..
output_directory: puml
diagrams:
t00025_class:
type: class
glob:
- ../../tests/t00025/t00025.cc
using_namespace:
- clanguml::t00025
include:
namespaces:
- clanguml::t00025
```
## Source code
File t00025.cc
```cpp
#include <memory>
namespace clanguml {
namespace t00025 {
class Target1 {
public:
void m1() {}
void m2() {}
};
class Target2 {
public:
void m1() {}
void m2() {}
};
template <typename T> class Proxy {
public:
Proxy(std::shared_ptr<T> target)
: m_target{std::move(target)}
{
}
void m1() { m_target->m1(); }
void m2() { m_target->m2(); }
private:
std::shared_ptr<T> m_target;
};
class ProxyHolder {
public:
Proxy<Target1> proxy1;
Proxy<Target2> proxy2;
};
}
}
```
## Generated UML diagrams
![t00025_class](./t00025_class.png "Template proxy pattern")

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB