Updated test case documentation tool to handle multifile test cases
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
* [t00031](./test_cases/t00031.md) - PlantUML style decorator test case
|
||||
* [t00032](./test_cases/t00032.md) - Class template with template base classes test case
|
||||
* [t00033](./test_cases/t00033.md) - Nested template instantiation dependency test case
|
||||
* [t00034](./test_cases/t00034.md) - Template metaprogramming type function test case
|
||||
## Sequence diagrams
|
||||
* [t20001](./test_cases/t20001.md) - Basic sequence diagram
|
||||
## Configuration diagrams
|
||||
|
||||
75
docs/test_cases/t00034.md
Normal file
75
docs/test_cases/t00034.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# t00034 - Template metaprogramming type function test case
|
||||
## Config
|
||||
```yaml
|
||||
compilation_database_dir: ..
|
||||
output_directory: puml
|
||||
diagrams:
|
||||
t00034_class:
|
||||
type: class
|
||||
glob:
|
||||
- ../../tests/t00034/t00034.cc
|
||||
using_namespace:
|
||||
- clanguml::t00034
|
||||
include:
|
||||
namespaces:
|
||||
- clanguml::t00034
|
||||
|
||||
```
|
||||
## Source code
|
||||
File t00034.cc
|
||||
```cpp
|
||||
#include <type_traits>
|
||||
|
||||
namespace clanguml {
|
||||
//
|
||||
// Based on https://github.com/facebook/folly/blob/master/folly/Unit.h
|
||||
//
|
||||
namespace t00034 {
|
||||
|
||||
struct Void {
|
||||
constexpr bool operator==(const Void & /* unused */) const { return true; }
|
||||
constexpr bool operator!=(const Void & /* unused */) const { return false; }
|
||||
};
|
||||
|
||||
constexpr Void void_t{};
|
||||
|
||||
template <typename T> struct lift_void {
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template <> struct lift_void<void> {
|
||||
using type = Void;
|
||||
};
|
||||
|
||||
//
|
||||
// TODO: This is a shortcoming of libclang which parses the type of lift_void_t
|
||||
// alias as unexposed, i.e. no actual reference to T can be inferred without
|
||||
// manually parsing the string 'typename lift_void<T>::type'
|
||||
// For now, this test validates that the visitor does not crash
|
||||
//
|
||||
template <typename T> using lift_void_t = typename lift_void<T>::type;
|
||||
|
||||
template <typename T> struct drop_void {
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template <> struct drop_void<Void> {
|
||||
using type = void;
|
||||
};
|
||||
|
||||
template <typename T> using drop_void_t = typename drop_void<T>::type;
|
||||
|
||||
struct A {
|
||||
};
|
||||
|
||||
struct R {
|
||||
lift_void_t<A> *la;
|
||||
lift_void_t<void> *lv;
|
||||
};
|
||||
|
||||
} // namespace t00034
|
||||
} // namespace clanguml
|
||||
|
||||
```
|
||||
## Generated UML diagrams
|
||||

|
||||
BIN
docs/test_cases/t00034_class.png
Normal file
BIN
docs/test_cases/t00034_class.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -96,6 +96,9 @@ test_cases:
|
||||
- name: t00033
|
||||
title: Nested template instantiation dependency test case
|
||||
description:
|
||||
- name: t00034
|
||||
title: Template metaprogramming type function test case
|
||||
description:
|
||||
Sequence diagrams:
|
||||
- name: t20001
|
||||
title: Basic sequence diagram
|
||||
|
||||
Reference in New Issue
Block a user