Added test case documentation generator
19
docs/test_cases.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Test cases index
|
||||
## Class diagrams
|
||||
* [t00002](./test_cases/t00002.md) - Basic class inheritance
|
||||
* [t00003](./test_cases/t00003.md) - Class field and methods
|
||||
* [t00004](./test_cases/t00004.md) - Nested classes and enums
|
||||
* [t00005](./test_cases/t00005.md) - Basic class field relationships
|
||||
* [t00006](./test_cases/t00006.md) - Class field relationships inferred from templates
|
||||
* [t00007](./test_cases/t00007.md) - Smart pointers
|
||||
* [t00008](./test_cases/t00008.md) - Template and template template relationships
|
||||
* [t00009](./test_cases/t00009.md) - Template instantiation
|
||||
* [t00010](./test_cases/t00010.md) - Basic template instantiation
|
||||
* [t00011](./test_cases/t00011.md) - Friend relationships
|
||||
* [t00012](./test_cases/t00012.md) - Advanced template instantiations
|
||||
* [t00013](./test_cases/t00013.md) - Template instantiation relationships
|
||||
* [t00014](./test_cases/t00014.md) - Alias template instantiation
|
||||
## Sequence diagrams
|
||||
* [t20001](./test_cases/t20001.md) - Basic sequence diagram
|
||||
## Configuration diagrams
|
||||
* [t90000](./test_cases/t90000.md) - Basic config test
|
||||
63
docs/test_cases/t00002.md
Normal file
@@ -0,0 +1,63 @@
|
||||
# t00002 - Basic class inheritance
|
||||
## Config
|
||||
```yaml
|
||||
compilation_database_dir: ..
|
||||
output_directory: puml
|
||||
diagrams:
|
||||
t00002_class:
|
||||
type: class
|
||||
glob:
|
||||
- ../../tests/t00002/t00002.cc
|
||||
using_namespace:
|
||||
- clanguml::t00002
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml::t00002
|
||||
|
||||
```
|
||||
## Source code
|
||||
```cpp
|
||||
#include <vector>
|
||||
|
||||
namespace clanguml {
|
||||
namespace t00002 {
|
||||
|
||||
class A {
|
||||
public:
|
||||
virtual void foo_a() = 0;
|
||||
virtual void foo_c() = 0;
|
||||
};
|
||||
|
||||
class B : public A {
|
||||
public:
|
||||
virtual void foo_a() override {}
|
||||
};
|
||||
|
||||
class C : public A {
|
||||
public:
|
||||
virtual void foo_c() override {}
|
||||
};
|
||||
|
||||
class D : public B, public C {
|
||||
public:
|
||||
void foo_a() override
|
||||
{
|
||||
for (auto a : as)
|
||||
a->foo_a();
|
||||
}
|
||||
|
||||
void foo_c() override
|
||||
{
|
||||
for (auto a : as)
|
||||
a->foo_c();
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<A *> as;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
BIN
docs/test_cases/t00002_class.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
79
docs/test_cases/t00003.md
Normal file
@@ -0,0 +1,79 @@
|
||||
# t00003 - Class field and methods
|
||||
## Config
|
||||
```yaml
|
||||
compilation_database_dir: ..
|
||||
output_directory: puml
|
||||
diagrams:
|
||||
t00003_class:
|
||||
type: class
|
||||
glob:
|
||||
- ../../tests/t00003/t00003.cc
|
||||
using_namespace:
|
||||
- clanguml::t00003
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml::t00003
|
||||
|
||||
```
|
||||
## Source code
|
||||
```cpp
|
||||
#include <functional>
|
||||
|
||||
namespace clanguml {
|
||||
namespace t00003 {
|
||||
|
||||
class A {
|
||||
public:
|
||||
A() = default;
|
||||
A(int i)
|
||||
: private_member{i}
|
||||
{
|
||||
}
|
||||
A(A &&) = default;
|
||||
A(const A &) = default;
|
||||
virtual ~A() = default;
|
||||
|
||||
void basic_method() {}
|
||||
static int static_method() { return 0; }
|
||||
void const_method() const {}
|
||||
auto auto_method() { return 1; }
|
||||
|
||||
auto double_int(const int i) { return 2 * i; }
|
||||
auto sum(const double a, const double b) { return a + b; }
|
||||
|
||||
auto default_int(int i = 12) { return i + 10; }
|
||||
std::string default_string(int i, std::string s = "abc")
|
||||
{
|
||||
return s + std::to_string(i);
|
||||
}
|
||||
|
||||
static A create_from_int(int i) { return A(i); }
|
||||
|
||||
int public_member;
|
||||
static int static_int;
|
||||
static const int static_const_int = 1;
|
||||
static const auto auto_member{10UL};
|
||||
|
||||
protected:
|
||||
void protected_method() {}
|
||||
|
||||
int protected_member;
|
||||
|
||||
std::function<bool(const int)> compare = [this](const int v) {
|
||||
return private_member > v;
|
||||
};
|
||||
|
||||
private:
|
||||
void private_method() {}
|
||||
|
||||
int private_member;
|
||||
int a, b, c;
|
||||
};
|
||||
|
||||
int A::static_int = 1;
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
BIN
docs/test_cases/t00003_class.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
44
docs/test_cases/t00004.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# t00004 - Nested classes and enums
|
||||
## Config
|
||||
```yaml
|
||||
compilation_database_dir: ..
|
||||
output_directory: puml
|
||||
diagrams:
|
||||
t00004_class:
|
||||
type: class
|
||||
glob:
|
||||
- ../../tests/t00004/t00004.cc
|
||||
using_namespace:
|
||||
- clanguml::t00004
|
||||
- clanguml::t00004::A
|
||||
- clanguml::t00004::A::AA
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml::t00004
|
||||
|
||||
```
|
||||
## Source code
|
||||
```cpp
|
||||
namespace clanguml {
|
||||
namespace t00004 {
|
||||
|
||||
class A {
|
||||
public:
|
||||
void foo() const {}
|
||||
|
||||
class AA {
|
||||
public:
|
||||
enum class Lights { Green, Yellow, Red };
|
||||
|
||||
class AAA {
|
||||
};
|
||||
};
|
||||
|
||||
void foo2() const {}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
BIN
docs/test_cases/t00004_class.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
78
docs/test_cases/t00005.md
Normal file
@@ -0,0 +1,78 @@
|
||||
# t00005 - Basic class field relationships
|
||||
## Config
|
||||
```yaml
|
||||
compilation_database_dir: ..
|
||||
output_directory: puml
|
||||
diagrams:
|
||||
t00005_class:
|
||||
type: class
|
||||
glob:
|
||||
- ../../tests/t00005/t00005.cc
|
||||
using_namespace:
|
||||
- clanguml::t00005
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml::t00005
|
||||
|
||||
```
|
||||
## Source code
|
||||
```cpp
|
||||
namespace clanguml {
|
||||
namespace t00005 {
|
||||
class A {
|
||||
};
|
||||
|
||||
class B {
|
||||
};
|
||||
|
||||
class C {
|
||||
};
|
||||
|
||||
class D {
|
||||
};
|
||||
|
||||
class E {
|
||||
};
|
||||
|
||||
class F {
|
||||
};
|
||||
|
||||
class G {
|
||||
};
|
||||
|
||||
class H {
|
||||
};
|
||||
|
||||
class I {
|
||||
};
|
||||
|
||||
class J {
|
||||
};
|
||||
|
||||
class K {
|
||||
};
|
||||
|
||||
class R {
|
||||
public:
|
||||
int some_int;
|
||||
int *some_int_pointer;
|
||||
int **some_int_pointer_pointer;
|
||||
int &some_int_reference;
|
||||
A a;
|
||||
B *b;
|
||||
C &c;
|
||||
const D *d;
|
||||
const E &e{};
|
||||
F &&f;
|
||||
G **g;
|
||||
H ***h;
|
||||
I *&i;
|
||||
volatile J *j;
|
||||
mutable K *k;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
BIN
docs/test_cases/t00005_class.png
Normal file
|
After Width: | Height: | Size: 30 KiB |
106
docs/test_cases/t00006.md
Normal file
@@ -0,0 +1,106 @@
|
||||
# t00006 - Class field relationships inferred from templates
|
||||
## Config
|
||||
```yaml
|
||||
compilation_database_dir: ..
|
||||
output_directory: puml
|
||||
diagrams:
|
||||
t00006_class:
|
||||
type: class
|
||||
glob:
|
||||
- ../../tests/t00006/t00006.cc
|
||||
using_namespace:
|
||||
- clanguml::t00006
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml::t00006
|
||||
|
||||
```
|
||||
## Source code
|
||||
```cpp
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
namespace clanguml {
|
||||
namespace t00006 {
|
||||
class A {
|
||||
};
|
||||
|
||||
class B {
|
||||
};
|
||||
|
||||
class C {
|
||||
};
|
||||
|
||||
class D {
|
||||
};
|
||||
|
||||
class E {
|
||||
};
|
||||
|
||||
class F {
|
||||
};
|
||||
|
||||
class G {
|
||||
};
|
||||
|
||||
class H {
|
||||
};
|
||||
|
||||
class I {
|
||||
};
|
||||
|
||||
class J {
|
||||
};
|
||||
|
||||
class K {
|
||||
};
|
||||
|
||||
class L {
|
||||
};
|
||||
|
||||
class M {
|
||||
};
|
||||
|
||||
class N {
|
||||
};
|
||||
|
||||
class NN {
|
||||
};
|
||||
|
||||
class NNN {
|
||||
};
|
||||
|
||||
template <typename T> class custom_container {
|
||||
public:
|
||||
std::vector<T> data;
|
||||
};
|
||||
|
||||
class R {
|
||||
public:
|
||||
std::vector<A> a;
|
||||
std::vector<B *> b;
|
||||
|
||||
std::map<int, C> c;
|
||||
std::map<int, D *> d;
|
||||
|
||||
custom_container<E> e;
|
||||
|
||||
std::vector<std::vector<F>> f;
|
||||
std::map<int, std::vector<G *>> g;
|
||||
|
||||
std::array<H, 10> h;
|
||||
std::array<I *, 5> i;
|
||||
|
||||
J j[10];
|
||||
K *k[20];
|
||||
|
||||
std::vector<std::pair<L, M>> lm;
|
||||
|
||||
std::tuple<N, NN, NNN> ns;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
BIN
docs/test_cases/t00006_class.png
Normal file
|
After Width: | Height: | Size: 63 KiB |
44
docs/test_cases/t00007.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# t00007 - Smart pointers
|
||||
## Config
|
||||
```yaml
|
||||
compilation_database_dir: ..
|
||||
output_directory: puml
|
||||
diagrams:
|
||||
t00007_class:
|
||||
type: class
|
||||
glob:
|
||||
- ../../tests/t00007/t00007.cc
|
||||
using_namespace:
|
||||
- clanguml::t00007
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml::t00007
|
||||
|
||||
```
|
||||
## Source code
|
||||
```cpp
|
||||
#include <memory>
|
||||
|
||||
namespace clanguml {
|
||||
namespace t00007 {
|
||||
class A {
|
||||
};
|
||||
|
||||
class B {
|
||||
};
|
||||
|
||||
class C {
|
||||
};
|
||||
|
||||
class R {
|
||||
public:
|
||||
std::unique_ptr<A> a;
|
||||
std::shared_ptr<B> b;
|
||||
std::weak_ptr<C> c;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
BIN
docs/test_cases/t00007_class.png
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
57
docs/test_cases/t00008.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# t00008 - Template and template template relationships
|
||||
## Config
|
||||
```yaml
|
||||
compilation_database_dir: ..
|
||||
output_directory: puml
|
||||
diagrams:
|
||||
t00008_class:
|
||||
type: class
|
||||
glob:
|
||||
- ../../tests/t00008/t00008.cc
|
||||
using_namespace:
|
||||
- clanguml::t00008
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml::t00008
|
||||
|
||||
```
|
||||
## Source code
|
||||
```cpp
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
namespace clanguml {
|
||||
namespace t00008 {
|
||||
|
||||
using CMP = bool (*)(const int, const int);
|
||||
|
||||
template <typename T, typename P = T, CMP = nullptr, int N = 3> class A {
|
||||
public:
|
||||
T value;
|
||||
T *pointer;
|
||||
T &reference;
|
||||
std::vector<P> values;
|
||||
std::array<int, N> ints;
|
||||
|
||||
CMP comparator;
|
||||
};
|
||||
|
||||
template <typename T> struct Vector {
|
||||
std::vector<T> values;
|
||||
};
|
||||
|
||||
template <typename T, template <typename> typename C> struct B {
|
||||
C<T> template_template;
|
||||
};
|
||||
|
||||
struct D {
|
||||
B<int, Vector> ints;
|
||||
|
||||
void add(int i) { ints.template_template.values.push_back(i); }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
BIN
docs/test_cases/t00008_class.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
42
docs/test_cases/t00009.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# t00009 - Template instantiation
|
||||
## Config
|
||||
```yaml
|
||||
compilation_database_dir: ..
|
||||
output_directory: puml
|
||||
diagrams:
|
||||
t00009_class:
|
||||
type: class
|
||||
glob:
|
||||
- ../../tests/t00009/t00009.cc
|
||||
using_namespace:
|
||||
- clanguml::t00009
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml::t00009
|
||||
|
||||
```
|
||||
## Source code
|
||||
```cpp
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace clanguml {
|
||||
namespace t00009 {
|
||||
|
||||
template <typename T> class A {
|
||||
public:
|
||||
T value;
|
||||
};
|
||||
|
||||
class B {
|
||||
public:
|
||||
A<int> aint;
|
||||
A<std::string> *astring;
|
||||
A<std::vector<std::string>> &avector;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
BIN
docs/test_cases/t00009_class.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
46
docs/test_cases/t00010.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# t00010 - Basic template instantiation
|
||||
## Config
|
||||
```yaml
|
||||
compilation_database_dir: ..
|
||||
output_directory: puml
|
||||
diagrams:
|
||||
t00010_class:
|
||||
type: class
|
||||
glob:
|
||||
- ../../tests/t00010/t00010.cc
|
||||
using_namespace:
|
||||
- clanguml::t00010
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml::t00010
|
||||
|
||||
```
|
||||
## Source code
|
||||
```cpp
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace clanguml {
|
||||
namespace t00010 {
|
||||
|
||||
template <typename T, typename P> class A {
|
||||
public:
|
||||
T first;
|
||||
P second;
|
||||
};
|
||||
|
||||
template <typename T> class B {
|
||||
public:
|
||||
A<T, std::string> astring;
|
||||
};
|
||||
|
||||
class C {
|
||||
public:
|
||||
B<int> aintstring;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
BIN
docs/test_cases/t00010_class.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
56
docs/test_cases/t00011.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# t00011 - Friend relationships
|
||||
## Config
|
||||
```yaml
|
||||
compilation_database_dir: ..
|
||||
output_directory: puml
|
||||
diagrams:
|
||||
t00011_class:
|
||||
type: class
|
||||
glob:
|
||||
- ../../tests/t00011/t00011.cc
|
||||
using_namespace:
|
||||
- clanguml::t00011
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml::t00011
|
||||
|
||||
```
|
||||
## Source code
|
||||
```cpp
|
||||
namespace external {
|
||||
class C {
|
||||
};
|
||||
}
|
||||
|
||||
namespace clanguml {
|
||||
namespace t00011 {
|
||||
|
||||
class B;
|
||||
|
||||
template <typename T> class D {
|
||||
T value;
|
||||
};
|
||||
|
||||
class A {
|
||||
private:
|
||||
void foo() {}
|
||||
friend class B;
|
||||
friend class external::C;
|
||||
// TODO
|
||||
template <typename T> friend class D;
|
||||
// TODO
|
||||
friend class D<int>;
|
||||
friend class D<A>;
|
||||
};
|
||||
|
||||
class B {
|
||||
public:
|
||||
void foo() { m_a->foo(); }
|
||||
A *m_a;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
BIN
docs/test_cases/t00011_class.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
59
docs/test_cases/t00012.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# t00012 - Advanced template instantiations
|
||||
## Config
|
||||
```yaml
|
||||
compilation_database_dir: ..
|
||||
output_directory: puml
|
||||
diagrams:
|
||||
t00012_class:
|
||||
type: class
|
||||
glob:
|
||||
- ../../tests/t00012/t00012.cc
|
||||
using_namespace:
|
||||
- clanguml::t00012
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml::t00012
|
||||
|
||||
```
|
||||
## Source code
|
||||
```cpp
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <numeric>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
namespace clanguml {
|
||||
namespace t00012 {
|
||||
|
||||
template <typename T, typename... Ts> class A {
|
||||
T value;
|
||||
std::variant<Ts...> values;
|
||||
};
|
||||
|
||||
template <int... Is> class B {
|
||||
std::array<int, sizeof...(Is)> ints;
|
||||
};
|
||||
|
||||
template <typename T, int... Is> class C {
|
||||
std::array<T, sizeof...(Is)> ints;
|
||||
};
|
||||
|
||||
class R {
|
||||
A<int, std::string, float> a1;
|
||||
A<int, std::string, bool> a2;
|
||||
|
||||
B<3, 2, 1> b1;
|
||||
B<1, 1, 1, 1> b2;
|
||||
|
||||
C<std::map<int, std::vector<std::vector<std::vector<std::string>>>>, 3, 3,
|
||||
3>
|
||||
c1;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
BIN
docs/test_cases/t00012_class.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
83
docs/test_cases/t00013.md
Normal file
@@ -0,0 +1,83 @@
|
||||
# t00013 - Template instantiation relationships
|
||||
## Config
|
||||
```yaml
|
||||
compilation_database_dir: ..
|
||||
output_directory: puml
|
||||
diagrams:
|
||||
t00013_class:
|
||||
type: class
|
||||
glob:
|
||||
- ../../tests/t00013/t00013.cc
|
||||
using_namespace:
|
||||
- clanguml::t00013
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml::t00013
|
||||
- ABCD
|
||||
|
||||
```
|
||||
## Source code
|
||||
```cpp
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <numeric>
|
||||
#include <string>
|
||||
|
||||
namespace ABCD {
|
||||
template <typename T> struct F {
|
||||
T f;
|
||||
};
|
||||
}
|
||||
namespace clanguml {
|
||||
namespace t00013 {
|
||||
|
||||
struct A {
|
||||
int a;
|
||||
};
|
||||
|
||||
struct B {
|
||||
int b;
|
||||
};
|
||||
|
||||
struct C {
|
||||
int c;
|
||||
};
|
||||
|
||||
class R;
|
||||
|
||||
struct D {
|
||||
int d;
|
||||
void print(R *r) {}
|
||||
};
|
||||
|
||||
template <typename T> struct E {
|
||||
T e;
|
||||
};
|
||||
|
||||
using namespace ABCD;
|
||||
class R {
|
||||
public:
|
||||
int get_a(A *a) { return a->a; }
|
||||
int get_b(B &b) { return b.b; }
|
||||
int get_const_b(const B &b) { return b.b; }
|
||||
int get_c(C c) { return c.c; }
|
||||
int get_d(D &&d) { return d.d; }
|
||||
// Dependency relationship should be rendered only once
|
||||
int get_d2(D &&d) { return d.d; }
|
||||
|
||||
template <typename T> T get_e(E<T> e) { return e.e; }
|
||||
int get_int_e(const E<int> &e) { return e.e; }
|
||||
int get_int_e2(E<int> &e) { return e.e; }
|
||||
|
||||
template <typename T> T get_f(const F<T> &f) { return f.f; }
|
||||
int get_int_f(const F<int> &f) { return f.f; }
|
||||
|
||||
private:
|
||||
mutable E<std::string> estring;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
BIN
docs/test_cases/t00013_class.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
74
docs/test_cases/t00014.md
Normal file
@@ -0,0 +1,74 @@
|
||||
# t00014 - Alias template instantiation
|
||||
## Config
|
||||
```yaml
|
||||
compilation_database_dir: ..
|
||||
output_directory: puml
|
||||
diagrams:
|
||||
t00014_class:
|
||||
type: class
|
||||
glob:
|
||||
- ../../tests/t00014/t00014.cc
|
||||
using_namespace:
|
||||
- clanguml::t00014
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml::t00014
|
||||
|
||||
```
|
||||
## Source code
|
||||
```cpp
|
||||
#include <algorithm>
|
||||
#include <ios>
|
||||
#include <map>
|
||||
#include <numeric>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
* These should not be include as they are not
|
||||
* in ns clanguml::t00014
|
||||
*/
|
||||
template <typename T> struct clanguml_t00014_A {
|
||||
T value;
|
||||
};
|
||||
|
||||
using clanguml_t00014_AString = clanguml_t00014_A<std::string>;
|
||||
|
||||
namespace clanguml {
|
||||
namespace t00014 {
|
||||
|
||||
template <typename T, typename P> struct A {
|
||||
T t;
|
||||
P p;
|
||||
};
|
||||
|
||||
template <typename T> using AString = A<T, std::string>;
|
||||
|
||||
struct B {
|
||||
std::string value;
|
||||
};
|
||||
|
||||
using BVector = std::vector<B>;
|
||||
using BVector2 = BVector;
|
||||
|
||||
using AIntString = AString<int>;
|
||||
using AStringString = AString<std::string>;
|
||||
using BStringString = AStringString;
|
||||
|
||||
class R {
|
||||
//clang-uml: tinst A<T, std::string>
|
||||
A<bool, std::string> boolstring;
|
||||
AString<float> floatstring;
|
||||
AIntString intstring;
|
||||
AStringString stringstring;
|
||||
BVector bs;
|
||||
BVector2 bs2;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
BIN
docs/test_cases/t00014_class.png
Normal file
|
After Width: | Height: | Size: 25 KiB |
103
docs/test_cases/t20001.md
Normal file
@@ -0,0 +1,103 @@
|
||||
# t20001 - Basic sequence diagram
|
||||
## Config
|
||||
```yaml
|
||||
compilation_database_dir: ..
|
||||
output_directory: puml
|
||||
diagrams:
|
||||
t20001_sequence:
|
||||
type: sequence
|
||||
glob:
|
||||
- ../../tests/t20001/t20001.cc
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml::t20001
|
||||
exclude:
|
||||
namespaces:
|
||||
- clanguml::t20001::detail
|
||||
using_namespace:
|
||||
- clanguml::t20001
|
||||
start_from:
|
||||
- usr: "c:@N@clanguml@N@t20001@F@tmain#"
|
||||
plantuml:
|
||||
before:
|
||||
- "' t20001 test sequence diagram"
|
||||
after:
|
||||
- 'note over "tmain()": Main test function'
|
||||
|
||||
```
|
||||
## Source code
|
||||
```cpp
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <vector>
|
||||
|
||||
namespace clanguml {
|
||||
namespace t20001 {
|
||||
|
||||
namespace detail {
|
||||
struct C {
|
||||
auto add(int x, int y) { return x + y; }
|
||||
};
|
||||
}
|
||||
|
||||
class A {
|
||||
public:
|
||||
A() {}
|
||||
|
||||
int add(int x, int y) { return m_c.add(x, y); }
|
||||
|
||||
int add3(int x, int y, int z)
|
||||
{
|
||||
std::vector<int> v;
|
||||
v.push_back(x);
|
||||
v.push_back(y);
|
||||
v.push_back(z);
|
||||
auto res = add(v[0], v[1]) + v[2];
|
||||
log_result(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
void log_result(int r) {}
|
||||
|
||||
private:
|
||||
detail::C m_c{};
|
||||
};
|
||||
|
||||
class B {
|
||||
public:
|
||||
B(A &a)
|
||||
: m_a{a}
|
||||
{
|
||||
}
|
||||
|
||||
int wrap_add(int x, int y)
|
||||
{
|
||||
auto res = m_a.add(x, y);
|
||||
m_a.log_result(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
int wrap_add3(int x, int y, int z)
|
||||
{
|
||||
auto res = m_a.add3(x, y, z);
|
||||
m_a.log_result(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
private:
|
||||
A &m_a;
|
||||
};
|
||||
|
||||
int tmain()
|
||||
{
|
||||
A a;
|
||||
B b(a);
|
||||
|
||||
return b.wrap_add3(1, 2, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
BIN
docs/test_cases/t20001_sequence.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
31
docs/test_cases/t90000.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# t90000 - Basic config test
|
||||
## Config
|
||||
```yaml
|
||||
compilation_database_dir: ..
|
||||
output_directory: puml
|
||||
diagrams:
|
||||
t90000_class:
|
||||
type: class
|
||||
plantuml:
|
||||
before:
|
||||
- 'class "Foo" as C_001'
|
||||
- 'class C_001 {'
|
||||
- ' +int value'
|
||||
- '}'
|
||||
- 'C_001 <|-- ArrayList'
|
||||
- 'note top of C_001: This is a very important class.'
|
||||
- 'note "This is a\nfloating note" as N1'
|
||||
- 'note "This note is connected\nto several objects." as N2'
|
||||
- 'C_001 .. N2'
|
||||
- 'N2 .. ArrayList'
|
||||
- 'class "Boo" as C_002'
|
||||
- 'class C_002 {'
|
||||
- '}'
|
||||
|
||||
```
|
||||
## Source code
|
||||
```cpp
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
BIN
docs/test_cases/t90000_class.png
Normal file
|
After Width: | Height: | Size: 16 KiB |