diff --git a/CHANGELOG.md b/CHANGELOG.md index b2dd19ff..a43daf91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,11 @@ # CHANGELOG + * Added MermaidJS diagram generators (#27) + ### 0.3.9 * Added `from_to` and `to` location constraints to sequence diagrams (#154) * Fixed 'else if' statement generation in sequence diagrams (#81) - * Implemented removal of redundant dependency relationhips (#28) + * Implemented removal of redundant dependency relationships (#28) * Add option to disable generation of dependency relation to template arguments (#141) * Added configuration file validation (#57) diff --git a/Makefile b/Makefile index 5a07603f..a5a4a0d3 100644 --- a/Makefile +++ b/Makefile @@ -93,18 +93,29 @@ test_release: release install: release make -C release install DESTDIR=${DESTDIR} -test_plantuml: test - plantuml -tsvg debug/tests/puml/*.puml +test_diagrams: test + mkdir -p debug/tests/diagrams/plantuml + mkdir -p debug/tests/diagrams/mermaid + plantuml -tsvg -nometadata -o plantuml debug/tests/diagrams/*.puml + python3 util/validate_json.py debug/tests/diagrams/*.json + python3 util/generate_mermaid.py debug/tests/diagrams/*.mmd -document_test_cases: test_plantuml +document_test_cases: test_diagrams python3 util/generate_test_cases_docs.py + # Format generated SVG files python3 util/format_svg.py docs/test_cases/*.svg clanguml_diagrams: debug - mkdir -p docs/diagrams - debug/src/clang-uml -g plantuml -g json -p - plantuml -tsvg -nometadata docs/diagrams/*.puml - python3 util/format_svg.py docs/diagrams/*.svg + mkdir -p docs/diagrams/plantuml + mkdir -p docs/diagrams/mermaid + debug/src/clang-uml -g plantuml -g json -g mermaid -p + # Convert .puml files to svg images + plantuml -tsvg -nometadata -o plantuml docs/diagrams/*.puml + # Convert .mmd files to svg images + python3 util/generate_mermaid.py docs/diagrams/*.mmd + # Format generated SVG files + python3 util/format_svg.py docs/diagrams/plantuml/*.svg + python3 util/format_svg.py docs/diagrams/mermaid/*.svg .PHONY: submodules submodules: @@ -147,7 +158,7 @@ docs: doxygen: docs cp CONTRIBUTING.md docs/contributing.md cp CHANGELOG.md docs/changelog.md - cp docs/diagrams/*.svg docs/doxygen/html/ + cp docs/diagrams/plantuml/*.svg docs/doxygen/html/ mkdir -p docs/doxygen/html/test_cases cp docs/test_cases/*.svg docs/doxygen/html/test_cases/ ../doxygen/_build/bin/doxygen diff --git a/README.md b/README.md index 88f03fc9..8fd3f0e9 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ YAML configuration files. The main idea behind the project is to easily maintain up-to-date diagrams within a code-base or document legacy code. The configuration file or files for `clang-uml` define the types and contents of each generated diagram. -The diagrams can be generated in [PlantUML](https://plantuml.com) and JSON formats. +The diagrams can be generated in [PlantUML](https://plantuml.com), +[MermaidJS](https://mermaid.js.org/) and JSON formats. `clang-uml` currently supports C++ up to version 17 with partial support for C++ 20. @@ -35,8 +36,8 @@ Main features supported so far include: * Template specialization and instantiation based on deduced context - [_example_](docs/test_cases/t00062.md) * Relationship inference from C++ containers and smart pointers - [_example_](docs/test_cases/t00007.md) * Diagram content filtering based on namespaces, elements and relationships - [_example_](docs/test_cases/t00040.md) - * Optional package generation from namespaces - [_example_](docs/test_cases/t00036.md) - * Optional package generation from subdirectories - [_example_](docs/test_cases/t00065.md) + * Optional package generation from namespaces (only PlantUML) - [_example_](docs/test_cases/t00036.md) + * Optional package generation from subdirectories (only PlantUML) - [_example_](docs/test_cases/t00065.md) * Interactive links to online code to classes, methods and class fields in SVG diagrams - [_example_](https://raw.githubusercontent.com/bkryza/clang-uml/master/docs/test_cases/t00002_class.svg) * Support for plain C99/C11 code (struct and units relationships) - [_example_](docs/test_cases/t00057.md) * C++20 concept constraints - [_example_](docs/test_cases/t00059.md) @@ -108,7 +109,7 @@ which should be generated by `clang-uml`. Basic example is as follows: ```yaml compilation_database_dir: . -output_directory: puml +output_directory: diagrams diagrams: myproject_class: type: class @@ -370,17 +371,17 @@ results in the following diagram (via PlantUML) based on include directives in t ### Default mappings -| UML | PlantUML | -| ---- | --- | -| Inheritance | ![extension](docs/img/puml_inheritance.png) | -| Association | ![association](docs/img/puml_association.png) | -| Dependency | ![dependency](docs/img/puml_dependency.png) | -| Aggregation | ![aggregation](docs/img/puml_aggregation.png) | -| Composition | ![composition](docs/img/puml_composition.png) | -| Template specialization/instantiation | ![specialization](docs/img/puml_instantiation.png) | -| Nesting (inner class/enum) | ![nesting](docs/img/puml_nested.png) | -| Include (local) | ![association](docs/img/puml_association.png) | -| Include (system) | ![dependency](docs/img/puml_dependency.png) | +| UML | PlantUML | MermaidJS | +| ---- | --- |------------------------------------------------| +| Inheritance | ![extension](docs/img/puml_inheritance.png) | ![extension](docs/img/mermaid_inheritance.png) | +| Association | ![association](docs/img/puml_association.png) | ![association](docs/img/mermaid_association.png) | +| Dependency | ![dependency](docs/img/puml_dependency.png) | ![dependency](docs/img/mermaid_dependency.png) | +| Aggregation | ![aggregation](docs/img/puml_aggregation.png) | ![aggregation](docs/img/mermaid_aggregation.png) | +| Composition | ![composition](docs/img/puml_composition.png) | ![composition](docs/img/mermaid_composition.png) | +| Template specialization/instantiation | ![specialization](docs/img/puml_instantiation.png) | ![specialization](docs/img/mermaid_instantiation.png) | +| Nesting (inner class/enum) | ![nesting](docs/img/puml_nested.png) | ![nesting](docs/img/mermaid_nested.png) | +| Include (local) | ![association](docs/img/puml_association.png) | ![association](docs/img/mermaid_association.png) | +| Include (system) | ![dependency](docs/img/puml_dependency.png) | ![dependency](docs/img/mermaid_dependency.png) | ### Diagram content filtering @@ -433,6 +434,7 @@ This project relies on the following great tools: * [Clang LibTooling](https://clang.llvm.org/docs/LibTooling.html) - a C++ library for creating tools based on Clang * [PlantUML](https://plantuml.com/) - language and diagram for generating UML diagrams +* [MermaidJS](https://mermaid.js.org/) - JavaScript based diagramming and charting tool * [Catch2](https://github.com/catchorg/Catch2) - C++ unit test framework * [glob](https://github.com/p-ranav/glob) - Unix style path expansion for C++ * [indicators](https://github.com/p-ranav/indicators) - Activity indicators for modern C++ diff --git a/docs/README.md b/docs/README.md index 81f0e489..8d146c4c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -7,7 +7,8 @@ YAML configuration files. The main idea behind the project is to easily maintain up-to-date diagrams within a code-base or document legacy code. The configuration file or files for `clang-uml` define the types and contents of each generated diagram. -The diagrams can be generated in [PlantUML](https://plantuml.com) and JSON formats. +The diagrams can be generated in [PlantUML](https://plantuml.com), +[MermaidJS](https://mermaid.js.org/) and JSON formats. Example sequence diagram generated using `clang-uml` from [this code](https://github.com/bkryza/clang-uml/blob/master/tests/t20029/t20029.cc): ![Sample sequence diagram](test_cases/t20029_sequence.svg) diff --git a/docs/architecture.md b/docs/architecture.md index 24cd6415..2367eb42 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -134,12 +134,14 @@ Diagram generators convert the `clang-uml`'s internal UML model into actual diagram in one of the supported formats: - PlantUML +- MermaidJS - JSON Each diagram generator extends a common interface appropriate for the selected output format, i.e.: - [PlantUML](classclanguml_1_1common_1_1generators_1_1plantuml_1_1generator.html) +- [MermaidJS](classclanguml_1_1common_1_1generators_1_1mermaid_1_1generator.html) - [JSON](classclanguml_1_1common_1_1generators_1_1json_1_1generator.html) and renders the output to a file. For each diagram type there is a separate diff --git a/docs/class_diagrams.md b/docs/class_diagrams.md index 611f02c3..26240c4f 100644 --- a/docs/class_diagrams.md +++ b/docs/class_diagrams.md @@ -18,7 +18,7 @@ The minimal config required to generate a class diagram is presented below: # Path to the directory where `compile_commands.json` can be found compilation_database_dir: _build # Output directory for the diagrams -output_directory: puml +output_directory: diagrams # Diagrams definitions diagrams: # Diagram name diff --git a/docs/common_options.md b/docs/common_options.md index d8f77ac8..f2535835 100644 --- a/docs/common_options.md +++ b/docs/common_options.md @@ -4,7 +4,7 @@ * [Overall configuration file structure](#overall-configuration-file-structure) * [Translation unit glob patterns](#translation-unit-glob-patterns) -* [PlantUML custom directives](#plantuml-custom-directives) +* [Custom directives](#custom-directives) * [Adding debug information in the generated diagrams](#adding-debug-information-in-the-generated-diagrams) * [Resolving include path and compiler flags issues](#resolving-include-path-and-compiler-flags-issues) * [Use '--query-driver' command line option](#use---query-driver-command-line-option) @@ -63,9 +63,10 @@ For small projects, the `glob` property can be omitted, which will result in `cl from `compile_commands.json` for the diagram. However for large projects, constraining the number of translation units for each diagram to absolute minimum will significantly decrease the diagram generation times. -## PlantUML custom directives -In case it's necessary to add some custom PlantUML declarations before or after the generated diagram content, -it can be achieved simply using the `plantuml` configuration properties, for instance: +## Custom directives +In case it's necessary to add some custom PlantUML or MermaidJS declarations +before or after the generated diagram content, it can be achieved simply using +the `plantuml` or `mermaid` configuration properties, for instance for PlantUML: ```yaml plantuml: @@ -75,23 +76,37 @@ it can be achieved simply using the `plantuml` configuration properties, for ins - note left of {{ alias("ns1::ns2::MyClass") }} This is my class. ``` -These directive are useful for instance for adding notes to elements in the diagrams or customizing diagram layout -or style. +or for MermaidJS: -Please note that when referring to diagram elements in the PlantUML directives, they must be added using Jinja -templates `alias` command as in the example above. +```yaml + mermaid: + before: + - direction LR + after: + - note for {{ alias("ns1::ns2::MyClass") }} "This is my class." +``` -More options can be found in the official PlantUML [documentation](https://plantuml.com/). +These directive are useful for instance for adding notes to elements in the +diagrams or customizing diagram layout or style. + +Please note that when referring to diagram elements in the PlantUML directives, +they must be added using Jinja templates `alias` command as in the example above. + +More options can be found in the official docs for each respective generator: + * [PlantUML](https://plantuml.com/) + * [MermaidJS](https://mermaid.js.org/intro/) ## Adding debug information in the generated diagrams -Sometimes it is useful for debugging issues with the diagrams to have information on the exact source location, -from which given declaration or call expression was derived. By adding option: +Sometimes it is useful for debugging issues with the diagrams to have information +on the exact source location, from which given declaration or call expression was +derived. By adding option: ```yaml debug_mode: true ``` -the generated PlantUML diagram will contain comments before each line containing the source location of the +the generated PlantUML diagram will contain comments before each line containing +the source location of the specific diagram element. ## Resolving include path and compiler flags issues diff --git a/docs/configuration_file.md b/docs/configuration_file.md index 1b0fe40a..77b39b64 100644 --- a/docs/configuration_file.md +++ b/docs/configuration_file.md @@ -54,7 +54,10 @@ * `plantuml` - verbatim PlantUML directives which should be added to a diagram * `before` - list of directives which will be added before the generated diagram * `after` - list of directives which will be added after the generated diagram - +* `mermaid` - verbatim MermaidJS directives which should be added to a diagram + * `before` - list of directives which will be added before the generated diagram + * `after` - list of directives which will be added after the generated diagram + * ## Example complete config ```yaml @@ -138,6 +141,10 @@ diagrams: # Add this line to the beginning of the resulting puml file before: - 'title clang-uml class diagram model' + mermaid: + # Add this line at the end of a Mermaid diagram + end: + - 'direction LR' ``` ## Determining config file location diff --git a/docs/generator_types.md b/docs/generator_types.md index 9d8de7ea..e52642ab 100644 --- a/docs/generator_types.md +++ b/docs/generator_types.md @@ -3,17 +3,19 @@ * [PlantUML](#plantuml) +* [MermaidJS](#mermaidjs) * [JSON](#json) -Currently, there are 2 types of diagram generators: `plantuml` and `json`. +Currently, there are 3 types of diagram generators: `plantuml`, `mermaid` +and `json`. To specify, which generators should be used on the command line use option `-g`. For instance to generate both types of diagrams run `clang-uml` as follows: ```bash -clang-uml -g plantuml -g json +clang-uml -g plantuml -g mermaid -g json ``` By default, only `plantuml` diagrams are generated. @@ -92,6 +94,70 @@ __ The footer at the end is added by default, but can be disabled with `--no-metadata` command line option. +## MermaidJS + +This generator, creates UML diagrams in textual MermaidJS format, which can then +be used directly in some Markdown renderers (e.g. GitHub) or converted to +various image formats using [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). + +In case there is a need for adding custom MermaidJS directives to generated +diagrams, they can be included directly in the diagram configuration. For +example: + +```yaml + mermaid: + before: + - direction LR + after: + - 'note for {{ alias("inheritable_diagram_options") }} "Options common to all diagram types."' + - 'note for {{ alias("config") }} "General options not used by diagrams."' +``` + +will add before the diagram contents (right after diagram type, +e.g. `classDiagram`) diagram direction hint, and after each diagram contents +2 notes attached to elements. + +An example MermaidJS diagram is presented below: + +``` +classDiagram + class C_0001371951663534295727["A"] + class C_0001371951663534295727 { + +A() : [default] void + +A(int i) : void + +A(A &&) : [default] void + +A(const A &) : void + +A(T t) : void + +~A() : [default] void + +operator=(A && other) : A & + +operator=(A & other) : A & + +operator++() : A & + +auto_method() : int + +basic_method() : void + +const_method() : [const] void + +create_from_int(int i) : A$ + +default_int(int i = 12) : int + +default_string(int i, std::string s = "abc") : std::string + +double_int(const int i) : int + -private_method() : void + #protected_method() : void + +size() : [const,constexpr] std::size_t + +static_method() : int$ + +sum(const double a, const double b) : int + -a_ : int + +auto_member : const unsigned long + -b_ : int + -c_ : int + #compare : std::function<bool (const int)> + -private_member : int + #protected_member : int + +public_member : int + +static_const_int : const int + +static_int : int + } + click C_0001371951663534295727 href "https://github.com/bkryza/clang-uml/blob/70e70888231938ba5310a8e0e28b9351beba21ef/tests/t00003/t00003.cc#L7" "A" +``` + ## JSON Generates a JSON representation of the intermediate `clang-uml` model, which diff --git a/docs/img/mermaid_aggregation.png b/docs/img/mermaid_aggregation.png new file mode 100644 index 00000000..10a052b7 Binary files /dev/null and b/docs/img/mermaid_aggregation.png differ diff --git a/docs/img/mermaid_association.png b/docs/img/mermaid_association.png new file mode 100644 index 00000000..005737e6 Binary files /dev/null and b/docs/img/mermaid_association.png differ diff --git a/docs/img/mermaid_composition.png b/docs/img/mermaid_composition.png new file mode 100644 index 00000000..3562b65a Binary files /dev/null and b/docs/img/mermaid_composition.png differ diff --git a/docs/img/mermaid_dependency.png b/docs/img/mermaid_dependency.png new file mode 100644 index 00000000..f4cb8a9c Binary files /dev/null and b/docs/img/mermaid_dependency.png differ diff --git a/docs/img/mermaid_inheritance.png b/docs/img/mermaid_inheritance.png new file mode 100644 index 00000000..01b75c5f Binary files /dev/null and b/docs/img/mermaid_inheritance.png differ diff --git a/docs/img/mermaid_instantiation.png b/docs/img/mermaid_instantiation.png new file mode 100644 index 00000000..cde3a265 Binary files /dev/null and b/docs/img/mermaid_instantiation.png differ diff --git a/docs/img/mermaid_nested.png b/docs/img/mermaid_nested.png new file mode 100644 index 00000000..144c5c4f Binary files /dev/null and b/docs/img/mermaid_nested.png differ diff --git a/docs/include_diagrams.md b/docs/include_diagrams.md index b05f0fbf..0a2041e0 100644 --- a/docs/include_diagrams.md +++ b/docs/include_diagrams.md @@ -15,7 +15,7 @@ The minimal config required to generate an include diagram is presented below: # Path to the directory where `compile_commands.json` can be found compilation_database_dir: _build # Output directory for the diagrams -output_directory: puml +output_directory: diagrams # Diagrams definitions diagrams: # Diagram name diff --git a/docs/interactive_svg_diagrams.md b/docs/interactive_svg_diagrams.md index d59de82b..aadb6375 100644 --- a/docs/interactive_svg_diagrams.md +++ b/docs/interactive_svg_diagrams.md @@ -6,12 +6,14 @@ -`clang-uml` in combination with PlantUML's link generation in diagrams allows to generate interactive diagrams, -where clicking on any class, method or call expression can direct the user directly to the source code or some other +`clang-uml` in combination with PlantUML's link generation in diagrams allows to +generate interactive diagrams, where clicking on any class, method or call +expression can direct the user directly to the source code or some other diagram or document available online. -For instance to generate links to GitHub repository directly for most of diagram elements simple add this to your -`.clang-uml` file: +For instance to generate links to GitHub repository directly for most diagram +elements simple add this to your `.clang-uml` file: + ```yaml generate_links: link: 'https://github.com/myorg/myrepo/blob/{{ git.commit }}/{{ element.source.path }}#L{{ element.source.line }}' diff --git a/docs/package_diagrams.md b/docs/package_diagrams.md index 58543cad..756e3b72 100644 --- a/docs/package_diagrams.md +++ b/docs/package_diagrams.md @@ -15,7 +15,7 @@ The minimal config required to generate a package diagram is presented below: # Path to the directory where `compile_commands.json` can be found compilation_database_dir: _build # Output directory for the diagrams -output_directory: puml +output_directory: diagrams # Diagrams definitions diagrams: # Diagram name diff --git a/docs/quick_start.md b/docs/quick_start.md index 5240f7c6..c687784e 100644 --- a/docs/quick_start.md +++ b/docs/quick_start.md @@ -17,7 +17,7 @@ To add an initial class diagram to your project, follow these steps: # Path to `compile_commands.json` directory compilation_database_dir: . # Path to diagram output directory - output_directory: puml + output_directory: diagrams diagrams: # This is the name of the diagram some_class_diagram: @@ -44,8 +44,14 @@ To add an initial class diagram to your project, follow these steps: ``` 4. Generate SVG images from the PlantUML diagrams: ```bash - plantuml -tsvg puml/*.puml + plantuml -tsvg diagrams/*.puml ``` + or generate also MermaidJS diagram (requires [mermaid-cli](https://github.com/mermaid-js/mermaid-cli)): + ``` + clang-uml --progress -n some_class_diagram -g mermaid + mmdc -i diagrams/some_class_diagram.mmd -o diagrams/some_class_diagram.svg + ``` + 5. Add another diagram: ```bash clang-uml --add-sequence-diagram another_diagram diff --git a/docs/sequence_diagrams.md b/docs/sequence_diagrams.md index 8fe0f54e..9f32dff9 100644 --- a/docs/sequence_diagrams.md +++ b/docs/sequence_diagrams.md @@ -17,7 +17,7 @@ The minimal config required to generate a sequence diagram is presented below: # Path to the directory where `compile_commands.json` can be found compilation_database_dir: _build # Output directory for the diagrams -output_directory: puml +output_directory: diagrams # Diagrams definitions diagrams: # Diagram name @@ -259,7 +259,7 @@ possible to override this order in the diagram definition using ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20029_sequence: type: sequence diff --git a/docs/test_cases/t00002.md b/docs/test_cases/t00002.md index 87e846f6..c48273ae 100644 --- a/docs/test_cases/t00002.md +++ b/docs/test_cases/t00002.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00002_class: type: class @@ -22,6 +22,11 @@ diagrams: note right of {{ alias("D") }} {{ comment("D").text }} end note + mermaid: + after: + - '{% set e=element("A") %} note for {{ e.alias }} "{{ trim(e.comment.brief.0) }}"' + - '{% set e=element("clanguml::t00002::B") %} note for {{ e.alias }} "{{ trim(e.comment.brief.0) }}"' + - 'note for {{ alias("D") }} "{{ comment("D").text }}"' ``` ## Source code File t00002.cc @@ -114,8 +119,10 @@ private: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00002_class](./t00002_class.svg "Basic class inheritance") +## Generated Mermaid diagrams +![t00002_class](./t00002_class_mermaid.svg "Basic class inheritance") ## Generated JSON models ```json { @@ -618,8 +625,8 @@ private: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00002_class", diff --git a/docs/test_cases/t00002_class.svg b/docs/test_cases/t00002_class.svg index c7a4fe72..19c4b806 100644 --- a/docs/test_cases/t00002_class.svg +++ b/docs/test_cases/t00002_class.svg @@ -1,6 +1,6 @@ - + @@ -9,123 +9,123 @@ - - + + A - + - + foo_a() = 0 : void - + - + foo_c() = 0 : void - - + + B - + - + foo_a() : void - - + + C - + - + foo_c() : void - - + + D - + - + foo_a() : void - + - + foo_c() : void - + - + as : std::vector<A *> - - + + E - + - + foo_a() : void - + - + foo_c() : void - + - + as : std::vector<A *> - + This is class A - + This is class B - + This is class D diff --git a/docs/test_cases/t00002_class_mermaid.svg b/docs/test_cases/t00002_class_mermaid.svg new file mode 100644 index 00000000..d7463afe --- /dev/null +++ b/docs/test_cases/t00002_class_mermaid.svg @@ -0,0 +1,352 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + -as + +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + -as + +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + + +
+ «abstract» +
+
+ +
+ A +
+
+ +
+ +foo_a() : void +
+
+ +
+ +foo_c() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+ +
+ +foo_a() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C +
+
+ +
+ +foo_c() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D +
+
+ +
+ -as : std::vector<A *> +
+
+ +
+ +foo_a() : void +
+
+ +
+ +foo_c() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E +
+
+ +
+ -as : std::vector<A *> +
+
+ +
+ +foo_a() : void +
+
+ +
+ +foo_c() : void +
+
+
+
+
+ + + + + +
+ This is class A +
+
+
+
+ + + + + +
+ This is class B +
+
+
+
+ + + + + +
+
This is class D
which is a little like B
and a little like C
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00003.md b/docs/test_cases/t00003.md index 45740e26..8c5ae9f0 100644 --- a/docs/test_cases/t00003.md +++ b/docs/test_cases/t00003.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00003_class: type: class @@ -94,8 +94,10 @@ int A::static_int = 1; } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00003_class](./t00003_class.svg "Class fields and methods") +## Generated Mermaid diagrams +![t00003_class](./t00003_class_mermaid.svg "Class fields and methods") ## Generated JSON models ```json { @@ -307,7 +309,7 @@ int A::static_int = 1; "parameters": [ { "name": "", - "type": "clanguml::t00003::A &&" + "type": "A &&" } ], "source_location": { @@ -337,7 +339,7 @@ int A::static_int = 1; "parameters": [ { "name": "", - "type": "const clanguml::t00003::A &" + "type": "const A &" } ], "source_location": { @@ -496,7 +498,7 @@ int A::static_int = 1; "line": 30, "translation_unit": "../../tests/t00003/t00003.cc" }, - "type": "clanguml::t00003::A &" + "type": "A &" }, { "access": "public", @@ -517,7 +519,7 @@ int A::static_int = 1; "parameters": [ { "name": "other", - "type": "clanguml::t00003::A &&" + "type": "A &&" } ], "source_location": { @@ -526,7 +528,7 @@ int A::static_int = 1; "line": 36, "translation_unit": "../../tests/t00003/t00003.cc" }, - "type": "clanguml::t00003::A &" + "type": "A &" }, { "access": "public", @@ -547,7 +549,7 @@ int A::static_int = 1; "parameters": [ { "name": "other", - "type": "clanguml::t00003::A &" + "type": "A &" } ], "source_location": { @@ -556,7 +558,7 @@ int A::static_int = 1; "line": 37, "translation_unit": "../../tests/t00003/t00003.cc" }, - "type": "clanguml::t00003::A &" + "type": "A &" }, { "access": "public", @@ -741,7 +743,7 @@ int A::static_int = 1; "line": 50, "translation_unit": "../../tests/t00003/t00003.cc" }, - "type": "clanguml::t00003::A" + "type": "A" }, { "access": "protected", @@ -831,8 +833,8 @@ int A::static_int = 1; } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00003_class", diff --git a/docs/test_cases/t00003_class.svg b/docs/test_cases/t00003_class.svg index a0f29032..1e1531c2 100644 --- a/docs/test_cases/t00003_class.svg +++ b/docs/test_cases/t00003_class.svg @@ -1,6 +1,6 @@ - + @@ -9,227 +9,227 @@ - - + + A - + - + A() = default : void - + - + A(int i) : void - + - + A(A &&) = default : void - + - + A(const A &) = deleted : void A<T>(T t) : void - + - + ~A() = default : void - + - + operator=(A && other) noexcept : A & - + - + operator=(A & other) noexcept : A & - + - + operator++() : A & - + - + auto_method() : int - + - + basic_method() : void - + - + const_method() const : void - + - + create_from_int(int i) : A - + - + default_int(int i = 12) : int - + - + default_string(int i, std::string s = "abc") : std::string - + - + double_int(const int i) : int - + - + private_method() : void - + - + protected_method() : void - + - + size() constexpr const : std::size_t - + - + static_method() : int - + - + sum(const double a, const double b) : int - + - + a_ : int - + - + auto_member : const unsigned long - + - + b_ : int - + - + c_ : int - + - + compare : std::function<bool (const int)> - + - + private_member : int - + - + protected_member : int - + - + public_member : int - + - + static_const_int : const int - + - + static_int : int diff --git a/docs/test_cases/t00003_class_mermaid.svg b/docs/test_cases/t00003_class_mermaid.svg new file mode 100644 index 00000000..4594d1f7 --- /dev/null +++ b/docs/test_cases/t00003_class_mermaid.svg @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ A +
+
+ +
+ -a_ : int +
+
+ +
+ +auto_member : const unsigned long +
+
+ +
+ -b_ : int +
+
+ +
+ -c_ : int +
+
+ +
+ #compare : std::function<bool (const int)> +
+
+ +
+ -private_member : int +
+
+ +
+ #protected_member : int +
+
+ +
+ +public_member : int +
+
+ +
+ +static_const_int : const int +
+
+ +
+ +static_int : int +
+
+ +
+ +A() : [default] void +
+
+ +
+ +A(int i) : void +
+
+ +
+ +A(A &&) : [default] void +
+
+ +
+ +A(const A &) : void +
+
+ +
+ +A(T t) : void +
+
+ +
+ +~A() : [default] void +
+
+ +
+ +operator=(A && other) : A & +
+
+ +
+ +operator=(A & other) : A & +
+
+ +
+ +operator++() : A & +
+
+ +
+ +auto_method() : int +
+
+ +
+ +basic_method() : void +
+
+ +
+ +const_method() : [const] void +
+
+ +
+ +create_from_int(int i) : A +
+
+ +
+ +default_int(int i = 12) : int +
+
+ +
+ +default_string(int i, std::string s = "abc") : std::string +
+
+ +
+ +double_int(const int i) : int +
+
+ +
+ -private_method() : void +
+
+ +
+ #protected_method() : void +
+
+ +
+ +size() : [const,constexpr] std::size_t +
+
+ +
+ +static_method() : int +
+
+ +
+ +sum(const double a, const double b) : int +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00004.md b/docs/test_cases/t00004.md index 4200fd7c..c42e3995 100644 --- a/docs/test_cases/t00004.md +++ b/docs/test_cases/t00004.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00004_class: type: class @@ -74,8 +74,10 @@ public: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00004_class](./t00004_class.svg "Nested classes and enums") +## Generated Mermaid diagrams +![t00004_class](./t00004_class_mermaid.svg "Nested classes and enums") ## Generated JSON models ```json { @@ -528,8 +530,8 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00004_class", diff --git a/docs/test_cases/t00004_class.svg b/docs/test_cases/t00004_class.svg index 80f7fd69..e276f324 100644 --- a/docs/test_cases/t00004_class.svg +++ b/docs/test_cases/t00004_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + B - - + + B::AA @@ -28,38 +28,38 @@ AA_3 - - + + A - + - + foo() const : void - + - + foo2() const : void - - + + A::AA - - + + A::AA::Lights @@ -69,16 +69,16 @@ Red - - + + A::AA::AAA - - + + C::B @@ -87,8 +87,8 @@ - - + + C @@ -97,38 +97,38 @@ - + - + b_int : B<int> - + - + t : T - - + + C::AA - - + + C::AA::AAA - - + + C::AA::CCC @@ -137,8 +137,8 @@ CCC_2 - - + + C::B @@ -147,15 +147,15 @@ - + - + b : V - - + + C::CC @@ -164,16 +164,16 @@ CC_2 - - + + detail::D - - + + detail::D::AA @@ -183,8 +183,8 @@ AA_3 - - + + detail::D::DD diff --git a/docs/test_cases/t00004_class_mermaid.svg b/docs/test_cases/t00004_class_mermaid.svg new file mode 100644 index 00000000..3df6e59a --- /dev/null +++ b/docs/test_cases/t00004_class_mermaid.svg @@ -0,0 +1,610 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +b_int + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ B +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ B::AA +
+
+ +
+ AA_1 +
+
+ +
+ AA_2 +
+
+ +
+ AA_3 +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A +
+
+ +
+ +foo() : [const] void +
+
+ +
+ +foo2() : [const] void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A::AA +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ A::AA::Lights +
+
+ +
+ Green +
+
+ +
+ Yellow +
+
+ +
+ Red +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A::AA::AAA +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C::B<int> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C<T> +
+
+ +
+ +b_int : B<int> +
+
+ +
+ +t : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C::AA +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C::AA::AAA +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ C::AA::CCC +
+
+ +
+ CCC_1 +
+
+ +
+ CCC_2 +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C::B<V> +
+
+ +
+ -b : V +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ C::CC +
+
+ +
+ CC_1 +
+
+ +
+ CC_2 +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ detail::D +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ detail::D::AA +
+
+ +
+ AA_1 +
+
+ +
+ AA_2 +
+
+ +
+ AA_3 +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ detail::D::DD +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00005.md b/docs/test_cases/t00005.md index 593827e8..50b87e4b 100644 --- a/docs/test_cases/t00005.md +++ b/docs/test_cases/t00005.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00005_class: type: class @@ -64,8 +64,10 @@ public: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00005_class](./t00005_class.svg "Basic class field relationships") +## Generated Mermaid diagrams +![t00005_class](./t00005_class_mermaid.svg "Basic class field relationships") ## Generated JSON models ```json { @@ -381,7 +383,7 @@ public: "line": 31, "translation_unit": "../../tests/t00005/t00005.cc" }, - "type": "clanguml::t00005::A" + "type": "A" }, { "access": "public", @@ -393,7 +395,7 @@ public: "line": 32, "translation_unit": "../../tests/t00005/t00005.cc" }, - "type": "clanguml::t00005::B *" + "type": "B *" }, { "access": "public", @@ -405,7 +407,7 @@ public: "line": 33, "translation_unit": "../../tests/t00005/t00005.cc" }, - "type": "clanguml::t00005::C &" + "type": "C &" }, { "access": "public", @@ -417,7 +419,7 @@ public: "line": 34, "translation_unit": "../../tests/t00005/t00005.cc" }, - "type": "const clanguml::t00005::D *" + "type": "const D *" }, { "access": "public", @@ -429,7 +431,7 @@ public: "line": 35, "translation_unit": "../../tests/t00005/t00005.cc" }, - "type": "const clanguml::t00005::E &" + "type": "const E &" }, { "access": "public", @@ -441,7 +443,7 @@ public: "line": 36, "translation_unit": "../../tests/t00005/t00005.cc" }, - "type": "clanguml::t00005::F &&" + "type": "F &&" }, { "access": "public", @@ -453,7 +455,7 @@ public: "line": 37, "translation_unit": "../../tests/t00005/t00005.cc" }, - "type": "clanguml::t00005::G **" + "type": "G **" }, { "access": "public", @@ -465,7 +467,7 @@ public: "line": 38, "translation_unit": "../../tests/t00005/t00005.cc" }, - "type": "clanguml::t00005::H ***" + "type": "H ***" }, { "access": "public", @@ -477,7 +479,7 @@ public: "line": 39, "translation_unit": "../../tests/t00005/t00005.cc" }, - "type": "clanguml::t00005::I *&" + "type": "I *&" }, { "access": "public", @@ -489,7 +491,7 @@ public: "line": 40, "translation_unit": "../../tests/t00005/t00005.cc" }, - "type": "volatile clanguml::t00005::J *" + "type": "volatile J *" }, { "access": "public", @@ -501,7 +503,7 @@ public: "line": 41, "translation_unit": "../../tests/t00005/t00005.cc" }, - "type": "clanguml::t00005::K *" + "type": "K *" } ], "methods": [], @@ -518,8 +520,8 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00005_class", diff --git a/docs/test_cases/t00005_class.svg b/docs/test_cases/t00005_class.svg index 39221f16..75ed326f 100644 --- a/docs/test_cases/t00005_class.svg +++ b/docs/test_cases/t00005_class.svg @@ -1,6 +1,6 @@ - + @@ -9,205 +9,205 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + R - + - + a : A - + - + b : B * - + - + c : C & - + - + d : const D * - + - + e : const E & - + - + f : F && - + - + g : G ** - + - + h : H *** - + - + i : I *& - + - + j : volatile J * - + - + k : K * - + - + some_int : int - + - + some_int_pointer : int * - + - + some_int_pointer_pointer : int ** - + - + some_int_reference : int & diff --git a/docs/test_cases/t00005_class_mermaid.svg b/docs/test_cases/t00005_class_mermaid.svg new file mode 100644 index 00000000..d24eed87 --- /dev/null +++ b/docs/test_cases/t00005_class_mermaid.svg @@ -0,0 +1,495 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +a + +
+
+
+
+ + + +
+ + +b + +
+
+
+
+ + + +
+ + +c + +
+
+
+
+ + + +
+ + +d + +
+
+
+
+ + + +
+ + +e + +
+
+
+
+ + + +
+ + +f + +
+
+
+
+ + + +
+ + +g + +
+
+
+
+ + + +
+ + +h + +
+
+
+
+ + + +
+ + +i + +
+
+
+
+ + + +
+ + +j + +
+
+
+
+ + + +
+ + +k + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ F +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ G +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ H +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ I +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ J +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ K +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +a : A +
+
+ +
+ +b : B +
+
+ +
+ +c : C & +
+
+ +
+ +d : const D +
+
+ +
+ +e : const E & +
+
+ +
+ +f : F && +
+
+ +
+ +g : G * +
+
+ +
+ +h : H ** +
+
+ +
+ +i : I *& +
+
+ +
+ +j : volatile J +
+
+ +
+ +k : K +
+
+ +
+ +some_int : int +
+
+ +
+ +some_int_pointer : int +
+
+ +
+ +some_int_pointer_pointer : int * +
+
+ +
+ +some_int_reference : int & +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00006.md b/docs/test_cases/t00006.md index 87e6e5ba..27c44d24 100644 --- a/docs/test_cases/t00006.md +++ b/docs/test_cases/t00006.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00006_class: type: class @@ -88,8 +88,10 @@ public: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00006_class](./t00006_class.svg "Class field relationships inferred from templates") +## Generated Mermaid diagrams +![t00006_class](./t00006_class_mermaid.svg "Class field relationships inferred from templates") ## Generated JSON models ```json { @@ -586,7 +588,7 @@ public: "line": 52, "translation_unit": "../../tests/t00006/t00006.cc" }, - "type": "custom_container" + "type": "custom_container" }, { "access": "public", @@ -646,7 +648,7 @@ public: "line": 60, "translation_unit": "../../tests/t00006/t00006.cc" }, - "type": "clanguml::t00006::J[10]" + "type": "J[10]" }, { "access": "public", @@ -658,7 +660,7 @@ public: "line": 61, "translation_unit": "../../tests/t00006/t00006.cc" }, - "type": "clanguml::t00006::K *[20]" + "type": "K *[20]" }, { "access": "public", @@ -699,8 +701,8 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00006_class", diff --git a/docs/test_cases/t00006_class.svg b/docs/test_cases/t00006_class.svg index 5c7f15e2..7195a8d1 100644 --- a/docs/test_cases/t00006_class.svg +++ b/docs/test_cases/t00006_class.svg @@ -1,6 +1,6 @@ - + @@ -9,136 +9,136 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + L - - + + M - - + + N - - + + NN - - + + NNN - - + + custom_container @@ -147,15 +147,15 @@ - + - + data : std::vector<T> - - + + custom_container @@ -164,103 +164,103 @@ - - + + R - + - + a : std::vector<A> - + - + b : std::vector<B *> - + - + c : std::map<int,C> - + - + d : std::map<int,D *> - + - + e : custom_container<E> - + - + f : std::vector<std::vector<F>> - + - + g : std::map<int,std::vector<G *>> - + - + h : std::array<H,10> - + - + i : std::array<I *,5> - + - + j : J[10] - + - + k : K *[20] - + - + lm : std::vector<std::pair<L,M>> - + - + ns : std::tuple<N,NN,NNN> diff --git a/docs/test_cases/t00006_class_mermaid.svg b/docs/test_cases/t00006_class_mermaid.svg new file mode 100644 index 00000000..5926bc36 --- /dev/null +++ b/docs/test_cases/t00006_class_mermaid.svg @@ -0,0 +1,707 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +a + +
+
+
+
+ + + +
+ + +b + +
+
+
+
+ + + +
+ + +c + +
+
+
+
+ + + +
+ + +d + +
+
+
+
+ + + +
+ + +e + +
+
+
+
+ + + +
+ + +f + +
+
+
+
+ + + +
+ + +g + +
+
+
+
+ + + +
+ + +h + +
+
+
+
+ + + +
+ + +i + +
+
+
+
+ + + +
+ + +j + +
+
+
+
+ + + +
+ + +k + +
+
+
+
+ + + +
+ + +lm + +
+
+
+
+ + + +
+ + +lm + +
+
+
+
+ + + +
+ + +ns + +
+
+
+
+ + + +
+ + +ns + +
+
+
+
+ + + +
+ + +ns + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ F +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ G +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ H +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ I +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ J +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ K +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ L +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ M +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ N +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ NN +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ NNN +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ custom_container<T> +
+
+ +
+ +data : std::vector<T> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ custom_container<E> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +a : std::vector<A> +
+
+ +
+ +b : std::vector<B *> +
+
+ +
+ +c : std::map<int,C> +
+
+ +
+ +d : std::map<int,D *> +
+
+ +
+ +e : custom_container<E> +
+
+ +
+ +f : std::vector<std::vector<F>> +
+
+ +
+ +g : std::map<int,std::vector<G *>> +
+
+ +
+ +h : std::array<H,10> +
+
+ +
+ +i : std::array<I *,5> +
+
+ +
+ +j : J[10] +
+
+ +
+ +k : K *[20] +
+
+ +
+ +lm : std::vector<std::pair<L,M>> +
+
+ +
+ +ns : std::tuple<N,NN,NNN> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00007.md b/docs/test_cases/t00007.md index d15b158e..1710a4c5 100644 --- a/docs/test_cases/t00007.md +++ b/docs/test_cases/t00007.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00007_class: type: class @@ -38,8 +38,10 @@ public: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00007_class](./t00007_class.svg "Smart pointers") +## Generated Mermaid diagrams +![t00007_class](./t00007_class_mermaid.svg "Smart pointers") ## Generated JSON models ```json { @@ -172,8 +174,8 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00007_class", diff --git a/docs/test_cases/t00007_class.svg b/docs/test_cases/t00007_class.svg index 73b2f6ee..068bb90a 100644 --- a/docs/test_cases/t00007_class.svg +++ b/docs/test_cases/t00007_class.svg @@ -1,6 +1,6 @@ - + @@ -9,57 +9,57 @@ - - + + A - - + + B - - + + C - - + + R - + - + a : std::unique_ptr<A> - + - + b : std::shared_ptr<B> - + - + c : std::weak_ptr<C> diff --git a/docs/test_cases/t00007_class_mermaid.svg b/docs/test_cases/t00007_class_mermaid.svg new file mode 100644 index 00000000..ab6659d1 --- /dev/null +++ b/docs/test_cases/t00007_class_mermaid.svg @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +a + +
+
+
+
+ + + +
+ + +b + +
+
+
+
+ + + +
+ + +c + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +a : std::unique_ptr<A> +
+
+ +
+ +b : std::shared_ptr<B> +
+
+ +
+ +c : std::weak_ptr<C> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00008.md b/docs/test_cases/t00008.md index 951054ad..31dfe453 100644 --- a/docs/test_cases/t00008.md +++ b/docs/test_cases/t00008.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00008_class: type: class @@ -71,8 +71,10 @@ template <> struct E::nested_template { } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00008_class](./t00008_class.svg "Template and template template relationships") +## Generated Mermaid diagrams +![t00008_class](./t00008_class_mermaid.svg "Template and template template relationships") ## Generated JSON models ```json { @@ -80,8 +82,8 @@ template <> struct E::nested_template { "elements": [ { "bases": [], - "display_name": "clanguml::t00008::A", - "id": "1657660300852090121", + "display_name": "clanguml::t00008::A", + "id": "2293517130897538130", "is_abstract": false, "is_nested": false, "is_struct": false, @@ -158,7 +160,7 @@ template <> struct E::nested_template { "line": 17, "translation_unit": "../../tests/t00008/t00008.cc" }, - "type": "clanguml::t00008::CMP" + "type": "CMP" } ], "methods": [], @@ -189,7 +191,7 @@ template <> struct E::nested_template { "is_variadic": false, "kind": "non_type_template", "template_parameters": [], - "type": "clanguml::t00008::CMP" + "type": "CMP" }, { "default": "3", @@ -478,7 +480,7 @@ template <> struct E::nested_template { "line": 40, "translation_unit": "../../tests/t00008/t00008.cc" }, - "type": "clanguml::t00008::E::nested_template::DT *" + "type": "DT *" } ], "name": "E::nested_template", @@ -538,7 +540,7 @@ template <> struct E::nested_template { "line": 47, "translation_unit": "../../tests/t00008/t00008.cc" }, - "type": "clanguml::t00008::E::nested_template::DeclType *" + "type": "DeclType *" } ], "name": "E::nested_template", @@ -561,8 +563,8 @@ template <> struct E::nested_template { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00008_class", diff --git a/docs/test_cases/t00008_class.svg b/docs/test_cases/t00008_class.svg index 60242514..7c614411 100644 --- a/docs/test_cases/t00008_class.svg +++ b/docs/test_cases/t00008_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,8 +9,8 @@ - - + + A @@ -19,50 +19,50 @@ - + - + comparator : CMP - + - + ints : std::array<int,N> - + - + pointer : T * - + - + reference : T & - + - + value : T - + - + values : std::vector<P> - - + + Vector @@ -71,15 +71,15 @@ - + - + values : std::vector<T> - - + + B @@ -88,15 +88,15 @@ - + - + template_template : C<T> - - + + B @@ -105,8 +105,8 @@ - - + + D @@ -115,78 +115,78 @@ D<Items...>(std::tuple<Items...> *) : void - + - + add(int i) : void - + - + ints : B<int,Vector> - - - - - E - - + + + + + E + + - - - - - E::nested_template - - ET - + + + + + E::nested_template + + ET + - - - + + + - - get(ET * d) : E::nested_template::DT * + + get(ET * d) : DT * - - - - - - E::nested_template - - char - + + + + + + E::nested_template + + char + - - - + + + - - getDecl(char * c) : E::nested_template<char>::DeclType * + + getDecl(char * c) : DeclType * - + ints - - - - - - - - - - + + + + + + + + + + diff --git a/docs/test_cases/t00008_class_mermaid.svg b/docs/test_cases/t00008_class_mermaid.svg new file mode 100644 index 00000000..cea158c5 --- /dev/null +++ b/docs/test_cases/t00008_class_mermaid.svg @@ -0,0 +1,337 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + +ints + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A<T,P=T,CMP=nullptr,int N=3> +
+
+ +
+ +comparator : CMP +
+
+ +
+ +ints : std::array<int,N> +
+
+ +
+ +pointer : T +
+
+ +
+ +reference : T & +
+
+ +
+ +value : T +
+
+ +
+ +values : std::vector<P> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Vector<T> +
+
+ +
+ +values : std::vector<T> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<T,C<>> +
+
+ +
+ +template_template : C<T> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<int,Vector> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D +
+
+ +
+ +ints : B<int,Vector> +
+
+ +
+ +D(std::tuple *) : void +
+
+ +
+ +add(int i) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E::nested_template<ET> +
+
+ +
+ +get(ET * d) : DT * +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E::nested_template<char> +
+
+ +
+ +getDecl(char * c) : DeclType * +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00009.md b/docs/test_cases/t00009.md index 0355da0a..dc54e8ec 100644 --- a/docs/test_cases/t00009.md +++ b/docs/test_cases/t00009.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00009_class: type: class @@ -39,8 +39,10 @@ public: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00009_class](./t00009_class.svg "Template instantiation") +## Generated Mermaid diagrams +![t00009_class](./t00009_class_mermaid.svg "Template instantiation") ## Generated JSON models ```json { @@ -243,8 +245,8 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00009_class", diff --git a/docs/test_cases/t00009_class.svg b/docs/test_cases/t00009_class.svg index c227ba31..35e7fe25 100644 --- a/docs/test_cases/t00009_class.svg +++ b/docs/test_cases/t00009_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -19,15 +19,15 @@ - + - + value : T - - + + A @@ -36,8 +36,8 @@ - - + + A @@ -46,8 +46,8 @@ - - + + A @@ -56,33 +56,33 @@ - - + + B - + - + aint : A<int> - + - + astring : A<std::string> * - + - + avector : A<std::vector<std::string>> & diff --git a/docs/test_cases/t00009_class_mermaid.svg b/docs/test_cases/t00009_class_mermaid.svg new file mode 100644 index 00000000..49cb1ab8 --- /dev/null +++ b/docs/test_cases/t00009_class_mermaid.svg @@ -0,0 +1,247 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +aint + +
+
+
+
+ + + +
+ + +astring + +
+
+
+
+ + + +
+ + +avector + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A<T> +
+
+ +
+ +value : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<int> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<std::string> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<std::vector<std::string>> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+ +
+ +aint : A<int> +
+
+ +
+ +astring : A<std::string> +
+
+ +
+ +avector : A<std::vector<std::string>> & +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00010.md b/docs/test_cases/t00010.md index ee0f92c7..24296f4e 100644 --- a/docs/test_cases/t00010.md +++ b/docs/test_cases/t00010.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00010_class: type: class @@ -43,8 +43,10 @@ public: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00010_class](./t00010_class.svg "Basic template instantiation") +## Generated Mermaid diagrams +![t00010_class](./t00010_class_mermaid.svg "Basic template instantiation") ## Generated JSON models ```json { @@ -253,8 +255,8 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00010_class", diff --git a/docs/test_cases/t00010_class.svg b/docs/test_cases/t00010_class.svg index 5a470caf..b1af3869 100644 --- a/docs/test_cases/t00010_class.svg +++ b/docs/test_cases/t00010_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -19,22 +19,22 @@ - + - + first : T - + - + second : P - - + + A @@ -43,8 +43,8 @@ - - + + B @@ -53,15 +53,15 @@ - + - + astring : A<T,std::string> - - + + B @@ -70,19 +70,19 @@ - - + + C - + - + aintstring : B<int> diff --git a/docs/test_cases/t00010_class_mermaid.svg b/docs/test_cases/t00010_class_mermaid.svg new file mode 100644 index 00000000..1c45921a --- /dev/null +++ b/docs/test_cases/t00010_class_mermaid.svg @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + +astring + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +aintstring + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A<T,P> +
+
+ +
+ +first : T +
+
+ +
+ +second : P +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<T,std::string> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<T> +
+
+ +
+ +astring : A<T,std::string> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<int> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C +
+
+ +
+ +aintstring : B<int> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00011.md b/docs/test_cases/t00011.md index 2acaf086..508a7018 100644 --- a/docs/test_cases/t00011.md +++ b/docs/test_cases/t00011.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00011_class: type: class @@ -52,8 +52,10 @@ public: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00011_class](./t00011_class.svg "Friend relationships") +## Generated Mermaid diagrams +![t00011_class](./t00011_class_mermaid.svg "Friend relationships") ## Generated JSON models ```json { @@ -169,7 +171,7 @@ public: "line": 29, "translation_unit": "../../tests/t00011/t00011.cc" }, - "type": "clanguml::t00011::A *" + "type": "A *" } ], "methods": [ @@ -212,8 +214,8 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00011_class", diff --git a/docs/test_cases/t00011_class.svg b/docs/test_cases/t00011_class.svg index 11777f86..b0fda56a 100644 --- a/docs/test_cases/t00011_class.svg +++ b/docs/test_cases/t00011_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + D @@ -19,48 +19,48 @@ - + - + value : T - - + + A - + - + foo() : void - - + + B - + - + foo() : void - + - + m_a : A * diff --git a/docs/test_cases/t00011_class_mermaid.svg b/docs/test_cases/t00011_class_mermaid.svg new file mode 100644 index 00000000..511eef8e --- /dev/null +++ b/docs/test_cases/t00011_class_mermaid.svg @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +[friend] + +
+
+
+
+ + + +
+ + +m_a + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ D<T> +
+
+ +
+ -value : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A +
+
+ +
+ +foo() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+ +
+ +m_a : A +
+
+ +
+ +foo() : void +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00012.md b/docs/test_cases/t00012.md index 928cc425..5a409d41 100644 --- a/docs/test_cases/t00012.md +++ b/docs/test_cases/t00012.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00012_class: type: class @@ -59,8 +59,10 @@ class R { } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00012_class](./t00012_class.svg "Advanced template instantiations") +## Generated Mermaid diagrams +![t00012_class](./t00012_class_mermaid.svg "Advanced template instantiations") ## Generated JSON models ```json { @@ -554,8 +556,8 @@ class R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00012_class", diff --git a/docs/test_cases/t00012_class.svg b/docs/test_cases/t00012_class.svg index ad4e4431..edab9d6d 100644 --- a/docs/test_cases/t00012_class.svg +++ b/docs/test_cases/t00012_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -19,22 +19,22 @@ - + - + value : T - + - + values : std::variant<Ts...> - - + + B @@ -43,15 +43,15 @@ - + - + ints : std::array<int,sizeof...(Is)> - - + + C @@ -60,15 +60,15 @@ - + - + ints : std::array<T,sizeof...(Is)> - - + + A @@ -77,8 +77,8 @@ - - + + A @@ -87,8 +87,8 @@ - - + + B @@ -97,8 +97,8 @@ - - + + B @@ -107,8 +107,8 @@ - - + + C @@ -117,50 +117,50 @@ - - + + R - + - + a1 : A<int,std::string,float> - + - + a2 : A<int,std::string,bool> - + - + b1 : B<3,2,1> - + - + b2 : B<1,1,1,1> - + - + c1 : C<std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3> - + Long template annotation diff --git a/docs/test_cases/t00012_class_mermaid.svg b/docs/test_cases/t00012_class_mermaid.svg new file mode 100644 index 00000000..a0652127 --- /dev/null +++ b/docs/test_cases/t00012_class_mermaid.svg @@ -0,0 +1,396 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + -a1 + +
+
+
+
+ + + +
+ + -a2 + +
+
+
+
+ + + +
+ + -b1 + +
+
+
+
+ + + +
+ + -b2 + +
+
+
+
+ + + +
+ + -c1 + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A<T,Ts...> +
+
+ +
+ -value : T +
+
+ +
+ -values : std::variant<Ts...> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<int... Is> +
+
+ +
+ -ints : std::array<int,sizeof...(Is)> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C<T,int... Is> +
+
+ +
+ -ints : std::array<T,sizeof...(Is)> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<int,std::string,float> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<int,std::string,bool> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<3,2,1> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<1,1,1,1> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C<std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ -a1 : A<int,std::string,float> +
+
+ +
+ -a2 : A<int,std::string,bool> +
+
+ +
+ -b1 : B<3,2,1> +
+
+ +
+ -b2 : B<1,1,1,1> +
+
+ +
+ -c1 : C<std::map<int,std::vector<std::vector<std::vector<std::string>>>>,3,3,3> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00013.md b/docs/test_cases/t00013.md index 52d54c16..64ad8575 100644 --- a/docs/test_cases/t00013.md +++ b/docs/test_cases/t00013.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00013_class: type: class @@ -87,8 +87,10 @@ private: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00013_class](./t00013_class.svg "Template instantiation relationships") +## Generated Mermaid diagrams +![t00013_class](./t00013_class_mermaid.svg "Template instantiation relationships") ## Generated JSON models ```json { @@ -313,7 +315,7 @@ private: "parameters": [ { "name": "r", - "type": "clanguml::t00013::R *" + "type": "R *" } ], "source_location": { @@ -592,7 +594,7 @@ private: "parameters": [ { "name": "a", - "type": "clanguml::t00013::A *" + "type": "A *" } ], "source_location": { @@ -622,7 +624,7 @@ private: "parameters": [ { "name": "b", - "type": "clanguml::t00013::B &" + "type": "B &" } ], "source_location": { @@ -652,7 +654,7 @@ private: "parameters": [ { "name": "b", - "type": "const clanguml::t00013::B &" + "type": "const B &" } ], "source_location": { @@ -682,7 +684,7 @@ private: "parameters": [ { "name": "c", - "type": "clanguml::t00013::C" + "type": "C" } ], "source_location": { @@ -712,7 +714,7 @@ private: "parameters": [ { "name": "d", - "type": "clanguml::t00013::D &&" + "type": "D &&" } ], "source_location": { @@ -742,7 +744,7 @@ private: "parameters": [ { "name": "d", - "type": "clanguml::t00013::D &&" + "type": "D &&" } ], "source_location": { @@ -905,8 +907,8 @@ private: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00013_class", diff --git a/docs/test_cases/t00013_class.svg b/docs/test_cases/t00013_class.svg index 94675b34..3145c0ab 100644 --- a/docs/test_cases/t00013_class.svg +++ b/docs/test_cases/t00013_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + ABCD::F @@ -19,15 +19,15 @@ - + - + f : T - - + + ABCD::F @@ -36,75 +36,75 @@ - - + + A - + - + a : int - - + + B - + - + b : int - - + + C - + - + c : int - - + + D - + - + print(R * r) : void - + - + d : int - - + + E @@ -113,15 +113,15 @@ - + - + e : T - - + + G @@ -130,22 +130,22 @@ - + - + args : std::tuple<Args...> - + - + g : T - - + + E @@ -154,8 +154,8 @@ - - + + G @@ -164,8 +164,8 @@ - - + + E @@ -174,93 +174,93 @@ - - + + R - + - + get_a(A * a) : int - + - + get_b(B & b) : int - + - + get_c(C c) : int - + - + get_const_b(const B & b) : int - + - + get_d(D && d) : int - + - + get_d2(D && d) : int get_e<T>(E<T> e) : T get_f<T>(const F<T> & f) : T - + - + get_int_e(const E<int> & e) : int - + - + get_int_e2(E<int> & e) : int - + - + get_int_f(const ABCD::F<int> & f) : int - + - + estring : E<std::string> - + - + gintstring : G<int,float,std::string> diff --git a/docs/test_cases/t00013_class_mermaid.svg b/docs/test_cases/t00013_class_mermaid.svg new file mode 100644 index 00000000..45d31678 --- /dev/null +++ b/docs/test_cases/t00013_class_mermaid.svg @@ -0,0 +1,578 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +gintstring + +
+
+
+
+ + + +
+ + -estring + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ ABCD::F<T> +
+
+ +
+ +f : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ABCD::F<int> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A +
+
+ +
+ +a : int +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+ +
+ +b : int +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C +
+
+ +
+ +c : int +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D +
+
+ +
+ +d : int +
+
+ +
+ +print(R * r) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E<T> +
+
+ +
+ +e : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ G<T,Args...> +
+
+ +
+ +args : std::tuple<Args...> +
+
+ +
+ +g : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E<int> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ G<int,float,std::string> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E<std::string> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ -estring : E<std::string> +
+
+ +
+ +gintstring : G<int,float,std::string> +
+
+ +
+ +get_a(A * a) : int +
+
+ +
+ +get_b(B & b) : int +
+
+ +
+ +get_c(C c) : int +
+
+ +
+ +get_const_b(const B & b) : int +
+
+ +
+ +get_d(D && d) : int +
+
+ +
+ +get_d2(D && d) : int +
+
+ +
+ +get_e(E e) : T +
+
+ +
+ +get_f(const F & f) : T +
+
+ +
+ +get_int_e(const E & e) : int +
+
+ +
+ +get_int_e2(E & e) : int +
+
+ +
+ +get_int_f(const ABCD::F & f) : int +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00014.md b/docs/test_cases/t00014.md index 58885733..1b21783a 100644 --- a/docs/test_cases/t00014.md +++ b/docs/test_cases/t00014.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00014_class: type: class @@ -16,6 +16,9 @@ diagrams: plantuml: before: - left to right direction + mermaid: + before: + - direction LR ``` ## Source code File t00014.cc @@ -104,8 +107,10 @@ public: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00014_class](./t00014_class.svg "Alias template instantiation") +## Generated Mermaid diagrams +![t00014_class](./t00014_class_mermaid.svg "Alias template instantiation") ## Generated JSON models ```json { @@ -298,8 +303,8 @@ public: "namespace": "clanguml::t00014", "source_location": { "column": 12, - "file": "../../../../../../usr/include/c++/12/bits/stl_iterator.h", - "line": 2611, + "file": "../../../../../../usr/include/c++/11/bits/stl_iterator.h", + "line": 2488, "translation_unit": "../../tests/t00014/t00014.cc" }, "template_parameters": [ @@ -333,8 +338,8 @@ public: "namespace": "clanguml::t00014", "source_location": { "column": 11, - "file": "../../../../../../usr/include/c++/12/bits/unique_ptr.h", - "line": 269, + "file": "../../../../../../usr/include/c++/11/bits/unique_ptr.h", + "line": 242, "translation_unit": "../../tests/t00014/t00014.cc" }, "template_parameters": [ @@ -368,8 +373,8 @@ public: "namespace": "clanguml::t00014", "source_location": { "column": 12, - "file": "../../../../../../usr/include/c++/12/bits/stl_iterator.h", - "line": 2611, + "file": "../../../../../../usr/include/c++/11/bits/stl_iterator.h", + "line": 2488, "translation_unit": "../../tests/t00014/t00014.cc" }, "template_parameters": [ @@ -403,8 +408,8 @@ public: "namespace": "clanguml::t00014", "source_location": { "column": 12, - "file": "../../../../../../usr/include/c++/12/bits/stl_iterator.h", - "line": 2611, + "file": "../../../../../../usr/include/c++/11/bits/stl_iterator.h", + "line": 2488, "translation_unit": "../../tests/t00014/t00014.cc" }, "template_parameters": [ @@ -438,8 +443,8 @@ public: "namespace": "clanguml::t00014", "source_location": { "column": 11, - "file": "../../../../../../usr/include/c++/12/bits/unique_ptr.h", - "line": 269, + "file": "../../../../../../usr/include/c++/11/bits/unique_ptr.h", + "line": 242, "translation_unit": "../../tests/t00014/t00014.cc" }, "template_parameters": [ @@ -473,8 +478,8 @@ public: "namespace": "clanguml::t00014", "source_location": { "column": 12, - "file": "../../../../../../usr/include/c++/12/bits/stl_iterator.h", - "line": 2611, + "file": "../../../../../../usr/include/c++/11/bits/stl_iterator.h", + "line": 2488, "translation_unit": "../../tests/t00014/t00014.cc" }, "template_parameters": [ @@ -508,8 +513,8 @@ public: "namespace": "clanguml::t00014", "source_location": { "column": 11, - "file": "../../../../../../usr/include/c++/12/bits/shared_ptr.h", - "line": 175, + "file": "../../../../../../usr/include/c++/11/bits/shared_ptr.h", + "line": 122, "translation_unit": "../../tests/t00014/t00014.cc" }, "template_parameters": [ @@ -690,7 +695,7 @@ public: "namespace": "clanguml::t00014", "source_location": { "column": 11, - "file": "../../../../../../usr/include/c++/12/bits/std_function.h", + "file": "../../../../../../usr/include/c++/11/bits/std_function.h", "line": 111, "translation_unit": "../../tests/t00014/t00014.cc" }, @@ -725,7 +730,7 @@ public: "namespace": "clanguml::t00014", "source_location": { "column": 11, - "file": "../../../../../../usr/include/c++/12/bits/std_function.h", + "file": "../../../../../../usr/include/c++/11/bits/std_function.h", "line": 111, "translation_unit": "../../tests/t00014/t00014.cc" }, @@ -837,7 +842,7 @@ public: "line": 66, "translation_unit": "../../tests/t00014/t00014.cc" }, - "type": "clanguml::t00014::AIntString" + "type": "AIntString" }, { "access": "private", @@ -849,7 +854,7 @@ public: "line": 67, "translation_unit": "../../tests/t00014/t00014.cc" }, - "type": "clanguml::t00014::AStringString" + "type": "AStringString" }, { "access": "private", @@ -861,7 +866,7 @@ public: "line": 68, "translation_unit": "../../tests/t00014/t00014.cc" }, - "type": "clanguml::t00014::BStringString" + "type": "BStringString" }, { "access": "private", @@ -885,7 +890,7 @@ public: "line": 72, "translation_unit": "../../tests/t00014/t00014.cc" }, - "type": "clanguml::t00014::BVector" + "type": "BVector" }, { "access": "public", @@ -897,7 +902,7 @@ public: "line": 75, "translation_unit": "../../tests/t00014/t00014.cc" }, - "type": "clanguml::t00014::BVector2" + "type": "BVector2" }, { "access": "public", @@ -909,7 +914,7 @@ public: "line": 76, "translation_unit": "../../tests/t00014/t00014.cc" }, - "type": "SimpleCallback" + "type": "SimpleCallback" }, { "access": "public", @@ -921,7 +926,7 @@ public: "line": 77, "translation_unit": "../../tests/t00014/t00014.cc" }, - "type": "GenericCallback" + "type": "GenericCallback" }, { "access": "public", @@ -933,7 +938,7 @@ public: "line": 78, "translation_unit": "../../tests/t00014/t00014.cc" }, - "type": "clanguml::t00014::VoidCallback" + "type": "VoidCallback" }, { "access": "public", @@ -945,7 +950,7 @@ public: "line": 79, "translation_unit": "../../tests/t00014/t00014.cc" }, - "type": "VectorPtr" + "type": "VectorPtr
" } ], "methods": [], @@ -969,8 +974,8 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00014_class", diff --git a/docs/test_cases/t00014_class.svg b/docs/test_cases/t00014_class.svg index c467a9c1..65767a96 100644 --- a/docs/test_cases/t00014_class.svg +++ b/docs/test_cases/t00014_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,414 +9,414 @@ - - - - - A - - T,P - - + + + + + A + + T,P + + - - - + + + - - p : P + + p : P - - - + + + - - t : T + + t : T - - - - - B - - + + + + + B + + - - - + + + - - value : std::string + + value : std::string - - - - - A - - T,std::string - - + + + + + A + + T,std::string + + - - - - - A - - T,std::unique_ptr<std::string> - - + + + + + A + + T,std::unique_ptr<std::string> + + - - - - - A - - long,T - - + + + + + A + + long,T + + - - - - - A - - double,T - - + + + + + A + + double,T + + - - - - - A - - long,U - - + + + + + A + + long,U + + - - - - - A - - long,bool - - + + + + + A + + long,bool + + - - - - - A - - double,bool - - + + + + + A + + double,bool + + - - - - - A - - long,float - - + + + + + A + + long,float + + - - - - - A - - double,float - - + + + + + A + + double,float + + - - - - - A - - bool,std::string - - + + + + + A + + bool,std::string + + - - - - - A - - float,std::unique_ptr<std::string> - - + + + + + A + + float,std::unique_ptr<std::string> + + - - - - - A - - int,std::string - - + + + + + A + + int,std::string + + - - - - - A - - std::string,std::string - - + + + + + A + + std::string,std::string + + - - - - - A - - char,std::string - - + + + + + A + + char,std::string + + - - - - - A - - wchar_t,std::string - - + + + + + A + + wchar_t,std::string + + - - - - - R - - T - - + + + + + R + + T + + - + - + abool : APtr<bool> - + - + aboolfloat : AAPtr<bool,float> - + - + afloat : ASharedPtr<float> - + - + atfloat : AAPtr<T,float> - + - + bapair : PairPairBA<bool> - + - + boolstring : A<bool,std::string> - + - + bs : BVector - + - + bs2 : BVector2 - + - + bstringstring : BStringString - + - + cb : SimpleCallback<ACharString> - + - + floatstring : AStringPtr<float> - + - - gcb : GenericCallback<R::AWCharString> + + gcb : GenericCallback<AWCharString> - + - + intstring : AIntString - + - + stringstring : AStringString - + - + vcb : VoidCallback - + - + vps : VectorPtr<B> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bapair - - - - bs - - - - bs2 - - - - vps - - - - bapair - - - - abool - - - - aboolfloat - - - - aboolfloat - - - - atfloat - - - - afloat - - - - boolstring - - - - floatstring - - - - intstring - - - - stringstring - - - - bstringstring - - - - atfloat - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bapair + + + + bs + + + + bs2 + + + + vps + + + + bapair + + + + abool + + + + aboolfloat + + + + aboolfloat + + + + atfloat + + + + afloat + + + + boolstring + + + + floatstring + + + + intstring + + + + stringstring + + + + bstringstring + + + + atfloat + + + + diff --git a/docs/test_cases/t00014_class_mermaid.svg b/docs/test_cases/t00014_class_mermaid.svg new file mode 100644 index 00000000..34fb5f98 --- /dev/null +++ b/docs/test_cases/t00014_class_mermaid.svg @@ -0,0 +1,893 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + -bapair + +
+
+
+
+ + + +
+ + -bapair + +
+
+
+
+ + + +
+ + -abool + +
+
+
+
+ + + +
+ + -aboolfloat + +
+
+
+
+ + + +
+ + -aboolfloat + +
+
+
+
+ + + +
+ + -afloat + +
+
+
+
+ + + +
+ + -boolstring + +
+
+
+
+ + + +
+ + -floatstring + +
+
+
+
+ + + +
+ + -intstring + +
+
+
+
+ + + +
+ + -stringstring + +
+
+
+
+ + + +
+ + -bstringstring + +
+
+
+
+ + + +
+ + -atfloat + +
+
+
+
+ + + +
+ + -atfloat + +
+
+
+
+ + + +
+ + #bs + +
+
+
+
+ + + +
+ + +bs2 + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +vps + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A<T,P> +
+
+ +
+ +p : P +
+
+ +
+ +t : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+ +
+ +value : std::string +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<T,std::string> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<T,std::unique_ptr<std::string>> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<long,T> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<double,T> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<long,U> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<long,bool> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<double,bool> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<long,float> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<double,float> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<bool,std::string> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<float,std::unique_ptr<std::string>> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<int,std::string> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<std::string,std::string> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<char,std::string> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<wchar_t,std::string> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R<T> +
+
+ +
+ -abool : APtr<bool> +
+
+ +
+ -aboolfloat : AAPtr<bool,float> +
+
+ +
+ -afloat : ASharedPtr<float> +
+
+ +
+ -atfloat : AAPtr<T,float> +
+
+ +
+ -bapair : PairPairBA<bool> +
+
+ +
+ -boolstring : A<bool,std::string> +
+
+ +
+ #bs : BVector +
+
+ +
+ +bs2 : BVector2 +
+
+ +
+ -bstringstring : BStringString +
+
+ +
+ +cb : SimpleCallback<ACharString> +
+
+ +
+ -floatstring : AStringPtr<float> +
+
+ +
+ +gcb : GenericCallback<AWCharString> +
+
+ +
+ -intstring : AIntString +
+
+ +
+ -stringstring : AStringString +
+
+ +
+ +vcb : VoidCallback +
+
+ +
+ +vps : VectorPtr<B> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00015.md b/docs/test_cases/t00015.md index 21d85ca6..7d271daf 100644 --- a/docs/test_cases/t00015.md +++ b/docs/test_cases/t00015.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00015_class: type: class @@ -47,8 +47,10 @@ class B : public ns1::ns2::Anon { }; } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00015_class](./t00015_class.svg "Namespace fun") +## Generated Mermaid diagrams +![t00015_class](./t00015_class_mermaid.svg "Namespace fun") ## Generated JSON models ```json { @@ -187,8 +189,8 @@ class B : public ns1::ns2::Anon { }; } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00015_class", diff --git a/docs/test_cases/t00015_class.svg b/docs/test_cases/t00015_class.svg index 6d366176..6b7826d8 100644 --- a/docs/test_cases/t00015_class.svg +++ b/docs/test_cases/t00015_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + ns1::A - - + + ns1::ns2_v0_9_0::A - - + + ns1::Anon - - + + ns3::ns1::ns2::Anon - - + + ns3::B diff --git a/docs/test_cases/t00015_class_mermaid.svg b/docs/test_cases/t00015_class_mermaid.svg new file mode 100644 index 00000000..0eb06101 --- /dev/null +++ b/docs/test_cases/t00015_class_mermaid.svg @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ ns1::A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns2_v0_9_0::A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::Anon +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns3::ns1::ns2::Anon +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns3::B +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00016.md b/docs/test_cases/t00016.md index 20ae6df8..4d390c9a 100644 --- a/docs/test_cases/t00016.md +++ b/docs/test_cases/t00016.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00016_class: type: class @@ -48,8 +48,10 @@ template <> struct is_numeric { } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00016_class](./t00016_class.svg "Unnamed enums and empty templates") +## Generated Mermaid diagrams +![t00016_class](./t00016_class_mermaid.svg "Unnamed enums and empty templates") ## Generated JSON models ```json { @@ -273,8 +275,8 @@ template <> struct is_numeric { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00016_class", diff --git a/docs/test_cases/t00016_class.svg b/docs/test_cases/t00016_class.svg index 6fd2ae8f..31ad6bc7 100644 --- a/docs/test_cases/t00016_class.svg +++ b/docs/test_cases/t00016_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + is_numeric @@ -21,8 +21,8 @@ value : enum - - + + is_numeric @@ -33,8 +33,8 @@ value : enum - - + + is_numeric @@ -45,8 +45,8 @@ value : enum - - + + is_numeric @@ -57,8 +57,8 @@ value : enum - - + + is_numeric @@ -69,8 +69,8 @@ value : enum - - + + is_numeric diff --git a/docs/test_cases/t00016_class_mermaid.svg b/docs/test_cases/t00016_class_mermaid.svg new file mode 100644 index 00000000..b57ce00c --- /dev/null +++ b/docs/test_cases/t00016_class_mermaid.svg @@ -0,0 +1,264 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ is_numeric<typename> +
+
+ +
+ +value : enum +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ is_numeric<float> +
+
+ +
+ +value : enum +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ is_numeric<char> +
+
+ +
+ +value : enum +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ is_numeric<unsigned int> +
+
+ +
+ +value : enum +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ is_numeric<int> +
+
+ +
+ +value : enum +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ is_numeric<bool> +
+
+ +
+ +value : enum +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00017.md b/docs/test_cases/t00017.md index ed5f59ce..98b5b270 100644 --- a/docs/test_cases/t00017.md +++ b/docs/test_cases/t00017.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00017_class: type: class @@ -76,8 +76,10 @@ private: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00017_class](./t00017_class.svg "Test include relations also as members flag") +## Generated Mermaid diagrams +![t00017_class](./t00017_class_mermaid.svg "Test include relations also as members flag") ## Generated JSON models ```json { @@ -393,7 +395,7 @@ private: "line": 42, "translation_unit": "../../tests/t00017/t00017.cc" }, - "type": "clanguml::t00017::A" + "type": "A" }, { "access": "private", @@ -405,7 +407,7 @@ private: "line": 43, "translation_unit": "../../tests/t00017/t00017.cc" }, - "type": "clanguml::t00017::B *" + "type": "B *" }, { "access": "private", @@ -417,7 +419,7 @@ private: "line": 44, "translation_unit": "../../tests/t00017/t00017.cc" }, - "type": "clanguml::t00017::C &" + "type": "C &" }, { "access": "private", @@ -429,7 +431,7 @@ private: "line": 45, "translation_unit": "../../tests/t00017/t00017.cc" }, - "type": "const clanguml::t00017::D *" + "type": "const D *" }, { "access": "private", @@ -441,7 +443,7 @@ private: "line": 46, "translation_unit": "../../tests/t00017/t00017.cc" }, - "type": "const clanguml::t00017::E &" + "type": "const E &" }, { "access": "private", @@ -453,7 +455,7 @@ private: "line": 47, "translation_unit": "../../tests/t00017/t00017.cc" }, - "type": "clanguml::t00017::F &&" + "type": "F &&" }, { "access": "private", @@ -465,7 +467,7 @@ private: "line": 48, "translation_unit": "../../tests/t00017/t00017.cc" }, - "type": "clanguml::t00017::G **" + "type": "G **" }, { "access": "private", @@ -477,7 +479,7 @@ private: "line": 49, "translation_unit": "../../tests/t00017/t00017.cc" }, - "type": "clanguml::t00017::H ***" + "type": "H ***" }, { "access": "private", @@ -489,7 +491,7 @@ private: "line": 50, "translation_unit": "../../tests/t00017/t00017.cc" }, - "type": "clanguml::t00017::I *&" + "type": "I *&" }, { "access": "private", @@ -501,7 +503,7 @@ private: "line": 51, "translation_unit": "../../tests/t00017/t00017.cc" }, - "type": "volatile clanguml::t00017::J *" + "type": "volatile J *" }, { "access": "private", @@ -513,7 +515,7 @@ private: "line": 52, "translation_unit": "../../tests/t00017/t00017.cc" }, - "type": "clanguml::t00017::K *" + "type": "K *" } ], "methods": [ @@ -540,19 +542,19 @@ private: }, { "name": "cc", - "type": "clanguml::t00017::C &" + "type": "C &" }, { "name": "ee", - "type": "const clanguml::t00017::E &" + "type": "const E &" }, { "name": "ff", - "type": "clanguml::t00017::F &&" + "type": "F &&" }, { "name": "ii", - "type": "clanguml::t00017::I *&" + "type": "I *&" } ], "source_location": { @@ -577,8 +579,8 @@ private: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00017_class", diff --git a/docs/test_cases/t00017_class.svg b/docs/test_cases/t00017_class.svg index e81dfa22..1d899dc8 100644 --- a/docs/test_cases/t00017_class.svg +++ b/docs/test_cases/t00017_class.svg @@ -1,6 +1,6 @@ - + @@ -9,135 +9,135 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J - - + + K - - + + R - + - + R(int & some_int, C & cc, const E & ee, F && ff, I *& ii) : void - + - + some_int : int - + - + some_int_pointer : int * - + - + some_int_pointer_pointer : int ** - + - + some_int_reference : int & diff --git a/docs/test_cases/t00017_class_mermaid.svg b/docs/test_cases/t00017_class_mermaid.svg new file mode 100644 index 00000000..7aaa99b8 --- /dev/null +++ b/docs/test_cases/t00017_class_mermaid.svg @@ -0,0 +1,445 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + -a + +
+
+
+
+ + + +
+ + -b + +
+
+
+
+ + + +
+ + -c + +
+
+
+
+ + + +
+ + -d + +
+
+
+
+ + + +
+ + -e + +
+
+
+
+ + + +
+ + -f + +
+
+
+
+ + + +
+ + -g + +
+
+
+
+ + + +
+ + -h + +
+
+
+
+ + + +
+ + -i + +
+
+
+
+ + + +
+ + -j + +
+
+
+
+ + + +
+ + -k + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ F +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ G +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ H +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ I +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ J +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ K +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ -some_int : int +
+
+ +
+ -some_int_pointer : int +
+
+ +
+ -some_int_pointer_pointer : int * +
+
+ +
+ -some_int_reference : int & +
+
+ +
+ -R(int & some_int, C & cc, const E & ee, F && ff, I *& ii) : void +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00018.md b/docs/test_cases/t00018.md index cc9762bd..d5cd987d 100644 --- a/docs/test_cases/t00018.md +++ b/docs/test_cases/t00018.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00018_class: type: class @@ -133,8 +133,10 @@ void widget::draw(const clanguml::t00018::widget &w) } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00018_class](./t00018_class.svg "Pimpl pattern") +## Generated Mermaid diagrams +![t00018_class](./t00018_class_mermaid.svg "Pimpl pattern") ## Generated JSON models ```json { @@ -439,7 +441,7 @@ void widget::draw(const clanguml::t00018::widget &w) "parameters": [ { "name": "", - "type": "clanguml::t00018::widget &&" + "type": "widget &&" } ], "source_location": { @@ -469,7 +471,7 @@ void widget::draw(const clanguml::t00018::widget &w) "parameters": [ { "name": "", - "type": "const clanguml::t00018::widget &" + "type": "const widget &" } ], "source_location": { @@ -499,7 +501,7 @@ void widget::draw(const clanguml::t00018::widget &w) "parameters": [ { "name": "", - "type": "clanguml::t00018::widget &&" + "type": "widget &&" } ], "source_location": { @@ -508,7 +510,7 @@ void widget::draw(const clanguml::t00018::widget &w) "line": 30, "translation_unit": "../../tests/t00018/t00018.cc" }, - "type": "clanguml::t00018::widget &" + "type": "widget &" }, { "access": "public", @@ -529,7 +531,7 @@ void widget::draw(const clanguml::t00018::widget &w) "parameters": [ { "name": "", - "type": "const clanguml::t00018::widget &" + "type": "const widget &" } ], "source_location": { @@ -538,7 +540,7 @@ void widget::draw(const clanguml::t00018::widget &w) "line": 31, "translation_unit": "../../tests/t00018/t00018.cc" }, - "type": "clanguml::t00018::widget &" + "type": "widget &" } ], "name": "widget", @@ -554,8 +556,8 @@ void widget::draw(const clanguml::t00018::widget &w) } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00018_class", diff --git a/docs/test_cases/t00018_class.svg b/docs/test_cases/t00018_class.svg index 6585b859..330371d7 100644 --- a/docs/test_cases/t00018_class.svg +++ b/docs/test_cases/t00018_class.svg @@ -1,6 +1,6 @@ - + @@ -9,121 +9,121 @@ - - + + impl::widget - + - + widget(int n) : void - + - + draw(const widget & w) const : void - + - + draw(const widget & w) : void - + - + n : int - - + + widget - + - + widget(int) : void - + - + widget(widget &&) : void - + - + widget(const widget &) = deleted : void - + - + ~widget() : void - + - + operator=(widget &&) : widget & - + - + operator=(const widget &) = deleted : widget & - + - + draw() const : void - + - + draw() : void - + - + shown() const : bool - + - + pImpl : std::unique_ptr<impl::widget> diff --git a/docs/test_cases/t00018_class_mermaid.svg b/docs/test_cases/t00018_class_mermaid.svg new file mode 100644 index 00000000..c1ad2ba0 --- /dev/null +++ b/docs/test_cases/t00018_class_mermaid.svg @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + -pImpl + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ impl::widget +
+
+ +
+ -n : int +
+
+ +
+ +widget(int n) : void +
+
+ +
+ +draw(const widget & w) : [const] void +
+
+ +
+ +draw(const widget & w) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ widget +
+
+ +
+ -pImpl : std::unique_ptr<impl::widget> +
+
+ +
+ +widget(int) : void +
+
+ +
+ +widget(widget &&) : void +
+
+ +
+ +widget(const widget &) : void +
+
+ +
+ +~widget() : void +
+
+ +
+ +operator=(widget &&) : widget & +
+
+ +
+ +operator=(const widget &) : widget & +
+
+ +
+ +draw() : [const] void +
+
+ +
+ +draw() : void +
+
+ +
+ +shown() : [const] bool +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00019.md b/docs/test_cases/t00019.md index 1651e8f3..18a2233d 100644 --- a/docs/test_cases/t00019.md +++ b/docs/test_cases/t00019.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00019_class: type: class @@ -151,8 +151,10 @@ class Base { } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00019_class](./t00019_class.svg "Layercake pattern") +## Generated Mermaid diagrams +![t00019_class](./t00019_class_mermaid.svg "Layercake pattern") ## Generated JSON models ```json { @@ -672,8 +674,8 @@ class Base { "namespace": "clanguml::t00019", "source_location": { "column": 11, - "file": "../../../../../../usr/include/c++/12/bits/unique_ptr.h", - "line": 269, + "file": "../../../../../../usr/include/c++/11/bits/unique_ptr.h", + "line": 242, "translation_unit": "../../tests/t00019/t00019.cc" }, "template_parameters": [ @@ -737,8 +739,8 @@ class Base { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00019_class", diff --git a/docs/test_cases/t00019_class.svg b/docs/test_cases/t00019_class.svg index 70fbc166..f385fcf5 100644 --- a/docs/test_cases/t00019_class.svg +++ b/docs/test_cases/t00019_class.svg @@ -1,6 +1,6 @@ - + @@ -9,45 +9,45 @@ - - + + Base - + - + Base() = default : void - + - + ~Base() constexpr = default : void - + - + m1() : int - + - + m2() : std::string - - + + Layer1 @@ -55,23 +55,23 @@ LowerLayer - + - + m1() : int - + - + m2() : std::string - - + + Layer2 @@ -79,16 +79,16 @@ LowerLayer - + - + all_calls_count() const : int - - + + Layer3 @@ -96,51 +96,51 @@ LowerLayer - + - + m1() : int - + - + m1_calls() const : int - + - + m2() : std::string - + - + m2_calls() const : int - + - + m_m1_calls : int - + - + m_m2_calls : int - - + + Layer3 @@ -149,8 +149,8 @@ - - + + Layer2 @@ -159,8 +159,8 @@ - - + + Layer1 @@ -169,19 +169,19 @@ - - + + A - + - + layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> diff --git a/docs/test_cases/t00019_class_mermaid.svg b/docs/test_cases/t00019_class_mermaid.svg new file mode 100644 index 00000000..32dfe464 --- /dev/null +++ b/docs/test_cases/t00019_class_mermaid.svg @@ -0,0 +1,360 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + +layers + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ Base +
+
+ +
+ -Base() : [default] void +
+
+ +
+ -~Base() : [default,constexpr] void +
+
+ +
+ -m1() : int +
+
+ +
+ -m2() : std::string +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Layer1<LowerLayer> +
+
+ +
+ -m1() : int +
+
+ +
+ -m2() : std::string +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Layer2<LowerLayer> +
+
+ +
+ -all_calls_count() : [const] int +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Layer3<LowerLayer> +
+
+ +
+ -m_m1_calls : int +
+
+ +
+ -m_m2_calls : int +
+
+ +
+ -m1() : int +
+
+ +
+ -m1_calls() : [const] int +
+
+ +
+ -m2() : std::string +
+
+ +
+ -m2_calls() : [const] int +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Layer3<Base> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Layer2<Layer3<Base>> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Layer1<Layer2<Layer3<Base>>> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A +
+
+ +
+ +layers : std::unique_ptr<Layer1<Layer2<Layer3<Base>>>> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00020.md b/docs/test_cases/t00020.md index b8b7ba2d..a962d6b6 100644 --- a/docs/test_cases/t00020.md +++ b/docs/test_cases/t00020.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00020_class: type: class @@ -96,8 +96,10 @@ public: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00020_class](./t00020_class.svg "Abstract factory pattern") +## Generated Mermaid diagrams +![t00020_class](./t00020_class_mermaid.svg "Abstract factory pattern") ## Generated JSON models ```json { @@ -734,8 +736,8 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00020_class", diff --git a/docs/test_cases/t00020_class.svg b/docs/test_cases/t00020_class.svg index 089cdf46..a2ca8e3c 100644 --- a/docs/test_cases/t00020_class.svg +++ b/docs/test_cases/t00020_class.svg @@ -1,6 +1,6 @@ - + @@ -9,175 +9,175 @@ - - + + ProductA - + - + ~ProductA() constexpr = default : void - + - + sell(int price) const = 0 : bool - - + + ProductA1 - + - + sell(int price) const : bool - - + + ProductA2 - + - + sell(int price) const : bool - - + + ProductB - + - + ~ProductB() constexpr = default : void - + - + buy(int price) const = 0 : bool - - + + ProductB1 - + - + buy(int price) const : bool - - + + ProductB2 - + - + buy(int price) const : bool - - + + AbstractFactory - + - + make_a() const = 0 : std::unique_ptr<ProductA> - + - + make_b() const = 0 : std::unique_ptr<ProductB> - - + + Factory1 - + - + make_a() const : std::unique_ptr<ProductA> - + - + make_b() const : std::unique_ptr<ProductB> - - + + Factory2 - + - + make_a() const : std::unique_ptr<ProductA> - + - + make_b() const : std::unique_ptr<ProductB> diff --git a/docs/test_cases/t00020_class_mermaid.svg b/docs/test_cases/t00020_class_mermaid.svg new file mode 100644 index 00000000..cfa8e199 --- /dev/null +++ b/docs/test_cases/t00020_class_mermaid.svg @@ -0,0 +1,433 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + + +
+ «abstract» +
+
+ +
+ ProductA +
+
+ +
+ +~ProductA() : [default,constexpr] void +
+
+ +
+ +sell(int price) : [const] bool +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ProductA1 +
+
+ +
+ +sell(int price) : [const] bool +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ProductA2 +
+
+ +
+ +sell(int price) : [const] bool +
+
+
+
+
+ + + + + + + +
+ «abstract» +
+
+ +
+ ProductB +
+
+ +
+ +~ProductB() : [default,constexpr] void +
+
+ +
+ +buy(int price) : [const] bool +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ProductB1 +
+
+ +
+ +buy(int price) : [const] bool +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ProductB2 +
+
+ +
+ +buy(int price) : [const] bool +
+
+
+
+
+ + + + + + + +
+ «abstract» +
+
+ +
+ AbstractFactory +
+
+ +
+ +make_a() : [const] std::unique_ptr<ProductA> +
+
+ +
+ +make_b() : [const] std::unique_ptr<ProductB> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Factory1 +
+
+ +
+ +make_a() : [const] std::unique_ptr<ProductA> +
+
+ +
+ +make_b() : [const] std::unique_ptr<ProductB> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Factory2 +
+
+ +
+ +make_a() : [const] std::unique_ptr<ProductA> +
+
+ +
+ +make_b() : [const] std::unique_ptr<ProductB> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00021.md b/docs/test_cases/t00021.md index f9914636..397d2607 100644 --- a/docs/test_cases/t00021.md +++ b/docs/test_cases/t00021.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00021_class: type: class @@ -70,8 +70,10 @@ public: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00021_class](./t00021_class.svg "Visitor pattern") +## Generated Mermaid diagrams +![t00021_class](./t00021_class_mermaid.svg "Visitor pattern") ## Generated JSON models ```json { @@ -132,7 +134,7 @@ public: "parameters": [ { "name": "item", - "type": "const clanguml::t00021::A &" + "type": "const A &" } ], "source_location": { @@ -162,7 +164,7 @@ public: "parameters": [ { "name": "item", - "type": "const clanguml::t00021::B &" + "type": "const B &" } ], "source_location": { @@ -222,7 +224,7 @@ public: "parameters": [ { "name": "item", - "type": "const clanguml::t00021::A &" + "type": "const A &" } ], "source_location": { @@ -252,7 +254,7 @@ public: "parameters": [ { "name": "item", - "type": "const clanguml::t00021::B &" + "type": "const B &" } ], "source_location": { @@ -312,7 +314,7 @@ public: "parameters": [ { "name": "item", - "type": "const clanguml::t00021::A &" + "type": "const A &" } ], "source_location": { @@ -342,7 +344,7 @@ public: "parameters": [ { "name": "item", - "type": "const clanguml::t00021::B &" + "type": "const B &" } ], "source_location": { @@ -402,7 +404,7 @@ public: "parameters": [ { "name": "item", - "type": "const clanguml::t00021::A &" + "type": "const A &" } ], "source_location": { @@ -432,7 +434,7 @@ public: "parameters": [ { "name": "item", - "type": "const clanguml::t00021::B &" + "type": "const B &" } ], "source_location": { @@ -510,7 +512,7 @@ public: "parameters": [ { "name": "visitor", - "type": "const clanguml::t00021::Visitor &" + "type": "const Visitor &" } ], "source_location": { @@ -570,7 +572,7 @@ public: "parameters": [ { "name": "visitor", - "type": "const clanguml::t00021::Visitor &" + "type": "const Visitor &" } ], "source_location": { @@ -630,7 +632,7 @@ public: "parameters": [ { "name": "visitor", - "type": "const clanguml::t00021::Visitor &" + "type": "const Visitor &" } ], "source_location": { @@ -655,8 +657,8 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00021_class", diff --git a/docs/test_cases/t00021_class.svg b/docs/test_cases/t00021_class.svg index 17428c24..39ec0cd5 100644 --- a/docs/test_cases/t00021_class.svg +++ b/docs/test_cases/t00021_class.svg @@ -1,6 +1,6 @@ - + @@ -9,152 +9,152 @@ - - + + Visitor - + - + ~Visitor() constexpr = default : void - + - + visit_A(const A & item) const = 0 : void - + - + visit_B(const B & item) const = 0 : void - - + + Visitor1 - + - + visit_A(const A & item) const : void - + - + visit_B(const B & item) const : void - - + + Visitor2 - + - + visit_A(const A & item) const : void - + - + visit_B(const B & item) const : void - - + + Visitor3 - + - + visit_A(const A & item) const : void - + - + visit_B(const B & item) const : void - - + + Item - + - + ~Item() constexpr = default : void - + - + accept(const Visitor & visitor) const = 0 : void - - + + A - + - + accept(const Visitor & visitor) const : void - - + + B - + - + accept(const Visitor & visitor) const : void diff --git a/docs/test_cases/t00021_class_mermaid.svg b/docs/test_cases/t00021_class_mermaid.svg new file mode 100644 index 00000000..8fe319e9 --- /dev/null +++ b/docs/test_cases/t00021_class_mermaid.svg @@ -0,0 +1,440 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + + +
+ «abstract» +
+
+ +
+ Visitor +
+
+ +
+ +~Visitor() : [default,constexpr] void +
+
+ +
+ +visit_A(const A & item) : [const] void +
+
+ +
+ +visit_B(const B & item) : [const] void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Visitor1 +
+
+ +
+ +visit_A(const A & item) : [const] void +
+
+ +
+ +visit_B(const B & item) : [const] void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Visitor2 +
+
+ +
+ +visit_A(const A & item) : [const] void +
+
+ +
+ +visit_B(const B & item) : [const] void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Visitor3 +
+
+ +
+ +visit_A(const A & item) : [const] void +
+
+ +
+ +visit_B(const B & item) : [const] void +
+
+
+
+
+ + + + + + + +
+ «abstract» +
+
+ +
+ Item +
+
+ +
+ +~Item() : [default,constexpr] void +
+
+ +
+ +accept(const Visitor & visitor) : [const] void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A +
+
+ +
+ +accept(const Visitor & visitor) : [const] void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+ +
+ +accept(const Visitor & visitor) : [const] void +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00022.md b/docs/test_cases/t00022.md index 33b26714..8556cb6d 100644 --- a/docs/test_cases/t00022.md +++ b/docs/test_cases/t00022.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00022_class: type: class @@ -51,8 +51,10 @@ protected: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00022_class](./t00022_class.svg "Template method pattern") +## Generated Mermaid diagrams +![t00022_class](./t00022_class_mermaid.svg "Template method pattern") ## Generated JSON models ```json { @@ -318,8 +320,8 @@ protected: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00022_class", diff --git a/docs/test_cases/t00022_class.svg b/docs/test_cases/t00022_class.svg index c304fffb..e5036a25 100644 --- a/docs/test_cases/t00022_class.svg +++ b/docs/test_cases/t00022_class.svg @@ -1,6 +1,6 @@ - + @@ -9,76 +9,76 @@ - - + + A - + - + method1() = 0 : void - + - + method2() = 0 : void - + - + template_method() : void - - + + A1 - + - + method1() : void - + - + method2() : void - - + + A2 - + - + method1() : void - + - + method2() : void diff --git a/docs/test_cases/t00022_class_mermaid.svg b/docs/test_cases/t00022_class_mermaid.svg new file mode 100644 index 00000000..90f77c1b --- /dev/null +++ b/docs/test_cases/t00022_class_mermaid.svg @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + + +
+ «abstract» +
+
+ +
+ A +
+
+ +
+ #method1() : void +
+
+ +
+ #method2() : void +
+
+ +
+ +template_method() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A1 +
+
+ +
+ #method1() : void +
+
+ +
+ #method2() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A2 +
+
+ +
+ #method1() : void +
+
+ +
+ #method2() : void +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00023.md b/docs/test_cases/t00023.md index 41abff3e..c4fb4c92 100644 --- a/docs/test_cases/t00023.md +++ b/docs/test_cases/t00023.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00023_class: type: class @@ -60,8 +60,10 @@ private: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00023_class](./t00023_class.svg "Strategy pattern") +## Generated Mermaid diagrams +![t00023_class](./t00023_class_mermaid.svg "Strategy pattern") ## Generated JSON models ```json { @@ -398,8 +400,8 @@ private: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00023_class", diff --git a/docs/test_cases/t00023_class.svg b/docs/test_cases/t00023_class.svg index 1cbb3f5a..0b30fab2 100644 --- a/docs/test_cases/t00023_class.svg +++ b/docs/test_cases/t00023_class.svg @@ -1,6 +1,6 @@ - + @@ -9,102 +9,102 @@ - - + + Strategy - + - + ~Strategy() constexpr = default : void - + - + algorithm() = 0 : void - - + + StrategyA - + - + algorithm() : void - - + + StrategyB - + - + algorithm() : void - - + + StrategyC - + - + algorithm() : void - - + + Context - + - + Context(std::unique_ptr<Strategy> strategy) : void - + - + apply() : void - + - + m_strategy : std::unique_ptr<Strategy> diff --git a/docs/test_cases/t00023_class_mermaid.svg b/docs/test_cases/t00023_class_mermaid.svg new file mode 100644 index 00000000..012d3109 --- /dev/null +++ b/docs/test_cases/t00023_class_mermaid.svg @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + -m_strategy + +
+
+
+
+
+ + + + + + + + +
+ «abstract» +
+
+ +
+ Strategy +
+
+ +
+ +~Strategy() : [default,constexpr] void +
+
+ +
+ +algorithm() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ StrategyA +
+
+ +
+ +algorithm() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ StrategyB +
+
+ +
+ +algorithm() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ StrategyC +
+
+ +
+ +algorithm() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Context +
+
+ +
+ -m_strategy : std::unique_ptr<Strategy> +
+
+ +
+ +Context(std::unique_ptr strategy) : void +
+
+ +
+ +apply() : void +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00024.md b/docs/test_cases/t00024.md index b45ba2be..1acf38a3 100644 --- a/docs/test_cases/t00024.md +++ b/docs/test_cases/t00024.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00024_class: type: class @@ -59,8 +59,10 @@ private: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00024_class](./t00024_class.svg "Proxy pattern") +## Generated Mermaid diagrams +![t00024_class](./t00024_class_mermaid.svg "Proxy pattern") ## Generated JSON models ```json { @@ -449,8 +451,8 @@ private: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00024_class", diff --git a/docs/test_cases/t00024_class.svg b/docs/test_cases/t00024_class.svg index 35606c41..0f7f46b6 100644 --- a/docs/test_cases/t00024_class.svg +++ b/docs/test_cases/t00024_class.svg @@ -1,6 +1,6 @@ - + @@ -9,115 +9,115 @@ - - + + Target - + - + ~Target() = 0 : void - + - + m1() = 0 : void - + - + m2() = 0 : void - - + + Target1 - + - + m1() : void - + - + m2() : void - - + + Target2 - + - + m1() : void - + - + m2() : void - - + + Proxy - + - + Proxy(std::shared_ptr<Target> target) : void - + - + m1() : void - + - + m2() : void - + - + m_target : std::shared_ptr<Target> diff --git a/docs/test_cases/t00024_class_mermaid.svg b/docs/test_cases/t00024_class_mermaid.svg new file mode 100644 index 00000000..e4f10d43 --- /dev/null +++ b/docs/test_cases/t00024_class_mermaid.svg @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + -m_target + +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + + +
+ «abstract» +
+
+ +
+ Target +
+
+ +
+ +~Target() : void +
+
+ +
+ +m1() : void +
+
+ +
+ +m2() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Target1 +
+
+ +
+ +m1() : void +
+
+ +
+ +m2() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Target2 +
+
+ +
+ +m1() : void +
+
+ +
+ +m2() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Proxy +
+
+ +
+ -m_target : std::shared_ptr<Target> +
+
+ +
+ +Proxy(std::shared_ptr target) : void +
+
+ +
+ +m1() : void +
+
+ +
+ +m2() : void +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00025.md b/docs/test_cases/t00025.md index 96b3d860..15ccdb9b 100644 --- a/docs/test_cases/t00025.md +++ b/docs/test_cases/t00025.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00025_class: type: class @@ -57,8 +57,10 @@ public: } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00025_class](./t00025_class.svg "Template proxy pattern") +## Generated Mermaid diagrams +![t00025_class](./t00025_class_mermaid.svg "Template proxy pattern") ## Generated JSON models ```json { @@ -411,7 +413,7 @@ public: "line": 33, "translation_unit": "../../tests/t00025/t00025.cc" }, - "type": "Proxy" + "type": "Proxy" }, { "access": "public", @@ -423,7 +425,7 @@ public: "line": 34, "translation_unit": "../../tests/t00025/t00025.cc" }, - "type": "Proxy" + "type": "Proxy" } ], "methods": [], @@ -440,8 +442,8 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00025_class", diff --git a/docs/test_cases/t00025_class.svg b/docs/test_cases/t00025_class.svg index 0f0d17a5..dd6d260b 100644 --- a/docs/test_cases/t00025_class.svg +++ b/docs/test_cases/t00025_class.svg @@ -1,6 +1,6 @@ - + @@ -9,52 +9,52 @@ - - + + Target1 - + - + m1() : void - + - + m2() : void - - + + Target2 - + - + m1() : void - + - + m2() : void - - + + Proxy @@ -62,38 +62,38 @@ T - + - + Proxy(std::shared_ptr<T> target) : void - + - + m1() : void - + - + m2() : void - + - + m_target : std::shared_ptr<T> - - + + Proxy @@ -102,8 +102,8 @@ - - + + Proxy @@ -112,26 +112,26 @@ - - + + ProxyHolder - + - + proxy1 : Proxy<Target1> - + - + proxy2 : Proxy<Target2> diff --git a/docs/test_cases/t00025_class_mermaid.svg b/docs/test_cases/t00025_class_mermaid.svg new file mode 100644 index 00000000..60883db7 --- /dev/null +++ b/docs/test_cases/t00025_class_mermaid.svg @@ -0,0 +1,296 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +proxy1 + +
+
+
+
+ + + +
+ + +proxy2 + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ Target1 +
+
+ +
+ +m1() : void +
+
+ +
+ +m2() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Target2 +
+
+ +
+ +m1() : void +
+
+ +
+ +m2() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Proxy<T> +
+
+ +
+ -m_target : std::shared_ptr<T> +
+
+ +
+ +Proxy(std::shared_ptr target) : void +
+
+ +
+ +m1() : void +
+
+ +
+ +m2() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Proxy<Target1> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Proxy<Target2> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ProxyHolder +
+
+ +
+ +proxy1 : Proxy<Target1> +
+
+ +
+ +proxy2 : Proxy<Target2> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00026.md b/docs/test_cases/t00026.md index f6d0343b..3bfa639b 100644 --- a/docs/test_cases/t00026.md +++ b/docs/test_cases/t00026.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00026_class: type: class @@ -78,8 +78,10 @@ struct StringMemento { } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00026_class](./t00026_class.svg "Template memento pattern") +## Generated Mermaid diagrams +![t00026_class](./t00026_class_mermaid.svg "Template memento pattern") ## Generated JSON models ```json { @@ -580,8 +582,8 @@ struct StringMemento { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00026_class", diff --git a/docs/test_cases/t00026_class.svg b/docs/test_cases/t00026_class.svg index 8abd603d..3c3444f7 100644 --- a/docs/test_cases/t00026_class.svg +++ b/docs/test_cases/t00026_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + Memento @@ -18,31 +18,31 @@ T - + - + Memento(T && v) : void - + - + value() const : T - + - + m_value : T - - + + Originator @@ -50,52 +50,52 @@ T - + - + Originator(T && v) : void - + - + load(const Memento<T> & m) : void - + - + memoize_value() const : Memento<T> - + - + print() const : void - + - + set(T && v) : void - + - + m_value : T - - + + Caretaker @@ -103,30 +103,30 @@ T - + - + set_state(const std::string & s, Memento<T> && m) : void - + - + state(const std::string & n) : Memento<T> & - + - + m_mementos : std::unordered_map<std::string,Memento<T>> - - + + Caretaker @@ -135,8 +135,8 @@ - - + + Originator @@ -145,26 +145,26 @@ - - + + StringMemento - + - + caretaker : Caretaker<std::string> - + - + originator : Originator<std::string> diff --git a/docs/test_cases/t00026_class_mermaid.svg b/docs/test_cases/t00026_class_mermaid.svg new file mode 100644 index 00000000..e40562f5 --- /dev/null +++ b/docs/test_cases/t00026_class_mermaid.svg @@ -0,0 +1,316 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + -m_mementos + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +caretaker + +
+
+
+
+ + + +
+ + +originator + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ Memento<T> +
+
+ +
+ -m_value : T +
+
+ +
+ +Memento(T && v) : void +
+
+ +
+ +value() : [const] T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Originator<T> +
+
+ +
+ -m_value : T +
+
+ +
+ +Originator(T && v) : void +
+
+ +
+ +load(const Memento & m) : void +
+
+ +
+ +memoize_value() : [const] Memento<T> +
+
+ +
+ +print() : [const] void +
+
+ +
+ +set(T && v) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Caretaker<T> +
+
+ +
+ -m_mementos : std::unordered_map<std::string,Memento<T>> +
+
+ +
+ +set_state(const std::string & s, Memento && m) : void +
+
+ +
+ +state(const std::string & n) : Memento<T> & +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Caretaker<std::string> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Originator<std::string> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ StringMemento +
+
+ +
+ +caretaker : Caretaker<std::string> +
+
+ +
+ +originator : Originator<std::string> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00027.md b/docs/test_cases/t00027.md index 462e782d..fd520716 100644 --- a/docs/test_cases/t00027.md +++ b/docs/test_cases/t00027.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00027_class: type: class @@ -75,8 +75,10 @@ struct Window { } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00027_class](./t00027_class.svg "Template decorator pattern") +## Generated Mermaid diagrams +![t00027_class](./t00027_class_mermaid.svg "Template decorator pattern") ## Generated JSON models ```json { @@ -708,8 +710,8 @@ struct Window { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00027_class", diff --git a/docs/test_cases/t00027_class.svg b/docs/test_cases/t00027_class.svg index f47e5821..9ac82bf9 100644 --- a/docs/test_cases/t00027_class.svg +++ b/docs/test_cases/t00027_class.svg @@ -1,6 +1,6 @@ - + @@ -9,39 +9,39 @@ - - + + Shape - + - + ~Shape() constexpr = default : void - + - + display() = 0 : void - - + + Line - - + + Line @@ -49,24 +49,24 @@ T<>... - + - + display() : void - - + + Text - - + + Text @@ -74,31 +74,31 @@ T<>... - + - + display() : void - - + + ShapeDecorator - + - + display() = 0 : void - - + + Color @@ -106,16 +106,16 @@ T - + - + display() : void - - + + Weight @@ -123,16 +123,16 @@ T - + - + display() : void - - + + Line @@ -141,8 +141,8 @@ - - + + Line @@ -151,8 +151,8 @@ - - + + Text @@ -161,8 +161,8 @@ - - + + Text @@ -171,40 +171,40 @@ - - + + Window - + - + border : Line<Color,Weight> - + - + description : Text<Color> - + - + divider : Line<Color> - + - + title : Text<Color,Weight> diff --git a/docs/test_cases/t00027_class_mermaid.svg b/docs/test_cases/t00027_class_mermaid.svg new file mode 100644 index 00000000..81baedaf --- /dev/null +++ b/docs/test_cases/t00027_class_mermaid.svg @@ -0,0 +1,498 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +border + +
+
+
+
+ + + +
+ + +divider + +
+
+
+
+ + + +
+ + +title + +
+
+
+
+ + + +
+ + +description + +
+
+
+
+
+ + + + + + + + +
+ «abstract» +
+
+ +
+ Shape +
+
+ +
+ +~Shape() : [default,constexpr] void +
+
+ +
+ +display() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Line +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Line<T<>...> +
+
+ +
+ +display() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Text +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Text<T<>...> +
+
+ +
+ +display() : void +
+
+
+
+
+ + + + + + + +
+ «abstract» +
+
+ +
+ ShapeDecorator +
+
+ +
+ +display() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Color<T> +
+
+ +
+ +display() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Weight<T> +
+
+ +
+ +display() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Line<Color,Weight> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Line<Color> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Text<Color,Weight> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Text<Color> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Window +
+
+ +
+ +border : Line<Color,Weight> +
+
+ +
+ +description : Text<Color> +
+
+ +
+ +divider : Line<Color> +
+
+ +
+ +title : Text<Color,Weight> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00028.md b/docs/test_cases/t00028.md index 1e891cd4..c6a1545b 100644 --- a/docs/test_cases/t00028.md +++ b/docs/test_cases/t00028.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00028_class: type: class @@ -84,8 +84,10 @@ class R { } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00028_class](./t00028_class.svg "PlantUML note decorator test case") +## Generated Mermaid diagrams +![t00028_class](./t00028_class_mermaid.svg "PlantUML note decorator test case") ## Generated JSON models ```json { @@ -347,7 +349,7 @@ class R { "line": 43, "translation_unit": "../../tests/t00028/t00028.cc" }, - "type": "clanguml::t00028::A" + "type": "A" }, { "access": "private", @@ -363,7 +365,7 @@ class R { "line": 46, "translation_unit": "../../tests/t00028/t00028.cc" }, - "type": "clanguml::t00028::B *" + "type": "B *" }, { "access": "private", @@ -375,7 +377,7 @@ class R { "line": 48, "translation_unit": "../../tests/t00028/t00028.cc" }, - "type": "clanguml::t00028::C &" + "type": "C &" }, { "access": "private", @@ -411,7 +413,7 @@ class R { "line": 54, "translation_unit": "../../tests/t00028/t00028.cc" }, - "type": "clanguml::t00028::G **" + "type": "G **" } ], "methods": [ @@ -434,7 +436,7 @@ class R { "parameters": [ { "name": "c", - "type": "clanguml::t00028::C &" + "type": "C &" } ], "source_location": { @@ -459,8 +461,8 @@ class R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00028_class", diff --git a/docs/test_cases/t00028_class.svg b/docs/test_cases/t00028_class.svg index 2516af12..76ccc984 100644 --- a/docs/test_cases/t00028_class.svg +++ b/docs/test_cases/t00028_class.svg @@ -1,6 +1,6 @@ - + @@ -9,54 +9,54 @@ - - + + A - + A class note. - - + + B - + B class note. - - + + C - + C class note. - - + + D - + D class note. - - + + E @@ -65,26 +65,26 @@ - + - + param : T - + E template class note. - - + + G - - + + F @@ -94,11 +94,11 @@ three - + F enum note. - - + + E @@ -107,70 +107,70 @@ - - + + R - + - + R(C & c) : void - + - + aaa : A - + - + bbb : B * - + - + ccc : C & - + - + ddd : std::vector<std::shared_ptr<D>> - + - + eee : E<int> - + - + ggg : G ** - + R class note. - + R contains an instance of A. - + Reference to C. diff --git a/docs/test_cases/t00028_class_mermaid.svg b/docs/test_cases/t00028_class_mermaid.svg new file mode 100644 index 00000000..6090b9b0 --- /dev/null +++ b/docs/test_cases/t00028_class_mermaid.svg @@ -0,0 +1,538 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + -aaa + +
+
+
+
+ + + +
+ + -bbb + +
+
+
+
+ + + +
+ + -ccc + +
+
+
+
+ + + +
+ + -ddd + +
+
+
+
+ + + +
+ + -eee + +
+
+
+
+ + + +
+ + -ggg + +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E<T> +
+
+ +
+ -param : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ G +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ F +
+
+ +
+ one +
+
+ +
+ two +
+
+ +
+ three +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E<int> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ -aaa : A +
+
+ +
+ -bbb : B +
+
+ +
+ -ccc : C & +
+
+ +
+ -ddd : std::vector<std::shared_ptr<D>> +
+
+ +
+ -eee : E<int> +
+
+ +
+ -ggg : G * +
+
+ +
+ -R(C & c) : void +
+
+
+
+
+ + + + + +
+ A class note. +
+
+
+
+ + + + + +
+ B class note. +
+
+
+
+ + + + + +
+ C class note. +
+
+
+
+ + + + + +
+ D
class
note.
+
+
+
+
+ + + + + +
+ E template class note. +
+
+
+
+ + + + + +
+ F enum note. +
+
+
+
+ + + + + +
+ R class note. +
+
+
+
+ + + + + +
+ R contains an instance of A. +
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00029.md b/docs/test_cases/t00029.md index e8b5898d..3d463517 100644 --- a/docs/test_cases/t00029.md +++ b/docs/test_cases/t00029.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00029_class: type: class @@ -67,8 +67,10 @@ struct R { } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00029_class](./t00029_class.svg "PlantUML skip decorator test case") +## Generated Mermaid diagrams +![t00029_class](./t00029_class_mermaid.svg "PlantUML skip decorator test case") ## Generated JSON models ```json { @@ -265,7 +267,7 @@ struct R { "line": 35, "translation_unit": "../../tests/t00029/t00029.cc" }, - "type": "clanguml::t00029::G1" + "type": "G1" }, { "access": "public", @@ -281,7 +283,7 @@ struct R { "line": 41, "translation_unit": "../../tests/t00029/t00029.cc" }, - "type": "clanguml::t00029::G3 &" + "type": "G3 &" }, { "access": "public", @@ -310,8 +312,8 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00029_class", diff --git a/docs/test_cases/t00029_class.svg b/docs/test_cases/t00029_class.svg index 2b962eaf..e394baeb 100644 --- a/docs/test_cases/t00029_class.svg +++ b/docs/test_cases/t00029_class.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - + + A - - + + C @@ -27,15 +27,15 @@ - + - + param : T - - + + E @@ -45,65 +45,65 @@ three - - + + G1 - - + + G2 - - + + G3 - - + + G4 - - + + R - + - + g1 : G1 - + - + g3 : G3 & - + - + g4 : std::shared_ptr<G4> diff --git a/docs/test_cases/t00029_class_mermaid.svg b/docs/test_cases/t00029_class_mermaid.svg new file mode 100644 index 00000000..781ce2ac --- /dev/null +++ b/docs/test_cases/t00029_class_mermaid.svg @@ -0,0 +1,271 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +g1 + +
+
+
+
+ + + +
+ + +g4 + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C<T> +
+
+ +
+ -param : T +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ E +
+
+ +
+ one +
+
+ +
+ two +
+
+ +
+ three +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ G1 +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ G2 +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ G3 +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ G4 +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +g1 : G1 +
+
+ +
+ +g3 : G3 & +
+
+ +
+ +g4 : std::shared_ptr<G4> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00030.md b/docs/test_cases/t00030.md index f375d031..76522228 100644 --- a/docs/test_cases/t00030.md +++ b/docs/test_cases/t00030.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00030_class: type: class @@ -55,8 +55,10 @@ struct R { } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00030_class](./t00030_class.svg "PlantUML relationship decorators test case") +## Generated Mermaid diagrams +![t00030_class](./t00030_class_mermaid.svg "PlantUML relationship decorators test case") ## Generated JSON models ```json { @@ -196,7 +198,7 @@ struct R { "line": 19, "translation_unit": "../../tests/t00030/t00030.cc" }, - "type": "clanguml::t00030::A" + "type": "A" }, { "access": "public", @@ -244,7 +246,7 @@ struct R { "line": 28, "translation_unit": "../../tests/t00030/t00030.cc" }, - "type": "clanguml::t00030::D" + "type": "D" }, { "access": "public", @@ -260,7 +262,7 @@ struct R { "line": 31, "translation_unit": "../../tests/t00030/t00030.cc" }, - "type": "clanguml::t00030::E *" + "type": "E *" } ], "methods": [], @@ -277,8 +279,8 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00030_class", diff --git a/docs/test_cases/t00030_class.svg b/docs/test_cases/t00030_class.svg index bb2a5012..7374e73d 100644 --- a/docs/test_cases/t00030_class.svg +++ b/docs/test_cases/t00030_class.svg @@ -1,6 +1,6 @@ - + @@ -9,87 +9,87 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + aaa : A - + - + bbb : std::vector<B> - + - + ccc : std::vector<C> - + - + ddd : D - + - + eee : E * diff --git a/docs/test_cases/t00030_class_mermaid.svg b/docs/test_cases/t00030_class_mermaid.svg new file mode 100644 index 00000000..c3126a44 --- /dev/null +++ b/docs/test_cases/t00030_class_mermaid.svg @@ -0,0 +1,309 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +aaa + +
+
+
+
+ + + +
+ + +bbb + +
+
+
+
+ + + +
+ 0..1 +
+
+
+
+ + + +
+ 1..* +
+
+
+ + + +
+ + +ccc + +
+
+
+
+ + + +
+ 0..1 +
+
+
+
+ + + +
+ 1..5 +
+
+
+ + + +
+ + +ddd + +
+
+
+
+ + + +
+ 1 +
+
+
+ + + +
+ + +eee + +
+
+
+
+ + + +
+ 1 +
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +aaa : A +
+
+ +
+ +bbb : std::vector<B> +
+
+ +
+ +ccc : std::vector<C> +
+
+ +
+ +ddd : D +
+
+ +
+ +eee : E +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00031.md b/docs/test_cases/t00031.md index 456a1c3a..c4189cc1 100644 --- a/docs/test_cases/t00031.md +++ b/docs/test_cases/t00031.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00031_class: type: class @@ -59,8 +59,10 @@ struct R { } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00031_class](./t00031_class.svg "PlantUML style decorator test case") +## Generated Mermaid diagrams +![t00031_class](./t00031_class_mermaid.svg "PlantUML style decorator test case") ## Generated JSON models ```json { @@ -236,7 +238,7 @@ struct R { "line": 22, "translation_unit": "../../tests/t00031/t00031.cc" }, - "type": "clanguml::t00031::A *" + "type": "A *" }, { "access": "public", @@ -284,7 +286,7 @@ struct R { "line": 34, "translation_unit": "../../tests/t00031/t00031.cc" }, - "type": "clanguml::t00031::D *" + "type": "D *" } ], "methods": [ @@ -307,7 +309,7 @@ struct R { "parameters": [ { "name": "b", - "type": "clanguml::t00031::B" + "type": "B" } ], "source_location": { @@ -332,8 +334,8 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00031_class", diff --git a/docs/test_cases/t00031_class.svg b/docs/test_cases/t00031_class.svg index 6d4f932e..bbeb27af 100644 --- a/docs/test_cases/t00031_class.svg +++ b/docs/test_cases/t00031_class.svg @@ -1,33 +1,33 @@ - + - + - + - - - + + + A - - + + B @@ -37,8 +37,8 @@ three - - + + @@ -48,23 +48,23 @@ - + - + ttt : T - - + + D - - + + C @@ -73,47 +73,47 @@ - - + + R - + - + add_b(B b) : void - + - + aaa : A * - + - + bbb : std::vector<B> - + - + ccc : C<int> - + - + ddd : D * diff --git a/docs/test_cases/t00031_class_mermaid.svg b/docs/test_cases/t00031_class_mermaid.svg new file mode 100644 index 00000000..6e6ae3cb --- /dev/null +++ b/docs/test_cases/t00031_class_mermaid.svg @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +aaa + +
+
+
+
+ + + +
+ + +bbb + +
+
+
+
+ + + +
+ + +ccc + +
+
+
+
+ + + +
+ + +ddd + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ B +
+
+ +
+ one +
+
+ +
+ two +
+
+ +
+ three +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C<T> +
+
+ +
+ -ttt : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C<int> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +aaa : A +
+
+ +
+ +bbb : std::vector<B> +
+
+ +
+ +ccc : C<int> +
+
+ +
+ +ddd : D +
+
+ +
+ +add_b(B b) : void +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00032.md b/docs/test_cases/t00032.md index 8c5756a2..a89bcbd6 100644 --- a/docs/test_cases/t00032.md +++ b/docs/test_cases/t00032.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00032_class: type: class @@ -56,8 +56,10 @@ struct R { } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00032_class](./t00032_class.svg "Class template with template base classes test case") +## Generated Mermaid diagrams +![t00032_class](./t00032_class_mermaid.svg "Class template with template base classes test case") ## Generated JSON models ```json { @@ -410,7 +412,7 @@ struct R { "line": 32, "translation_unit": "../../tests/t00032/t00032.cc" }, - "type": "Overload" + "type": "Overload" } ], "methods": [], @@ -427,8 +429,8 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00032_class", diff --git a/docs/test_cases/t00032_class.svg b/docs/test_cases/t00032_class.svg index cc05752d..19b48ccc 100644 --- a/docs/test_cases/t00032_class.svg +++ b/docs/test_cases/t00032_class.svg @@ -1,6 +1,6 @@ - + @@ -9,69 +9,69 @@ - - + + Base - - + + TBase - - + + A - + - + operator()() : void - - + + B - + - + operator()() : void - - + + C - + - + operator()() : void - - + + Overload @@ -80,15 +80,15 @@ - + - + counter : L - - + + Overload @@ -97,19 +97,19 @@ - - + + R - + - + overload : Overload<TBase,int,A,B,C> diff --git a/docs/test_cases/t00032_class_mermaid.svg b/docs/test_cases/t00032_class_mermaid.svg new file mode 100644 index 00000000..83a16aac --- /dev/null +++ b/docs/test_cases/t00032_class_mermaid.svg @@ -0,0 +1,311 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + +overload + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ Base +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ TBase +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A +
+
+ +
+ +operator() : ) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+ +
+ +operator() : ) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C +
+
+ +
+ +operator() : ) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Overload<T,L,Ts...> +
+
+ +
+ +counter : L +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Overload<TBase,int,A,B,C> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +overload : Overload<TBase,int,A,B,C> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00033.md b/docs/test_cases/t00033.md index 35542ceb..ced2d5af 100644 --- a/docs/test_cases/t00033.md +++ b/docs/test_cases/t00033.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00033_class: type: class @@ -48,8 +48,10 @@ struct R { } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00033_class](./t00033_class.svg "Nested template instantiation dependency test case") +## Generated Mermaid diagrams +![t00033_class](./t00033_class_mermaid.svg "Nested template instantiation dependency test case") ## Generated JSON models ```json { @@ -231,8 +233,8 @@ struct R { "namespace": "clanguml::t00033", "source_location": { "column": 11, - "file": "../../../../../../usr/include/c++/12/bits/unique_ptr.h", - "line": 269, + "file": "../../../../../../usr/include/c++/11/bits/unique_ptr.h", + "line": 242, "translation_unit": "../../tests/t00033/t00033.cc" }, "template_parameters": [ @@ -375,8 +377,8 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00033_class", diff --git a/docs/test_cases/t00033_class.svg b/docs/test_cases/t00033_class.svg index ee759801..1568f5cc 100644 --- a/docs/test_cases/t00033_class.svg +++ b/docs/test_cases/t00033_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -19,15 +19,15 @@ - + - + aaa : T - - + + B @@ -36,15 +36,15 @@ - + - + bbb : T - - + + C @@ -53,30 +53,30 @@ - + - + ccc : T - - + + D - + - + ddd : int - - + + C @@ -85,8 +85,8 @@ - - + + B @@ -95,8 +95,8 @@ - - + + A @@ -105,19 +105,19 @@ - - + + R - + - + abc : A<B<std::unique_ptr<C<D>>>> diff --git a/docs/test_cases/t00033_class_mermaid.svg b/docs/test_cases/t00033_class_mermaid.svg new file mode 100644 index 00000000..5726ca14 --- /dev/null +++ b/docs/test_cases/t00033_class_mermaid.svg @@ -0,0 +1,321 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +abc + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A<T> +
+
+ +
+ +aaa : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<T> +
+
+ +
+ +bbb : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C<T> +
+
+ +
+ +ccc : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D +
+
+ +
+ +ddd : int +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C<D> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<std::unique_ptr<C<D>>> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<B<std::unique_ptr<C<D>>>> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +abc : A<B<std::unique_ptr<C<D>>>> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00034.md b/docs/test_cases/t00034.md index 84570b84..e6dac289 100644 --- a/docs/test_cases/t00034.md +++ b/docs/test_cases/t00034.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00034_class: type: class @@ -74,8 +74,10 @@ struct R { } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00034_class](./t00034_class.svg "Template metaprogramming type function test case") +## Generated Mermaid diagrams +![t00034_class](./t00034_class_mermaid.svg "Template metaprogramming type function test case") ## Generated JSON models ```json { @@ -111,7 +113,7 @@ struct R { "parameters": [ { "name": "", - "type": "const clanguml::t00034::Void &" + "type": "const Void &" } ], "source_location": { @@ -141,7 +143,7 @@ struct R { "parameters": [ { "name": "", - "type": "const clanguml::t00034::Void &" + "type": "const Void &" } ], "source_location": { @@ -322,7 +324,7 @@ struct R { "line": 46, "translation_unit": "../../tests/t00034/t00034.cc" }, - "type": "lift_void_t *" + "type": "lift_void_t *" }, { "access": "public", @@ -351,8 +353,8 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00034_class", diff --git a/docs/test_cases/t00034_class.svg b/docs/test_cases/t00034_class.svg index b36921bc..06b3d655 100644 --- a/docs/test_cases/t00034_class.svg +++ b/docs/test_cases/t00034_class.svg @@ -1,6 +1,6 @@ - + @@ -9,30 +9,30 @@ - - + + Void - + - + operator!=(const Void &) constexpr const : bool - + - + operator==(const Void &) constexpr const : bool - - + + lift_void @@ -41,8 +41,8 @@ - - + + lift_void @@ -51,8 +51,8 @@ - - + + drop_void @@ -61,8 +61,8 @@ - - + + drop_void @@ -71,34 +71,34 @@ - - + + A - - + + R - + - + la : lift_void_t<A> * - + - + lv : lift_void_t<void> * diff --git a/docs/test_cases/t00034_class_mermaid.svg b/docs/test_cases/t00034_class_mermaid.svg new file mode 100644 index 00000000..12988704 --- /dev/null +++ b/docs/test_cases/t00034_class_mermaid.svg @@ -0,0 +1,261 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +la + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ Void +
+
+ +
+ +operator!=(const Void &) : [const,constexpr] bool +
+
+ +
+ +operator==(const Void &) : [const,constexpr] bool +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ lift_void<T> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ lift_void<void> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ drop_void<T> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ drop_void<Void> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +la : lift_void_t<A> +
+
+ +
+ +lv : lift_void_t<void> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00035.md b/docs/test_cases/t00035.md index 9939fe26..0df62c3d 100644 --- a/docs/test_cases/t00035.md +++ b/docs/test_cases/t00035.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00035_class: type: class @@ -41,8 +41,10 @@ struct Right { }; } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00035_class](./t00035_class.svg "PlantUML class diagram layout hints test case") +## Generated Mermaid diagrams +![t00035_class](./t00035_class_mermaid.svg "PlantUML class diagram layout hints test case") ## Generated JSON models ```json { @@ -160,8 +162,8 @@ struct Right { }; } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00035_class", diff --git a/docs/test_cases/t00035_class.svg b/docs/test_cases/t00035_class.svg index bb335c51..1a94f100 100644 --- a/docs/test_cases/t00035_class.svg +++ b/docs/test_cases/t00035_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + Top - - + + Left - - + + Center - - + + Bottom - - + + Right diff --git a/docs/test_cases/t00035_class_mermaid.svg b/docs/test_cases/t00035_class_mermaid.svg new file mode 100644 index 00000000..0780c15d --- /dev/null +++ b/docs/test_cases/t00035_class_mermaid.svg @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ Top +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Left +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Center +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Bottom +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Right +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00036.md b/docs/test_cases/t00036.md index 3b68c378..208897b8 100644 --- a/docs/test_cases/t00036.md +++ b/docs/test_cases/t00036.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00036_class: type: class @@ -67,8 +67,10 @@ struct DImpl : public ns2::ns22::D { }; } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00036_class](./t00036_class.svg "Class diagram with namespaces generated as packages") +## Generated Mermaid diagrams +![t00036_class](./t00036_class_mermaid.svg "Class diagram with namespaces generated as packages") ## Generated JSON models ```json { @@ -276,8 +278,8 @@ struct DImpl : public ns2::ns22::D { }; } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00036_class", diff --git a/docs/test_cases/t00036_class.svg b/docs/test_cases/t00036_class.svg index fcf9a876..b2f4c125 100644 --- a/docs/test_cases/t00036_class.svg +++ b/docs/test_cases/t00036_class.svg @@ -1,6 +1,6 @@ - + @@ -9,23 +9,23 @@ - + ns1 - + ns11 - + ns111 - + ns2 - + ns22 - - + + E @@ -34,8 +34,8 @@ yellow - - + + A @@ -44,15 +44,15 @@ - + - + a : T - - + + A @@ -61,23 +61,23 @@ - - + + B - + - + a_int : A<int> - - + + C diff --git a/docs/test_cases/t00036_class_mermaid.svg b/docs/test_cases/t00036_class_mermaid.svg new file mode 100644 index 00000000..4dd7b187 --- /dev/null +++ b/docs/test_cases/t00036_class_mermaid.svg @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +a_int + +
+
+
+
+ + + +
+ + + +
+
+
+
+
+ + + + + + + + +
+ «enumeration» +
+
+ +
+ ns1::E +
+
+ +
+ blue +
+
+ +
+ yellow +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns11::A<T> +
+
+ +
+ +a : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns11::ns111::B +
+
+ +
+ +a_int : A<int> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns11::A<int> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns2::ns22::C +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00037.md b/docs/test_cases/t00037.md index 98d4409f..4b580bd5 100644 --- a/docs/test_cases/t00037.md +++ b/docs/test_cases/t00037.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00037_class: type: class @@ -53,8 +53,10 @@ struct A { } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00037_class](./t00037_class.svg "Anonymous nested struct test case") +## Generated Mermaid diagrams +![t00037_class](./t00037_class_mermaid.svg "Anonymous nested struct test case") ## Generated JSON models ```json { @@ -245,7 +247,7 @@ struct A { "line": 29, "translation_unit": "../../tests/t00037/t00037.cc" }, - "type": "clanguml::t00037::ST" + "type": "ST" } ], "methods": [ @@ -288,8 +290,8 @@ struct A { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00037_class", diff --git a/docs/test_cases/t00037_class.svg b/docs/test_cases/t00037_class.svg index 6d5a7dd9..6fe47325 100644 --- a/docs/test_cases/t00037_class.svg +++ b/docs/test_cases/t00037_class.svg @@ -1,6 +1,6 @@ - + @@ -9,106 +9,106 @@ - - + + ST - + - + dimensions : ST::(anonymous_662) - + - + units : ST::(anonymous_792) - - + + ST::(dimensions) - + - + t : double - + - + x : double - + - + y : double - + - + z : double - - + + ST::(units) - + - + c : double - + - + h : double - - + + A - + - + A() : void - + - + st : ST diff --git a/docs/test_cases/t00037_class_mermaid.svg b/docs/test_cases/t00037_class_mermaid.svg new file mode 100644 index 00000000..cb2f53bc --- /dev/null +++ b/docs/test_cases/t00037_class_mermaid.svg @@ -0,0 +1,222 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +dimensions + +
+
+
+
+ + + +
+ + -units + +
+
+
+
+ + + +
+ + +st + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ ST +
+
+ +
+ +dimensions : ST::(anonymous_662) +
+
+ +
+ -units : ST::(anonymous_792) +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ST::(dimensions) +
+
+ +
+ +t : double +
+
+ +
+ +x : double +
+
+ +
+ +y : double +
+
+ +
+ +z : double +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ST::(units) +
+
+ +
+ +c : double +
+
+ +
+ +h : double +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A +
+
+ +
+ +st : ST +
+
+ +
+ +A() : void +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00038.md b/docs/test_cases/t00038.md index bf67d3cb..c4f7a113 100644 --- a/docs/test_cases/t00038.md +++ b/docs/test_cases/t00038.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00038_class: type: class @@ -72,8 +72,10 @@ struct map - + @@ -9,8 +9,8 @@ - - + + thirdparty::ns1::color_t @@ -20,16 +20,16 @@ blue - - + + thirdparty::ns1::E - - + + property_t @@ -39,47 +39,47 @@ property_c - - + + A - - + + B - - + + C - - + + key_t - + - + key : std::string - - + + map @@ -88,8 +88,8 @@ - - + + map @@ -98,8 +98,8 @@ - - + + map @@ -108,8 +108,8 @@ - - + + map @@ -118,8 +118,8 @@ - - + + map diff --git a/docs/test_cases/t00038_class_mermaid.svg b/docs/test_cases/t00038_class_mermaid.svg new file mode 100644 index 00000000..a430a1cc --- /dev/null +++ b/docs/test_cases/t00038_class_mermaid.svg @@ -0,0 +1,471 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + + +
+ «enumeration» +
+
+ +
+ thirdparty::ns1::color_t +
+
+ +
+ red +
+
+ +
+ green +
+
+ +
+ blue +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ thirdparty::ns1::E +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ property_t +
+
+ +
+ property_a +
+
+ +
+ property_b +
+
+ +
+ property_c +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ key_t +
+
+ +
+ +key : std::string +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ map<T> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ map<std::integral_constant<thirdparty::ns1::color_t,thirdparty::ns1::color_t::red>> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ map<std::integral_constant<property_t,property_t::property_a>> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ map<std::vector<std::integral_constant<property_t,property_t::property_b>>> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ map<std::map<key_t,std::vector<std::integral_constant<property_t,property_t::property_c>>>> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00039.md b/docs/test_cases/t00039.md index 826bd042..e37cc93b 100644 --- a/docs/test_cases/t00039.md +++ b/docs/test_cases/t00039.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00039_class: type: class @@ -87,8 +87,10 @@ template struct FFF : public FF { } // namespace clanguml::t00039 ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00039_class](./t00039_class.svg "Subclass class diagram filter test") +## Generated Mermaid diagrams +![t00039_class](./t00039_class_mermaid.svg "Subclass class diagram filter test") ## Generated JSON models ```json { @@ -349,7 +351,7 @@ template struct FFF : public FF { "line": 27, "translation_unit": "../../tests/t00039/t00039.cc" }, - "type": "clanguml::t00039::B *" + "type": "B *" } ], "methods": [], @@ -608,8 +610,8 @@ template struct FFF : public FF { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00039_class", diff --git a/docs/test_cases/t00039_class.svg b/docs/test_cases/t00039_class.svg index 77b36048..f95056d5 100644 --- a/docs/test_cases/t00039_class.svg +++ b/docs/test_cases/t00039_class.svg @@ -1,6 +1,6 @@ - + @@ -9,95 +9,95 @@ - - + + C - - + + D - - + + E - - + + CD - - + + DE - - + + CDE - - + + A - - + + AA - - + + AAA - + - + b : B * - - + + ns2::AAAA - - + + ns3::F @@ -106,15 +106,15 @@ - + - + t : T * - - + + ns3::FF @@ -123,15 +123,15 @@ - + - + m : M * - - + + ns3::FE @@ -140,15 +140,15 @@ - + - + m : M * - - + + ns3::FFF @@ -157,11 +157,11 @@ - + - + n : N * diff --git a/docs/test_cases/t00039_class_mermaid.svg b/docs/test_cases/t00039_class_mermaid.svg new file mode 100644 index 00000000..cc4df4b8 --- /dev/null +++ b/docs/test_cases/t00039_class_mermaid.svg @@ -0,0 +1,481 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ C +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ CD +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ DE +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ CDE +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ AA +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ AAA +
+
+ +
+ +b : B +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns2::AAAA +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns3::F<T> +
+
+ +
+ +t : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns3::FF<T,M> +
+
+ +
+ +m : M +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns3::FE<T,M> +
+
+ +
+ +m : M +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns3::FFF<T,M,N> +
+
+ +
+ +n : N +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00040.md b/docs/test_cases/t00040.md index 9987b51a..416292a4 100644 --- a/docs/test_cases/t00040.md +++ b/docs/test_cases/t00040.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00040_class: type: class @@ -63,8 +63,10 @@ struct R { } // namespace clanguml::t00040 ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00040_class](./t00040_class.svg "Relationship and access filter test") +## Generated Mermaid diagrams +![t00040_class](./t00040_class_mermaid.svg "Relationship and access filter test") ## Generated JSON models ```json { @@ -199,7 +201,7 @@ struct R { "line": 25, "translation_unit": "../../tests/t00040/t00040.cc" }, - "type": "clanguml::t00040::B *" + "type": "B *" }, { "access": "private", @@ -282,7 +284,7 @@ struct R { "parameters": [ { "name": "a", - "type": "clanguml::t00040::A *" + "type": "A *" } ], "source_location": { @@ -307,8 +309,8 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00040_class", diff --git a/docs/test_cases/t00040_class.svg b/docs/test_cases/t00040_class.svg index 43b04c5c..96267ab6 100644 --- a/docs/test_cases/t00040_class.svg +++ b/docs/test_cases/t00040_class.svg @@ -1,6 +1,6 @@ - + @@ -9,70 +9,70 @@ - - + + A - + - + get_a() : int - + - + ii_ : int - - + + AA - - + + AAA - + - + get_aaa() : int - + - + b : B * - - + + R - + - + foo(A * a) : void diff --git a/docs/test_cases/t00040_class_mermaid.svg b/docs/test_cases/t00040_class_mermaid.svg new file mode 100644 index 00000000..1ca732d6 --- /dev/null +++ b/docs/test_cases/t00040_class_mermaid.svg @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A +
+
+ +
+ #ii_ : int +
+
+ +
+ +get_a() : int +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ AA +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ AAA +
+
+ +
+ +b : B +
+
+ +
+ +get_aaa() : int +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +foo(A * a) : void +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00041.md b/docs/test_cases/t00041.md index 068b8344..35b88937 100644 --- a/docs/test_cases/t00041.md +++ b/docs/test_cases/t00041.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00041_class: type: class @@ -74,8 +74,10 @@ struct NM : public N { }; } // namespace clanguml::t00041 ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00041_class](./t00041_class.svg "Context diagram filter test") +## Generated Mermaid diagrams +![t00041_class](./t00041_class_mermaid.svg "Context diagram filter test") ## Generated JSON models ```json { @@ -123,7 +125,7 @@ struct NM : public N { }; "line": 14, "translation_unit": "../../tests/t00041/t00041.cc" }, - "type": "clanguml::t00041::RR *" + "type": "RR *" } ], "methods": [], @@ -209,7 +211,7 @@ struct NM : public N { }; "line": 28, "translation_unit": "../../tests/t00041/t00041.cc" }, - "type": "clanguml::t00041::E *" + "type": "E *" }, { "access": "public", @@ -221,7 +223,7 @@ struct NM : public N { }; "line": 29, "translation_unit": "../../tests/t00041/t00041.cc" }, - "type": "clanguml::t00041::F *" + "type": "F *" }, { "access": "public", @@ -256,7 +258,7 @@ struct NM : public N { }; "parameters": [ { "name": "h", - "type": "clanguml::t00041::H *" + "type": "H *" } ], "source_location": { @@ -390,8 +392,8 @@ struct NM : public N { }; } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00041_class", diff --git a/docs/test_cases/t00041_class.svg b/docs/test_cases/t00041_class.svg index aca40ed3..c0bc19c3 100644 --- a/docs/test_cases/t00041_class.svg +++ b/docs/test_cases/t00041_class.svg @@ -1,6 +1,6 @@ - + @@ -9,107 +9,107 @@ - - + + R - - + + D - + - + rr : RR * - - + + E - - + + F - - + + RR - + - + foo(H * h) : void - + - + e : E * - + - + f : F * - + - + g : detail::G * - - + + RRR - - + + ns1::N - - + + ns1::NN - - + + ns1::NM diff --git a/docs/test_cases/t00041_class_mermaid.svg b/docs/test_cases/t00041_class_mermaid.svg new file mode 100644 index 00000000..65234735 --- /dev/null +++ b/docs/test_cases/t00041_class_mermaid.svg @@ -0,0 +1,332 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +rr + +
+
+
+
+ + + +
+ + +e + +
+
+
+
+ + + +
+ + +f + +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ R +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D +
+
+ +
+ +rr : RR +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ F +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ RR +
+
+ +
+ +e : E +
+
+ +
+ +f : F +
+
+ +
+ +g : detail::G +
+
+ +
+ +foo(H * h) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ RRR +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::N +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::NN +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::NM +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00042.md b/docs/test_cases/t00042.md index 784356f9..dfa41457 100644 --- a/docs/test_cases/t00042.md +++ b/docs/test_cases/t00042.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00042_class: type: class @@ -59,8 +59,10 @@ struct R { } // namespace clanguml::t00042 ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00042_class](./t00042_class.svg "Specialization class template diagram filter test") +## Generated Mermaid diagrams +![t00042_class](./t00042_class_mermaid.svg "Specialization class template diagram filter test") ## Generated JSON models ```json { @@ -305,8 +307,8 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00042_class", diff --git a/docs/test_cases/t00042_class.svg b/docs/test_cases/t00042_class.svg index e7240d76..27433162 100644 --- a/docs/test_cases/t00042_class.svg +++ b/docs/test_cases/t00042_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -19,15 +19,15 @@ - + - + a : T - - + + A @@ -36,15 +36,15 @@ - + - + a : void * - - + + B @@ -53,22 +53,22 @@ - + - + b : T - + - + bb : K - - + + A @@ -77,8 +77,8 @@ - - + + A @@ -87,8 +87,8 @@ - - + + B diff --git a/docs/test_cases/t00042_class_mermaid.svg b/docs/test_cases/t00042_class_mermaid.svg new file mode 100644 index 00000000..ec8ff8b4 --- /dev/null +++ b/docs/test_cases/t00042_class_mermaid.svg @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A<T> +
+
+ +
+ +a : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<void> +
+
+ +
+ +a : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<T,K> +
+
+ +
+ +b : T +
+
+ +
+ +bb : K +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<double> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<std::string> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<int,float> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00043.md b/docs/test_cases/t00043.md index 3de9ab65..06312776 100644 --- a/docs/test_cases/t00043.md +++ b/docs/test_cases/t00043.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00043_class: type: class @@ -78,8 +78,10 @@ struct J { } // namespace clanguml::t00043 ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00043_class](./t00043_class.svg "Dependants and dependencies class diagram filter test") +## Generated Mermaid diagrams +![t00043_class](./t00043_class_mermaid.svg "Dependants and dependencies class diagram filter test") ## Generated JSON models ```json { @@ -140,7 +142,7 @@ struct J { "parameters": [ { "name": "a", - "type": "clanguml::t00043::dependants::A *" + "type": "A *" } ], "source_location": { @@ -193,7 +195,7 @@ struct J { "parameters": [ { "name": "a", - "type": "clanguml::t00043::dependants::A *" + "type": "A *" } ], "source_location": { @@ -246,7 +248,7 @@ struct J { "parameters": [ { "name": "b", - "type": "clanguml::t00043::dependants::B *" + "type": "B *" } ], "source_location": { @@ -299,7 +301,7 @@ struct J { "parameters": [ { "name": "c", - "type": "clanguml::t00043::dependants::C *" + "type": "C *" } ], "source_location": { @@ -329,7 +331,7 @@ struct J { "parameters": [ { "name": "bb", - "type": "clanguml::t00043::dependants::BB *" + "type": "BB *" } ], "source_location": { @@ -382,7 +384,7 @@ struct J { "parameters": [ { "name": "d", - "type": "clanguml::t00043::dependants::D *" + "type": "D *" } ], "source_location": { @@ -486,7 +488,7 @@ struct J { "parameters": [ { "name": "g", - "type": "clanguml::t00043::dependencies::G *" + "type": "G *" } ], "source_location": { @@ -516,7 +518,7 @@ struct J { "parameters": [ { "name": "gg", - "type": "clanguml::t00043::dependencies::GG *" + "type": "GG *" } ], "source_location": { @@ -569,7 +571,7 @@ struct J { "parameters": [ { "name": "h", - "type": "clanguml::t00043::dependencies::H *" + "type": "H *" } ], "source_location": { @@ -622,7 +624,7 @@ struct J { "parameters": [ { "name": "i", - "type": "clanguml::t00043::dependencies::I *" + "type": "I *" } ], "source_location": { @@ -651,8 +653,8 @@ struct J { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00043_class", diff --git a/docs/test_cases/t00043_class.svg b/docs/test_cases/t00043_class.svg index f1bf95c5..0fb770da 100644 --- a/docs/test_cases/t00043_class.svg +++ b/docs/test_cases/t00043_class.svg @@ -1,6 +1,6 @@ - + - + @@ -9,189 +9,189 @@ - + dependants - - - dependencies - - - - - A - - + + + dependencies + + + + + A + + - - - - - B - + + + + + B + - - - + + + - - b(dependants::A * a) : void + + b(A * a) : void - - - - - - BB - + + + + + + BB + - - - + + + - - bb(dependants::A * a) : void + + bb(A * a) : void - - - - - - C - + + + + + + C + - - - + + + - - c(dependants::B * b) : void + + c(B * b) : void - - - - - - D - + + + + + + D + - - - + + + - - d(dependants::C * c) : void + + d(C * c) : void - - - + + + - - dd(dependants::BB * bb) : void + + dd(BB * bb) : void - - - - - - E - + + + + + + E + - - - + + + - - e(dependants::D * d) : void + + e(D * d) : void - - - - - - G - - + + + + + + G + + - - - - - GG - - + + + + + GG + + - - - - - H - + + + + + H + - - - + + + - - h(dependencies::G * g) : void + + h(G * g) : void - - - + + + - - hh(dependencies::GG * gg) : void + + hh(GG * gg) : void - - - - - - I - + + + + + + I + - - - + + + - - i(dependencies::H * h) : void + + i(H * h) : void - - - - - - J - + + + + + + J + - - - + + + - - i(dependencies::I * i) : void + + i(I * i) : void - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/test_cases/t00043_class_mermaid.svg b/docs/test_cases/t00043_class_mermaid.svg new file mode 100644 index 00000000..203547b1 --- /dev/null +++ b/docs/test_cases/t00043_class_mermaid.svg @@ -0,0 +1,439 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ dependants::A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ dependants::B +
+
+ +
+ +b(A * a) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ dependants::BB +
+
+ +
+ +bb(A * a) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ dependants::C +
+
+ +
+ +c(B * b) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ dependants::D +
+
+ +
+ +d(C * c) : void +
+
+ +
+ +dd(BB * bb) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ dependants::E +
+
+ +
+ +e(D * d) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ dependencies::G +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ dependencies::GG +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ dependencies::H +
+
+ +
+ +h(G * g) : void +
+
+ +
+ +hh(GG * gg) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ dependencies::I +
+
+ +
+ +i(H * h) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ dependencies::J +
+
+ +
+ +i(I * i) : void +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00044.md b/docs/test_cases/t00044.md index 26128337..eb6a9b1b 100644 --- a/docs/test_cases/t00044.md +++ b/docs/test_cases/t00044.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00044_class: type: class @@ -57,8 +57,10 @@ struct R { } // namespace clanguml::t00044 ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00044_class](./t00044_class.svg "Test case for inner type aliases with parent class template args") +## Generated Mermaid diagrams +![t00044_class](./t00044_class_mermaid.svg "Test case for inner type aliases with parent class template args") ## Generated JSON models ```json { @@ -430,8 +432,8 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00044_class", diff --git a/docs/test_cases/t00044_class.svg b/docs/test_cases/t00044_class.svg index 63829706..c4a75f4b 100644 --- a/docs/test_cases/t00044_class.svg +++ b/docs/test_cases/t00044_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + signal_handler @@ -19,8 +19,8 @@ - - + + sink @@ -28,26 +28,26 @@ signal_handler<Ret(Args...),A> - + - + sink(signal_t & sh) : void get_signal<CastTo>() : CastTo * - + - + signal : signal_t * - - + + signal_handler @@ -56,8 +56,8 @@ - - + + sink @@ -66,23 +66,23 @@ - - + + R - + - + sink1 : sink<signal_handler<void (int),bool>> - - + + signal_handler @@ -91,8 +91,8 @@ - - + + sink diff --git a/docs/test_cases/t00044_class_mermaid.svg b/docs/test_cases/t00044_class_mermaid.svg new file mode 100644 index 00000000..b047c268 --- /dev/null +++ b/docs/test_cases/t00044_class_mermaid.svg @@ -0,0 +1,297 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + -signal + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +sink1 + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ signal_handler<Ret(Args...),A> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ sink<signal_handler<Ret(Args...),A>> +
+
+ +
+ -signal : signal_t +
+
+ +
+ +sink(signal_t & sh) : void +
+
+ +
+ +get_signal() : CastTo +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ signal_handler<void(int),bool> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ sink<signal_handler<void(int),bool>> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +sink1 : sink<signal_handler<void (int),bool>> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ signal_handler<T,A> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ sink<T> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00045.md b/docs/test_cases/t00045.md index ddbd892a..69271b20 100644 --- a/docs/test_cases/t00045.md +++ b/docs/test_cases/t00045.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00045_class: type: class @@ -60,8 +60,10 @@ public: } // namespace ns1 ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00045_class](./t00045_class.svg "Test case for root namespace handling") +## Generated Mermaid diagrams +![t00045_class](./t00045_class_mermaid.svg "Test case for root namespace handling") ## Generated JSON models ```json { @@ -377,7 +379,7 @@ public: "line": 31, "translation_unit": "../../tests/t00045/t00045.cc" }, - "type": "ns1::ns2::A *" + "type": "A *" }, { "access": "public", @@ -461,8 +463,8 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00045_class", diff --git a/docs/test_cases/t00045_class.svg b/docs/test_cases/t00045_class.svg index c422693b..81fe8d24 100644 --- a/docs/test_cases/t00045_class.svg +++ b/docs/test_cases/t00045_class.svg @@ -1,6 +1,6 @@ - + @@ -9,32 +9,32 @@ - - + + A - - + + AA - - + + AAA - - + + AAAA @@ -43,110 +43,110 @@ - + - + t : T - - + + ns1::A - - + + ns1::ns2::A - - + + ns1::ns2::B - - + + ns1::ns2::C - - + + ns1::ns2::D - - + + ns1::ns2::E - - + + ns1::ns2::AAA - - + + ns1::ns2::R - + - + foo(AA & aa) : void - + - - a : ns1::ns2::A * + + a : A * - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * diff --git a/docs/test_cases/t00045_class_mermaid.svg b/docs/test_cases/t00045_class_mermaid.svg new file mode 100644 index 00000000..66bf6457 --- /dev/null +++ b/docs/test_cases/t00045_class_mermaid.svg @@ -0,0 +1,430 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +a + +
+
+
+
+ + + +
+ + +ns1_a + +
+
+
+
+ + + +
+ + +ns1_ns2_a + +
+
+
+
+ + + +
+ + +root_a + +
+
+
+
+ + + +
+ + +[friend] + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ AA +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ AAA +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ AAAA<T> +
+
+ +
+ -t : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns2::A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns2::B +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns2::C +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns2::D +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns2::E +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns2::AAA +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns2::R +
+
+ +
+ +a : A +
+
+ +
+ +ns1_a : ns1::A +
+
+ +
+ +ns1_ns2_a : ns1::ns2::A +
+
+ +
+ +root_a : ::A +
+
+ +
+ +foo(AA & aa) : void +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00046.md b/docs/test_cases/t00046.md index bce68ce3..fb7902a8 100644 --- a/docs/test_cases/t00046.md +++ b/docs/test_cases/t00046.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00046_class: type: class @@ -53,8 +53,10 @@ public: } // namespace ns1 ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00046_class](./t00046_class.svg "Test case for root namespace handling with packages") +## Generated Mermaid diagrams +![t00046_class](./t00046_class_mermaid.svg "Test case for root namespace handling with packages") ## Generated JSON models ```json { @@ -290,7 +292,7 @@ public: "line": 26, "translation_unit": "../../tests/t00046/t00046.cc" }, - "type": "ns1::ns2::A *" + "type": "A *" }, { "access": "public", @@ -394,8 +396,8 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00046_class", diff --git a/docs/test_cases/t00046_class.svg b/docs/test_cases/t00046_class.svg index b4aeb1af..9d767c7f 100644 --- a/docs/test_cases/t00046_class.svg +++ b/docs/test_cases/t00046_class.svg @@ -1,6 +1,6 @@ - + @@ -9,120 +9,120 @@ - + ns1 - + ns2 - - + + A - - + + A - - + + B - - + + C - - + + D - - + + E - - + + R - + - + foo(AA & aa) : void - + - - a : ns1::ns2::A * + + a : A * - + - + i : std::vector<std::uint8_t> - + - + ns1_a : ns1::A * - + - + ns1_ns2_a : ns1::ns2::A * - + - + root_a : ::A * - - + + A - - + + AA diff --git a/docs/test_cases/t00046_class_mermaid.svg b/docs/test_cases/t00046_class_mermaid.svg new file mode 100644 index 00000000..7532e6f8 --- /dev/null +++ b/docs/test_cases/t00046_class_mermaid.svg @@ -0,0 +1,361 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +a + +
+
+
+
+ + + +
+ + +ns1_a + +
+
+
+
+ + + +
+ + +ns1_ns2_a + +
+
+
+
+ + + +
+ + +root_a + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ AA +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns2::A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns2::B +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns2::C +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns2::D +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns2::E +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ns1::ns2::R +
+
+ +
+ +a : A +
+
+ +
+ +i : std::vector<std::uint8_t> +
+
+ +
+ +ns1_a : ns1::A +
+
+ +
+ +ns1_ns2_a : ns1::ns2::A +
+
+ +
+ +root_a : ::A +
+
+ +
+ +foo(AA & aa) : void +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00047.md b/docs/test_cases/t00047.md index d24e203b..b0ec290e 100644 --- a/docs/test_cases/t00047.md +++ b/docs/test_cases/t00047.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00047_class: type: class @@ -43,8 +43,10 @@ using conditional = typename conditional_t::type; } // namespace t00047 } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00047_class](./t00047_class.svg "Test case for recursive variadic template") +## Generated Mermaid diagrams +![t00047_class](./t00047_class_mermaid.svg "Test case for recursive variadic template") ## Generated JSON models ```json { @@ -192,8 +194,8 @@ using conditional = typename conditional_t::type; } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00047_class", diff --git a/docs/test_cases/t00047_class.svg b/docs/test_cases/t00047_class.svg index eb0acaab..833f0ad5 100644 --- a/docs/test_cases/t00047_class.svg +++ b/docs/test_cases/t00047_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + conditional_t @@ -19,8 +19,8 @@ - - + + conditional_t @@ -29,8 +29,8 @@ - - + + conditional_t @@ -39,8 +39,8 @@ - - + + conditional_t diff --git a/docs/test_cases/t00047_class_mermaid.svg b/docs/test_cases/t00047_class_mermaid.svg new file mode 100644 index 00000000..208e4fea --- /dev/null +++ b/docs/test_cases/t00047_class_mermaid.svg @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ conditional_t<Else> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ conditional_t<std::true_type,Result,Tail...> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ conditional_t<std::false_type,Result,Tail...> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ conditional_t<Ts...> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00048.md b/docs/test_cases/t00048.md index 9a932067..4cecca85 100644 --- a/docs/test_cases/t00048.md +++ b/docs/test_cases/t00048.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00048_class: type: class @@ -119,8 +119,10 @@ template struct BaseTemplate { } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00048_class](./t00048_class.svg "Test case for unique entity id with multiple translation units") +## Generated Mermaid diagrams +![t00048_class](./t00048_class_mermaid.svg "Test case for unique entity id with multiple translation units") ## Generated JSON models ```json { @@ -543,8 +545,8 @@ template struct BaseTemplate { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00048_class", diff --git a/docs/test_cases/t00048_class.svg b/docs/test_cases/t00048_class.svg index 2200ab4b..566a2771 100644 --- a/docs/test_cases/t00048_class.svg +++ b/docs/test_cases/t00048_class.svg @@ -1,6 +1,6 @@ - + @@ -9,30 +9,30 @@ - - + + Base - + - + foo() = 0 : void - + - + base : int - - + + BaseTemplate @@ -40,45 +40,45 @@ T - + - + foo() = 0 : void - + - + base : T - - + + B - + - + foo() : void - + - + b : int - - + + BTemplate @@ -86,45 +86,45 @@ T - + - + foo() : void - + - + b : T - - + + A - + - + foo() : void - + - + a : int - - + + ATemplate @@ -132,19 +132,19 @@ T - + - + foo() : void - + - + a : T diff --git a/docs/test_cases/t00048_class_mermaid.svg b/docs/test_cases/t00048_class_mermaid.svg new file mode 100644 index 00000000..927e203f --- /dev/null +++ b/docs/test_cases/t00048_class_mermaid.svg @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + + +
+ «abstract» +
+
+ +
+ Base +
+
+ +
+ +base : int +
+
+ +
+ +foo() : void +
+
+
+
+
+ + + + + + + +
+ «abstract» +
+
+ +
+ BaseTemplate<T> +
+
+ +
+ +base : T +
+
+ +
+ +foo() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+ +
+ +b : int +
+
+ +
+ +foo() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ BTemplate<T> +
+
+ +
+ +b : T +
+
+ +
+ +foo() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A +
+
+ +
+ +a : int +
+
+ +
+ +foo() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ ATemplate<T> +
+
+ +
+ +a : T +
+
+ +
+ +foo() : void +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00049.md b/docs/test_cases/t00049.md index 708b2d5c..6c3b7f8b 100644 --- a/docs/test_cases/t00049.md +++ b/docs/test_cases/t00049.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00049_class: type: class @@ -46,8 +46,10 @@ struct R { } // namespace t00049 } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00049_class](./t00049_class.svg "Test case configurable type aliases") +## Generated Mermaid diagrams +![t00049_class](./t00049_class_mermaid.svg "Test case configurable type aliases") ## Generated JSON models ```json { @@ -325,8 +327,8 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00049_class", diff --git a/docs/test_cases/t00049_class.svg b/docs/test_cases/t00049_class.svg index 92378b07..ab3b8513 100644 --- a/docs/test_cases/t00049_class.svg +++ b/docs/test_cases/t00049_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -18,23 +18,23 @@ T - + - + get_a() : T & - + - + a : T - - + + A @@ -43,8 +43,8 @@ - - + + A @@ -53,8 +53,8 @@ - - + + A @@ -63,47 +63,47 @@ - - + + R - + - + get_int_map() : A<intmap> - + - + set_int_map(A<intmap> && int_map) : void - + - + a_int_map : A<intmap> - + - + a_string : A<thestring> - + - + a_vector_string : A<string_vector> diff --git a/docs/test_cases/t00049_class_mermaid.svg b/docs/test_cases/t00049_class_mermaid.svg new file mode 100644 index 00000000..5f7efdaf --- /dev/null +++ b/docs/test_cases/t00049_class_mermaid.svg @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +a_string + +
+
+
+
+ + + +
+ + +a_vector_string + +
+
+
+
+ + + +
+ + +a_int_map + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A<T> +
+
+ +
+ +a : T +
+
+ +
+ +get_a() : T & +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<intmap> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<thestring> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<string_vector> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +a_int_map : A<intmap> +
+
+ +
+ +a_string : A<thestring> +
+
+ +
+ +a_vector_string : A<string_vector> +
+
+ +
+ +get_int_map() : A<intmap> +
+
+ +
+ +set_int_map(A && int_map) : void +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00050.md b/docs/test_cases/t00050.md index a233da47..5521822e 100644 --- a/docs/test_cases/t00050.md +++ b/docs/test_cases/t00050.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00050_class: type: class @@ -65,7 +65,7 @@ diagrams: {% endfor %} {% endif %} - {# Render template paramete if any #} + {# Render template parameters if any #} {% if existsIn(e, "comment") and existsIn(e.comment, "tparam") %} {% set c=e.comment %} @@ -78,6 +78,32 @@ diagrams: {% endif %} {% endfor %} + mermaid: + after: + - | + note for {{ alias("NoSuchClass") }} "{{ comment("NoSuchClass").formatted }}" + - | + note for {{ alias("A") }} "{{ comment("clanguml::t00050::A").formatted }}" + - | + note for {{ element("clanguml::t00050::A").alias }} {% set e=element("clanguml::t00050::A") %} "{{ e.comment.formatted }}" + note for {{ alias("C") }} "{{ trim(comment("clanguml::t00050::C").text) }}" + {% set cmt=comment("clanguml::t00050::G").paragraph %} + note for {{ alias("G") }} "{{ trim(cmt.0) }}" + note for {{ alias("G") }} "{{ trim(cmt.1) }}" + note for {{ alias("G") }} "{{ trim(cmt.2) }}" + - | + {# Render brief comments and todos, if any were written for an element #} + {% for e in diagram.elements %} + {% if existsIn(e, "comment") and existsIn(e.comment, "brief") %} + note for {{ e.alias }} {% set c=e.comment %} "{{ c.brief.0 }}" + {% endif %} + {% if existsIn(e, "comment") and existsIn(e.comment, "todo") %} + {% set c=e.comment %} + {% for t in c.todo %} + note for {{ e.alias }} "**TODO** {{ t }}" + {% endfor %} + {% endif %} + {% endfor %} ``` ## Source code @@ -180,8 +206,10 @@ class NoComment { }; } // namespace t00050 } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00050_class](./t00050_class.svg "Test case for generating notes from comments using jinja templates") +## Generated Mermaid diagrams +![t00050_class](./t00050_class_mermaid.svg "Test case for generating notes from comments using jinja templates") ## Generated JSON models ```json { @@ -504,8 +532,8 @@ class NoComment { }; } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00050_class", diff --git a/docs/test_cases/t00050_class.svg b/docs/test_cases/t00050_class.svg index 12f5f89a..8d95bb73 100644 --- a/docs/test_cases/t00050_class.svg +++ b/docs/test_cases/t00050_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - - + + B - - + + C - - + + utils::D - - + + E @@ -52,8 +52,8 @@ E3 - - + + F @@ -62,43 +62,43 @@ - + - + t : T[N] - + - + v : V - - + + G - - + + NoComment - + Lorem ipsum dolor sit - + Lorem ipsum dolor sit - + Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis vehicula class ultricies mollis dictumst, aenean non a in donec nulla. @@ -125,50 +125,50 @@ imperdiet praesent magnis ridiculus congue gravida curabitur dictum sagittis, enim et magna sit inceptos sodales parturient pharetra mollis, aenean vel nostra tellus commodo pretium sapien sociosqu. - + This is a short description of class G. - + This is an intermediate description of class G. - + This is a long description of class G. - + Lorem ipsum - + TODO 1. Write meaningful comment - + TODO 2. Write tests - + TODO 3. Implement - + Long comment example - + TODO Implement... - + Simple array wrapper. - + Template parameters diff --git a/docs/test_cases/t00050_class_mermaid.svg b/docs/test_cases/t00050_class_mermaid.svg new file mode 100644 index 00000000..406026a6 --- /dev/null +++ b/docs/test_cases/t00050_class_mermaid.svg @@ -0,0 +1,510 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ utils::D +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ E +
+
+ +
+ E1 +
+
+ +
+ E2 +
+
+ +
+ E3 +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ F<T,V,int N> +
+
+ +
+ -t : T[N] +
+
+ +
+ -v : V +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ G +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ NoComment +
+
+
+
+
+ + + + + +
+ Lorem ipsum dolor sit +
+
+
+
+ + + + + +
+ Lorem ipsum dolor sit +
+
+
+
+ + + + + +
+ Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis
vehicula class ultricies mollis dictumst, aenean non a in donec nulla.
Phasellus ante pellentesque erat cum risus consequat imperdiet aliquam,
integer placerat et turpis mi eros nec lobortis taciti, vehicula nisl litora
tellus ligula porttitor metus.

Vivamus integer non suscipit taciti mus etiam at primis tempor sagittis sit,
euismod libero facilisi aptent elementum felis blandit cursus gravida sociis
erat ante, eleifend lectus nullam dapibus netus feugiat curae curabitur est
ad. Massa curae fringilla porttitor quam sollicitudin iaculis aptent leo
ligula euismod dictumst, orci penatibus mauris eros etiam praesent erat
volutpat posuere hac. Metus fringilla nec ullamcorper odio aliquam lacinia
conubia mauris tempor, etiam ultricies proin quisque lectus sociis id
tristique, integer phasellus taciti pretium adipiscing tortor sagittis
ligula.

Mollis pretium lorem primis senectus habitasse lectus scelerisque
donec, ultricies tortor suspendisse adipiscing fusce morbi volutpat
pellentesque, consectetur mi risus molestie curae malesuada cum. Dignissim
lacus convallis massa mauris enim ad mattis magnis senectus montes, mollis
taciti phasellus accumsan bibendum semper blandit suspendisse faucibus nibh
est, metus lobortis morbi cras magna vivamus per risus fermentum. Dapibus
imperdiet praesent magnis ridiculus congue gravida curabitur dictum
sagittis, enim et magna sit inceptos sodales parturient pharetra mollis,
aenean vel nostra tellus commodo pretium sapien sociosqu.
+
+
+
+
+ + + + + +
+ This is a short description of class G. +
+
+
+
+ + + + + +
+ This is an intermediate description of class G. +
+
+
+
+ + + + + +
+ This is a long description of class G. +
+
+
+
+ + + + + +
+ Lorem ipsum
+
+
+
+
+ + + + + +
+ **TODO** 1. Write meaningful comment

+
+
+
+
+ + + + + +
+ **TODO** 2. Write tests

+
+
+
+
+ + + + + +
+ **TODO** 3. Implement
+
+
+
+
+ + + + + +
+ Long comment example
+
+
+
+
+ + + + + +
+ **TODO** Implement...
+
+
+
+
+ + + + + +
+ Simple array wrapper.
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00051.md b/docs/test_cases/t00051.md index f9b463c5..84fa4d84 100644 --- a/docs/test_cases/t00051.md +++ b/docs/test_cases/t00051.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00051_class: type: class @@ -82,8 +82,10 @@ A::custom_thread2 A::start_thread2() } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00051_class](./t00051_class.svg "Test case for relative paths in lambda names") +## Generated Mermaid diagrams +![t00051_class](./t00051_class_mermaid.svg "Test case for relative paths in lambda names") ## Generated JSON models ```json { @@ -428,7 +430,7 @@ A::custom_thread2 A::start_thread2() "line": 33, "translation_unit": "../../tests/t00051/t00051.cc" }, - "type": "clanguml::t00051::A::custom_thread1" + "type": "custom_thread1" }, { "access": "private", @@ -453,7 +455,7 @@ A::custom_thread2 A::start_thread2() "line": 39, "translation_unit": "../../tests/t00051/t00051.cc" }, - "type": "clanguml::t00051::A::custom_thread2" + "type": "custom_thread2" }, { "access": "private", @@ -637,8 +639,8 @@ A::custom_thread2 A::start_thread2() } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00051_class", diff --git a/docs/test_cases/t00051_class.svg b/docs/test_cases/t00051_class.svg index 7463e030..1dc6236c 100644 --- a/docs/test_cases/t00051_class.svg +++ b/docs/test_cases/t00051_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + B @@ -18,125 +18,125 @@ F,FF=F - + - + B(F && f, FF && ff) : void - + - + f() : void - + - + ff() : void - + - + f_ : F - + - + ff_ : FF - - + + B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at ../../tests/t00051/t00051.cc:43:27)> - + - + B((lambda at ../../tests/t00051/t00051.cc:43:18) && f, (lambda at ../../tests/t00051/t00051.cc:43:27) && ff) : void - + - + f() : void - + - + ff() : void - + - + f_ : (lambda at ../../tests/t00051/t00051.cc:43:18) - + - + ff_ : (lambda at ../../tests/t00051/t00051.cc:43:27) - - + + A - + - + get_function() : (lambda at ../../tests/t00051/t00051.cc:48:16) - + - - start_thread1() : A::custom_thread1 + + start_thread1() : custom_thread1 - + - - start_thread2() : A::custom_thread2 + + start_thread2() : custom_thread2 - + - + start_thread3() : B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at ../../tests/t00051/t00051.cc:43:27)> - - + + A::custom_thread1 @@ -145,18 +145,18 @@ custom_thread1<Function,Args...>(Function && f, Args &&... args) : void - - + + A::custom_thread2 - + - + thread((lambda at ../../tests/t00051/t00051.cc:59:27) &&) : void diff --git a/docs/test_cases/t00051_class_mermaid.svg b/docs/test_cases/t00051_class_mermaid.svg new file mode 100644 index 00000000..e2ab365c --- /dev/null +++ b/docs/test_cases/t00051_class_mermaid.svg @@ -0,0 +1,283 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ B<F,FF=F> +
+
+ +
+ +f_ : F +
+
+ +
+ +ff_ : FF +
+
+ +
+ +B(F && f, FF && ff) : void +
+
+ +
+ +f() : void +
+
+ +
+ +ff() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at ../../tests/t00051/t00051.cc:43:27)> +
+
+ +
+ +f_ : (lambda at ../../tests/t00051/t00051.cc:43:18) +
+
+ +
+ +ff_ : (lambda at ../../tests/t00051/t00051.cc:43:27) +
+
+ +
+ +B((lambda at ../../tests/t00051/t00051.cc:43:18) && f, (lambda at ../../tests/t00051/t00051.cc:43:27) && ff) : void +
+
+ +
+ +f() : void +
+
+ +
+ +ff() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A +
+
+ +
+ -get_function() : (lambda at ../../tests/t00051/t00051.cc:48:16) +
+
+ +
+ -start_thread1() : custom_thread1 +
+
+ +
+ -start_thread2() : custom_thread2 +
+
+ +
+ -start_thread3() : B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at ../../tests/t00051/t00051.cc:43:27)> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A::custom_thread1 +
+
+ +
+ +custom_thread1(Function && f, Args &&... args) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A::custom_thread2 +
+
+ +
+ +thread((lambda at ../../tests/t00051/t00051.cc:59:27) : &&) : void +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00052.md b/docs/test_cases/t00052.md index 7a1854fc..8f775e9b 100644 --- a/docs/test_cases/t00052.md +++ b/docs/test_cases/t00052.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00052_class: type: class @@ -53,8 +53,10 @@ struct R { } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00052_class](./t00052_class.svg "Test case for template methods rendering") +## Generated Mermaid diagrams +![t00052_class](./t00052_class_mermaid.svg "Test case for template methods rendering") ## Generated JSON models ```json { @@ -355,7 +357,7 @@ struct R { "line": 30, "translation_unit": "../../tests/t00052/t00052.cc" }, - "type": "clanguml::t00052::A" + "type": "A" }, { "access": "public", @@ -396,8 +398,8 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00052_class", diff --git a/docs/test_cases/t00052_class.svg b/docs/test_cases/t00052_class.svg index a605c9cd..e8a86c65 100644 --- a/docs/test_cases/t00052_class.svg +++ b/docs/test_cases/t00052_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -21,8 +21,8 @@ aa<F,Q>(F && f, Q q) : void - - + + B @@ -30,18 +30,18 @@ T - + - + b(T t) : T bb<F>(F && f, T t) : T - - + + C @@ -52,8 +52,8 @@ c<P>(P p) : T - - + + B @@ -62,8 +62,8 @@ - - + + C @@ -72,33 +72,33 @@ - - + + R - + - + a : A - + - + b : B<int> - + - + c : C<int> diff --git a/docs/test_cases/t00052_class_mermaid.svg b/docs/test_cases/t00052_class_mermaid.svg new file mode 100644 index 00000000..2567f37f --- /dev/null +++ b/docs/test_cases/t00052_class_mermaid.svg @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +a + +
+
+
+
+ + + +
+ + +b + +
+
+
+
+ + + +
+ + +c + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A +
+
+ +
+ +a(T p) : T +
+
+ +
+ +aa(F && f, Q q) : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<T> +
+
+ +
+ +b(T t) : T +
+
+ +
+ +bb(F && f, T t) : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C<T> +
+
+ +
+ -c<p>(P p) : T</p> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<int> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C<int> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +a : A +
+
+ +
+ +b : B<int> +
+
+ +
+ +c : C<int> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00053.md b/docs/test_cases/t00053.md index 48f486eb..33e2d666 100644 --- a/docs/test_cases/t00053.md +++ b/docs/test_cases/t00053.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00053_class: type: class @@ -50,8 +50,10 @@ enum class j { jjj }; } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00053_class](./t00053_class.svg "Test case for `together` layout hint in class diagram") +## Generated Mermaid diagrams +![t00053_class](./t00053_class_mermaid.svg "Test case for `together` layout hint in class diagram") ## Generated JSON models ```json { @@ -418,8 +420,8 @@ enum class j { jjj }; } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00053_class", diff --git a/docs/test_cases/t00053_class.svg b/docs/test_cases/t00053_class.svg index 587925c6..9db7e650 100644 --- a/docs/test_cases/t00053_class.svg +++ b/docs/test_cases/t00053_class.svg @@ -1,6 +1,6 @@ - + @@ -9,72 +9,72 @@ - - + + A - - + + C - - + + E - - + + F - - + + a - - + + c - - + + e - - + + f - - + + h @@ -82,8 +82,8 @@ hhh - - + + j @@ -91,56 +91,56 @@ jjj - - + + b - - + + d - - + + g - - + + B - - + + D - - + + G - - + + i diff --git a/docs/test_cases/t00053_class_mermaid.svg b/docs/test_cases/t00053_class_mermaid.svg new file mode 100644 index 00000000..fd91ee76 --- /dev/null +++ b/docs/test_cases/t00053_class_mermaid.svg @@ -0,0 +1,396 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ b +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ d +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ g +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ G +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ i +
+
+ +
+ iii +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ F +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ a +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ c +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ e +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ f +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ h +
+
+ +
+ hhh +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ j +
+
+ +
+ jjj +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00054.md b/docs/test_cases/t00054.md index 96016cf9..31de9163 100644 --- a/docs/test_cases/t00054.md +++ b/docs/test_cases/t00054.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00054_class: type: class @@ -64,8 +64,10 @@ enum class j { jjj }; } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00054_class](./t00054_class.svg "Test case for `together` layout hint in class diagram with rendered namespaces") +## Generated Mermaid diagrams +![t00054_class](./t00054_class_mermaid.svg "Test case for `together` layout hint in class diagram with rendered namespaces") ## Generated JSON models ```json { @@ -460,8 +462,8 @@ enum class j { jjj }; } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00054_class", diff --git a/docs/test_cases/t00054_class.svg b/docs/test_cases/t00054_class.svg index 36964618..48d3893c 100644 --- a/docs/test_cases/t00054_class.svg +++ b/docs/test_cases/t00054_class.svg @@ -1,6 +1,6 @@ - + @@ -9,28 +9,28 @@ - + detail - + detail2 - + detail3 - + detail4 - - + + d - - + + a @@ -40,8 +40,8 @@ - - + + c @@ -51,8 +51,8 @@ - - + + e @@ -62,40 +62,40 @@ - - + + C - - + + F - - + + D - - + + E - - + + A @@ -104,8 +104,8 @@ - - + + B @@ -114,8 +114,8 @@ - - + + f @@ -124,8 +124,8 @@ - - + + G @@ -133,8 +133,8 @@ - - + + h @@ -143,8 +143,8 @@ hhh - - + + i @@ -153,8 +153,8 @@ iii - - + + j @@ -163,16 +163,16 @@ jjj - - + + b - - + + g diff --git a/docs/test_cases/t00054_class_mermaid.svg b/docs/test_cases/t00054_class_mermaid.svg new file mode 100644 index 00000000..d7448a01 --- /dev/null +++ b/docs/test_cases/t00054_class_mermaid.svg @@ -0,0 +1,396 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ b +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ detail::d +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ g +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ detail2::C +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ detail2::F +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ G +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ a +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ f +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ detail2::detail3::D +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ detail2::detail3::E +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ detail4::h +
+
+ +
+ hhh +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ detail4::i +
+
+ +
+ iii +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ detail4::j +
+
+ +
+ jjj +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ detail::c +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ detail::e +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00055.md b/docs/test_cases/t00055.md index ae2cbd83..2b9f60a5 100644 --- a/docs/test_cases/t00055.md +++ b/docs/test_cases/t00055.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00055_class: type: class @@ -37,8 +37,10 @@ struct J { }; } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00055_class](./t00055_class.svg "Test case for `row` and `column` layout hints") +## Generated Mermaid diagrams +![t00055_class](./t00055_class_mermaid.svg "Test case for `row` and `column` layout hints") ## Generated JSON models ```json { @@ -266,8 +268,8 @@ struct J { }; } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00055_class", diff --git a/docs/test_cases/t00055_class.svg b/docs/test_cases/t00055_class.svg index ef567e17..26e90231 100644 --- a/docs/test_cases/t00055_class.svg +++ b/docs/test_cases/t00055_class.svg @@ -1,6 +1,6 @@ - + @@ -9,80 +9,80 @@ - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F - - + + G - - + + H - - + + I - - + + J diff --git a/docs/test_cases/t00055_class_mermaid.svg b/docs/test_cases/t00055_class_mermaid.svg new file mode 100644 index 00000000..505c337e --- /dev/null +++ b/docs/test_cases/t00055_class_mermaid.svg @@ -0,0 +1,248 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ F +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ G +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ H +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ I +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ J +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00056.md b/docs/test_cases/t00056.md index 22737e67..a22dc9b6 100644 --- a/docs/test_cases/t00056.md +++ b/docs/test_cases/t00056.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00056_class: type: class @@ -17,6 +17,7 @@ diagrams: ## Source code File t00056.cc ```cpp +#include #include namespace clanguml { @@ -111,8 +112,10 @@ struct F { } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00056_class](./t00056_class.svg "Basic C++20 concepts test case") +## Generated Mermaid diagrams +![t00056_class](./t00056_class_mermaid.svg "Basic C++20 concepts test case") ## Generated JSON models ```json { @@ -127,7 +130,7 @@ struct F { "source_location": { "column": 9, "file": "../../tests/t00056/t00056.cc", - "line": 7, + "line": 8, "translation_unit": "../../tests/t00056/t00056.cc" }, "statements": [], @@ -151,7 +154,7 @@ struct F { "source_location": { "column": 9, "file": "../../tests/t00056/t00056.cc", - "line": 10, + "line": 11, "translation_unit": "../../tests/t00056/t00056.cc" }, "statements": [ @@ -168,7 +171,7 @@ struct F { "source_location": { "column": 9, "file": "../../tests/t00056/t00056.cc", - "line": 15, + "line": 16, "translation_unit": "../../tests/t00056/t00056.cc" }, "statements": [], @@ -188,7 +191,7 @@ struct F { "source_location": { "column": 9, "file": "../../tests/t00056/t00056.cc", - "line": 19, + "line": 20, "translation_unit": "../../tests/t00056/t00056.cc" }, "statements": [ @@ -206,7 +209,7 @@ struct F { "source_location": { "column": 9, "file": "../../tests/t00056/t00056.cc", - "line": 26, + "line": 27, "translation_unit": "../../tests/t00056/t00056.cc" }, "statements": [ @@ -228,7 +231,7 @@ struct F { "source_location": { "column": 9, "file": "../../tests/t00056/t00056.cc", - "line": 29, + "line": 30, "translation_unit": "../../tests/t00056/t00056.cc" }, "statements": [ @@ -247,7 +250,7 @@ struct F { "source_location": { "column": 9, "file": "../../tests/t00056/t00056.cc", - "line": 45, + "line": 46, "translation_unit": "../../tests/t00056/t00056.cc" }, "statements": [], @@ -262,7 +265,7 @@ struct F { "source_location": { "column": 9, "file": "../../tests/t00056/t00056.cc", - "line": 48, + "line": 49, "translation_unit": "../../tests/t00056/t00056.cc" }, "statements": [], @@ -285,7 +288,7 @@ struct F { "source_location": { "column": 7, "file": "../../tests/t00056/t00056.cc", - "line": 53, + "line": 54, "translation_unit": "../../tests/t00056/t00056.cc" }, "type": "T" @@ -297,7 +300,7 @@ struct F { "source_location": { "column": 36, "file": "../../tests/t00056/t00056.cc", - "line": 52, + "line": 53, "translation_unit": "../../tests/t00056/t00056.cc" }, "template_parameters": [ @@ -327,7 +330,7 @@ struct F { "source_location": { "column": 7, "file": "../../tests/t00056/t00056.cc", - "line": 60, + "line": 61, "translation_unit": "../../tests/t00056/t00056.cc" }, "type": "T" @@ -339,7 +342,7 @@ struct F { "source_location": { "column": 8, "file": "../../tests/t00056/t00056.cc", - "line": 59, + "line": 60, "translation_unit": "../../tests/t00056/t00056.cc" }, "template_parameters": [ @@ -369,7 +372,7 @@ struct F { "source_location": { "column": 7, "file": "../../tests/t00056/t00056.cc", - "line": 70, + "line": 71, "translation_unit": "../../tests/t00056/t00056.cc" }, "type": "T" @@ -381,7 +384,7 @@ struct F { "source_location": { "column": 8, "file": "../../tests/t00056/t00056.cc", - "line": 69, + "line": 70, "translation_unit": "../../tests/t00056/t00056.cc" }, "template_parameters": [ @@ -410,7 +413,7 @@ struct F { "source_location": { "column": 8, "file": "../../tests/t00056/t00056.cc", - "line": 75, + "line": 76, "translation_unit": "../../tests/t00056/t00056.cc" }, "template_parameters": [ @@ -464,7 +467,7 @@ struct F { "source_location": { "column": 8, "file": "../../tests/t00056/t00056.cc", - "line": 80, + "line": 81, "translation_unit": "../../tests/t00056/t00056.cc" }, "type": "T1" @@ -476,7 +479,7 @@ struct F { "source_location": { "column": 8, "file": "../../tests/t00056/t00056.cc", - "line": 81, + "line": 82, "translation_unit": "../../tests/t00056/t00056.cc" }, "type": "T2" @@ -488,7 +491,7 @@ struct F { "source_location": { "column": 8, "file": "../../tests/t00056/t00056.cc", - "line": 82, + "line": 83, "translation_unit": "../../tests/t00056/t00056.cc" }, "type": "T3" @@ -500,7 +503,7 @@ struct F { "source_location": { "column": 8, "file": "../../tests/t00056/t00056.cc", - "line": 79, + "line": 80, "translation_unit": "../../tests/t00056/t00056.cc" }, "template_parameters": [ @@ -542,7 +545,7 @@ struct F { "source_location": { "column": 8, "file": "../../tests/t00056/t00056.cc", - "line": 88, + "line": 89, "translation_unit": "../../tests/t00056/t00056.cc" }, "type": "T1" @@ -554,7 +557,7 @@ struct F { "source_location": { "column": 8, "file": "../../tests/t00056/t00056.cc", - "line": 89, + "line": 90, "translation_unit": "../../tests/t00056/t00056.cc" }, "type": "T2" @@ -566,7 +569,7 @@ struct F { "source_location": { "column": 8, "file": "../../tests/t00056/t00056.cc", - "line": 90, + "line": 91, "translation_unit": "../../tests/t00056/t00056.cc" }, "type": "T3" @@ -578,7 +581,7 @@ struct F { "source_location": { "column": 8, "file": "../../tests/t00056/t00056.cc", - "line": 87, + "line": 88, "translation_unit": "../../tests/t00056/t00056.cc" }, "template_parameters": [ @@ -605,8 +608,8 @@ struct F { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00056_class", diff --git a/docs/test_cases/t00056_class.svg b/docs/test_cases/t00056_class.svg index 05e1a14b..e44e2ce1 100644 --- a/docs/test_cases/t00056_class.svg +++ b/docs/test_cases/t00056_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + «concept» @@ -20,8 +20,8 @@ - - + + «concept» @@ -33,8 +33,8 @@ sizeof (l) > sizeof (r) - - + + «concept» @@ -44,8 +44,8 @@ - - + + «concept» @@ -58,8 +58,8 @@ container.begin() container.end() - - + + «concept» @@ -71,8 +71,8 @@ typename T::value_type - - + + «concept» @@ -86,8 +86,8 @@ {std::to_string(s)} noexcept {std::to_string(s)} -> std::same_as<std::string> - - + + «concept» @@ -97,8 +97,8 @@ - - + + «concept» @@ -108,8 +108,8 @@ - - + + A @@ -118,15 +118,15 @@ - + - + a : T - - + + B @@ -135,15 +135,15 @@ - + - + b : T - - + + C @@ -152,15 +152,15 @@ - + - + c : T - - + + D @@ -169,8 +169,8 @@ - - + + E @@ -179,29 +179,29 @@ - + - + e1 : T1 - + - + e2 : T2 - + - + e3 : T3 - - + + F @@ -210,25 +210,25 @@ - + - + f1 : T1 - + - + f2 : T2 - + - + f3 : T3 diff --git a/docs/test_cases/t00056_class_mermaid.svg b/docs/test_cases/t00056_class_mermaid.svg new file mode 100644 index 00000000..266f71ce --- /dev/null +++ b/docs/test_cases/t00056_class_mermaid.svg @@ -0,0 +1,594 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + T + +
+
+
+
+ + + +
+ + T + +
+
+
+
+ + + +
+ + T + +
+
+
+
+ + + +
+ + T + +
+
+
+
+ + + +
+ + T + +
+
+
+
+ + + +
+ + T + +
+
+
+
+ + + +
+ + T + +
+
+
+
+ + + +
+ + T + +
+
+
+
+ + + +
+ + T1 + +
+
+
+
+ + + +
+ + T3 + +
+
+
+
+ + + +
+ + T2 + +
+
+
+
+ + + +
+ + T5 + +
+
+
+
+ + + +
+ + T1,T3 + +
+
+
+
+ + + +
+ + T1,T3 + +
+
+
+
+
+ + + + + + + + +
+ «concept» +
+
+ +
+ greater_than_simple<T,L> +
+
+
+
+
+ + + + + + + +
+ «concept» +
+
+ +
+ greater_than_with_requires<T,P> +
+
+ +
+ "sizeof (l) > sizeof (r)" +
+
+ +
+ "(T l,P r)" +
+
+
+
+
+ + + + + + + +
+ «concept» +
+
+ +
+ max_four_bytes<T> +
+
+
+
+
+ + + + + + + +
+ «concept» +
+
+ +
+ iterable<T> +
+
+ +
+ "container.begin()" +
+
+ +
+ "container.end()" +
+
+ +
+ "(T container)" +
+
+
+
+
+ + + + + + + +
+ «concept» +
+
+ +
+ has_value_type<T> +
+
+ +
+ "typename T::value_type" +
+
+ +
+ "()" +
+
+
+
+
+ + + + + + + +
+ «concept» +
+
+ +
+ convertible_to_string<T> +
+
+ +
+ "std::string{s}" +
+
+ +
+ "{std::to_string(s)} noexcept" +
+
+ +
+ "{std::to_string(s)} -> std::same_as<std::string>" +
+
+ +
+ "(T s)" +
+
+
+
+
+ + + + + + + +
+ «concept» +
+
+ +
+ iterable_with_value_type<T> +
+
+
+
+
+ + + + + + + +
+ «concept» +
+
+ +
+ iterable_or_small_value_type<T> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<max_four_bytes T> +
+
+ +
+ +a : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<T> +
+
+ +
+ +b : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C<convertible_to_string T> +
+
+ +
+ +c : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D<iterable T1,T2,iterable T3,T4,T5> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ E<T1,T2,T3> +
+
+ +
+ +e1 : T1 +
+
+ +
+ +e2 : T2 +
+
+ +
+ +e3 : T3 +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ F<T1,T2,T3> +
+
+ +
+ +f1 : T1 +
+
+ +
+ +f2 : T2 +
+
+ +
+ +f3 : T3 +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00057.md b/docs/test_cases/t00057.md index 479b3839..e78d1cd4 100644 --- a/docs/test_cases/t00057.md +++ b/docs/test_cases/t00057.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00057_class: type: class @@ -59,8 +59,10 @@ struct t00057_R { }; ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00057_class](./t00057_class.svg "Test case C99/C11 translation units with structs and unions") +## Generated Mermaid diagrams +![t00057_class](./t00057_class_mermaid.svg "Test case C99/C11 translation units with structs and unions") ## Generated JSON models ```json { @@ -550,8 +552,8 @@ struct t00057_R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00057_class", diff --git a/docs/test_cases/t00057_class.svg b/docs/test_cases/t00057_class.svg index 8e219367..efe5d381 100644 --- a/docs/test_cases/t00057_class.svg +++ b/docs/test_cases/t00057_class.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - + + t00057_A - + - + a1 : int - - + + t00057_B - + - + b1 : int - - + + t00057_C - + - + c1 : int - - + + «union» @@ -63,73 +63,73 @@ - + - + d1 : int - + - + d2 : float - - + + t00057_E - + - + coordinates : t00057_E::(anonymous_739) - + - + e : int - + - + height : t00057_E::(anonymous_807) - - + + t00057_E::(coordinates) - + - + x : int - + - + y : int - - + + «union» @@ -137,105 +137,105 @@ - + - + t : double - + - + z : int - - + + t00057_G - + - + g1 : int - - + + t00057_R - + - + a : struct t00057_A - + - + b : t00057_B - + - + c : struct t00057_C * - + - + d : union t00057_D - + - + e : struct t00057_E * - + - + f : struct t00057_F * - + - + g : struct t00057_G * - - + + t00057_F - + - + f1 : int diff --git a/docs/test_cases/t00057_class_mermaid.svg b/docs/test_cases/t00057_class_mermaid.svg new file mode 100644 index 00000000..6a87930f --- /dev/null +++ b/docs/test_cases/t00057_class_mermaid.svg @@ -0,0 +1,463 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +coordinates + +
+
+
+
+ + + +
+ + +height + +
+
+
+
+ + + +
+ + +a + +
+
+
+
+ + + +
+ + +b + +
+
+
+
+ + + +
+ + +c + +
+
+
+
+ + + +
+ + +d + +
+
+
+
+ + + +
+ + +e + +
+
+
+
+ + + +
+ + +f + +
+
+
+
+ + + +
+ + +g + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ t00057_A +
+
+ +
+ +a1 : int +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ t00057_B +
+
+ +
+ +b1 : int +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ t00057_C +
+
+ +
+ +c1 : int +
+
+
+
+
+ + + + + + + +
+ «union» +
+
+ +
+ t00057_D +
+
+ +
+ +d1 : int +
+
+ +
+ +d2 : float +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ t00057_E +
+
+ +
+ +coordinates : t00057_E::(anonymous_739) +
+
+ +
+ +e : int +
+
+ +
+ +height : t00057_E::(anonymous_807) +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ t00057_E::(coordinates) +
+
+ +
+ +x : int +
+
+ +
+ +y : int +
+
+
+
+
+ + + + + + + +
+ «union» +
+
+ +
+ t00057_E::(height) +
+
+ +
+ +t : double +
+
+ +
+ +z : int +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ t00057_G +
+
+ +
+ +g1 : int +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ t00057_R +
+
+ +
+ +a : struct t00057_A +
+
+ +
+ +b : t00057_B +
+
+ +
+ +c : struct t00057_C +
+
+ +
+ +d : union t00057_D +
+
+ +
+ +e : struct t00057_E +
+
+ +
+ +f : struct t00057_F +
+
+ +
+ +g : struct t00057_G +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ t00057_F +
+
+ +
+ +f1 : int +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00058.md b/docs/test_cases/t00058.md index b445768c..96908e3f 100644 --- a/docs/test_cases/t00058.md +++ b/docs/test_cases/t00058.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00058_class: type: class @@ -65,8 +65,10 @@ struct R { } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00058_class](./t00058_class.svg "Test case for concepts with variadic parameters and type aliases") +## Generated Mermaid diagrams +![t00058_class](./t00058_class_mermaid.svg "Test case for concepts with variadic parameters and type aliases") ## Generated JSON models ```json { @@ -433,8 +435,8 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00058_class", diff --git a/docs/test_cases/t00058_class.svg b/docs/test_cases/t00058_class.svg index 3e69b90e..211b66b3 100644 --- a/docs/test_cases/t00058_class.svg +++ b/docs/test_cases/t00058_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + first_type @@ -19,8 +19,8 @@ - - + + «concept» @@ -30,8 +30,8 @@ - - + + A @@ -40,15 +40,15 @@ - + - + a : std::vector<T> - - + + B @@ -57,22 +57,22 @@ - + - + b : std::vector<T> - + - + bb : P - - + + A @@ -81,8 +81,8 @@ - - + + A @@ -91,8 +91,8 @@ - - + + B @@ -101,26 +101,26 @@ - - + + R - + - + aa : A<int,int,double,std::string> - + - + bb : B<int,std::string,int,double,A<int,int>> diff --git a/docs/test_cases/t00058_class_mermaid.svg b/docs/test_cases/t00058_class_mermaid.svg new file mode 100644 index 00000000..346b04e6 --- /dev/null +++ b/docs/test_cases/t00058_class_mermaid.svg @@ -0,0 +1,333 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + T,Args... + +
+
+
+
+ + + +
+ + T,Args... + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +aa + +
+
+
+
+ + + +
+ + +bb + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ first_type<T,Args...> +
+
+
+
+
+ + + + + + + +
+ «concept» +
+
+ +
+ same_as_first_type<T,Args...> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<T,Args...> +
+
+ +
+ +a : std::vector<T> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<T,P,Args...> +
+
+ +
+ +b : std::vector<T> +
+
+ +
+ +bb : P +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<int,int,double,std::string> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<int,int> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B<int,std::string,int,double,A<int,int>> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +aa : A<int,int,double,std::string> +
+
+ +
+ +bb : B<int,std::string,int,double,A<int,int>> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00059.md b/docs/test_cases/t00059.md index 697d368b..cd88e72e 100644 --- a/docs/test_cases/t00059.md +++ b/docs/test_cases/t00059.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00059_class: type: class @@ -74,8 +74,10 @@ struct R { } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00059_class](./t00059_class.svg "Non-virtual abstract factory pattern using concepts test case") +## Generated Mermaid diagrams +![t00059_class](./t00059_class_mermaid.svg "Non-virtual abstract factory pattern using concepts test case") ## Generated JSON models ```json { @@ -616,7 +618,7 @@ struct R { "line": 52, "translation_unit": "../../tests/t00059/t00059.cc" }, - "type": "clanguml::t00059::fruit_factory_1" + "type": "fruit_factory_1" }, { "access": "public", @@ -628,7 +630,7 @@ struct R { "line": 53, "translation_unit": "../../tests/t00059/t00059.cc" }, - "type": "clanguml::t00059::fruit_factory_2" + "type": "fruit_factory_2" } ], "methods": [], @@ -645,8 +647,8 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00059_class", diff --git a/docs/test_cases/t00059_class.svg b/docs/test_cases/t00059_class.svg index 2fef6eef..e3c9f2d5 100644 --- a/docs/test_cases/t00059_class.svg +++ b/docs/test_cases/t00059_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + «concept» @@ -23,8 +23,8 @@ T{} t.get_name() - - + + «concept» @@ -36,8 +36,8 @@ t.get_sweetness() - - + + «concept» @@ -49,96 +49,96 @@ t.get_bitterness() - - + + gala_apple - + - + get_name() const : std::string - + - + get_sweetness() const : float - - + + empire_apple - + - + get_name() const : std::string - + - + get_sweetness() const : float - - + + lima_orange - + - + get_bitterness() const : float - + - + get_name() const : std::string - - + + valencia_orange - + - + get_bitterness() const : float - + - + get_name() const : std::string - - + + fruit_factory @@ -146,23 +146,23 @@ apple_c TA,orange_c TO - + - + create_apple() const : TA - + - + create_orange() const : TO - - + + fruit_factory @@ -171,8 +171,8 @@ - - + + fruit_factory @@ -181,26 +181,26 @@ - - + + R - + - + factory_1 : fruit_factory_1 - + - + factory_2 : fruit_factory_2 diff --git a/docs/test_cases/t00059_class_mermaid.svg b/docs/test_cases/t00059_class_mermaid.svg new file mode 100644 index 00000000..1815e9cf --- /dev/null +++ b/docs/test_cases/t00059_class_mermaid.svg @@ -0,0 +1,508 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + T + +
+
+
+
+ + + +
+ + T + +
+
+
+
+ + + +
+ + TA + +
+
+
+
+ + + +
+ + TO + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +factory_1 + +
+
+
+
+ + + +
+ + +factory_2 + +
+
+
+
+
+ + + + + + + + +
+ «concept» +
+
+ +
+ fruit_c<T> +
+
+ +
+ "T{}" +
+
+ +
+ "t.get_name()" +
+
+ +
+ "(T t)" +
+
+
+
+
+ + + + + + + +
+ «concept» +
+
+ +
+ apple_c<T> +
+
+ +
+ "t.get_sweetness()" +
+
+ +
+ "(T t)" +
+
+
+
+
+ + + + + + + +
+ «concept» +
+
+ +
+ orange_c<T> +
+
+ +
+ "t.get_bitterness()" +
+
+ +
+ "(T t)" +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ gala_apple +
+
+ +
+ +get_name() : [const] std::string +
+
+ +
+ +get_sweetness() : [const] float +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ empire_apple +
+
+ +
+ +get_name() : [const] std::string +
+
+ +
+ +get_sweetness() : [const] float +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ lima_orange +
+
+ +
+ +get_bitterness() : [const] float +
+
+ +
+ +get_name() : [const] std::string +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ valencia_orange +
+
+ +
+ +get_bitterness() : [const] float +
+
+ +
+ +get_name() : [const] std::string +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ fruit_factory<apple_c TA,orange_c TO> +
+
+ +
+ +create_apple() : [const] TA +
+
+ +
+ +create_orange() : [const] TO +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ fruit_factory<gala_apple,valencia_orange> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ fruit_factory<empire_apple,lima_orange> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +factory_1 : fruit_factory_1 +
+
+ +
+ +factory_2 : fruit_factory_2 +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00060.md b/docs/test_cases/t00060.md index f8b08e7a..e61d106c 100644 --- a/docs/test_cases/t00060.md +++ b/docs/test_cases/t00060.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00060_class: type: class @@ -41,8 +41,10 @@ template struct H : public G { } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00060_class](./t00060_class.svg "Parents (base classes) diagram filter test case") +## Generated Mermaid diagrams +![t00060_class](./t00060_class_mermaid.svg "Parents (base classes) diagram filter test case") ## Generated JSON models ```json { @@ -274,8 +276,8 @@ template struct H : public G { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00060_class", diff --git a/docs/test_cases/t00060_class.svg b/docs/test_cases/t00060_class.svg index d3882529..26bf27a9 100644 --- a/docs/test_cases/t00060_class.svg +++ b/docs/test_cases/t00060_class.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - - + + B - - + + C - - + + D - - + + G @@ -51,15 +51,15 @@ - + - + g : T - - + + H @@ -68,18 +68,18 @@ - + - + h : G<T> - + - + hh : P diff --git a/docs/test_cases/t00060_class_mermaid.svg b/docs/test_cases/t00060_class_mermaid.svg new file mode 100644 index 00000000..becd2acf --- /dev/null +++ b/docs/test_cases/t00060_class_mermaid.svg @@ -0,0 +1,251 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ + +h + +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ G<T> +
+
+ +
+ +g : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ H<T,P> +
+
+ +
+ +h : G<T> +
+
+ +
+ +hh : P +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00061.md b/docs/test_cases/t00061.md index ee1771b8..724a81fc 100644 --- a/docs/test_cases/t00061.md +++ b/docs/test_cases/t00061.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00061_class: type: class @@ -32,8 +32,10 @@ struct C { } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00061_class](./t00061_class.svg "Paths diagram filter test case") +## Generated Mermaid diagrams +![t00061_class](./t00061_class_mermaid.svg "Paths diagram filter test case") ## Generated JSON models ```json { @@ -63,8 +65,8 @@ struct C { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00061_class", diff --git a/docs/test_cases/t00061_class.svg b/docs/test_cases/t00061_class.svg index 1967491b..8046e1bc 100644 --- a/docs/test_cases/t00061_class.svg +++ b/docs/test_cases/t00061_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A diff --git a/docs/test_cases/t00061_class_mermaid.svg b/docs/test_cases/t00061_class_mermaid.svg new file mode 100644 index 00000000..49afa2f4 --- /dev/null +++ b/docs/test_cases/t00061_class_mermaid.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00062.md b/docs/test_cases/t00062.md index 76f740d2..41d848ac 100644 --- a/docs/test_cases/t00062.md +++ b/docs/test_cases/t00062.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00062_class: type: class @@ -122,8 +122,10 @@ struct A> { } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00062_class](./t00062_class.svg "Template specialization matching based on deduced context") +## Generated Mermaid diagrams +![t00062_class](./t00062_class_mermaid.svg "Template specialization matching based on deduced context") ## Generated JSON models ```json { @@ -1370,8 +1372,8 @@ struct A> { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00062_class", diff --git a/docs/test_cases/t00062_class.svg b/docs/test_cases/t00062_class.svg index f66b5981..c2263d8e 100644 --- a/docs/test_cases/t00062_class.svg +++ b/docs/test_cases/t00062_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A @@ -19,15 +19,15 @@ - + - + u : U & - - + + A @@ -36,15 +36,15 @@ - + - + u : U & - - + + A @@ -53,8 +53,8 @@ - - + + A @@ -63,15 +63,15 @@ - + - + u : U ** - - + + A @@ -80,15 +80,15 @@ - + - + u : U *** - - + + A @@ -97,15 +97,15 @@ - + - + u : U *** - - + + A @@ -114,15 +114,15 @@ - + - + u : U && - - + + A @@ -131,15 +131,15 @@ - + - + u : const U & - - + + A @@ -148,22 +148,22 @@ - + - + c : C & - + - + m : M C::* - - + + A @@ -172,22 +172,22 @@ - + - + c : C && - + - + m : M C::* - - + + A @@ -196,22 +196,22 @@ - + - + c : C & - + - + m : M C::* - - + + A @@ -220,15 +220,15 @@ - + - + c : C & - - + + A @@ -237,22 +237,22 @@ - + - + c : C && - + - + m : M C::* - - + + A @@ -261,22 +261,22 @@ - + - + c : C && - + - + mf : float C::* - - + + A @@ -285,22 +285,22 @@ - + - + c : C & - + - + m : M C::* - - + + A @@ -309,15 +309,15 @@ - + - + n : char[N] - - + + A @@ -326,15 +326,15 @@ - + - + n : std::vector<char> - - + + A @@ -343,15 +343,15 @@ - + - + klm : char[K][L][M] - - + + A @@ -360,15 +360,15 @@ - + - + u : bool - - + + A @@ -377,15 +377,15 @@ - + - + c : C<T> - - + + A @@ -394,22 +394,22 @@ - + - + args : std::tuple<Args...> - + - + c : C<T> - - + + A diff --git a/docs/test_cases/t00062_class_mermaid.svg b/docs/test_cases/t00062_class_mermaid.svg new file mode 100644 index 00000000..3cdf9b07 --- /dev/null +++ b/docs/test_cases/t00062_class_mermaid.svg @@ -0,0 +1,865 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ A<U &> +
+
+ +
+ +u : U & +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<std::map<std::string,U> &> +
+
+ +
+ +u : U & +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<std::map<std::string,std::map<std::string,std::string>> &> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<U * *> +
+
+ +
+ +u : U * +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<U * * const*> +
+
+ +
+ +u : U ** +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<U const volatile* const volatile> +
+
+ +
+ +u : U ** +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<U &&> +
+
+ +
+ +u : U && +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<U const&> +
+
+ +
+ +u : const U & +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<M C::*> +
+
+ +
+ +c : C & +
+
+ +
+ +m : M C:: +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<M C::* &&> +
+
+ +
+ +c : C && +
+
+ +
+ +m : M C:: +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<M (C::*)(Arg)> +
+
+ +
+ +c : C & +
+
+ +
+ +m : M C:: +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<int (C::*)(bool)> +
+
+ +
+ +c : C & +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<M (C::*)(Arg) &&> +
+
+ +
+ +c : C && +
+
+ +
+ +m : M C:: +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<float (C::*)(int) &&> +
+
+ +
+ +c : C && +
+
+ +
+ +mf : float C:: +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<M (C::*)(Arg1,Arg2,Arg3)> +
+
+ +
+ +c : C & +
+
+ +
+ +m : M C:: +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<char[N]> +
+
+ +
+ +n : char[N] +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<char[1000]> +
+
+ +
+ +n : std::vector<char> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<char[M][L][K]> +
+
+ +
+ +klm : char[K][L][M] +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<U(...)> +
+
+ +
+ +u : bool +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<C<T>> +
+
+ +
+ +c : C<T> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<C<T,Args...>> +
+
+ +
+ +args : std::tuple<Args...> +
+
+ +
+ +c : C<T> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A<T> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00063.md b/docs/test_cases/t00063.md index a91dcf32..03b95889 100644 --- a/docs/test_cases/t00063.md +++ b/docs/test_cases/t00063.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00063_class: type: class @@ -30,8 +30,10 @@ enum class C { c1, c2, c3 }; } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00063_class](./t00063_class.svg "Element types diagram filter test case") +## Generated Mermaid diagrams +![t00063_class](./t00063_class_mermaid.svg "Element types diagram filter test case") ## Generated JSON models ```json { @@ -61,8 +63,8 @@ enum class C { c1, c2, c3 }; } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00063_class", diff --git a/docs/test_cases/t00063_class.svg b/docs/test_cases/t00063_class.svg index 628a990e..7a9af6e7 100644 --- a/docs/test_cases/t00063_class.svg +++ b/docs/test_cases/t00063_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + A diff --git a/docs/test_cases/t00063_class_mermaid.svg b/docs/test_cases/t00063_class_mermaid.svg new file mode 100644 index 00000000..24fc7691 --- /dev/null +++ b/docs/test_cases/t00063_class_mermaid.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00064.md b/docs/test_cases/t00064.md index 90c15e14..17a44423 100644 --- a/docs/test_cases/t00064.md +++ b/docs/test_cases/t00064.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00064_class: type: class @@ -82,8 +82,10 @@ public: } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00064_class](./t00064_class.svg "Template type list test case") +## Generated Mermaid diagrams +![t00064_class](./t00064_class_mermaid.svg "Template type list test case") ## Generated JSON models ```json { @@ -553,7 +555,7 @@ public: "line": 46, "translation_unit": "../../tests/t00064/t00064.cc" }, - "type": "value_type const*" + "type": "const value_type *" }, { "access": "public", @@ -574,7 +576,7 @@ public: "parameters": [ { "name": "v", - "type": "value_type const&" + "type": "const value_type &" } ], "source_location": { @@ -900,7 +902,7 @@ public: "line": 57, "translation_unit": "../../tests/t00064/t00064.cc" }, - "type": "type_list" + "type": "type_list" }, { "access": "public", @@ -912,7 +914,7 @@ public: "line": 58, "translation_unit": "../../tests/t00064/t00064.cc" }, - "type": "type_group_pair,type_list>" + "type": "type_group_pair,type_list>" } ], "methods": [], @@ -1034,8 +1036,8 @@ public: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00064_class", diff --git a/docs/test_cases/t00064_class.svg b/docs/test_cases/t00064_class.svg index 89406df6..93506a95 100644 --- a/docs/test_cases/t00064_class.svg +++ b/docs/test_cases/t00064_class.svg @@ -1,6 +1,6 @@ - + @@ -9,8 +9,8 @@ - - + + type_list @@ -19,8 +19,8 @@ - - + + type_list @@ -29,8 +29,8 @@ - - + + type_list @@ -39,8 +39,8 @@ - - + + type_list @@ -49,8 +49,8 @@ - - + + head @@ -59,8 +59,8 @@ - - + + type_list @@ -69,8 +69,8 @@ - - + + type_list @@ -79,8 +79,8 @@ - - + + type_list @@ -89,8 +89,8 @@ - - + + type_group_pair @@ -99,15 +99,15 @@ - + - + size : const size_t - - + + optional_ref @@ -116,8 +116,8 @@ - - + + optional_ref @@ -126,8 +126,8 @@ - - + + type_group_pair_it @@ -135,54 +135,54 @@ It,type_list<First...>,type_list<Second...> - + - - find(value_type const& v) constexpr : unsigned int + + find(const value_type & v) constexpr : unsigned int - + - + get(unsigned int i) : ref_t - + - - getp(unsigned int i) : value_type const* + + getp(unsigned int i) : const value_type * - - + + A - - + + B - - + + C - - + + type_list @@ -191,8 +191,8 @@ - - + + type_list @@ -201,8 +201,8 @@ - - + + type_list @@ -211,8 +211,8 @@ - - + + type_group_pair @@ -221,30 +221,30 @@ - - + + R - + - + abc : type_group_pair<type_list<float,double>,type_list<A,B,C>> - + - + aboolint : type_list<A,bool,int> - - + + type_group_pair @@ -253,8 +253,8 @@ - - + + type_group_pair_it @@ -263,8 +263,8 @@ - - + + head diff --git a/docs/test_cases/t00064_class_mermaid.svg b/docs/test_cases/t00064_class_mermaid.svg new file mode 100644 index 00000000..65fe6b68 --- /dev/null +++ b/docs/test_cases/t00064_class_mermaid.svg @@ -0,0 +1,863 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +aboolint + +
+
+
+
+ + + +
+ + +abc + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ type_list<Ts...> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ type_list<Ret(Arg &&),Ts...> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ type_list<T const,Ts...> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ type_list<Head,Tail...> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ head<type_list<Head,Tail...>> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ type_list<Type...> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ type_list<First...> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ type_list<Second...> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ type_group_pair<type_list<First...>,type_list<Second...>> +
+
+ +
+ -size : const size_t +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ optional_ref<T> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ optional_ref<type_group_pair_it<It,type_list<First...>,type_list<Second...>>::value_type> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ type_group_pair_it<It,type_list<First...>,type_list<Second...>> +
+
+ +
+ +find(const value_type & v) : [constexpr] unsigned int +
+
+ +
+ +get(unsigned int i) : ref_t +
+
+ +
+ +getp(unsigned int i) : const value_type +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ type_list<A,bool,int> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ type_list<float,double> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ type_list<A,B,C> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ type_group_pair<type_list<float,double>,type_list<A,B,C>> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +abc : type_group_pair<type_list<float,double>,type_list<A,B,C>> +
+
+ +
+ +aboolint : type_list<A,bool,int> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ type_group_pair<typename,typename> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ type_group_pair_it<typename,typename,typename> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ head<typename> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00065.md b/docs/test_cases/t00065.md index 3dd1227c..ab3dc08b 100644 --- a/docs/test_cases/t00065.md +++ b/docs/test_cases/t00065.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00065_class: type: class @@ -33,8 +33,10 @@ struct R { } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00065_class](./t00065_class.svg "Class diagram with packages from directory structure") +## Generated Mermaid diagrams +![t00065_class](./t00065_class_mermaid.svg "Class diagram with packages from directory structure") ## Generated JSON models ```json { @@ -130,7 +132,7 @@ struct R { "line": 13, "translation_unit": "../../clang-uml/tests/t00065/t00065.cc" }, - "type": "clanguml::t00065::ABC" + "type": "ABC" }, { "access": "public", @@ -142,7 +144,7 @@ struct R { "line": 14, "translation_unit": "../../clang-uml/tests/t00065/t00065.cc" }, - "type": "clanguml::t00065::XYZ" + "type": "XYZ" }, { "access": "public", @@ -486,7 +488,7 @@ struct R { "line": 7, "translation_unit": "../../clang-uml/tests/t00065/t00065.cc" }, - "type": "clanguml::t00065::A *" + "type": "A *" }, { "access": "public", @@ -498,7 +500,7 @@ struct R { "line": 8, "translation_unit": "../../clang-uml/tests/t00065/t00065.cc" }, - "type": "C" + "type": "C
" }, { "access": "public", @@ -510,7 +512,7 @@ struct R { "line": 9, "translation_unit": "../../clang-uml/tests/t00065/t00065.cc" }, - "type": "D" + "type": "D" } ], "methods": [], @@ -527,8 +529,8 @@ struct R { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00065_class", diff --git a/docs/test_cases/t00065_class.svg b/docs/test_cases/t00065_class.svg index b20b34e7..52bbbb45 100644 --- a/docs/test_cases/t00065_class.svg +++ b/docs/test_cases/t00065_class.svg @@ -1,6 +1,6 @@ - + @@ -9,20 +9,20 @@ - + module1 - + submodule1a - + module2 - + concepts - - + + ABC @@ -32,8 +32,8 @@ c - - + + XYZ @@ -43,68 +43,68 @@ z - - + + A - + - + abc : ABC - + - + pimpl : detail::AImpl * - + - + xyz : XYZ - - + + AImpl - - + + B - + - + B() = default : void - + - + b() : void - - + + C @@ -113,15 +113,15 @@ - + - + t : T * - - + + C @@ -130,8 +130,8 @@ - - + + D @@ -140,22 +140,22 @@ - + - + c : C<int> - + - + t : T - - + + C @@ -164,8 +164,8 @@ - - + + D @@ -174,8 +174,8 @@ - - + + «concept» @@ -186,33 +186,33 @@ T{} t.b() - - + + R - + - + a : A * - + - + c : C<B> - + - + d : D<B> diff --git a/docs/test_cases/t00065_class_mermaid.svg b/docs/test_cases/t00065_class_mermaid.svg new file mode 100644 index 00000000..a2039cd3 --- /dev/null +++ b/docs/test_cases/t00065_class_mermaid.svg @@ -0,0 +1,544 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +abc + +
+
+
+
+ + + +
+ + +xyz + +
+
+
+
+ + + +
+ + +pimpl + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + T + +
+
+
+
+ + + +
+ + +c + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + + +
+
+
+
+ + + +
+ + +a + +
+
+
+
+ + + +
+ + +c + +
+
+
+
+ + + +
+ + +d + +
+
+
+
+
+ + + + + + + + +
+ +
+
+ +
+ detail::AImpl +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ ABC +
+
+ +
+ a +
+
+ +
+ b +
+
+ +
+ c +
+
+
+
+
+ + + + + + + +
+ «enumeration» +
+
+ +
+ XYZ +
+
+ +
+ x +
+
+ +
+ y +
+
+ +
+ z +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ A +
+
+ +
+ +abc : ABC +
+
+ +
+ +pimpl : detail::AImpl +
+
+ +
+ +xyz : XYZ +
+
+
+
+
+ + + + + + + +
+ «concept» +
+
+ +
+ bconcept<T> +
+
+ +
+ "T{}" +
+
+ +
+ "t.b()" +
+
+ +
+ "(T t)" +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ B +
+
+ +
+ +B() : [default] void +
+
+ +
+ +b() : void +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C<T> +
+
+ +
+ +t : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C<int> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D<bconcept T> +
+
+ +
+ +c : C<int> +
+
+ +
+ +t : T +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ C<B> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ D<B> +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ R +
+
+ +
+ +a : A +
+
+ +
+ +c : C<B> +
+
+ +
+ +d : D<B> +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00066.md b/docs/test_cases/t00066.md index 49953e27..08b3e952 100644 --- a/docs/test_cases/t00066.md +++ b/docs/test_cases/t00066.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00066_class: type: class @@ -89,8 +89,10 @@ int A::static_int = 1; } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00066_class](./t00066_class.svg "Class fields and methods without grouping and sorting") +## Generated Mermaid diagrams +![t00066_class](./t00066_class_mermaid.svg "Class fields and methods without grouping and sorting") ## Generated JSON models ```json { @@ -302,7 +304,7 @@ int A::static_int = 1; "parameters": [ { "name": "", - "type": "clanguml::t00066::A &&" + "type": "A &&" } ], "source_location": { @@ -332,7 +334,7 @@ int A::static_int = 1; "parameters": [ { "name": "", - "type": "const clanguml::t00066::A &" + "type": "const A &" } ], "source_location": { @@ -491,7 +493,7 @@ int A::static_int = 1; "line": 23, "translation_unit": "../../tests/t00066/t00066.cc" }, - "type": "clanguml::t00066::A &" + "type": "A &" }, { "access": "public", @@ -512,7 +514,7 @@ int A::static_int = 1; "parameters": [ { "name": "other", - "type": "clanguml::t00066::A &&" + "type": "A &&" } ], "source_location": { @@ -521,7 +523,7 @@ int A::static_int = 1; "line": 29, "translation_unit": "../../tests/t00066/t00066.cc" }, - "type": "clanguml::t00066::A &" + "type": "A &" }, { "access": "public", @@ -542,7 +544,7 @@ int A::static_int = 1; "parameters": [ { "name": "other", - "type": "clanguml::t00066::A &" + "type": "A &" } ], "source_location": { @@ -551,7 +553,7 @@ int A::static_int = 1; "line": 30, "translation_unit": "../../tests/t00066/t00066.cc" }, - "type": "clanguml::t00066::A &" + "type": "A &" }, { "access": "public", @@ -736,7 +738,7 @@ int A::static_int = 1; "line": 43, "translation_unit": "../../tests/t00066/t00066.cc" }, - "type": "clanguml::t00066::A" + "type": "A" }, { "access": "protected", @@ -802,8 +804,8 @@ int A::static_int = 1; } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00066_class", diff --git a/docs/test_cases/t00066_class.svg b/docs/test_cases/t00066_class.svg index 04a6dda2..d0986656 100644 --- a/docs/test_cases/t00066_class.svg +++ b/docs/test_cases/t00066_class.svg @@ -1,6 +1,6 @@ - + @@ -9,222 +9,222 @@ - - + + A - + - + public_member : int - + - + protected_member : int - + - + private_member : int - + - + a_ : int - + - + b_ : int - + - + c_ : int - + - + static_int : int - + - + static_const_int : const int - + - + auto_member : const unsigned long - + - + A() = default : void - + - + A(int i) : void - + - + A(A &&) = default : void - + - + A(const A &) = deleted : void - + - + ~A() = default : void - + - + basic_method() : void - + - + static_method() : int - + - + const_method() const : void - + - + auto_method() : int - + - + operator++() : A & - + - + operator=(A && other) noexcept : A & - + - + operator=(A & other) noexcept : A & - + - + size() const : std::size_t - + - + double_int(const int i) : int - + - + sum(const double a, const double b) : int - + - + default_int(int i = 12) : int - + - + default_string(int i, std::string s = "abc") : std::string - + - + create_from_int(int i) : A - + - + protected_method() : void - + - + private_method() : void - + - + compare : std::function<bool (const int)> diff --git a/docs/test_cases/t00066_class_mermaid.svg b/docs/test_cases/t00066_class_mermaid.svg new file mode 100644 index 00000000..e9d56351 --- /dev/null +++ b/docs/test_cases/t00066_class_mermaid.svg @@ -0,0 +1,227 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ A +
+
+ +
+ +public_member : int +
+
+ +
+ #protected_member : int +
+
+ +
+ #compare : std::function<bool (const int)> +
+
+ +
+ -private_member : int +
+
+ +
+ -a_ : int +
+
+ +
+ -b_ : int +
+
+ +
+ -c_ : int +
+
+ +
+ +static_int : int +
+
+ +
+ +static_const_int : const int +
+
+ +
+ +auto_member : const unsigned long +
+
+ +
+ +A() : [default] void +
+
+ +
+ +A(int i) : void +
+
+ +
+ +A(A &&) : [default] void +
+
+ +
+ +A(const A &) : void +
+
+ +
+ +~A() : [default] void +
+
+ +
+ +basic_method() : void +
+
+ +
+ +static_method() : int +
+
+ +
+ +const_method() : [const] void +
+
+ +
+ +auto_method() : int +
+
+ +
+ +operator++() : A & +
+
+ +
+ +operator=(A && other) : A & +
+
+ +
+ +operator=(A & other) : A & +
+
+ +
+ +size() : [const] std::size_t +
+
+ +
+ +double_int(const int i) : int +
+
+ +
+ +sum(const double a, const double b) : int +
+
+ +
+ +default_int(int i = 12) : int +
+
+ +
+ +default_string(int i, std::string s = "abc") : std::string +
+
+ +
+ +create_from_int(int i) : A +
+
+ +
+ #protected_method() : void +
+
+ +
+ -private_method() : void +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t00067.md b/docs/test_cases/t00067.md index d6d5a79e..05dafd12 100644 --- a/docs/test_cases/t00067.md +++ b/docs/test_cases/t00067.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00067_class: type: class @@ -92,8 +92,10 @@ int A::static_int = 1; } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t00067_class](./t00067_class.svg "Class method type filter test case") +## Generated Mermaid diagrams +![t00067_class](./t00067_class_mermaid.svg "Class method type filter test case") ## Generated JSON models ```json { @@ -525,8 +527,8 @@ int A::static_int = 1; } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t00067_class", diff --git a/docs/test_cases/t00067_class.svg b/docs/test_cases/t00067_class.svg index b94b5977..b21c7d5a 100644 --- a/docs/test_cases/t00067_class.svg +++ b/docs/test_cases/t00067_class.svg @@ -1,6 +1,6 @@ - + @@ -9,152 +9,152 @@ - - + + A - + - + auto_method() : int - + - + basic_method() : void - + - + const_method() const : void - + - + default_int(int i = 12) : int - + - + default_string(int i, std::string s = "abc") : std::string - + - + double_int(const int i) : int - + - + private_method() : void - + - + protected_method() : void - + - + size() const : std::size_t - + - + sum(const double a, const double b) : int - + - + a_ : int - + - + auto_member : const unsigned long - + - + b_ : int - + - + c_ : int - + - + compare : std::function<bool (const int)> - + - + private_member : int - + - + protected_member : int - + - + public_member : int - + - + static_const_int : const int - + - + static_int : int diff --git a/docs/test_cases/t00067_class_mermaid.svg b/docs/test_cases/t00067_class_mermaid.svg new file mode 100644 index 00000000..1a3b9c63 --- /dev/null +++ b/docs/test_cases/t00067_class_mermaid.svg @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ A +
+
+ +
+ -a_ : int +
+
+ +
+ +auto_member : const unsigned long +
+
+ +
+ -b_ : int +
+
+ +
+ -c_ : int +
+
+ +
+ #compare : std::function<bool (const int)> +
+
+ +
+ -private_member : int +
+
+ +
+ #protected_member : int +
+
+ +
+ +public_member : int +
+
+ +
+ +static_const_int : const int +
+
+ +
+ +static_int : int +
+
+ +
+ +auto_method() : int +
+
+ +
+ +basic_method() : void +
+
+ +
+ +const_method() : [const] void +
+
+ +
+ +default_int(int i = 12) : int +
+
+ +
+ +default_string(int i, std::string s = "abc") : std::string +
+
+ +
+ +double_int(const int i) : int +
+
+ +
+ -private_method() : void +
+
+ +
+ #protected_method() : void +
+
+ +
+ +size() : [const] std::size_t +
+
+ +
+ +sum(const double a, const double b) : int +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t20001.md b/docs/test_cases/t20001.md index 45fd634e..c9f1d71a 100644 --- a/docs/test_cases/t20001.md +++ b/docs/test_cases/t20001.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20001_sequence: type: sequence @@ -23,6 +23,11 @@ diagrams: - "' t20001 test diagram of type {{ diagram.type }}" after: - '{% set e=element("clanguml::t20001::tmain()") %} note over {{ e.alias) }}: Main test function' + mermaid: + before: + - "%% t20001 test diagram of type {{ diagram.type }}" + after: + - '{% set e=element("clanguml::t20001::tmain()") %} Note over {{ e.alias) }}: Main test function' ``` ## Source code @@ -101,15 +106,17 @@ int tmain() } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20001_sequence](./t20001_sequence.svg "Basic sequence diagram test case") +## Generated Mermaid diagrams +![t20001_sequence](./t20001_sequence_mermaid.svg "Basic sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20001_sequence", diff --git a/docs/test_cases/t20001_sequence.svg b/docs/test_cases/t20001_sequence.svg index caa78384..5b3cabeb 100644 --- a/docs/test_cases/t20001_sequence.svg +++ b/docs/test_cases/t20001_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,73 +9,73 @@ - - - - - - - - - + + + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - - - - - - + + + + + + + + + + A() - + B(A &) - + add(int,int) - + wrap_add3(int,int,int) - + add3(int,int,int) - + @@ -86,7 +86,7 @@ - + @@ -95,14 +95,14 @@ - + log_result(int) - + Main test function diff --git a/docs/test_cases/t20001_sequence_mermaid.svg b/docs/test_cases/t20001_sequence_mermaid.svg new file mode 100644 index 00000000..686a956b --- /dev/null +++ b/docs/test_cases/t20001_sequence_mermaid.svg @@ -0,0 +1,142 @@ + + + + + B + + + + + + A + + + + + + tmain() + + + + + + + + B + + + + + + + + + A + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Main test function + + + A() + + B(A &) + + add(int,int) + + ​ + + wrap_add3(int,int,int) + + add3(int,int,int) + + add(int,int) + + ​ + + log_result(int) + + ​ + + log_result(int) + + ​ + + diff --git a/docs/test_cases/t20002.md b/docs/test_cases/t20002.md index 4469d224..f78af2b5 100644 --- a/docs/test_cases/t20002.md +++ b/docs/test_cases/t20002.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20002_sequence: type: sequence @@ -38,15 +38,17 @@ void m1() { m2(); } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20002_sequence](./t20002_sequence.svg "Free function sequence diagram test case") +## Generated Mermaid diagrams +![t20002_sequence](./t20002_sequence_mermaid.svg "Free function sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20002_sequence", diff --git a/docs/test_cases/t20002_sequence.svg b/docs/test_cases/t20002_sequence.svg index f7df505d..f347da46 100644 --- a/docs/test_cases/t20002_sequence.svg +++ b/docs/test_cases/t20002_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - - - + + + + - - + + m1() - + m1() - - + + m2() - + m2() - - + + m3() - + m3() - - + + m4() - + m4() - - - - - + + + + + - + - + diff --git a/docs/test_cases/t20002_sequence_mermaid.svg b/docs/test_cases/t20002_sequence_mermaid.svg new file mode 100644 index 00000000..856d0a45 --- /dev/null +++ b/docs/test_cases/t20002_sequence_mermaid.svg @@ -0,0 +1,118 @@ + + + + + m4() + + + + + + m3() + + + + + + m2() + + + + + + m1() + + + + + + + + m4() + + + + + + + + + m3() + + + + + + + + + m2() + + + + + + + + + m1() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ​ + + ​ + + ​ + + diff --git a/docs/test_cases/t20003.md b/docs/test_cases/t20003.md index f4dc9ab9..63b12e20 100644 --- a/docs/test_cases/t20003.md +++ b/docs/test_cases/t20003.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20003_sequence: type: sequence @@ -34,15 +34,17 @@ template void m1(T p) { m2(p); } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20003_sequence](./t20003_sequence.svg "Function template sequence diagram test case") +## Generated Mermaid diagrams +![t20003_sequence](./t20003_sequence_mermaid.svg "Function template sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20003_sequence", diff --git a/docs/test_cases/t20003_sequence.svg b/docs/test_cases/t20003_sequence.svg index 66d24598..8a9dfb0b 100644 --- a/docs/test_cases/t20003_sequence.svg +++ b/docs/test_cases/t20003_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,51 +9,51 @@ - - - - + + + + - - + + m1<T>(T) - + m1<T>(T) - - + + m2<T>(T) - + m2<T>(T) - - + + m3<T>(T) - + m3<T>(T) - - + + m4<T>(T) - + m4<T>(T) - - - - - + + + + + - + - + diff --git a/docs/test_cases/t20003_sequence_mermaid.svg b/docs/test_cases/t20003_sequence_mermaid.svg new file mode 100644 index 00000000..6541cbff --- /dev/null +++ b/docs/test_cases/t20003_sequence_mermaid.svg @@ -0,0 +1,118 @@ + + + + + m4<T>(T) + + + + + + m3<T>(T) + + + + + + m2<T>(T) + + + + + + m1<T>(T) + + + + + + + + m4<T>(T) + + + + + + + + + m3<T>(T) + + + + + + + + + m2<T>(T) + + + + + + + + + m1<T>(T) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ​ + + ​ + + ​ + + diff --git a/docs/test_cases/t20004.md b/docs/test_cases/t20004.md index 8a9f41ad..a6556ab6 100644 --- a/docs/test_cases/t20004.md +++ b/docs/test_cases/t20004.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20004_sequence: type: sequence @@ -70,15 +70,17 @@ int main() } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20004_sequence](./t20004_sequence.svg "Function template instantiation sequence diagram test case") +## Generated Mermaid diagrams +![t20004_sequence](./t20004_sequence_mermaid.svg "Function template instantiation sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20004_sequence", diff --git a/docs/test_cases/t20004_sequence.svg b/docs/test_cases/t20004_sequence.svg index 897d7ff8..0be1623b 100644 --- a/docs/test_cases/t20004_sequence.svg +++ b/docs/test_cases/t20004_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,16 +9,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -29,87 +29,87 @@ - - + + main() - + main() - - + + m1<float>(float) - + m1<float>(float) - - + + m1<unsigned long>(unsigned long) - + m1<unsigned long>(unsigned long) - - + + m4<unsigned long>(unsigned long) - + m4<unsigned long>(unsigned long) - - + + m1<std::string>(std::string) - + m1<std::string>(std::string) - - + + m2<std::string>(std::string) - + m2<std::string>(std::string) - - + + m1<int>(int) - + m1<int>(int) - - + + m2<int>(int) - + m2<int>(int) - - + + m3<int>(int) - + m3<int>(int) - - + + m4<int>(int) - + m4<int>(int) - - - - - - - - - - - + + + + + + + + + + + - + - + @@ -117,11 +117,11 @@ - + - + @@ -129,19 +129,19 @@ - + - + - + - + diff --git a/docs/test_cases/t20004_sequence_mermaid.svg b/docs/test_cases/t20004_sequence_mermaid.svg new file mode 100644 index 00000000..20b66b63 --- /dev/null +++ b/docs/test_cases/t20004_sequence_mermaid.svg @@ -0,0 +1,256 @@ + + + + + m4<int>(int) + + + + + + m3<int>(int) + + + + + + m2<int>(int) + + + + + + m1<int>(int) + + + + + + m2<std::string>(std::string) + + + + + + m1<std::string>(std::string) + + + + + + m4<unsigned long>(unsigned long) + + + + + + m1<unsigned long>(unsigned long) + + + + + + m1<float>(float) + + + + + + main() + + + + + + + + m4<int>(int) + + + + + + + + + m3<int>(int) + + + + + + + + + m2<int>(int) + + + + + + + + + m1<int>(int) + + + + + + + + + m2<std::string>(std::string) + + + + + + + + + m1<std::string>(std::string) + + + + + + + + + m4<unsigned long>(unsigned long) + + + + + + + + + m1<unsigned long>(unsigned long) + + + + + + + + + m1<float>(float) + + + + + + + + + main() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ​ + + ​ + + ​ + + ​ + + ​ + + ​ + + ​ + + ​ + + ​ + + ​ + + ​ + + ​ + + ​ + + ​ + + ​ + + ​ + + ​ + + ​ + + diff --git a/docs/test_cases/t20005.md b/docs/test_cases/t20005.md index ffcd06a5..915bdf02 100644 --- a/docs/test_cases/t20005.md +++ b/docs/test_cases/t20005.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20005_sequence: type: sequence @@ -41,15 +41,17 @@ template struct C { } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20005_sequence](./t20005_sequence.svg "Class template basic sequence diagram") +## Generated Mermaid diagrams +![t20005_sequence](./t20005_sequence_mermaid.svg "Class template basic sequence diagram") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20005_sequence", diff --git a/docs/test_cases/t20005_sequence.svg b/docs/test_cases/t20005_sequence.svg index 1bacf220..613d48b9 100644 --- a/docs/test_cases/t20005_sequence.svg +++ b/docs/test_cases/t20005_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,42 +9,42 @@ - - - + + + - - + + C<T> - + C<T> - - + + B<T> - + B<T> - - + + A<T> - + A<T> - - - + + + c(T) - + b(T) - + a(T) diff --git a/docs/test_cases/t20005_sequence_mermaid.svg b/docs/test_cases/t20005_sequence_mermaid.svg new file mode 100644 index 00000000..63cb6780 --- /dev/null +++ b/docs/test_cases/t20005_sequence_mermaid.svg @@ -0,0 +1,121 @@ + + + + + A<T> + + + + + + B<T> + + + + + + * + + + + + + C<T> + + + + + + + + A<T> + + + + + + + + + B<T> + + + + + + + + + * + + + + + + + + + C<T> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + c(T) + + b(T) + + a(T) + + ​ + + ​ + + ​ + + diff --git a/docs/test_cases/t20006.md b/docs/test_cases/t20006.md index 8f31ad6c..7b407bea 100644 --- a/docs/test_cases/t20006.md +++ b/docs/test_cases/t20006.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20006_sequence: type: sequence @@ -99,15 +99,17 @@ void tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20006_sequence](./t20006_sequence.svg "Class template specialization basic sequence diagram") +## Generated Mermaid diagrams +![t20006_sequence](./t20006_sequence_mermaid.svg "Class template specialization basic sequence diagram") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20006_sequence", diff --git a/docs/test_cases/t20006_sequence.svg b/docs/test_cases/t20006_sequence.svg index dcee9252..8bcb06fa 100644 --- a/docs/test_cases/t20006_sequence.svg +++ b/docs/test_cases/t20006_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,24 +9,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -36,84 +36,84 @@ - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - + + BB<int,std::string> - + BB<int,std::string> - - + + BB<int,float> - + BB<int,float> - - + + BB<int,int> - + BB<int,int> - - + + AA<int> - + AA<int> - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + b(int) - + a1(int) @@ -122,12 +122,12 @@ - + b(std::string) - + a2(std::string) @@ -136,69 +136,69 @@ - + BB(AA<int> *) - + BB(AA<int> &) - + bb1(int,int) - + aa1(int) - + bb2(int,int) - + aa2(int) - + bb1(int,std::string) - + aa2(int) - + bb2(int,std::string) - + aa1(int) - + bb1(int,float) - + bb2(int,float) - + aa2(int) diff --git a/docs/test_cases/t20006_sequence_mermaid.svg b/docs/test_cases/t20006_sequence_mermaid.svg new file mode 100644 index 00000000..33f9eca7 --- /dev/null +++ b/docs/test_cases/t20006_sequence_mermaid.svg @@ -0,0 +1,271 @@ + + + + + AA<int> + + + + + + BB<int,int> + + + + + + BB<int,float> + + + + + + BB<int,std::string> + + + + + + A<std::string> + + + + + + B<std::string> + + + + + + A<int> + + + + + + B<int> + + + + + + tmain() + + + + + + + + AA<int> + + + + + + + + + BB<int,int> + + + + + + + + + BB<int,float> + + + + + + + + + BB<int,std::string> + + + + + + + + + A<std::string> + + + + + + + + + B<std::string> + + + + + + + + + A<int> + + + + + + + + + B<int> + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + b(int) + + a1(int) + + ​ + + ​ + + b(std::string) + + a2(std::string) + + ​ + + ​ + + BB(AA<int> *) + + BB(AA<int> &) + + bb1(int,int) + + aa1(int) + + bb2(int,int) + + aa2(int) + + bb1(int,std::string) + + aa2(int) + + bb2(int,std::string) + + aa1(int) + + bb1(int,float) + + bb2(int,float) + + aa2(int) + + diff --git a/docs/test_cases/t20007.md b/docs/test_cases/t20007.md index 4a098ee5..5bff624d 100644 --- a/docs/test_cases/t20007.md +++ b/docs/test_cases/t20007.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20007_sequence: type: sequence @@ -45,15 +45,17 @@ void tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20007_sequence](./t20007_sequence.svg "Class template variadic argument list sequence diagram") +## Generated Mermaid diagrams +![t20007_sequence](./t20007_sequence_mermaid.svg "Class template variadic argument list sequence diagram") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20007_sequence", diff --git a/docs/test_cases/t20007_sequence.svg b/docs/test_cases/t20007_sequence.svg index 54b3f78d..550854f6 100644 --- a/docs/test_cases/t20007_sequence.svg +++ b/docs/test_cases/t20007_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,57 +9,57 @@ - - - - + + + + - - + + tmain() - + tmain() - - + + Adder<int,int> - + Adder<int,int> - - + + Adder<int,float,double> - + Adder<int,float,double> - - + + Adder<std::string,std::string,std::string> - + Adder<std::string,std::string,std::string> - - - - - + + + + + add(int &&,int &&) - + add(int &&,float &&,double &&) - + add(std::string &&,std::string &&,std::string &&) diff --git a/docs/test_cases/t20007_sequence_mermaid.svg b/docs/test_cases/t20007_sequence_mermaid.svg new file mode 100644 index 00000000..44578764 --- /dev/null +++ b/docs/test_cases/t20007_sequence_mermaid.svg @@ -0,0 +1,124 @@ + + + + + Adder<std::string,std::string,std::string> + + + + + + Adder<int,float,double> + + + + + + Adder<int,int> + + + + + + tmain() + + + + + + + + Adder<std::string,std::string,std::string> + + + + + + + + + Adder<int,float,double> + + + + + + + + + Adder<int,int> + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + add(int &&,int &&) + + ​ + + add(int &&,float &&,double &&) + + ​ + + add(std::string &&,std::string &&,std::string &&) + + ​ + + diff --git a/docs/test_cases/t20008.md b/docs/test_cases/t20008.md index d2e72e27..4f5c736c 100644 --- a/docs/test_cases/t20008.md +++ b/docs/test_cases/t20008.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20008_sequence: type: sequence @@ -63,15 +63,17 @@ void tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20008_sequence](./t20008_sequence.svg "Constexpr if sequence diagram test case") +## Generated Mermaid diagrams +![t20008_sequence](./t20008_sequence_mermaid.svg "Constexpr if sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20008_sequence", diff --git a/docs/test_cases/t20008_sequence.svg b/docs/test_cases/t20008_sequence.svg index 6eff851e..e6c63f2f 100644 --- a/docs/test_cases/t20008_sequence.svg +++ b/docs/test_cases/t20008_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,81 +23,81 @@ - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<const char *> - + B<const char *> - - + + A<const char *> - + A<const char *> - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - - - - - - - + + + + + + + + b(int) - + a1(int) - + b(const char *) - + a2(const char *) - + b(std::string) - + a3(std::string) diff --git a/docs/test_cases/t20008_sequence_mermaid.svg b/docs/test_cases/t20008_sequence_mermaid.svg new file mode 100644 index 00000000..12de9b96 --- /dev/null +++ b/docs/test_cases/t20008_sequence_mermaid.svg @@ -0,0 +1,178 @@ + + + + + A<std::string> + + + + + + B<std::string> + + + + + + A<const char *> + + + + + + B<const char *> + + + + + + A<int> + + + + + + B<int> + + + + + + tmain() + + + + + + + + A<std::string> + + + + + + + + + B<std::string> + + + + + + + + + A<const char *> + + + + + + + + + B<const char *> + + + + + + + + + A<int> + + + + + + + + + B<int> + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + b(int) + + a1(int) + + b(const char *) + + a2(const char *) + + b(std::string) + + a3(std::string) + + diff --git a/docs/test_cases/t20009.md b/docs/test_cases/t20009.md index 3ad191c3..57c69149 100644 --- a/docs/test_cases/t20009.md +++ b/docs/test_cases/t20009.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20009_sequence: type: sequence @@ -49,15 +49,17 @@ void tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20009_sequence](./t20009_sequence.svg "Smart pointer dereference call expression test case") +## Generated Mermaid diagrams +![t20009_sequence](./t20009_sequence_mermaid.svg "Smart pointer dereference call expression test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20009_sequence", diff --git a/docs/test_cases/t20009_sequence.svg b/docs/test_cases/t20009_sequence.svg index 127ce789..50ff4243 100644 --- a/docs/test_cases/t20009_sequence.svg +++ b/docs/test_cases/t20009_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,13 +9,13 @@ - - - - - - - + + + + + + + @@ -23,81 +23,81 @@ - - + + tmain() - + tmain() - - + + B<std::string> - + B<std::string> - - + + A<std::string> - + A<std::string> - - + + B<int> - + B<int> - - + + A<int> - + A<int> - - + + B<float> - + B<float> - - + + A<float> - + A<float> - - - - - - - - + + + + + + + + b(std::string) - + a(std::string) - + b(int) - + a(int) - + b(float) - + a(float) diff --git a/docs/test_cases/t20009_sequence_mermaid.svg b/docs/test_cases/t20009_sequence_mermaid.svg new file mode 100644 index 00000000..a5ffc27e --- /dev/null +++ b/docs/test_cases/t20009_sequence_mermaid.svg @@ -0,0 +1,178 @@ + + + + + A<float> + + + + + + B<float> + + + + + + A<int> + + + + + + B<int> + + + + + + A<std::string> + + + + + + B<std::string> + + + + + + tmain() + + + + + + + + A<float> + + + + + + + + + B<float> + + + + + + + + + A<int> + + + + + + + + + B<int> + + + + + + + + + A<std::string> + + + + + + + + + B<std::string> + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + b(std::string) + + a(std::string) + + b(int) + + a(int) + + b(float) + + a(float) + + diff --git a/docs/test_cases/t20010.md b/docs/test_cases/t20010.md index f9a4a576..cc9b949e 100644 --- a/docs/test_cases/t20010.md +++ b/docs/test_cases/t20010.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20010_sequence: type: sequence @@ -59,15 +59,17 @@ void tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20010_sequence](./t20010_sequence.svg "Container sequence diagram test case") +## Generated Mermaid diagrams +![t20010_sequence](./t20010_sequence_mermaid.svg "Container sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20010_sequence", diff --git a/docs/test_cases/t20010_sequence.svg b/docs/test_cases/t20010_sequence.svg index b265ac5f..c9c547ff 100644 --- a/docs/test_cases/t20010_sequence.svg +++ b/docs/test_cases/t20010_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,81 +9,81 @@ - - - - - - - - - + + + + + + + + + - - + + tmain() - + tmain() - - + + B<int> - + B<int> - - + + A - + A - - - - - - - - - - + + + + + + + + + + b1() - + a1() - + b2() - + a2() - + b3() - + a3() - + b4() - + a4() diff --git a/docs/test_cases/t20010_sequence_mermaid.svg b/docs/test_cases/t20010_sequence_mermaid.svg new file mode 100644 index 00000000..f8beb39e --- /dev/null +++ b/docs/test_cases/t20010_sequence_mermaid.svg @@ -0,0 +1,128 @@ + + + + + A + + + + + + B<int> + + + + + + tmain() + + + + + + + + A + + + + + + + + + B<int> + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + b1() + + a1() + + b2() + + a2() + + b3() + + a3() + + b4() + + a4() + + diff --git a/docs/test_cases/t20011.md b/docs/test_cases/t20011.md index c354e5e2..dbe6d8d7 100644 --- a/docs/test_cases/t20011.md +++ b/docs/test_cases/t20011.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20011_sequence: type: sequence @@ -51,15 +51,17 @@ void tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20011_sequence](./t20011_sequence.svg "Recursive calls sequence diagram test case") +## Generated Mermaid diagrams +![t20011_sequence](./t20011_sequence_mermaid.svg "Recursive calls sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20011_sequence", diff --git a/docs/test_cases/t20011_sequence.svg b/docs/test_cases/t20011_sequence.svg index 1bdeb089..e6a8f503 100644 --- a/docs/test_cases/t20011_sequence.svg +++ b/docs/test_cases/t20011_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,42 +9,42 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - - - - - - + + + + + + + + + + a(int) @@ -52,26 +52,26 @@ alt - + a(int) - + b(int) - + c(int) - + @@ -81,14 +81,14 @@ alt - + b(int) - + @@ -98,7 +98,7 @@ alt - + diff --git a/docs/test_cases/t20011_sequence_mermaid.svg b/docs/test_cases/t20011_sequence_mermaid.svg new file mode 100644 index 00000000..c412119f --- /dev/null +++ b/docs/test_cases/t20011_sequence_mermaid.svg @@ -0,0 +1,146 @@ + + + + + A + + + + + + tmain() + + + + + + + + A + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alt + + ​ + + + + + + + + + + + + + + + + + + + + + + + + + + + alt + + ​ + + + + + + + + + alt + + ​ + + + a(int) + + a(int) + + b(int) + + c(int) + + d(int) + + b(int) + + a(int) + + a(int) + + diff --git a/docs/test_cases/t20012.md b/docs/test_cases/t20012.md index b1415c20..7bb259fe 100644 --- a/docs/test_cases/t20012.md +++ b/docs/test_cases/t20012.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20012_sequence: type: sequence @@ -126,15 +126,17 @@ void tmain() } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20012_sequence](./t20012_sequence.svg "Lambda expression call sequence diagram test case") +## Generated Mermaid diagrams +![t20012_sequence](./t20012_sequence_mermaid.svg "Lambda expression call sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20012_sequence", diff --git a/docs/test_cases/t20012_sequence.svg b/docs/test_cases/t20012_sequence.svg index 2d04ffd2..37e7905d 100644 --- a/docs/test_cases/t20012_sequence.svg +++ b/docs/test_cases/t20012_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,31 +9,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -42,116 +42,116 @@ - - + + tmain() - + tmain() - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:67:20) - + tmain()::(lambda ../../tests/t20012/t20012.cc:67:20) - - + + A - + A - - + + B - + B - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:80:20) - + tmain()::(lambda ../../tests/t20012/t20012.cc:80:20) - - + + C - + C - - + + R<R::(lambda ../../tests/t20012/t20012.cc:86:9)> - + R<R::(lambda ../../tests/t20012/t20012.cc:86:9)> - - + + tmain()::(lambda ../../tests/t20012/t20012.cc:86:9) - + tmain()::(lambda ../../tests/t20012/t20012.cc:86:9) - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + operator()() - + a() - + aa() - + aaa() - + b() - + bb() - + @@ -160,67 +160,67 @@ - + operator()() - + c() - + cc() - + ccc() - + operator()() - + a() - + aa() - + aaa() - + b() - + bb() - + @@ -231,34 +231,34 @@ - + R((lambda at /home/bartek/devel/clang-uml/tests/t20012/t20012.cc:86:9) &&) - + r() - + operator()() - + c() - + cc() - + diff --git a/docs/test_cases/t20012_sequence_mermaid.svg b/docs/test_cases/t20012_sequence_mermaid.svg new file mode 100644 index 00000000..f2682488 --- /dev/null +++ b/docs/test_cases/t20012_sequence_mermaid.svg @@ -0,0 +1,291 @@ + + + + + tmain()::(lambda ../../tests/t20012/t20012.cc:86:9) + + + + + + R<R::(lambda ../../tests/t20012/t20012.cc:86:9)> + + + + + + C + + + + + + tmain()::(lambda ../../tests/t20012/t20012.cc:80:20) + + + + + + B + + + + + + A + + + + + + tmain()::(lambda ../../tests/t20012/t20012.cc:67:20) + + + + + + tmain() + + + + + + + + tmain()::(lambda ../../tests/t20012/t20012.cc:86:9) + + + + + + + + + R<R::(lambda ../../tests/t20012/t20012.cc:86:9)> + + + + + + + + + C + + + + + + + + + tmain()::(lambda ../../tests/t20012/t20012.cc:80:20) + + + + + + + + + B + + + + + + + + + A + + + + + + + + + tmain()::(lambda ../../tests/t20012/t20012.cc:67:20) + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator()() + + a() + + aa() + + aaa() + + b() + + bb() + + bbb() + + ​ + + operator()() + + c() + + cc() + + ccc() + + operator()() + + a() + + aa() + + aaa() + + b() + + bb() + + bbb() + + ​ + + ​ + + R((lambda at /home/bartek/devel/clang-uml/tests/t20012/t20012.cc:86:9) &&) + + r() + + operator()() + + c() + + cc() + + ccc() + + ​ + + diff --git a/docs/test_cases/t20013.md b/docs/test_cases/t20013.md index 45c8d073..700e2a38 100644 --- a/docs/test_cases/t20013.md +++ b/docs/test_cases/t20013.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20013_sequence: type: sequence @@ -47,15 +47,17 @@ void tmain(int argc, char **argv) } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20013_sequence](./t20013_sequence.svg "Function and method arguments in sequence diagrams test case") +## Generated Mermaid diagrams +![t20013_sequence](./t20013_sequence_mermaid.svg "Function and method arguments in sequence diagrams test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20013_sequence", diff --git a/docs/test_cases/t20013_sequence.svg b/docs/test_cases/t20013_sequence.svg index 5468e948..58318b92 100644 --- a/docs/test_cases/t20013_sequence.svg +++ b/docs/test_cases/t20013_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,47 +9,47 @@ - - - - - - - + + + + + + + - - + + tmain(int,char **) - + tmain(int,char **) - - + + B - + B - - + + A - + A - - - - - - - - + + + + + + + + b(int) - + a1(int) @@ -58,12 +58,12 @@ - + b(double) - + a2(double) @@ -72,12 +72,12 @@ - + b(const char *) - + a3(const char *) diff --git a/docs/test_cases/t20013_sequence_mermaid.svg b/docs/test_cases/t20013_sequence_mermaid.svg new file mode 100644 index 00000000..9113c14e --- /dev/null +++ b/docs/test_cases/t20013_sequence_mermaid.svg @@ -0,0 +1,130 @@ + + + + + A + + + + + + B + + + + + + tmain(int,char **) + + + + + + + + A + + + + + + + + + B + + + + + + + + + tmain(int,char **) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + b(int) + + a1(int) + + ​ + + ​ + + b(double) + + a2(double) + + ​ + + ​ + + b(const char *) + + a3(const char *) + + ​ + + ​ + + diff --git a/docs/test_cases/t20014.md b/docs/test_cases/t20014.md index e6c9bc23..79474a58 100644 --- a/docs/test_cases/t20014.md +++ b/docs/test_cases/t20014.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20014_sequence: type: sequence @@ -82,15 +82,17 @@ namespace t20014 { } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20014_sequence](./t20014_sequence.svg "Multiple translation units sequence diagram test case") +## Generated Mermaid diagrams +![t20014_sequence](./t20014_sequence_mermaid.svg "Multiple translation units sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20014_sequence", diff --git a/docs/test_cases/t20014_sequence.svg b/docs/test_cases/t20014_sequence.svg index 22ac1fdb..50e68453 100644 --- a/docs/test_cases/t20014_sequence.svg +++ b/docs/test_cases/t20014_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,56 +9,56 @@ - - - - - - - - + + + + + + + + - - + + tmain() - + tmain() - - + + B - + B - - + + A - + A - - + + C<B,int> - + C<B,int> - - - - - - - - - + + + + + + + + + b1(int,int) - + a1(int,int) @@ -67,12 +67,12 @@ - + b2(int,int) - + a2(int,int) @@ -81,17 +81,17 @@ - + c1(int,int) - + b1(int,int) - + a1(int,int) diff --git a/docs/test_cases/t20014_sequence_mermaid.svg b/docs/test_cases/t20014_sequence_mermaid.svg new file mode 100644 index 00000000..701f40f7 --- /dev/null +++ b/docs/test_cases/t20014_sequence_mermaid.svg @@ -0,0 +1,152 @@ + + + + + C<B,int> + + + + + + A + + + + + + B + + + + + + tmain() + + + + + + + + C<B,int> + + + + + + + + + A + + + + + + + + + B + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + b1(int,int) + + a1(int,int) + + ​ + + ​ + + b2(int,int) + + a2(int,int) + + ​ + + ​ + + c1(int,int) + + b1(int,int) + + a1(int,int) + + ​ + + ​ + + ​ + + diff --git a/docs/test_cases/t20015.md b/docs/test_cases/t20015.md index aa3984e5..c85feeb2 100644 --- a/docs/test_cases/t20015.md +++ b/docs/test_cases/t20015.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20015_sequence: type: sequence @@ -63,15 +63,17 @@ void tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20015_sequence](./t20015_sequence.svg "Class exclusion by namespace in sequence diagram test case") +## Generated Mermaid diagrams +![t20015_sequence](./t20015_sequence_mermaid.svg "Class exclusion by namespace in sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20015_sequence", diff --git a/docs/test_cases/t20015_sequence.svg b/docs/test_cases/t20015_sequence.svg index e86e1b3e..6436b73e 100644 --- a/docs/test_cases/t20015_sequence.svg +++ b/docs/test_cases/t20015_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + B - + B - - - + + + setup_a(std::shared_ptr<detail::A> &) diff --git a/docs/test_cases/t20015_sequence_mermaid.svg b/docs/test_cases/t20015_sequence_mermaid.svg new file mode 100644 index 00000000..15fab6f5 --- /dev/null +++ b/docs/test_cases/t20015_sequence_mermaid.svg @@ -0,0 +1,78 @@ + + + + + B + + + + + + tmain() + + + + + + + + B + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + setup_a(std::shared_ptr<detail::A> &) + + diff --git a/docs/test_cases/t20016.md b/docs/test_cases/t20016.md index 52f36349..b984d473 100644 --- a/docs/test_cases/t20016.md +++ b/docs/test_cases/t20016.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20016_sequence: type: sequence @@ -45,15 +45,17 @@ void tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20016_sequence](./t20016_sequence.svg "Template method specialization sequence diagram test case") +## Generated Mermaid diagrams +![t20016_sequence](./t20016_sequence_mermaid.svg "Template method specialization sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20016_sequence", diff --git a/docs/test_cases/t20016_sequence.svg b/docs/test_cases/t20016_sequence.svg index 7d1498ea..18587d60 100644 --- a/docs/test_cases/t20016_sequence.svg +++ b/docs/test_cases/t20016_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - - - - + + + + + - - + + tmain() - + tmain() - - + + B<long> - + B<long> - - + + A - + A - - - - - - + + + + + + b1(long) - + a1(int) - + b2(long) - + a2(const long &) diff --git a/docs/test_cases/t20016_sequence_mermaid.svg b/docs/test_cases/t20016_sequence_mermaid.svg new file mode 100644 index 00000000..a4e11094 --- /dev/null +++ b/docs/test_cases/t20016_sequence_mermaid.svg @@ -0,0 +1,112 @@ + + + + + A + + + + + + B<long> + + + + + + tmain() + + + + + + + + A + + + + + + + + + B<long> + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + b1(long) + + a1(int) + + b2(long) + + a2(const long &) + + ​ + + ​ + + diff --git a/docs/test_cases/t20017.md b/docs/test_cases/t20017.md index b09bedc5..1ca9721b 100644 --- a/docs/test_cases/t20017.md +++ b/docs/test_cases/t20017.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20017_sequence: type: sequence @@ -42,15 +42,17 @@ int tmain() { return b2(a1(a2(a3(1, 2), b1(3, 4)), 5), 6); } } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20017_sequence](./t20017_sequence.svg "Test case for combine_free_functions_into_file_participants option") +## Generated Mermaid diagrams +![t20017_sequence](./t20017_sequence_mermaid.svg "Test case for combine_free_functions_into_file_participants option") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20017_sequence", diff --git a/docs/test_cases/t20017_sequence.svg b/docs/test_cases/t20017_sequence.svg index 7486bd8e..96e9748b 100644 --- a/docs/test_cases/t20017_sequence.svg +++ b/docs/test_cases/t20017_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,65 +9,65 @@ - - - - - - + + + + + + - + t20017.cc - + t20017.cc - + include/t20017_a.h - + include/t20017_a.h - + include/t20017_b.h - + include/t20017_b.h - - - - - - + + + + + + tmain() - + a3(int,int) - + b1(int,int) - + a2(int,int) - + a1(int,int) - + b2<int>(int,int) diff --git a/docs/test_cases/t20017_sequence_mermaid.svg b/docs/test_cases/t20017_sequence_mermaid.svg new file mode 100644 index 00000000..27d40e19 --- /dev/null +++ b/docs/test_cases/t20017_sequence_mermaid.svg @@ -0,0 +1,142 @@ + + + + + include/t20017_b.h + + + + + + include/t20017_a.h + + + + + + * + + + + + + t20017.cc + + + + + + + + include/t20017_b.h + + + + + + + + + include/t20017_a.h + + + + + + + + + * + + + + + + + + + t20017.cc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + tmain() + + a3(int,int) + + ​ + + b1(int,int) + + ​ + + a2(int,int) + + ​ + + a1(int,int) + + ​ + + b2<int>(int,int) + + ​ + + ​ + + diff --git a/docs/test_cases/t20018.md b/docs/test_cases/t20018.md index 6a7506a8..87918e83 100644 --- a/docs/test_cases/t20018.md +++ b/docs/test_cases/t20018.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20018_sequence: type: sequence @@ -47,15 +47,17 @@ void tmain() { Answer>::print(); } } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20018_sequence](./t20018_sequence.svg "Recursive template sequence diagram test case") +## Generated Mermaid diagrams +![t20018_sequence](./t20018_sequence_mermaid.svg "Recursive template sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20018_sequence", diff --git a/docs/test_cases/t20018_sequence.svg b/docs/test_cases/t20018_sequence.svg index 9941c9b9..6fb88792 100644 --- a/docs/test_cases/t20018_sequence.svg +++ b/docs/test_cases/t20018_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,14 +9,14 @@ - - - - - - - - + + + + + + + + @@ -25,93 +25,93 @@ - - + + tmain() - + tmain() - - + + Answer<Factorial<5>,120> - + Answer<Factorial<5>,120> - - + + Factorial<5> - + Factorial<5> - - + + Factorial<4> - + Factorial<4> - - + + Factorial<3> - + Factorial<3> - - + + Factorial<2> - + Factorial<2> - - + + Factorial<1> - + Factorial<1> - - + + Factorial<0> - + Factorial<0> - - - - - - - - - + + + + + + + + + print() - + print(int) - + print(int) - + print(int) - + print(int) - + print(int) - + print(int) diff --git a/docs/test_cases/t20018_sequence_mermaid.svg b/docs/test_cases/t20018_sequence_mermaid.svg new file mode 100644 index 00000000..93ba205f --- /dev/null +++ b/docs/test_cases/t20018_sequence_mermaid.svg @@ -0,0 +1,198 @@ + + + + + Factorial<0> + + + + + + Factorial<1> + + + + + + Factorial<2> + + + + + + Factorial<3> + + + + + + Factorial<4> + + + + + + Factorial<5> + + + + + + Answer<Factorial<5>,120> + + + + + + tmain() + + + + + + + + Factorial<0> + + + + + + + + + Factorial<1> + + + + + + + + + Factorial<2> + + + + + + + + + Factorial<3> + + + + + + + + + Factorial<4> + + + + + + + + + Factorial<5> + + + + + + + + + Answer<Factorial<5>,120> + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + print() + + print(int) + + print(int) + + print(int) + + print(int) + + print(int) + + print(int) + + diff --git a/docs/test_cases/t20019.md b/docs/test_cases/t20019.md index 7bd92ef5..000ea856 100644 --- a/docs/test_cases/t20019.md +++ b/docs/test_cases/t20019.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20019_sequence: type: sequence @@ -54,15 +54,17 @@ void tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20019_sequence](./t20019_sequence.svg "Curiously Recurring Template Pattern sequence diagram test case") +## Generated Mermaid diagrams +![t20019_sequence](./t20019_sequence_mermaid.svg "Curiously Recurring Template Pattern sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20019_sequence", diff --git a/docs/test_cases/t20019_sequence.svg b/docs/test_cases/t20019_sequence.svg index 5ea04584..d32f4836 100644 --- a/docs/test_cases/t20019_sequence.svg +++ b/docs/test_cases/t20019_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,95 +9,95 @@ - - - - - - - - - + + + + + + + + + - - + + tmain() - + tmain() - - + + Base<D1> - + Base<D1> - - + + D1 - + D1 - - + + Base<D2> - + Base<D2> - - + + D2 - + D2 - - - - - - - - - - + + + + + + + + + + name() - + impl() - + name() - + impl() - + name() - + impl() - + name() - + impl() diff --git a/docs/test_cases/t20019_sequence_mermaid.svg b/docs/test_cases/t20019_sequence_mermaid.svg new file mode 100644 index 00000000..51597fd2 --- /dev/null +++ b/docs/test_cases/t20019_sequence_mermaid.svg @@ -0,0 +1,158 @@ + + + + + D2 + + + + + + Base<D2> + + + + + + D1 + + + + + + Base<D1> + + + + + + tmain() + + + + + + + + D2 + + + + + + + + + Base<D2> + + + + + + + + + D1 + + + + + + + + + Base<D1> + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + name() + + impl() + + name() + + impl() + + name() + + impl() + + name() + + impl() + + diff --git a/docs/test_cases/t20020.md b/docs/test_cases/t20020.md index 322a4865..b4b03b95 100644 --- a/docs/test_cases/t20020.md +++ b/docs/test_cases/t20020.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20020_sequence: type: sequence @@ -110,15 +110,17 @@ int tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20020_sequence](./t20020_sequence.svg "If statement sequence diagram test case") +## Generated Mermaid diagrams +![t20020_sequence](./t20020_sequence_mermaid.svg "If statement sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20020_sequence", diff --git a/docs/test_cases/t20020_sequence.svg b/docs/test_cases/t20020_sequence.svg index e038970f..84e43688 100644 --- a/docs/test_cases/t20020_sequence.svg +++ b/docs/test_cases/t20020_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,82 +9,82 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + - - - + + + - - + + tmain() - + tmain() - - + + A - + A - - + + C - + C - - + + B - + B - - + + D<int> - + D<int> - - - - - - - - - - - - - - + + + + + + + + + + + + + + alt - + a1() @@ -92,7 +92,7 @@ - + a5() @@ -103,7 +103,7 @@ alt - + [ @@ -112,7 +112,7 @@ - + [ @@ -121,7 +121,7 @@ - + b1() @@ -129,7 +129,7 @@ - + [ @@ -138,7 +138,7 @@ - + b2() @@ -146,14 +146,14 @@ - + a4() - + log() @@ -161,7 +161,7 @@ alt - + c1() const @@ -169,7 +169,7 @@ alt - + @@ -182,7 +182,7 @@ - + @@ -192,7 +192,7 @@ alt - + d1(int,int) diff --git a/docs/test_cases/t20020_sequence_mermaid.svg b/docs/test_cases/t20020_sequence_mermaid.svg new file mode 100644 index 00000000..df3f9b5a --- /dev/null +++ b/docs/test_cases/t20020_sequence_mermaid.svg @@ -0,0 +1,262 @@ + + + + + D<int> + + + + + + B + + + + + + C + + + + + + A + + + + + + tmain() + + + + + + + + D<int> + + + + + + + + + B + + + + + + + + + C + + + + + + + + + A + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alt + + ​ + + + + + + + + + + + + + + + alt + + ​ + + + + + + + + + + + + + + + + + + + + + alt + + ​ + + + + + + + + + alt + + ​ + + + + + + + + + + + + alt + + ​ + + + a1() + + ​ + + a5() + + ​ + + [a2()] + + ​ + + [c3(int)] + + ​ + + b1() + + ​ + + [a3()] + + ​ + + b2() + + ​ + + a4() + + ​ + + log() + + c1() const + + [c2() const] + + ​ + + log() const + + d1(int,int) + + ​ + + diff --git a/docs/test_cases/t20021.md b/docs/test_cases/t20021.md index a3e7e81a..e327bb2b 100644 --- a/docs/test_cases/t20021.md +++ b/docs/test_cases/t20021.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20021_sequence: type: sequence @@ -77,15 +77,17 @@ int tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20021_sequence](./t20021_sequence.svg "Loop statements sequence diagram test case") +## Generated Mermaid diagrams +![t20021_sequence](./t20021_sequence_mermaid.svg "Loop statements sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20021_sequence", diff --git a/docs/test_cases/t20021_sequence.svg b/docs/test_cases/t20021_sequence.svg index 3f654d8c..592d6a6c 100644 --- a/docs/test_cases/t20021_sequence.svg +++ b/docs/test_cases/t20021_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,74 +9,74 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + tmain() - + tmain() - - + + C - + C - - + + A - + A - - + + B - + B - - - - - - - - - - - - + + + + + + + + + + + + loop - + [ c4() ] - + @@ -89,7 +89,7 @@ - + a3() @@ -102,7 +102,7 @@ loop - + [ @@ -111,7 +111,7 @@ - + [ @@ -120,7 +120,7 @@ - + [ @@ -129,14 +129,14 @@ - + a1() - + [ @@ -148,7 +148,7 @@ loop - + b2() const @@ -158,7 +158,7 @@ loop - + [ @@ -167,7 +167,7 @@ - + b2() const diff --git a/docs/test_cases/t20021_sequence_mermaid.svg b/docs/test_cases/t20021_sequence_mermaid.svg new file mode 100644 index 00000000..5b801fd5 --- /dev/null +++ b/docs/test_cases/t20021_sequence_mermaid.svg @@ -0,0 +1,235 @@ + + + + + B + + + + + + A + + + + + + C + + + + + + tmain() + + + + + + + + B + + + + + + + + + A + + + + + + + + + C + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + loop + + ​ + + + + + + + + + + + + loop + + ​ + + + + + + + + + loop + + ​ + + + + + + + + + + + + loop + + ​ + + + + + + + + + + + + loop + + ​ + + + + + + [c4()] + + c5() + + ​ + + ​ + + a3() + + ​ + + [a2()] + + ​ + + [c1()] + + ​ + + [c2()] + + ​ + + a1() + + ​ + + [c3()] + + ​ + + b2() const + + ​ + + [contents()] + + ​ + + b2() const + + ​ + + diff --git a/docs/test_cases/t20022.md b/docs/test_cases/t20022.md index 89d5835c..83239d69 100644 --- a/docs/test_cases/t20022.md +++ b/docs/test_cases/t20022.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20022_sequence: type: sequence @@ -57,15 +57,17 @@ int tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20022_sequence](./t20022_sequence.svg "Forward class declaration sequence diagram test case") +## Generated Mermaid diagrams +![t20022_sequence](./t20022_sequence_mermaid.svg "Forward class declaration sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20022_sequence", diff --git a/docs/test_cases/t20022_sequence.svg b/docs/test_cases/t20022_sequence.svg index 615f198a..805cd976 100644 --- a/docs/test_cases/t20022_sequence.svg +++ b/docs/test_cases/t20022_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,47 +9,47 @@ - - - - + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - + + + + + A(std::unique_ptr ) - + a() - + b() diff --git a/docs/test_cases/t20022_sequence_mermaid.svg b/docs/test_cases/t20022_sequence_mermaid.svg new file mode 100644 index 00000000..d9408adc --- /dev/null +++ b/docs/test_cases/t20022_sequence_mermaid.svg @@ -0,0 +1,103 @@ + + + + + B + + + + + + A + + + + + + tmain() + + + + + + + + B + + + + + + + + + A + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A(std::unique_ptr<B>) + + a() + + b() + + diff --git a/docs/test_cases/t20023.md b/docs/test_cases/t20023.md index fb13d0a1..174c711f 100644 --- a/docs/test_cases/t20023.md +++ b/docs/test_cases/t20023.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20023_sequence: type: sequence @@ -60,15 +60,17 @@ int tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20023_sequence](./t20023_sequence.svg "Try/catch statement sequence diagram test case") +## Generated Mermaid diagrams +![t20023_sequence](./t20023_sequence_mermaid.svg "Try/catch statement sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20023_sequence", diff --git a/docs/test_cases/t20023_sequence.svg b/docs/test_cases/t20023_sequence.svg index f0a654e7..9ff383ac 100644 --- a/docs/test_cases/t20023_sequence.svg +++ b/docs/test_cases/t20023_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,37 +9,37 @@ - - - - - - - + + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - - - + + + + + + + a() @@ -47,7 +47,7 @@ try - + @@ -60,7 +60,7 @@ [std::runtime_error &] - + @@ -73,7 +73,7 @@ [std::logic_error &] - + @@ -86,7 +86,7 @@ [...] - + diff --git a/docs/test_cases/t20023_sequence_mermaid.svg b/docs/test_cases/t20023_sequence_mermaid.svg new file mode 100644 index 00000000..724fa9de --- /dev/null +++ b/docs/test_cases/t20023_sequence_mermaid.svg @@ -0,0 +1,127 @@ + + + + + A + + + + + + tmain() + + + + + + + + A + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + critical + + ​ + + [std::runtime- + _error &] + [std::logic_e- + rror &] + [...] + + a() + + a1() + + ​ + + a2() + + ​ + + a3() + + ​ + + a4() + + ​ + + ​ + + diff --git a/docs/test_cases/t20024.md b/docs/test_cases/t20024.md index a60056cd..02b7bf24 100644 --- a/docs/test_cases/t20024.md +++ b/docs/test_cases/t20024.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20024_sequence: type: sequence @@ -85,15 +85,17 @@ int tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20024_sequence](./t20024_sequence.svg "Switch statement sequence diagram test case") +## Generated Mermaid diagrams +![t20024_sequence](./t20024_sequence_mermaid.svg "Switch statement sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20024_sequence", diff --git a/docs/test_cases/t20024_sequence.svg b/docs/test_cases/t20024_sequence.svg index 3e37100e..622df532 100644 --- a/docs/test_cases/t20024_sequence.svg +++ b/docs/test_cases/t20024_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,23 +9,23 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -33,36 +33,36 @@ - - + + tmain() - + tmain() - - + + A - + A - - + + B - + B - - - - - - - - - - - - + + + + + + + + + + + + select(enum_a) @@ -72,7 +72,7 @@ switch [zero] - + @@ -85,7 +85,7 @@ [one] - + @@ -98,7 +98,7 @@ [two] - + @@ -111,7 +111,7 @@ [default] - + @@ -124,7 +124,7 @@ - + select(colors) @@ -134,7 +134,7 @@ switch [enum colors::red] - + @@ -143,7 +143,7 @@ [enum colors::orange] - + @@ -152,7 +152,7 @@ [enum colors::green] - + @@ -161,7 +161,7 @@ [default] - + diff --git a/docs/test_cases/t20024_sequence_mermaid.svg b/docs/test_cases/t20024_sequence_mermaid.svg new file mode 100644 index 00000000..f7db7c3e --- /dev/null +++ b/docs/test_cases/t20024_sequence_mermaid.svg @@ -0,0 +1,191 @@ + + + + + B + + + + + + A + + + + + + tmain() + + + + + + + + B + + + + + + + + + A + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alt + + ​ + + [zero] + [one] + [two] + [default] + + + + + + + + + + + + + + + + + + + + + + + + + + + alt + + ​ + + [enum + colors::red] + [enum + colors::orang- + e] + [enum + colors::green- + ] + [default] + + select(enum_a) + + a0() + + ​ + + a1() + + ​ + + a2() + + ​ + + a3() + + ​ + + ​ + + select(colors) + + red() + + orange() + + green() + + grey() + + diff --git a/docs/test_cases/t20025.md b/docs/test_cases/t20025.md index 5e9c2565..c76896cf 100644 --- a/docs/test_cases/t20025.md +++ b/docs/test_cases/t20025.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20025_sequence: type: sequence @@ -65,15 +65,17 @@ int tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20025_sequence](./t20025_sequence.svg "Skip decorator sequence diagram test case") +## Generated Mermaid diagrams +![t20025_sequence](./t20025_sequence_mermaid.svg "Skip decorator sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20025_sequence", diff --git a/docs/test_cases/t20025_sequence.svg b/docs/test_cases/t20025_sequence.svg index 2757cdc5..1d5f8f20 100644 --- a/docs/test_cases/t20025_sequence.svg +++ b/docs/test_cases/t20025_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,41 +9,41 @@ - - - - + + + + - - + + tmain() - + tmain() - - + + A - + A - - + + add(int,int) - + add(int,int) - - - - - + + + + + a() - + @@ -52,7 +52,7 @@ - + diff --git a/docs/test_cases/t20025_sequence_mermaid.svg b/docs/test_cases/t20025_sequence_mermaid.svg new file mode 100644 index 00000000..555db82f --- /dev/null +++ b/docs/test_cases/t20025_sequence_mermaid.svg @@ -0,0 +1,107 @@ + + + + + add(int,int) + + + + + + A + + + + + + tmain() + + + + + + + + add(int,int) + + + + + + + + + A + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a() + + a2() + + ​ + + ​ + + ​ + + diff --git a/docs/test_cases/t20026.md b/docs/test_cases/t20026.md index 15bf509f..f8ae620f 100644 --- a/docs/test_cases/t20026.md +++ b/docs/test_cases/t20026.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20026_sequence: type: sequence @@ -45,15 +45,17 @@ int tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20026_sequence](./t20026_sequence.svg "Virtual method call sequence diagram test case") +## Generated Mermaid diagrams +![t20026_sequence](./t20026_sequence_mermaid.svg "Virtual method call sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20026_sequence", diff --git a/docs/test_cases/t20026_sequence.svg b/docs/test_cases/t20026_sequence.svg index bc3970c4..09485d7b 100644 --- a/docs/test_cases/t20026_sequence.svg +++ b/docs/test_cases/t20026_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + A - + A - - - + + + a() diff --git a/docs/test_cases/t20026_sequence_mermaid.svg b/docs/test_cases/t20026_sequence_mermaid.svg new file mode 100644 index 00000000..121a3afb --- /dev/null +++ b/docs/test_cases/t20026_sequence_mermaid.svg @@ -0,0 +1,78 @@ + + + + + A + + + + + + tmain() + + + + + + + + A + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a() + + diff --git a/docs/test_cases/t20027.md b/docs/test_cases/t20027.md index 70edc879..a1eb9e17 100644 --- a/docs/test_cases/t20027.md +++ b/docs/test_cases/t20027.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20027_sequence: type: sequence @@ -44,15 +44,17 @@ void tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20027_sequence](./t20027_sequence.svg "Filter call expressions based on access test case") +## Generated Mermaid diagrams +![t20027_sequence](./t20027_sequence_mermaid.svg "Filter call expressions based on access test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20027_sequence", diff --git a/docs/test_cases/t20027_sequence.svg b/docs/test_cases/t20027_sequence.svg index 34bb8b7c..3437ff74 100644 --- a/docs/test_cases/t20027_sequence.svg +++ b/docs/test_cases/t20027_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,25 +9,25 @@ - - + + - - + + tmain() - + tmain() - - + + A - + A - - - + + + a() diff --git a/docs/test_cases/t20027_sequence_mermaid.svg b/docs/test_cases/t20027_sequence_mermaid.svg new file mode 100644 index 00000000..121a3afb --- /dev/null +++ b/docs/test_cases/t20027_sequence_mermaid.svg @@ -0,0 +1,78 @@ + + + + + A + + + + + + tmain() + + + + + + + + A + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a() + + diff --git a/docs/test_cases/t20028.md b/docs/test_cases/t20028.md index 10118fce..f67267b9 100644 --- a/docs/test_cases/t20028.md +++ b/docs/test_cases/t20028.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20028_sequence: type: sequence @@ -54,15 +54,17 @@ int tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20028_sequence](./t20028_sequence.svg "Conditional (ternary) '?:' operator test case") +## Generated Mermaid diagrams +![t20028_sequence](./t20028_sequence_mermaid.svg "Conditional (ternary) '?:' operator test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20028_sequence", diff --git a/docs/test_cases/t20028_sequence.svg b/docs/test_cases/t20028_sequence.svg index d4e2f872..0ae142ba 100644 --- a/docs/test_cases/t20028_sequence.svg +++ b/docs/test_cases/t20028_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,36 +9,36 @@ - - - - - - + + + + + + - - + + tmain() - + tmain() - - + + A - + A - - - - - + + + + + alt - + [ @@ -47,14 +47,14 @@ - + b() - + c() @@ -62,7 +62,7 @@ - + d() diff --git a/docs/test_cases/t20028_sequence_mermaid.svg b/docs/test_cases/t20028_sequence_mermaid.svg new file mode 100644 index 00000000..0ebc51b3 --- /dev/null +++ b/docs/test_cases/t20028_sequence_mermaid.svg @@ -0,0 +1,113 @@ + + + + + A + + + + + + tmain() + + + + + + + + A + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alt + + ​ + + + [a()] + + ​ + + b() + + ​ + + c() + + ​ + + d() + + ​ + + diff --git a/docs/test_cases/t20029.md b/docs/test_cases/t20029.md index 4601353b..9192f426 100644 --- a/docs/test_cases/t20029.md +++ b/docs/test_cases/t20029.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20029_sequence: type: sequence @@ -98,15 +98,17 @@ int tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20029_sequence](./t20029_sequence.svg "Combined feature sequence diagram test case") +## Generated Mermaid diagrams +![t20029_sequence](./t20029_sequence_mermaid.svg "Combined feature sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20029_sequence", diff --git a/docs/test_cases/t20029_sequence.svg b/docs/test_cases/t20029_sequence.svg index 8a3ae390..15f99760 100644 --- a/docs/test_cases/t20029_sequence.svg +++ b/docs/test_cases/t20029_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,60 +9,60 @@ - - - - - - - - - - - + + + + + + + + + + + - - + + tmain() - + tmain() - - + + Encoder<Retrier<ConnectionPool>> - + Encoder<Retrier<ConnectionPool>> - - + + Retrier<ConnectionPool> - + Retrier<ConnectionPool> - - + + ConnectionPool - + ConnectionPool - - + + encode_b64(std::string &&) - + encode_b64(std::string &&) - - - - - - - - + + + + + + + + connect() @@ -73,21 +73,21 @@ alt - + [ send(std::string &&) ] - + encode(std::string &&) - + @@ -97,7 +97,7 @@ - + send(std::string &&) @@ -108,7 +108,7 @@ alt - + [ diff --git a/docs/test_cases/t20029_sequence_mermaid.svg b/docs/test_cases/t20029_sequence_mermaid.svg new file mode 100644 index 00000000..3eefa41d --- /dev/null +++ b/docs/test_cases/t20029_sequence_mermaid.svg @@ -0,0 +1,202 @@ + + + + + encode_b64(std::string &&) + + + + + + ConnectionPool + + + + + + Retrier<ConnectionPool> + + + + + + Encoder<Retrier<ConnectionPool>> + + + + + + tmain() + + + + + + + + encode_b64(std::string &&) + + + + + + + + + ConnectionPool + + + + + + + + + Retrier<ConnectionPool> + + + + + + + + + Encoder<Retrier<ConnectionPool>> + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alt + + ​ + + + + + + + + + loop + + ​ + + + + + + + + + alt + + ​ + + + + + + + + + loop + + ​ + + + connect() + + [send(std::string &&)] + + encode(std::string &&) + + ​ + + ​ + + ​ + + send(std::string &&) + + [send(const std::string &)] + + ​ + + ​ + + ​ + + diff --git a/docs/test_cases/t20030.md b/docs/test_cases/t20030.md index 90f8cb6b..74e11bfe 100644 --- a/docs/test_cases/t20030.md +++ b/docs/test_cases/t20030.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20030_sequence: type: sequence @@ -72,15 +72,17 @@ int tmain(bool f, int a) } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20030_sequence](./t20030_sequence.svg "Constructor and operator call test case") +## Generated Mermaid diagrams +![t20030_sequence](./t20030_sequence_mermaid.svg "Constructor and operator call test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20030_sequence", @@ -187,7 +189,7 @@ int tmain(bool f, int a) "participant_name": "clanguml::t20030::tmain(int)" }, "name": "operator+=(int)", - "return_type": "clanguml::t20030::A &", + "return_type": "A &", "scope": "normal", "source_location": { "column": 5, @@ -308,7 +310,7 @@ int tmain(bool f, int a) "participant_name": "clanguml::t20030::tmain(bool,int)" }, "name": "operator+=(int)", - "return_type": "clanguml::t20030::A &", + "return_type": "A &", "scope": "normal", "source_location": { "column": 5, @@ -353,7 +355,7 @@ int tmain(bool f, int a) "participant_name": "clanguml::t20030::tmain(bool,int)" }, "name": "operator=(const A &)", - "return_type": "clanguml::t20030::A &", + "return_type": "A &", "scope": "normal", "source_location": { "column": 5, diff --git a/docs/test_cases/t20030_sequence.svg b/docs/test_cases/t20030_sequence.svg index d636e258..ef20329d 100644 --- a/docs/test_cases/t20030_sequence.svg +++ b/docs/test_cases/t20030_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,81 +9,81 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + tmain(int) - + tmain(int) - - + + magic() - + magic() - - + + A - + A - - + + tmain(bool,int) - + tmain(bool,int) - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + A(int) - + operator+=(int) - + @@ -92,36 +92,36 @@ - + A() - + create() - + A() - + create() - + operator+=(int) - + @@ -130,12 +130,12 @@ - + operator=(const A &) - + @@ -144,7 +144,7 @@ - + value() const diff --git a/docs/test_cases/t20030_sequence_mermaid.svg b/docs/test_cases/t20030_sequence_mermaid.svg new file mode 100644 index 00000000..13ec0fcc --- /dev/null +++ b/docs/test_cases/t20030_sequence_mermaid.svg @@ -0,0 +1,181 @@ + + + + + tmain(bool,int) + + + + + + A + + + + + + magic() + + + + + + tmain(int) + + + + + + + + tmain(bool,int) + + + + + + + + + A + + + + + + + + + magic() + + + + + + + + + tmain(int) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ​ + + ​ + + A(int) + + operator+=(int) + + add(int) + + ​ + + A() + + create() + + A() + + create() + + operator+=(int) + + add(int) + + ​ + + operator=(const A &) + + set(int) + + ​ + + value() const + + ​ + + diff --git a/docs/test_cases/t20031.md b/docs/test_cases/t20031.md index 7bbeb738..b966014d 100644 --- a/docs/test_cases/t20031.md +++ b/docs/test_cases/t20031.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20031_sequence: type: sequence @@ -88,15 +88,17 @@ int tmain(bool f, int a) } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20031_sequence](./t20031_sequence.svg "Callee type sequence diagram filter test case") +## Generated Mermaid diagrams +![t20031_sequence](./t20031_sequence_mermaid.svg "Callee type sequence diagram filter test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20031_sequence", diff --git a/docs/test_cases/t20031_sequence.svg b/docs/test_cases/t20031_sequence.svg index 545558e5..0b5e1ca3 100644 --- a/docs/test_cases/t20031_sequence.svg +++ b/docs/test_cases/t20031_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,64 +9,64 @@ - - - - - + + + + + - - + + tmain(int) - + tmain(int) - - + + magic() - + magic() - - + + tmain(bool,int) - + tmain(bool,int) - - + + execute(std::function<int ()>) - + execute(std::function<int ()>) - - + + A - + A - - - - - - + + + + + + - + - + value() const diff --git a/docs/test_cases/t20031_sequence_mermaid.svg b/docs/test_cases/t20031_sequence_mermaid.svg new file mode 100644 index 00000000..c6200e3a --- /dev/null +++ b/docs/test_cases/t20031_sequence_mermaid.svg @@ -0,0 +1,142 @@ + + + + + A + + + + + + execute(std::function<int ()>) + + + + + + tmain(bool,int) + + + + + + magic() + + + + + + tmain(int) + + + + + + + + A + + + + + + + + + execute(std::function<int ()>) + + + + + + + + + tmain(bool,int) + + + + + + + + + magic() + + + + + + + + + tmain(int) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ​ + + ​ + + ​ + + ​ + + value() const + + ​ + + diff --git a/docs/test_cases/t20032.md b/docs/test_cases/t20032.md index a4a1b541..6618d7f5 100644 --- a/docs/test_cases/t20032.md +++ b/docs/test_cases/t20032.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20032_sequence: type: sequence @@ -48,15 +48,17 @@ void tmain(int argc, char **argv) } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20032_sequence](./t20032_sequence.svg "Return type generation option sequence diagram test case") +## Generated Mermaid diagrams +![t20032_sequence](./t20032_sequence_mermaid.svg "Return type generation option sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20032_sequence", diff --git a/docs/test_cases/t20032_sequence.svg b/docs/test_cases/t20032_sequence.svg index fa734a6e..69e11ce3 100644 --- a/docs/test_cases/t20032_sequence.svg +++ b/docs/test_cases/t20032_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,47 +9,47 @@ - - - - - - - + + + + + + + - - + + tmain(int,char **) - + tmain(int,char **) - - + + B - + B - - + + A - + A - - - - - - - - + + + + + + + + b(int) - + a1(int) @@ -60,12 +60,12 @@ int - + b(double) - + a2(double) @@ -76,12 +76,12 @@ double - + b(const char *) - + a3(const char *) diff --git a/docs/test_cases/t20032_sequence_mermaid.svg b/docs/test_cases/t20032_sequence_mermaid.svg new file mode 100644 index 00000000..86fd4f5a --- /dev/null +++ b/docs/test_cases/t20032_sequence_mermaid.svg @@ -0,0 +1,130 @@ + + + + + A + + + + + + B + + + + + + tmain(int,char **) + + + + + + + + A + + + + + + + + + B + + + + + + + + + tmain(int,char **) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + b(int) + + a1(int) + + int + + int + + b(double) + + a2(double) + + double + + double + + b(const char *) + + a3(const char *) + + const char * + + const char * + + diff --git a/docs/test_cases/t20033.md b/docs/test_cases/t20033.md index e5b0632d..2604f6df 100644 --- a/docs/test_cases/t20033.md +++ b/docs/test_cases/t20033.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20033_sequence: type: sequence @@ -86,15 +86,17 @@ int tmain() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20033_sequence](./t20033_sequence.svg "Control statement text in sequence diagram test case") +## Generated Mermaid diagrams +![t20033_sequence](./t20033_sequence_mermaid.svg "Control statement text in sequence diagram test case") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20033_sequence", diff --git a/docs/test_cases/t20033_sequence.svg b/docs/test_cases/t20033_sequence.svg index 1214f325..79d2a95c 100644 --- a/docs/test_cases/t20033_sequence.svg +++ b/docs/test_cases/t20033_sequence.svg @@ -1,6 +1,6 @@ - + @@ -9,73 +9,73 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - + + + + + - + - - + + tmain() - + tmain() - - + + A - + A - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + alt [false] [reinterpret_cast<uint64_t>(&a) % 100 == 0ULL] - + a1() @@ -84,7 +84,7 @@ [reinterpret_cast<uint64_t>(&a) % 64 == 0ULL] - + a2() @@ -93,7 +93,7 @@ [a.a2() == 2 && a.a3() == 3] - + [ @@ -102,7 +102,7 @@ - + [ @@ -111,7 +111,7 @@ - + a3() @@ -119,7 +119,7 @@ - + a4() @@ -130,7 +130,7 @@ alt [int i = a.a2(); i != 2] - + [ @@ -139,7 +139,7 @@ - + a3() @@ -150,7 +150,7 @@ loop [int i = 0; i < a.a2(); i++] - + [ @@ -159,14 +159,14 @@ - + a3() - + a3() @@ -177,7 +177,7 @@ loop [retry_count--] - + a2() @@ -188,14 +188,14 @@ loop [retry_count++ < a.a3()] - + a4() - + [ @@ -208,7 +208,7 @@ alt [a.a4() % 6] - + [ @@ -222,7 +222,7 @@ loop [ints] - + a4() diff --git a/docs/test_cases/t20033_sequence_mermaid.svg b/docs/test_cases/t20033_sequence_mermaid.svg new file mode 100644 index 00000000..95d14083 --- /dev/null +++ b/docs/test_cases/t20033_sequence_mermaid.svg @@ -0,0 +1,284 @@ + + + + + A + + + + + + tmain() + + + + + + + + A + + + + + + + + + tmain() + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alt + + [false] + + [reinterpret_cast<uint6- + 4_t>(&a) % 100 == + 0ULL] + [reinterpret_cast<uint6- + 4_t>(&a) % 64 == + 0ULL] + [a.a2() == 2 && + a.a3() == 3] + + + + + + + + + + + + + + alt + + [int i = a.a2(); + + + i != 2] + + + + + + + + + + + + + + + loop + + [int i = 0; i < + + + a.a2(); i++] + + + + + + + + + + + + + + + loop + + [retry_count--] + + + + + + + + + + + + + + + loop + + [retry_count++ < + + + a.a3()] + + + + + + + + + + + + + alt + + [a.a4() % 6] + + + + + + + + + + + + loop + + [ints] + + + a1() + + ​ + + a2() + + ​ + + [a2()] + + ​ + + [a3()] + + ​ + + a3() + + ​ + + a4() + + ​ + + [a2()] + + ​ + + a3() + + ​ + + [a2()] + + ​ + + a3() + + ​ + + a3() + + ​ + + a2() + + ​ + + a4() + + ​ + + [a3()] + + ​ + + [a4()] + + ​ + + a4() + + ​ + + diff --git a/docs/test_cases/t20034.md b/docs/test_cases/t20034.md index 8e570407..b202689b 100644 --- a/docs/test_cases/t20034.md +++ b/docs/test_cases/t20034.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20034_sequence: type: sequence @@ -92,15 +92,17 @@ void B::b4() } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20034_sequence](./t20034_sequence.svg "Test case for rendering all call chains from one activity to another (from_to)") +## Generated Mermaid diagrams +![t20034_sequence](./t20034_sequence_mermaid.svg "Test case for rendering all call chains from one activity to another (from_to)") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20034_sequence", @@ -182,35 +184,13 @@ void B::b4() "activity_name": "clanguml::t20034::D::d2()", "participant_id": "272777525372220260" }, - "name": "c3()", + "name": "c2()", "return_type": "void", "scope": "normal", "source_location": { "column": 9, "file": "../../tests/t20034/t20034.cc", - "line": 51, - "translation_unit": "../../tests/t20034/t20034.cc" - }, - "to": { - "activity_id": "2116989777037608337", - "activity_name": "clanguml::t20034::C::c3()", - "participant_id": "2153793652884753477" - }, - "type": "message" - }, - { - "from": { - "activity_id": "2116989777037608337", - "activity_name": "clanguml::t20034::C::c3()", - "participant_id": "2153793652884753477" - }, - "name": "c2()", - "return_type": "void", - "scope": "normal", - "source_location": { - "column": 13, - "file": "../../tests/t20034/t20034.cc", - "line": 36, + "line": 50, "translation_unit": "../../tests/t20034/t20034.cc" }, "to": { @@ -266,168 +246,6 @@ void B::b4() } ] }, - { - "messages": [ - { - "from": { - "activity_id": "1707514178726476738", - "activity_name": "clanguml::t20034::D::d2()", - "participant_id": "272777525372220260" - }, - "name": "c1()", - "return_type": "void", - "scope": "normal", - "source_location": { - "column": 9, - "file": "../../tests/t20034/t20034.cc", - "line": 48, - "translation_unit": "../../tests/t20034/t20034.cc" - }, - "to": { - "activity_id": "148530508384958711", - "activity_name": "clanguml::t20034::C::c1()", - "participant_id": "2153793652884753477" - }, - "type": "message" - }, - { - "from": { - "activity_id": "148530508384958711", - "activity_name": "clanguml::t20034::C::c1()", - "participant_id": "2153793652884753477" - }, - "name": "b1()", - "return_type": "void", - "scope": "normal", - "source_location": { - "column": 17, - "file": "../../tests/t20034/t20034.cc", - "line": 29, - "translation_unit": "../../tests/t20034/t20034.cc" - }, - "to": { - "activity_id": "289899516984058785", - "activity_name": "clanguml::t20034::B::b1()", - "participant_id": "1214895773389400008" - }, - "type": "message" - }, - { - "from": { - "activity_id": "289899516984058785", - "activity_name": "clanguml::t20034::B::b1()", - "participant_id": "1214895773389400008" - }, - "name": "a2()", - "return_type": "void", - "scope": "normal", - "source_location": { - "column": 9, - "file": "../../tests/t20034/t20034.cc", - "line": 17, - "translation_unit": "../../tests/t20034/t20034.cc" - }, - "to": { - "activity_id": "1307188853155365430", - "activity_name": "clanguml::t20034::A::a2()", - "participant_id": "1029414747563549012" - }, - "type": "message" - } - ] - }, - { - "messages": [ - { - "from": { - "activity_id": "1707514178726476738", - "activity_name": "clanguml::t20034::D::d2()", - "participant_id": "272777525372220260" - }, - "name": "c4()", - "return_type": "void", - "scope": "normal", - "source_location": { - "column": 9, - "file": "../../tests/t20034/t20034.cc", - "line": 54, - "translation_unit": "../../tests/t20034/t20034.cc" - }, - "to": { - "activity_id": "395720534444062628", - "activity_name": "clanguml::t20034::C::c4()", - "participant_id": "2153793652884753477" - }, - "type": "message" - }, - { - "from": { - "activity_id": "395720534444062628", - "activity_name": "clanguml::t20034::C::c4()", - "participant_id": "2153793652884753477" - }, - "name": "b4()", - "return_type": "void", - "scope": "normal", - "source_location": { - "column": 17, - "file": "../../tests/t20034/t20034.cc", - "line": 39, - "translation_unit": "../../tests/t20034/t20034.cc" - }, - "to": { - "activity_id": "1774155279072101253", - "activity_name": "clanguml::t20034::B::b4()", - "participant_id": "1214895773389400008" - }, - "type": "message" - }, - { - "from": { - "activity_id": "1774155279072101253", - "activity_name": "clanguml::t20034::B::b4()", - "participant_id": "1214895773389400008" - }, - "name": "b2()", - "return_type": "void", - "scope": "normal", - "source_location": { - "column": 5, - "file": "../../tests/t20034/t20034.cc", - "line": 68, - "translation_unit": "../../tests/t20034/t20034.cc" - }, - "to": { - "activity_id": "1034410188120190919", - "activity_name": "clanguml::t20034::B::b2()", - "participant_id": "1214895773389400008" - }, - "type": "message" - }, - { - "from": { - "activity_id": "1034410188120190919", - "activity_name": "clanguml::t20034::B::b2()", - "participant_id": "1214895773389400008" - }, - "name": "a2()", - "return_type": "void", - "scope": "normal", - "source_location": { - "column": 17, - "file": "../../tests/t20034/t20034.cc", - "line": 19, - "translation_unit": "../../tests/t20034/t20034.cc" - }, - "to": { - "activity_id": "1307188853155365430", - "activity_name": "clanguml::t20034::A::a2()", - "participant_id": "1029414747563549012" - }, - "type": "message" - } - ] - }, { "messages": [ { @@ -510,13 +328,197 @@ void B::b4() "activity_name": "clanguml::t20034::D::d2()", "participant_id": "272777525372220260" }, - "name": "c2()", + "name": "c4()", "return_type": "void", "scope": "normal", "source_location": { "column": 9, "file": "../../tests/t20034/t20034.cc", - "line": 50, + "line": 54, + "translation_unit": "../../tests/t20034/t20034.cc" + }, + "to": { + "activity_id": "395720534444062628", + "activity_name": "clanguml::t20034::C::c4()", + "participant_id": "2153793652884753477" + }, + "type": "message" + }, + { + "from": { + "activity_id": "395720534444062628", + "activity_name": "clanguml::t20034::C::c4()", + "participant_id": "2153793652884753477" + }, + "name": "b4()", + "return_type": "void", + "scope": "normal", + "source_location": { + "column": 17, + "file": "../../tests/t20034/t20034.cc", + "line": 39, + "translation_unit": "../../tests/t20034/t20034.cc" + }, + "to": { + "activity_id": "1774155279072101253", + "activity_name": "clanguml::t20034::B::b4()", + "participant_id": "1214895773389400008" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1774155279072101253", + "activity_name": "clanguml::t20034::B::b4()", + "participant_id": "1214895773389400008" + }, + "name": "b2()", + "return_type": "void", + "scope": "normal", + "source_location": { + "column": 5, + "file": "../../tests/t20034/t20034.cc", + "line": 68, + "translation_unit": "../../tests/t20034/t20034.cc" + }, + "to": { + "activity_id": "1034410188120190919", + "activity_name": "clanguml::t20034::B::b2()", + "participant_id": "1214895773389400008" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1034410188120190919", + "activity_name": "clanguml::t20034::B::b2()", + "participant_id": "1214895773389400008" + }, + "name": "a2()", + "return_type": "void", + "scope": "normal", + "source_location": { + "column": 17, + "file": "../../tests/t20034/t20034.cc", + "line": 19, + "translation_unit": "../../tests/t20034/t20034.cc" + }, + "to": { + "activity_id": "1307188853155365430", + "activity_name": "clanguml::t20034::A::a2()", + "participant_id": "1029414747563549012" + }, + "type": "message" + } + ] + }, + { + "messages": [ + { + "from": { + "activity_id": "1707514178726476738", + "activity_name": "clanguml::t20034::D::d2()", + "participant_id": "272777525372220260" + }, + "name": "c1()", + "return_type": "void", + "scope": "normal", + "source_location": { + "column": 9, + "file": "../../tests/t20034/t20034.cc", + "line": 48, + "translation_unit": "../../tests/t20034/t20034.cc" + }, + "to": { + "activity_id": "148530508384958711", + "activity_name": "clanguml::t20034::C::c1()", + "participant_id": "2153793652884753477" + }, + "type": "message" + }, + { + "from": { + "activity_id": "148530508384958711", + "activity_name": "clanguml::t20034::C::c1()", + "participant_id": "2153793652884753477" + }, + "name": "b1()", + "return_type": "void", + "scope": "normal", + "source_location": { + "column": 17, + "file": "../../tests/t20034/t20034.cc", + "line": 29, + "translation_unit": "../../tests/t20034/t20034.cc" + }, + "to": { + "activity_id": "289899516984058785", + "activity_name": "clanguml::t20034::B::b1()", + "participant_id": "1214895773389400008" + }, + "type": "message" + }, + { + "from": { + "activity_id": "289899516984058785", + "activity_name": "clanguml::t20034::B::b1()", + "participant_id": "1214895773389400008" + }, + "name": "a2()", + "return_type": "void", + "scope": "normal", + "source_location": { + "column": 9, + "file": "../../tests/t20034/t20034.cc", + "line": 17, + "translation_unit": "../../tests/t20034/t20034.cc" + }, + "to": { + "activity_id": "1307188853155365430", + "activity_name": "clanguml::t20034::A::a2()", + "participant_id": "1029414747563549012" + }, + "type": "message" + } + ] + }, + { + "messages": [ + { + "from": { + "activity_id": "1707514178726476738", + "activity_name": "clanguml::t20034::D::d2()", + "participant_id": "272777525372220260" + }, + "name": "c3()", + "return_type": "void", + "scope": "normal", + "source_location": { + "column": 9, + "file": "../../tests/t20034/t20034.cc", + "line": 51, + "translation_unit": "../../tests/t20034/t20034.cc" + }, + "to": { + "activity_id": "2116989777037608337", + "activity_name": "clanguml::t20034::C::c3()", + "participant_id": "2153793652884753477" + }, + "type": "message" + }, + { + "from": { + "activity_id": "2116989777037608337", + "activity_name": "clanguml::t20034::C::c3()", + "participant_id": "2153793652884753477" + }, + "name": "c2()", + "return_type": "void", + "scope": "normal", + "source_location": { + "column": 13, + "file": "../../tests/t20034/t20034.cc", + "line": 36, "translation_unit": "../../tests/t20034/t20034.cc" }, "to": { diff --git a/docs/test_cases/t20034_sequence.svg b/docs/test_cases/t20034_sequence.svg index 890c9ce7..10e1258a 100644 --- a/docs/test_cases/t20034_sequence.svg +++ b/docs/test_cases/t20034_sequence.svg @@ -1,6 +1,6 @@ - + @@ -14,154 +14,154 @@ - - + + D - + D - - + + C - + C - - + + B - + B - - + + A - + A - - + + D::d2()::(lambda ../../tests/t20034/t20034.cc:56:18) - + D::d2()::(lambda ../../tests/t20034/t20034.cc:56:18) d2() - + - c3() + c2() - - - - - - c2() + + + + b2() - - - - b2() + + + + a2() - - - - a2() + + + + + + d2() + + + + a2() - - - - - - d2() - - - - c1() + + + + + + d2() + + + + operator()() - - - - b1() + + + + a2() - - - - a2() + + + + + + d2() + + + + c4() - - - - - - d2() - - - - c4() + + + + b4() - - - - b4() + + + + + + b2() - - - - - - b2() + + + + a2() - - - - a2() + + + + + + d2() + + + + c1() - - - - - - d2() - - - - a2() + + + + b1() - - - - - - d2() - - - - operator()() + + + + a2() - - - - a2() + + + + + + d2() + + + + c3() - - - - - - d2() - - - - c2() + + + + + + c2() - + b2() - + a2() diff --git a/docs/test_cases/t20034_sequence_mermaid.svg b/docs/test_cases/t20034_sequence_mermaid.svg new file mode 100644 index 00000000..d10b6c93 --- /dev/null +++ b/docs/test_cases/t20034_sequence_mermaid.svg @@ -0,0 +1,176 @@ + + + + + D::d2()::(lambda ../../tests/t20034/t20034.cc:56:18) + + + + + + A + + + + + + B + + + + + + C + + + + + + D + + + + + + * + + + + + + + + D::d2()::(lambda ../../tests/t20034/t20034.cc:56:18) + + + + + + + + + A + + + + + + + + + B + + + + + + + + + C + + + + + + + + + D + + + + + + + + + * + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + d2() + + c2() + + b2() + + a2() + + d2() + + a2() + + d2() + + operator()() + + a2() + + d2() + + c4() + + b4() + + b2() + + a2() + + d2() + + c1() + + b1() + + a2() + + d2() + + c3() + + c2() + + b2() + + a2() + + diff --git a/docs/test_cases/t20035.md b/docs/test_cases/t20035.md index 74137990..9a210be0 100644 --- a/docs/test_cases/t20035.md +++ b/docs/test_cases/t20035.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20035_sequence: type: sequence @@ -35,15 +35,17 @@ int tmain(int argc, char **argv) { return a(argc); } } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20035_sequence](./t20035_sequence.svg "from_to sequence diagram test case with free functions") +## Generated Mermaid diagrams +![t20035_sequence](./t20035_sequence_mermaid.svg "from_to sequence diagram test case with free functions") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20035_sequence", diff --git a/docs/test_cases/t20035_sequence.svg b/docs/test_cases/t20035_sequence.svg index a49e0818..bf85f19d 100644 --- a/docs/test_cases/t20035_sequence.svg +++ b/docs/test_cases/t20035_sequence.svg @@ -1,6 +1,6 @@ - + @@ -13,39 +13,39 @@ - - + + tmain(int,char **) - + tmain(int,char **) - - + + a(int) - + a(int) - - + + b1(int) - + b1(int) - - + + c(int) - + c(int) - + - + - + diff --git a/docs/test_cases/t20035_sequence_mermaid.svg b/docs/test_cases/t20035_sequence_mermaid.svg new file mode 100644 index 00000000..dbd1dab4 --- /dev/null +++ b/docs/test_cases/t20035_sequence_mermaid.svg @@ -0,0 +1,106 @@ + + + + + c(int) + + + + + + b1(int) + + + + + + a(int) + + + + + + tmain(int,char **) + + + + + + + + c(int) + + + + + + + + + b1(int) + + + + + + + + + a(int) + + + + + + + + + tmain(int,char **) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ​ + + ​ + + ​ + + diff --git a/docs/test_cases/t20036.md b/docs/test_cases/t20036.md index 8f7cb08c..16515bc4 100644 --- a/docs/test_cases/t20036.md +++ b/docs/test_cases/t20036.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20036_sequence: type: sequence @@ -64,15 +64,17 @@ struct D { } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t20036_sequence](./t20036_sequence.svg "Test case for rendering all call chains leading to an activity (to)") +## Generated Mermaid diagrams +![t20036_sequence](./t20036_sequence_mermaid.svg "Test case for rendering all call chains leading to an activity (to)") ## Generated JSON models ```json { "diagram_type": "sequence", "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t20036_sequence", @@ -129,17 +131,65 @@ struct D { "messages": [ { "from": { - "activity_id": "1523531372012294984", - "activity_name": "clanguml::t20036::C::c3()", + "activity_id": "1742507735898803374", + "activity_name": "clanguml::t20036::C::c1()", "participant_id": "589458700000736705" }, + "name": "b1()", + "return_type": "void", + "scope": "normal", + "source_location": { + "column": 17, + "file": "../../tests/t20036/t20036.cc", + "line": 20, + "translation_unit": "../../tests/t20036/t20036.cc" + }, + "to": { + "activity_id": "203660950902052846", + "activity_name": "clanguml::t20036::B::b1()", + "participant_id": "607147607288902300" + }, + "type": "message" + }, + { + "from": { + "activity_id": "203660950902052846", + "activity_name": "clanguml::t20036::B::b1()", + "participant_id": "607147607288902300" + }, + "name": "a2()", + "return_type": "void", + "scope": "normal", + "source_location": { + "column": 17, + "file": "../../tests/t20036/t20036.cc", + "line": 12, + "translation_unit": "../../tests/t20036/t20036.cc" + }, + "to": { + "activity_id": "2124074228514438863", + "activity_name": "clanguml::t20036::A::a2()", + "participant_id": "399722216848214287" + }, + "type": "message" + } + ] + }, + { + "messages": [ + { + "from": { + "activity_id": "701488875613014930", + "activity_name": "clanguml::t20036::D::d1()", + "participant_id": "847434467114564641" + }, "name": "c2()", "return_type": "void", "scope": "normal", "source_location": { - "column": 13, + "column": 17, "file": "../../tests/t20036/t20036.cc", - "line": 27, + "line": 36, "translation_unit": "../../tests/t20036/t20036.cc" }, "to": { @@ -195,54 +245,6 @@ struct D { } ] }, - { - "messages": [ - { - "from": { - "activity_id": "1735839766717973272", - "activity_name": "clanguml::t20036::C::c4()", - "participant_id": "589458700000736705" - }, - "name": "b2()", - "return_type": "void", - "scope": "normal", - "source_location": { - "column": 17, - "file": "../../tests/t20036/t20036.cc", - "line": 30, - "translation_unit": "../../tests/t20036/t20036.cc" - }, - "to": { - "activity_id": "1726094580455938498", - "activity_name": "clanguml::t20036::B::b2()", - "participant_id": "607147607288902300" - }, - "type": "message" - }, - { - "from": { - "activity_id": "1726094580455938498", - "activity_name": "clanguml::t20036::B::b2()", - "participant_id": "607147607288902300" - }, - "name": "a2()", - "return_type": "void", - "scope": "normal", - "source_location": { - "column": 17, - "file": "../../tests/t20036/t20036.cc", - "line": 13, - "translation_unit": "../../tests/t20036/t20036.cc" - }, - "to": { - "activity_id": "2124074228514438863", - "activity_name": "clanguml::t20036::A::a2()", - "participant_id": "399722216848214287" - }, - "type": "message" - } - ] - }, { "messages": [ { @@ -273,17 +275,65 @@ struct D { "messages": [ { "from": { - "activity_id": "701488875613014930", - "activity_name": "clanguml::t20036::D::d1()", - "participant_id": "847434467114564641" + "activity_id": "1735839766717973272", + "activity_name": "clanguml::t20036::C::c4()", + "participant_id": "589458700000736705" }, - "name": "c2()", + "name": "b2()", "return_type": "void", "scope": "normal", "source_location": { "column": 17, "file": "../../tests/t20036/t20036.cc", - "line": 36, + "line": 30, + "translation_unit": "../../tests/t20036/t20036.cc" + }, + "to": { + "activity_id": "1726094580455938498", + "activity_name": "clanguml::t20036::B::b2()", + "participant_id": "607147607288902300" + }, + "type": "message" + }, + { + "from": { + "activity_id": "1726094580455938498", + "activity_name": "clanguml::t20036::B::b2()", + "participant_id": "607147607288902300" + }, + "name": "a2()", + "return_type": "void", + "scope": "normal", + "source_location": { + "column": 17, + "file": "../../tests/t20036/t20036.cc", + "line": 13, + "translation_unit": "../../tests/t20036/t20036.cc" + }, + "to": { + "activity_id": "2124074228514438863", + "activity_name": "clanguml::t20036::A::a2()", + "participant_id": "399722216848214287" + }, + "type": "message" + } + ] + }, + { + "messages": [ + { + "from": { + "activity_id": "1523531372012294984", + "activity_name": "clanguml::t20036::C::c3()", + "participant_id": "589458700000736705" + }, + "name": "c2()", + "return_type": "void", + "scope": "normal", + "source_location": { + "column": 13, + "file": "../../tests/t20036/t20036.cc", + "line": 27, "translation_unit": "../../tests/t20036/t20036.cc" }, "to": { @@ -408,54 +458,6 @@ struct D { "type": "message" } ] - }, - { - "messages": [ - { - "from": { - "activity_id": "1742507735898803374", - "activity_name": "clanguml::t20036::C::c1()", - "participant_id": "589458700000736705" - }, - "name": "b1()", - "return_type": "void", - "scope": "normal", - "source_location": { - "column": 17, - "file": "../../tests/t20036/t20036.cc", - "line": 20, - "translation_unit": "../../tests/t20036/t20036.cc" - }, - "to": { - "activity_id": "203660950902052846", - "activity_name": "clanguml::t20036::B::b1()", - "participant_id": "607147607288902300" - }, - "type": "message" - }, - { - "from": { - "activity_id": "203660950902052846", - "activity_name": "clanguml::t20036::B::b1()", - "participant_id": "607147607288902300" - }, - "name": "a2()", - "return_type": "void", - "scope": "normal", - "source_location": { - "column": 17, - "file": "../../tests/t20036/t20036.cc", - "line": 12, - "translation_unit": "../../tests/t20036/t20036.cc" - }, - "to": { - "activity_id": "2124074228514438863", - "activity_name": "clanguml::t20036::A::a2()", - "participant_id": "399722216848214287" - }, - "type": "message" - } - ] } ], "to": { diff --git a/docs/test_cases/t20036_sequence.svg b/docs/test_cases/t20036_sequence.svg index a9b86b38..198a3314 100644 --- a/docs/test_cases/t20036_sequence.svg +++ b/docs/test_cases/t20036_sequence.svg @@ -1,6 +1,6 @@ - + @@ -13,131 +13,131 @@ - - + + C - + C - - + + B - + B - - + + A - + A - - + + D - + D - c3() - - - - - - c2() + c1() + + + + b1() - - - - b2() + + + + a2() - - - - a2() + + + + + + d1() + + + + c2() - - - - - - c4() - - - - b2() + + + + b2() - - - - a2() + + + + a2() - - - - - - d3() - - - - a2() + + + + + + d3() + + + + a2() - - - - - - d1() - - - - c2() + + + + + + c4() + + + + b2() - - - - b2() + + + + a2() - - - - a2() + + + + + + c3() + + + + + + c2() - - - - - - d2() - - - - c2() + + + + b2() - - - - b2() + + + + a2() - - - - a2() + + + + + + d2() + + + + c2() - - - - - - c1() - + - b1() + b2() - + a2() diff --git a/docs/test_cases/t20036_sequence_mermaid.svg b/docs/test_cases/t20036_sequence_mermaid.svg new file mode 100644 index 00000000..cd661d11 --- /dev/null +++ b/docs/test_cases/t20036_sequence_mermaid.svg @@ -0,0 +1,155 @@ + + + + + D + + + + + + A + + + + + + B + + + + + + * + + + + + + C + + + + + + + + D + + + + + + + + + A + + + + + + + + + B + + + + + + + + + * + + + + + + + + + C + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + c1() + + b1() + + a2() + + d1() + + c2() + + b2() + + a2() + + d3() + + a2() + + c4() + + b2() + + a2() + + c3() + + c2() + + b2() + + a2() + + d2() + + c2() + + b2() + + a2() + + diff --git a/docs/test_cases/t30001.md b/docs/test_cases/t30001.md index 02be978b..cfbead57 100644 --- a/docs/test_cases/t30001.md +++ b/docs/test_cases/t30001.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30001_package: type: package @@ -23,6 +23,18 @@ diagrams: - 'note right of {{ alias("A::AA::AAA") }}: A AAA note...' - '{% set e=element("A::AA") %} note top of {{ alias("A::AA") }} : {{ e.comment.formatted }}' - '{% set e=element("B::AA") %} note top of {{ alias("B::AA") }} : {{ e.comment.formatted }}' + mermaid: + before: + - "%% t30001 test diagram of type {{ diagram.type }}" + after: + - 'N_0001(A AAA note...)' + - 'N_0001 -.- {{ alias("A::AA::AAA") }}' + - '{% set e=element("A::AA") %}N_0002({{ e.comment.formatted }})' + - '{% set e=element("B::AA") %}N_0003({{ e.comment.formatted }})' + - 'N_0002 -.- {{ alias("A::AA") }}' + - 'N_0003 -.- {{ alias("B::AA") }}' + + ``` ## Source code @@ -56,8 +68,10 @@ namespace BB { } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t30001_package](./t30001_package.svg "Basic package diagram test case") +## Generated Mermaid diagrams +![t30001_package](./t30001_package_mermaid.svg "Basic package diagram test case") ## Generated JSON models ```json { @@ -239,8 +253,8 @@ namespace BB { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t30001_package", diff --git a/docs/test_cases/t30001_package.svg b/docs/test_cases/t30001_package.svg index 0e6e77d6..d473ee6c 100644 --- a/docs/test_cases/t30001_package.svg +++ b/docs/test_cases/t30001_package.svg @@ -1,6 +1,6 @@ - + @@ -9,63 +9,63 @@ - - + + A - - + + AA - - + + B - - + + AA - - + + AAA - - + + BBB - - + + BB - - + + AAA - - + + BBB - - + + BB - + A AAA note... - + This is namespace AA in namespace A - + This is namespace AA in namespace B diff --git a/docs/test_cases/t30001_package_mermaid.svg b/docs/test_cases/t30001_package_mermaid.svg new file mode 100644 index 00000000..36542ab3 --- /dev/null +++ b/docs/test_cases/t30001_package_mermaid.svg @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ B +
+
+
+
+ + + + +
+ A +
+
+
+
+ + + + +
+ AA +
+
+
+
+
+ + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + +
+ AA +
+
+
+
+
+ + + + + + + + +
+ AAA +
+
+
+
+ + + + + +
+ BBB +
+
+
+
+
+
+ + + + + +
+ BB +
+
+
+
+ + + + + +
+ BB +
+
+
+
+ + + + + +
+ AAA +
+
+
+
+ + + + + +
+ BBB +
+
+
+
+ + + + + +
+ A AAA note... +
+
+
+
+ + + + + +
+ This is namespace AA in namespace A +
+
+
+
+ + + + + +
+ This is namespace AA in namespace B +
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t30002.md b/docs/test_cases/t30002.md index ec4b99e5..fcf346fa 100644 --- a/docs/test_cases/t30002.md +++ b/docs/test_cases/t30002.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30002_package: type: package @@ -143,8 +143,10 @@ template std::map> cm() } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t30002_package](./t30002_package.svg "Package dependency test case") +## Generated Mermaid diagrams +![t30002_package](./t30002_package_mermaid.svg "Package dependency test case") ## Generated JSON models ```json { @@ -487,8 +489,8 @@ template std::map> cm() } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t30002_package", diff --git a/docs/test_cases/t30002_package.svg b/docs/test_cases/t30002_package.svg index 848b1352..1ee3f5e4 100644 --- a/docs/test_cases/t30002_package.svg +++ b/docs/test_cases/t30002_package.svg @@ -1,6 +1,6 @@ - + @@ -9,118 +9,118 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + A1 - - + + A2 - - + + A3 - - + + A4 - - + + A5 - - + + A6 - - + + A7 - - + + A8 - - + + A9 - - + + A10 - - + + A11 - - + + A12 - - + + A13 - - + + A14 - - + + A15 - - + + A16 - - + + A17 - - + + A18 - - + + BBB diff --git a/docs/test_cases/t30002_package_mermaid.svg b/docs/test_cases/t30002_package_mermaid.svg new file mode 100644 index 00000000..652965df --- /dev/null +++ b/docs/test_cases/t30002_package_mermaid.svg @@ -0,0 +1,462 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ B +
+
+
+
+ + + + +
+ A +
+
+
+
+ + + + +
+ BB +
+
+
+
+ + + + +
+ AA +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + +
+ BBB +
+
+
+
+ + + + + +
+ A1 +
+
+
+
+ + + + + +
+ A2 +
+
+
+
+ + + + + +
+ A3 +
+
+
+
+ + + + + +
+ A4 +
+
+
+
+ + + + + +
+ A5 +
+
+
+
+ + + + + +
+ A6 +
+
+
+
+ + + + + +
+ A7 +
+
+
+
+ + + + + +
+ A8 +
+
+
+
+ + + + + +
+ A9 +
+
+
+
+ + + + + +
+ A10 +
+
+
+
+ + + + + +
+ A11 +
+
+
+
+ + + + + +
+ A12 +
+
+
+
+ + + + + +
+ A13 +
+
+
+
+ + + + + +
+ A14 +
+
+
+
+ + + + + +
+ A15 +
+
+
+
+ + + + + +
+ A16 +
+
+
+
+ + + + + +
+ A17 +
+
+
+
+ + + + + +
+ A18 +
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t30003.md b/docs/test_cases/t30003.md index fc87a937..e0bc016d 100644 --- a/docs/test_cases/t30003.md +++ b/docs/test_cases/t30003.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30003_package: type: package @@ -48,8 +48,10 @@ class B : public ns1::ns2::Anon { }; } // namespace t30003 } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t30003_package](./t30003_package.svg "Package deprecated attribute test case") +## Generated Mermaid diagrams +![t30003_package](./t30003_package_mermaid.svg "Package deprecated attribute test case") ## Generated JSON models ```json { @@ -169,8 +171,8 @@ class B : public ns1::ns2::Anon { }; } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t30003_package", diff --git a/docs/test_cases/t30003_package.svg b/docs/test_cases/t30003_package.svg index 9d3ad2cc..ef8c3bd3 100644 --- a/docs/test_cases/t30003_package.svg +++ b/docs/test_cases/t30003_package.svg @@ -1,6 +1,6 @@ - + @@ -9,35 +9,35 @@ - - + + ns1 - - + + ns3 «deprecated» - - + + ns1 - - + + ns2_v1_0_0 - - + + ns2_v0_9_0 «deprecated» - - + + ns2 diff --git a/docs/test_cases/t30003_package_mermaid.svg b/docs/test_cases/t30003_package_mermaid.svg new file mode 100644 index 00000000..417d2e5b --- /dev/null +++ b/docs/test_cases/t30003_package_mermaid.svg @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ ns1 +
+
+
+
+ + + + +
+ ns3 +
+
+
+
+
+ + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + +
+ ns2_v1_0_0 +
+
+
+
+ + + + + +
+ ns2 +
+
+
+
+ + + + + +
+ ns2_v0_9_0 +
+
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t30004.md b/docs/test_cases/t30004.md index e2005b0a..0af2a18d 100644 --- a/docs/test_cases/t30004.md +++ b/docs/test_cases/t30004.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30004_package: type: package @@ -56,8 +56,10 @@ namespace CCC { } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t30004_package](./t30004_package.svg "PlantUML package decorators test case") +## Generated Mermaid diagrams +![t30004_package](./t30004_package_mermaid.svg "PlantUML package decorators test case") ## Generated JSON models ```json { @@ -180,8 +182,8 @@ namespace CCC { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t30004_package", diff --git a/docs/test_cases/t30004_package.svg b/docs/test_cases/t30004_package.svg index 5d90b82e..db7ad8c0 100644 --- a/docs/test_cases/t30004_package.svg +++ b/docs/test_cases/t30004_package.svg @@ -1,6 +1,6 @@ - + @@ -9,40 +9,40 @@ - - + + A - + Package AAA. - + Package BBB. - + CCCC package note. - + We skipped DDD. - - + + AAA - - + + BBB - - + + CCC - - + + EEE diff --git a/docs/test_cases/t30004_package_mermaid.svg b/docs/test_cases/t30004_package_mermaid.svg new file mode 100644 index 00000000..b3da38b3 --- /dev/null +++ b/docs/test_cases/t30004_package_mermaid.svg @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ A +
+
+
+
+
+ + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + +
+ AAA +
+
+
+
+ + + + + +
+ Package AAA. +
+
+
+
+ + + + + +
+ Package BBB. +
+
+
+
+ + + + + +
+ BBB +
+
+
+
+ + + + + +
+ CCCC package note. +
+
+
+
+ + + + + +
+ CCC +
+
+
+
+ + + + + +
+ We skipped DDD. +
+
+
+
+ + + + + +
+ EEE +
+
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t30005.md b/docs/test_cases/t30005.md index 9b9ca455..bb662edb 100644 --- a/docs/test_cases/t30005.md +++ b/docs/test_cases/t30005.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30005_package: type: package @@ -48,8 +48,10 @@ struct C2 { } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t30005_package](./t30005_package.svg "Package namespace alias test case") +## Generated Mermaid diagrams +![t30005_package](./t30005_package_mermaid.svg "Package namespace alias test case") ## Generated JSON models ```json { @@ -214,8 +216,8 @@ struct C2 { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t30005_package", diff --git a/docs/test_cases/t30005_package.svg b/docs/test_cases/t30005_package.svg index 866752fd..068615cf 100644 --- a/docs/test_cases/t30005_package.svg +++ b/docs/test_cases/t30005_package.svg @@ -1,6 +1,6 @@ - + @@ -9,48 +9,48 @@ - - + + A - - + + AA - - + + B - - + + BB - - + + C - - + + CC - - + + AAA - - + + BBB - - + + CCC diff --git a/docs/test_cases/t30005_package_mermaid.svg b/docs/test_cases/t30005_package_mermaid.svg new file mode 100644 index 00000000..f97615b4 --- /dev/null +++ b/docs/test_cases/t30005_package_mermaid.svg @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ C +
+
+
+
+ + + + +
+ B +
+
+
+
+ + + + +
+ A +
+
+
+
+ + + + +
+ CC +
+
+
+
+ + + + +
+ BB +
+
+
+
+ + + + +
+ AA +
+
+
+
+
+ + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + +
+ CCC +
+
+
+
+ + + + + +
+ BBB +
+
+
+
+ + + + + +
+ AAA +
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t30006.md b/docs/test_cases/t30006.md index 81909a20..06f98c8d 100644 --- a/docs/test_cases/t30006.md +++ b/docs/test_cases/t30006.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30006_package: type: package @@ -48,8 +48,10 @@ struct A2 { } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t30006_package](./t30006_package.svg "Package split namespace test case") +## Generated Mermaid diagrams +![t30006_package](./t30006_package_mermaid.svg "Package split namespace test case") ## Generated JSON models ```json { @@ -128,8 +130,8 @@ struct A2 { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t30006_package", diff --git a/docs/test_cases/t30006_package.svg b/docs/test_cases/t30006_package.svg index ecef1104..e1d4cf01 100644 --- a/docs/test_cases/t30006_package.svg +++ b/docs/test_cases/t30006_package.svg @@ -1,6 +1,6 @@ - + @@ -9,22 +9,22 @@ - - + + B - - + + A - - + + C - + Top A note. diff --git a/docs/test_cases/t30006_package_mermaid.svg b/docs/test_cases/t30006_package_mermaid.svg new file mode 100644 index 00000000..6bc8f006 --- /dev/null +++ b/docs/test_cases/t30006_package_mermaid.svg @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + +
+ Top A note. +
+
+
+
+ + + + + +
+ A +
+
+
+
+ + + + + +
+ B +
+
+
+
+ + + + + +
+ C +
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t30007.md b/docs/test_cases/t30007.md index 2298b863..89186482 100644 --- a/docs/test_cases/t30007.md +++ b/docs/test_cases/t30007.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30007_package: type: package @@ -56,8 +56,10 @@ struct A2 { } } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t30007_package](./t30007_package.svg "Package diagram layout hints test case") +## Generated Mermaid diagrams +![t30007_package](./t30007_package_mermaid.svg "Package diagram layout hints test case") ## Generated JSON models ```json { @@ -151,8 +153,8 @@ struct A2 { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t30007_package", diff --git a/docs/test_cases/t30007_package.svg b/docs/test_cases/t30007_package.svg index f765832b..6612bbf6 100644 --- a/docs/test_cases/t30007_package.svg +++ b/docs/test_cases/t30007_package.svg @@ -1,6 +1,6 @@ - + @@ -9,27 +9,27 @@ - - + + A - - + + B - - + + AA - - + + C - + Compare layout with t30006. diff --git a/docs/test_cases/t30007_package_mermaid.svg b/docs/test_cases/t30007_package_mermaid.svg new file mode 100644 index 00000000..bb0c362d --- /dev/null +++ b/docs/test_cases/t30007_package_mermaid.svg @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ A +
+
+
+
+
+ + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + +
+ AA +
+
+
+
+ + + + + +
+ Compare layout with t30006. +
+
+
+
+ + + + + +
+ B +
+
+
+
+ + + + + +
+ C +
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t30008.md b/docs/test_cases/t30008.md index 7ed7b9d5..b9c14fd7 100644 --- a/docs/test_cases/t30008.md +++ b/docs/test_cases/t30008.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30008_package: type: package @@ -66,8 +66,10 @@ struct FF { } // namespace t30008 } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t30008_package](./t30008_package.svg "Dependants and dependencies package diagram filter test") +## Generated Mermaid diagrams +![t30008_package](./t30008_package_mermaid.svg "Dependants and dependencies package diagram filter test") ## Generated JSON models ```json { @@ -211,8 +213,8 @@ struct FF { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t30008_package", diff --git a/docs/test_cases/t30008_package.svg b/docs/test_cases/t30008_package.svg index 743da6ce..54d031fd 100644 --- a/docs/test_cases/t30008_package.svg +++ b/docs/test_cases/t30008_package.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,43 @@ - - + + dependants - - + + dependencies - - + + A - - + + B - - + + C - - + + D - - + + E - - + + F diff --git a/docs/test_cases/t30008_package_mermaid.svg b/docs/test_cases/t30008_package_mermaid.svg new file mode 100644 index 00000000..6d9fc16a --- /dev/null +++ b/docs/test_cases/t30008_package_mermaid.svg @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ dependencies +
+
+
+
+
+ + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + +
+ D +
+
+
+
+ + + + + +
+ E +
+
+
+
+ + + + + +
+ F +
+
+
+
+
+
+ + + + + + +
+ dependants +
+
+
+
+
+ + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + +
+ A +
+
+
+
+ + + + + +
+ B +
+
+
+
+ + + + + +
+ C +
+
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t30009.md b/docs/test_cases/t30009.md index 7e88afbe..e0e79408 100644 --- a/docs/test_cases/t30009.md +++ b/docs/test_cases/t30009.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30009_package: type: package @@ -46,8 +46,10 @@ namespace D { } ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t30009_package](./t30009_package.svg "Together layout hint test") +## Generated Mermaid diagrams +![t30009_package](./t30009_package_mermaid.svg "Together layout hint test") ## Generated JSON models ```json { @@ -217,8 +219,8 @@ namespace D { } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t30009_package", diff --git a/docs/test_cases/t30009_package.svg b/docs/test_cases/t30009_package.svg index d13e74cb..4792de09 100644 --- a/docs/test_cases/t30009_package.svg +++ b/docs/test_cases/t30009_package.svg @@ -1,6 +1,6 @@ - + @@ -9,53 +9,53 @@ - - + + One - - + + Two - - + + B - - + + D - - + + A - - + + C - - + + A - - + + B - - + + C - - + + D diff --git a/docs/test_cases/t30009_package_mermaid.svg b/docs/test_cases/t30009_package_mermaid.svg new file mode 100644 index 00000000..903c6979 --- /dev/null +++ b/docs/test_cases/t30009_package_mermaid.svg @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Two +
+
+
+
+
+ + + + + + + + +
+ A +
+
+
+
+ + + + + +
+ B +
+
+
+
+ + + + + +
+ C +
+
+
+
+ + + + + +
+ D +
+
+
+
+
+
+ + + + + + +
+ One +
+
+
+
+
+ + + + + + + + +
+ B +
+
+
+
+ + + + + +
+ D +
+
+
+
+ + + + + +
+ A +
+
+
+
+ + + + + +
+ C +
+
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t30010.md b/docs/test_cases/t30010.md index d64f0317..0862cc8f 100644 --- a/docs/test_cases/t30010.md +++ b/docs/test_cases/t30010.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30010_package: type: package @@ -32,8 +32,10 @@ App app; } // namespace clanguml ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t30010_package](./t30010_package.svg "Package diagram with packages from directory structure") +## Generated Mermaid diagrams +![t30010_package](./t30010_package_mermaid.svg "Package diagram with packages from directory structure") ## Generated JSON models ```json { @@ -85,8 +87,8 @@ App app; } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t30010_package", diff --git a/docs/test_cases/t30010_package_mermaid.svg b/docs/test_cases/t30010_package_mermaid.svg new file mode 100644 index 00000000..f0026729 --- /dev/null +++ b/docs/test_cases/t30010_package_mermaid.svg @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ libraries +
+
+
+
+
+ + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + +
+ lib1 +
+
+
+
+ + + + + +
+ lib2 +
+
+
+
+ + + + + +
+ lib3 +
+
+
+
+ + + + + +
+ lib4 +
+
+
+
+ + + + + +
+ app +
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t30011.md b/docs/test_cases/t30011.md index 9fae3402..c251d6a3 100644 --- a/docs/test_cases/t30011.md +++ b/docs/test_cases/t30011.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30011_package: type: package @@ -22,8 +22,10 @@ File t30011.c struct t30011_App app; ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t30011_package](./t30011_package.svg "Package diagram with packages from directory structure for plain C") +## Generated Mermaid diagrams +![t30011_package](./t30011_package_mermaid.svg "Package diagram with packages from directory structure for plain C") ## Generated JSON models ```json { @@ -75,8 +77,8 @@ struct t30011_App app; } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t30011_package", diff --git a/docs/test_cases/t30011_package_mermaid.svg b/docs/test_cases/t30011_package_mermaid.svg new file mode 100644 index 00000000..f0026729 --- /dev/null +++ b/docs/test_cases/t30011_package_mermaid.svg @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ libraries +
+
+
+
+
+ + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + +
+ lib1 +
+
+
+
+ + + + + +
+ lib2 +
+
+
+
+ + + + + +
+ lib3 +
+
+
+
+ + + + + +
+ lib4 +
+
+
+
+ + + + + +
+ app +
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t40001.md b/docs/test_cases/t40001.md index 4693d820..14abdd43 100644 --- a/docs/test_cases/t40001.md +++ b/docs/test_cases/t40001.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t40001_include: type: include @@ -24,10 +24,18 @@ diagrams: after: - 'note right of {{ alias("include/lib1") }}: This is a lib1 include dir' - 'note right of {{ alias("include/t40001_include1.h") }}: This is a t40001_include1.h include file' + mermaid: + before: + - "%% t40001 test diagram of type {{ diagram.type }}" + after: + - 'N_00001(This is a lib1 include dir)-.-{{ alias("include/lib1") }}' + - 'N_00002(This is a t40001_include1.h include file)-.-{{ alias("include/t40001_include1.h") }}' ``` ## Source code -## Generated UML diagrams +## Generated PlantUML diagrams ![t40001_include](./t40001_include.svg "Basic include graph diagram test case") +## Generated Mermaid diagrams +![t40001_include](./t40001_include_mermaid.svg "Basic include graph diagram test case") ## Generated JSON models ```json { @@ -101,8 +109,8 @@ diagrams: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t40001_include", diff --git a/docs/test_cases/t40001_include.svg b/docs/test_cases/t40001_include.svg index cbbc804d..b2da2c93 100644 --- a/docs/test_cases/t40001_include.svg +++ b/docs/test_cases/t40001_include.svg @@ -1,6 +1,6 @@ - + @@ -9,43 +9,43 @@ - + src - + include - + lib1 - - + + t40001.cc - - + + t40001_include1.h - - + + lib1.h - + string - + vector - + yaml-cpp/yaml.h - + This is a lib1 include dir - + This is a t40001_include1.h include file diff --git a/docs/test_cases/t40001_include_mermaid.svg b/docs/test_cases/t40001_include_mermaid.svg new file mode 100644 index 00000000..daff004b --- /dev/null +++ b/docs/test_cases/t40001_include_mermaid.svg @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ include +
+
+
+
+ + + + +
+ src +
+
+
+
+ + + + +
+ lib1 +
+
+
+
+
+ + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + +
+ t40001_include1.h +
+
+
+
+
+ + + + + + +
+ lib1.h +
+
+
+
+
+ + + + + + +
+ t40001.cc +
+
+
+
+
+ + + + + +
+ string +
+
+
+
+ + + + + +
+ vector +
+
+
+
+ + + + + +
+ yaml-cpp/yaml.h +
+
+
+
+ + + + + +
+ This is a lib1 include dir +
+
+
+
+ + + + + +
+ This is a t40001_include1.h include file +
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t40002.md b/docs/test_cases/t40002.md index 77f4bd5e..0b8679aa 100644 --- a/docs/test_cases/t40002.md +++ b/docs/test_cases/t40002.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t40002_include: type: include @@ -27,8 +27,10 @@ diagrams: - "' t40002 test include diagram" ``` ## Source code -## Generated UML diagrams +## Generated PlantUML diagrams ![t40002_include](./t40002_include.svg "Cyclic include graph diagram test case") +## Generated Mermaid diagrams +![t40002_include](./t40002_include_mermaid.svg "Cyclic include graph diagram test case") ## Generated JSON models ```json { @@ -119,8 +121,8 @@ diagrams: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t40002_include", diff --git a/docs/test_cases/t40002_include.svg b/docs/test_cases/t40002_include.svg index 2755b479..7bea8ec7 100644 --- a/docs/test_cases/t40002_include.svg +++ b/docs/test_cases/t40002_include.svg @@ -1,6 +1,6 @@ - + @@ -9,46 +9,46 @@ - + src - + lib1 - + lib2 - + include - + lib1 - + lib2 - - + + t40002.cc - - + + lib1.cc - - + + lib2.cc - - + + lib1.h - - + + lib2.h diff --git a/docs/test_cases/t40002_include_mermaid.svg b/docs/test_cases/t40002_include_mermaid.svg new file mode 100644 index 00000000..61802b75 --- /dev/null +++ b/docs/test_cases/t40002_include_mermaid.svg @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ include +
+
+
+
+ + + + +
+ src +
+
+
+
+ + + + +
+ lib1 +
+
+
+
+ + + + +
+ lib2 +
+
+
+
+ + + + +
+ lib1 +
+
+
+
+ + + + +
+ lib2 +
+
+
+
+
+ + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + +
+ lib2.h +
+
+
+
+
+ + + + + + +
+ lib1.h +
+
+
+
+
+ + + + + + +
+ t40002.cc +
+
+
+
+
+ + + + + + +
+ lib2.cc +
+
+
+
+
+ + + + + + +
+ lib1.cc +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t40003.md b/docs/test_cases/t40003.md index 9069b526..d7009117 100644 --- a/docs/test_cases/t40003.md +++ b/docs/test_cases/t40003.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t40003_include: type: include @@ -25,8 +25,10 @@ diagrams: - "' t40003 test include diagram" ``` ## Source code -## Generated UML diagrams +## Generated PlantUML diagrams ![t40003_include](./t40003_include.svg "Dependants and dependencies include diagram filter test") +## Generated Mermaid diagrams +![t40003_include](./t40003_include_mermaid.svg "Dependants and dependencies include diagram filter test") ## Generated JSON models ```json { @@ -145,8 +147,8 @@ diagrams: } ], "metadata": { - "clang_uml_version": "0.3.8-32-ge830195", - "llvm_version": "Ubuntu clang version 15.0.7", + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", "schema_version": 1 }, "name": "t40003_include", diff --git a/docs/test_cases/t40003_include.svg b/docs/test_cases/t40003_include.svg index 10c317c6..c69451d1 100644 --- a/docs/test_cases/t40003_include.svg +++ b/docs/test_cases/t40003_include.svg @@ -1,6 +1,6 @@ - + @@ -9,66 +9,66 @@ - + src - + dependants - + dependencies - + include - + dependants - + dependencies - - + + t1.cc - - + + t2.cc - - + + t3.h - - + + t2.h - - + + t1.h - - + + t3.h - - + + t2.h - - + + t1.h - - + + t5.h diff --git a/docs/test_cases/t40003_include_mermaid.svg b/docs/test_cases/t40003_include_mermaid.svg new file mode 100644 index 00000000..3512df85 --- /dev/null +++ b/docs/test_cases/t40003_include_mermaid.svg @@ -0,0 +1,290 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ include +
+
+
+
+ + + + +
+ src +
+
+
+
+ + + + +
+ dependants +
+
+
+
+ + + + +
+ dependencies +
+
+
+
+ + + + +
+ dependants +
+
+
+
+ + + + +
+ dependencies +
+
+
+
+
+ + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + +
+ t3.h +
+
+
+
+
+ + + + + + +
+ t2.h +
+
+
+
+
+ + + + + + +
+ t1.h +
+
+
+
+
+ + + + + + +
+ t5.h +
+
+
+
+
+ + + + + + +
+ t3.h +
+
+
+
+
+ + + + + + +
+ t2.h +
+
+
+
+
+ + + + + + +
+ t1.h +
+
+
+
+
+ + + + + + +
+ t2.cc +
+
+
+
+
+ + + + + + +
+ t1.cc +
+
+
+
+
+
+
+
+
diff --git a/docs/test_cases/t90000.md b/docs/test_cases/t90000.md index 95ffd5ff..a4377c0e 100644 --- a/docs/test_cases/t90000.md +++ b/docs/test_cases/t90000.md @@ -2,7 +2,7 @@ ## Config ```yaml compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t90000_class: type: class @@ -21,6 +21,18 @@ diagrams: - 'class "Boo" as C_002' - 'class C_002 {' - '}' + mermaid: + before: + - 'class C_001["Foo"]' + - 'class C_001 {' + - ' +int value' + - '}' + - 'C_001 <|-- ArrayList' + - 'note for C_001 "This is a very important class."' + - 'note "This is a\nfloating note"' + - 'class C_002["Boo"]' + - 'class C_002 {' + - '}' ``` ## Source code @@ -28,6 +40,21 @@ File t90000.cc ```cpp ``` -## Generated UML diagrams +## Generated PlantUML diagrams ![t90000_class](./t90000_class.svg "Basic config test") +## Generated Mermaid diagrams +![t90000_class](./t90000_class_mermaid.svg "Basic config test") ## Generated JSON models +```json +{ + "diagram_type": "class", + "elements": [], + "metadata": { + "clang_uml_version": "0.3.9-23-g7e22b0b", + "llvm_version": "Ubuntu clang version 16.0.1 (++20230328073357+42d1b276f779-1~exp1~20230328073502.65)", + "schema_version": 1 + }, + "name": "t90000_class", + "relationships": [] +} +``` diff --git a/docs/test_cases/t90000_class_mermaid.svg b/docs/test_cases/t90000_class_mermaid.svg new file mode 100644 index 00000000..ea66542d --- /dev/null +++ b/docs/test_cases/t90000_class_mermaid.svg @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+ + + +
+ +
+
+
+
+
+ + + + + + + +
+ +
+
+ +
+ Foo +
+
+ +
+ +int value +
+
+
+
+ + + + + + +
+ +
+
+ +
+ ArrayList +
+
+
+
+ + + + + + +
+ +
+
+ +
+ Boo +
+
+
+
+ + + + + +
+ This is a very important class. +
+
+
+
+ + + + + +
+ This is a
floating note
+
+
+
+
+
+
+
+
diff --git a/src/class_diagram/generators/mermaid/class_diagram_generator.cc b/src/class_diagram/generators/mermaid/class_diagram_generator.cc new file mode 100644 index 00000000..0b115042 --- /dev/null +++ b/src/class_diagram/generators/mermaid/class_diagram_generator.cc @@ -0,0 +1,840 @@ +/** + * @file src/class_diagram/generators/mermaid/class_diagram_generator.cc + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * 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. + */ + +#include "class_diagram_generator.h" + +#include "util/error.h" + +#include + +namespace clanguml::class_diagram::generators::mermaid { + +using clanguml::common::generators::mermaid::indent; +using clanguml::common::generators::mermaid::render_name; + +generator::generator(diagram_config &config, diagram_model &model) + : common_generator{config, model} + , together_group_stack_{true} +{ +} + +void generator::generate_diagram_type(std::ostream &ostr) const +{ + ostr << "classDiagram\n"; +} + +void generator::generate_alias( + const common::model::element &c, std::ostream &ostr) const +{ + const auto full_name = c.full_name(true); + + assert(!full_name.empty()); + + print_debug(c, ostr); + + auto class_label = config().simplify_template_type(render_name(full_name)); + + ostr << indent(1) << "class " << c.alias() << "[\"" << class_label + << "\"]\n"; + + // Register the added alias + m_generated_aliases.emplace(c.alias()); +} + +void generator::generate(const class_ &c, std::ostream &ostr) const +{ + namespace mermaid_common = clanguml::common::generators::mermaid; + + std::string class_type{"class"}; + + ostr << indent(1) << "class " << c.alias(); + + ostr << " {" << '\n'; + + if (c.is_union()) + ostr << indent(2) << "<>\n"; + else if (c.is_abstract()) + ostr << indent(2) << "<>\n"; + + // + // Process methods + // + if (config().group_methods()) { + generate_methods(group_methods(c.methods()), ostr); + } + else { + generate_methods(c.methods(), ostr); + } + + // + // Process relationships - here only generate the set of + // rendered_relationships we'll generate them in a seperate method + // + std::set rendered_relations; + + std::stringstream all_relations_str; + for (const auto &r : c.relationships()) { + if (!model().should_include(r.type())) + continue; + + try { + generate_relationship(r, rendered_relations); + } + catch (error::uml_alias_missing &e) { + LOG_DBG("Skipping {} relation from {} to {} due " + "to: {}", + mermaid_common::to_mermaid(r.type(), r.style()), c.full_name(), + r.destination(), e.what()); + } + } + + // + // Process members + // + std::vector members{ + c.members()}; + + sort_class_elements(members); + + for (const auto &m : members) { + if (!model().should_include(m)) + continue; + + if (!config().include_relations_also_as_members() && + rendered_relations.find(m.name()) != rendered_relations.end()) + continue; + + generate_member(m, ostr); + + ostr << '\n'; + } + + ostr << indent(1) << "}" << '\n'; + + if (config().generate_links) { + common_generator::generate_link(ostr, c); + } + + generate_notes(ostr, c); + + for (const auto &member : c.members()) + generate_member_notes(ostr, member, c.alias()); + + for (const auto &method : c.methods()) + generate_member_notes(ostr, method, c.alias()); +} + +void generator::generate_methods( + const method_groups_t &methods, std::ostream &ostr) const +{ + for (const auto &group : method_groups_) { + const auto &group_methods = methods.at(group); + if (!group_methods.empty()) { + generate_methods(group_methods, ostr); + } + } +} + +void generator::generate_methods( + const std::vector &methods, std::ostream &ostr) const +{ + auto sorted_methods = methods; + sort_class_elements(sorted_methods); + + for (const auto &m : sorted_methods) { + if (!model().should_include(m)) + continue; + + generate_method(m, ostr); + + ostr << '\n'; + } +} + +generator::method_groups_t generator::group_methods( + const std::vector &methods) const +{ + std::map> result; + + // First get rid of methods which don't pass the filters + std::vector filtered_methods; + std::copy_if(methods.cbegin(), methods.cend(), + std::back_inserter(filtered_methods), + [this](auto &m) { return model().should_include(m); }); + + for (const auto &g : method_groups_) { + result[g] = {}; + } + + for (const auto &m : filtered_methods) { + if (m.is_constructor() || m.is_destructor()) { + result["constructors"].push_back(m); + } + else if (m.is_copy_assignment() || m.is_move_assignment()) { + result["assignment"].push_back(m); + } + else if (m.is_operator()) { + result["operators"].push_back(m); + } + else { + result["other"].push_back(m); + } + } + + return result; +} + +void generator::generate_method( + const class_diagram::model::class_method &m, std::ostream &ostr) const +{ + namespace mermaid_common = clanguml::common::generators::mermaid; + const auto &uns = config().using_namespace(); + + constexpr auto kAbbreviatedMethodArgumentsLength{15}; + + print_debug(m, ostr); + + std::string type{uns.relative(config().simplify_template_type(m.type()))}; + + ostr << indent(2) << mermaid_common::to_mermaid(m.access()) << m.name(); + + if (!m.template_params().empty()) { + m.render_template_params(ostr, config().using_namespace(), false); + } + + ostr << "("; + if (config().generate_method_arguments() != + config::method_arguments::none) { + std::vector params; + std::transform(m.parameters().cbegin(), m.parameters().cend(), + std::back_inserter(params), [this](const auto &mp) { + return config().simplify_template_type( + mp.to_string(config().using_namespace())); + }); + auto args_string = fmt::format("{}", fmt::join(params, ", ")); + if (config().generate_method_arguments() == + config::method_arguments::abbreviated) { + args_string = clanguml::util::abbreviate( + args_string, kAbbreviatedMethodArgumentsLength); + } + ostr << args_string; + } + ostr << ")"; + + ostr << " : "; + + std::vector method_mods; + if (m.is_defaulted()) { + method_mods.emplace_back("default"); + } + if (m.is_const()) { + method_mods.emplace_back("const"); + } + if (m.is_constexpr()) { + method_mods.emplace_back("constexpr"); + } + if (m.is_consteval()) { + method_mods.emplace_back("consteval"); + } + + if (!method_mods.empty()) { + ostr << fmt::format("[{}] ", fmt::join(method_mods, ",")); + } + + ostr << render_name(type); + + if (m.is_pure_virtual()) + ostr << "*"; + + if (m.is_static()) + ostr << "$"; +} + +void generator::generate_member( + const class_diagram::model::class_member &m, std::ostream &ostr) const +{ + namespace mermaid_common = clanguml::common::generators::mermaid; + const auto &uns = config().using_namespace(); + + print_debug(m, ostr); + + ostr << indent(2) << mermaid_common::to_mermaid(m.access()) << m.name() + << " : " + << render_name( + uns.relative(config().simplify_template_type(m.type()))); +} + +void generator::generate(const concept_ &c, std::ostream &ostr) const +{ + ostr << indent(1) << "class" + << " " << c.alias(); + + if (!c.style().empty()) + ostr << " " << c.style(); + + ostr << " {" << '\n'; + ostr << indent(2) << "<>\n"; + + // TODO: add option to enable/disable this + if (c.requires_parameters().size() + c.requires_statements().size() > 0) { + std::vector parameters; + parameters.reserve(c.requires_parameters().size()); + for (const auto &p : c.requires_parameters()) { + parameters.emplace_back( + render_name(p.to_string(config().using_namespace()))); + } + + ostr << indent(2) + << fmt::format("\"({})\"\n", fmt::join(parameters, ",")); + + for (const auto &req : c.requires_statements()) { + ostr << indent(2) << fmt::format("\"{}\"\n", render_name(req)); + } + } + + ostr << indent(1) << "}" << '\n'; + + if (config().generate_links) { + common_generator::generate_link(ostr, c); + } +} + +void generator::generate_member_notes(std::ostream &ostr, + const class_element &member, const std::string &alias) const +{ + for (const auto &decorator : member.decorators()) { + auto note = std::dynamic_pointer_cast(decorator); + if (note && note->applies_to_diagram(config().name)) { + ostr << indent(1) << "note for " << alias << " \"" << note->text + << "\"" << '\n'; + } + } +} + +void generator::generate_relationships(std::ostream &ostr) const +{ + for (const auto &p : model()) { + if (auto *pkg = dynamic_cast(p.get()); pkg) { + generate_relationships(*pkg, ostr); + } + else if (auto *cls = dynamic_cast(p.get()); cls) { + if (model().should_include(*cls)) { + generate_relationships(*cls, ostr); + } + } + else if (auto *enm = dynamic_cast(p.get()); enm) { + if (model().should_include(*enm)) { + generate_relationships(*enm, ostr); + } + } + else if (auto *cpt = dynamic_cast(p.get()); cpt) { + if (model().should_include(*cpt)) { + generate_relationships(*cpt, ostr); + } + } + } +} + +void generator::generate_relationship( + const relationship &r, std::set &rendered_relations) const +{ + namespace mermaid_common = clanguml::common::generators::mermaid; + + LOG_DBG("Processing relationship {}", + mermaid_common::to_mermaid(r.type(), r.style())); + + std::string destination; + + auto target_element = model().get(r.destination()); + if (!target_element.has_value()) + throw error::uml_alias_missing{fmt::format( + "Missing element in the model for ID: {}", r.destination())}; + + destination = target_element.value().full_name(false); + + if (util::starts_with(destination, std::string{"::"})) + destination = destination.substr(2, destination.size()); + + std::string mmd_relation; + if (!r.multiplicity_source().empty()) + mmd_relation += "\"" + r.multiplicity_source() + "\" "; + + mmd_relation += mermaid_common::to_mermaid(r.type(), r.style()); + + if (!r.multiplicity_destination().empty()) + mmd_relation += " \"" + r.multiplicity_destination() + "\""; + + if (!r.label().empty()) { + if (r.type() == relationship_t::kFriendship) + rendered_relations.emplace(fmt::format( + "{}[friend]", mermaid_common::to_mermaid(r.access()))); + else + rendered_relations.emplace(r.label()); + } +} + +void generator::generate_relationships( + const class_ &c, std::ostream &ostr) const +{ + namespace mermaid_common = clanguml::common::generators::mermaid; + + // + // Process relationships + // + std::set rendered_relations; + + std::stringstream all_relations_str; + std::set unique_relations; + + for (const auto &r : c.relationships()) { + if (!model().should_include(r.type())) + continue; + + LOG_DBG("== Processing relationship {}", + mermaid_common::to_mermaid(r.type(), r.style())); + + std::stringstream relstr; + clanguml::common::id_t destination{0}; + try { + destination = r.destination(); + + std::string relation_str; + + if (!r.multiplicity_source().empty()) + relation_str += "\"" + r.multiplicity_source() + "\" "; + + relation_str += mermaid_common::to_mermaid(r.type(), r.style()); + + if (!r.multiplicity_destination().empty()) + relation_str += " \"" + r.multiplicity_destination() + "\""; + + std::string target_alias; + try { + target_alias = model().to_alias(destination); + } + catch (...) { + LOG_DBG("Failed to find alias to {}", destination); + continue; + } + + if (m_generated_aliases.find(target_alias) == + m_generated_aliases.end()) + continue; + + if (r.type() == relationship_t::kContainment) { + relstr << indent(1) << target_alias << " " << relation_str + << " " << c.alias(); + } + else { + relstr << indent(1) << c.alias() << " " << relation_str << " " + << target_alias; + } + + relstr << " : "; + + if (!r.label().empty()) { + auto lbl = r.label(); + if (r.type() == relationship_t::kFriendship) + lbl = "[friend]"; + relstr << mermaid_common::to_mermaid(r.access()) << lbl; + rendered_relations.emplace(r.label()); + } + + if (unique_relations.count(relstr.str()) == 0) { + unique_relations.emplace(relstr.str()); + + relstr << '\n'; + + LOG_DBG("=== Adding relation {}", relstr.str()); + + all_relations_str << relstr.str(); + } + } + catch (error::uml_alias_missing &e) { + LOG_DBG("=== Skipping {} relation from {} to {} due " + "to: {}", + mermaid_common::to_mermaid(r.type(), r.style()), c.full_name(), + destination, e.what()); + } + } + + if (model().should_include(relationship_t::kExtension)) { + for (const auto &b : c.parents()) { + std::stringstream relstr; + try { + auto target_alias = model().to_alias(b.id()); + + if (m_generated_aliases.find(target_alias) == + m_generated_aliases.end()) + continue; + + relstr << indent(1) << target_alias << " <|-- " << c.alias() + << '\n'; + all_relations_str << relstr.str(); + } + catch (error::uml_alias_missing &e) { + LOG_DBG("=== Skipping inheritance relation from {} to {} due " + "to: {}", + b.name(), c.name(), e.what()); + } + } + } + + ostr << all_relations_str.str(); +} + +void generator::generate_relationships( + const concept_ &c, std::ostream &ostr) const +{ + namespace mermaid_common = clanguml::common::generators::mermaid; + + // + // Process relationships + // + std::set rendered_relations; + + std::stringstream all_relations_str; + std::set unique_relations; + + for (const auto &r : c.relationships()) { + if (!model().should_include(r.type())) + continue; + + LOG_DBG("== Processing relationship {}", + mermaid_common::to_mermaid(r.type(), r.style())); + + std::stringstream relstr; + clanguml::common::id_t destination{0}; + try { + destination = r.destination(); + + std::string mmd_relation; + if (!r.multiplicity_source().empty()) + mmd_relation += "\"" + r.multiplicity_source() + "\" "; + + mmd_relation += mermaid_common::to_mermaid(r.type(), r.style()); + + if (!r.multiplicity_destination().empty()) + mmd_relation += " \"" + r.multiplicity_destination() + "\""; + + std::string target_alias; + try { + target_alias = model().to_alias(destination); + } + catch (...) { + LOG_DBG("Failed to find alias to {}", destination); + continue; + } + + if (m_generated_aliases.find(target_alias) == + m_generated_aliases.end()) + continue; + + if (r.type() == relationship_t::kContainment) { + relstr << indent(1) << target_alias << " " << mmd_relation + << " " << c.alias(); + } + else { + relstr << indent(1) << c.alias() << " " << mmd_relation << " " + << target_alias; + } + + relstr << " : "; + + if (!r.label().empty()) { + auto lbl = r.label(); + if (r.type() == relationship_t::kFriendship) + lbl = "[friend]"; + relstr << mermaid_common::to_mermaid(r.access()) << lbl; + rendered_relations.emplace(r.label()); + } + + if (unique_relations.count(relstr.str()) == 0) { + unique_relations.emplace(relstr.str()); + + relstr << '\n'; + + LOG_DBG("=== Adding relation {}", relstr.str()); + + all_relations_str << relstr.str(); + } + } + catch (error::uml_alias_missing &e) { + LOG_DBG("=== Skipping {} relation from {} to {} due " + "to: {}", + mermaid_common::to_mermaid(r.type(), r.style()), c.full_name(), + destination, e.what()); + } + } + + ostr << all_relations_str.str(); +} + +void generator::generate_relationships(const enum_ &e, std::ostream &ostr) const +{ + for (const auto &r : e.relationships()) { + if (!model().should_include(r.type())) + continue; + + clanguml::common::id_t destination{0}; + std::stringstream relstr; + try { + destination = r.destination(); + + auto target_alias = model().to_alias(destination); + + if (m_generated_aliases.find(target_alias) == + m_generated_aliases.end()) + continue; + + if (r.type() == relationship_t::kContainment) { + relstr << indent(1) << target_alias << " " + << clanguml::common::generators::mermaid::to_mermaid( + r.type(), r.style()) + << " " << e.alias(); + } + else { + relstr << indent(1) << e.alias() << " " + << clanguml::common::generators::mermaid::to_mermaid( + r.type(), r.style()) + << " " << target_alias; + } + + auto lbl = r.label(); + if (r.type() == relationship_t::kFriendship) + lbl = "[friend]"; + + relstr << " : " << r.label(); + + relstr << '\n'; + + ostr << relstr.str(); + } + catch (error::uml_alias_missing &ex) { + LOG_DBG("Skipping {} relation from {} to {} due " + "to: {}", + clanguml::common::generators::mermaid::to_mermaid( + r.type(), r.style()), + e.full_name(), destination, ex.what()); + } + } +} + +void generator::generate(const enum_ &e, std::ostream &ostr) const +{ + ostr << indent(1) << "class " << e.alias(); + + ostr << " {" << '\n'; + + ostr << indent(2) << "<>\n"; + + for (const auto &enum_constant : e.constants()) { + ostr << indent(2) << enum_constant << '\n'; + } + + ostr << indent(1) << "}" << '\n'; + + if (config().generate_links) { + common_generator::generate_link(ostr, e); + } + + generate_notes(ostr, e); +} + +void generator::generate(const package &p, std::ostream &ostr) const +{ + for (const auto &subpackage : p) { + if (dynamic_cast(subpackage.get()) != nullptr) { + // TODO: add option - generate_empty_packages + const auto &sp = dynamic_cast(*subpackage); + if (!sp.is_empty()) { + together_group_stack_.enter(); + + generate(sp, ostr); + + together_group_stack_.leave(); + } + } + else if (auto *cls = dynamic_cast(subpackage.get()); cls) { + if (model().should_include(*subpackage)) { + auto together_group = + config().get_together_group(cls->full_name(false)); + if (together_group) { + together_group_stack_.group_together( + together_group.value(), cls); + } + else { + generate_alias(*cls, ostr); + generate(*cls, ostr); + } + } + } + else if (auto *enm = dynamic_cast(subpackage.get()); enm) { + if (model().should_include(*subpackage)) { + auto together_group = + config().get_together_group(subpackage->full_name(false)); + if (together_group) { + together_group_stack_.group_together( + together_group.value(), enm); + } + else { + generate_alias(*enm, ostr); + generate(*enm, ostr); + } + } + } + else if (auto *cpt = dynamic_cast(subpackage.get()); cpt) { + if (model().should_include(*subpackage)) { + auto together_group = + config().get_together_group(cpt->full_name(false)); + if (together_group) { + together_group_stack_.group_together( + together_group.value(), cpt); + } + else { + generate_alias(*cpt, ostr); + generate(*cpt, ostr); + } + } + } + } +} + +void generator::generate_relationships( + const package &p, std::ostream &ostr) const +{ + for (const auto &subpackage : p) { + if (dynamic_cast(subpackage.get()) != nullptr) { + // TODO: add option - generate_empty_packages, currently + // packages which do not contain anything but other + // packages are skipped + const auto &sp = dynamic_cast(*subpackage); + if (!sp.is_empty() && + !sp.all_of([this](const common::model::element &e) { + return !model().should_include(e); + })) + generate_relationships(sp, ostr); + } + else if (dynamic_cast(subpackage.get()) != nullptr) { + if (model().should_include(*subpackage)) { + generate_relationships( + dynamic_cast(*subpackage), ostr); + } + } + else if (dynamic_cast(subpackage.get()) != nullptr) { + if (model().should_include(*subpackage)) { + generate_relationships( + dynamic_cast(*subpackage), ostr); + } + } + else if (dynamic_cast(subpackage.get()) != nullptr) { + if (model().should_include(*subpackage)) { + generate_relationships( + dynamic_cast(*subpackage), ostr); + } + } + } +} + +void generator::generate_diagram(std::ostream &ostr) const +{ + generate_top_level_elements(ostr); + + generate_groups(ostr); + + generate_relationships(ostr); +} + +void generator::generate_top_level_elements(std::ostream &ostr) const +{ + for (const auto &p : model()) { + if (auto *pkg = dynamic_cast(p.get()); pkg) { + if (!pkg->is_empty() && + !pkg->all_of([this](const common::model::element &e) { + return !model().should_include(e); + })) + generate(*pkg, ostr); + } + else if (auto *cls = dynamic_cast(p.get()); cls) { + if (model().should_include(*cls)) { + auto together_group = + config().get_together_group(cls->full_name(false)); + if (together_group) { + together_group_stack_.group_together( + together_group.value(), cls); + } + else { + generate_alias(*cls, ostr); + generate(*cls, ostr); + } + } + } + else if (auto *enm = dynamic_cast(p.get()); enm) { + if (model().should_include(*enm)) { + auto together_group = + config().get_together_group(enm->full_name(false)); + if (together_group) { + together_group_stack_.group_together( + together_group.value(), enm); + } + else { + generate_alias(*enm, ostr); + generate(*enm, ostr); + } + } + } + else if (auto *cpt = dynamic_cast(p.get()); cpt) { + if (model().should_include(*cpt)) { + auto together_group = + config().get_together_group(cpt->full_name(false)); + if (together_group) { + together_group_stack_.group_together( + together_group.value(), cpt); + } + else { + generate_alias(*cpt, ostr); + generate(*cpt, ostr); + } + } + } + } +} + +void generator::generate_groups(std::ostream &ostr) const +{ + for (const auto &[group_name, group_elements] : + together_group_stack_.get_current_groups()) { + + for (auto *e : group_elements) { + if (auto *cls = dynamic_cast(e); cls) { + generate_alias(*cls, ostr); + generate(*cls, ostr); + } + if (auto *enm = dynamic_cast(e); enm) { + generate_alias(*enm, ostr); + generate(*enm, ostr); + } + if (auto *cpt = dynamic_cast(e); cpt) { + generate_alias(*cpt, ostr); + generate(*cpt, ostr); + } + } + } +} + +} // namespace clanguml::class_diagram::generators::mermaid diff --git a/src/class_diagram/generators/mermaid/class_diagram_generator.h b/src/class_diagram/generators/mermaid/class_diagram_generator.h new file mode 100644 index 00000000..0ec125af --- /dev/null +++ b/src/class_diagram/generators/mermaid/class_diagram_generator.h @@ -0,0 +1,274 @@ +/** + * @file src/class_diagram/generators/mermaid/class_diagram_generator.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * 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. + */ +#pragma once + +#include "class_diagram/model/class.h" +#include "class_diagram/model/concept.h" +#include "class_diagram/model/diagram.h" +#include "class_diagram/model/enum.h" +#include "class_diagram/visitor/translation_unit_visitor.h" +#include "common/generators/mermaid/generator.h" +#include "common/generators/nested_element_stack.h" +#include "common/model/relationship.h" +#include "config/config.h" +#include "util/util.h" + +#include + +#include +#include +#include +#include + +namespace clanguml { +namespace class_diagram { +namespace generators { +namespace mermaid { + +using diagram_config = clanguml::config::class_diagram; +using diagram_model = clanguml::class_diagram::model::diagram; +template +using common_generator = clanguml::common::generators::mermaid::generator; + +using clanguml::class_diagram::model::class_; +using clanguml::class_diagram::model::class_element; +using clanguml::class_diagram::model::class_member; +using clanguml::class_diagram::model::class_method; +using clanguml::class_diagram::model::concept_; +using clanguml::class_diagram::model::enum_; +using clanguml::common::model::access_t; +using clanguml::common::model::package; +using clanguml::common::model::relationship; +using clanguml::common::model::relationship_t; + +using namespace clanguml::util; + +/** + * @brief Class diagram MermaidJS generator + */ +class generator : public common_generator { + using method_groups_t = std::map>; + +public: + generator(diagram_config &config, diagram_model &model); + + using common_generator::generate; + + /** + * @brief Main generator method. + * + * This method is called first and coordinates the entire diagram + * generation. + * + * @param ostr Output stream. + */ + void generate_diagram(std::ostream &ostr) const override; + + /** + * @brief Generate the diagram type + * + * @param ostr Output stream + */ + void generate_diagram_type(std::ostream &ostr) const override; + + /** + * @brief In a nested diagram, generate the top level elements. + * + * This method iterates over the top level elements. In case the diagram + * is nested (i.e. includes packages), for each package it recursively + * call generation of elements contained in each package. + * + * @param parent JSON node + */ + void generate_top_level_elements(std::ostream &ostr) const; + + /** + * @brief Generate MermaidJS alias for a class element. + * + * @param c Class element + * @param ostr Output stream + */ + void generate_alias( + const common::model::element &e, std::ostream &ostr) const; + + /** + * @brief Render class element to MermaidJS + * + * @param c Class element + * @param ostr Output stream + */ + void generate(const class_ &c, std::ostream &ostr) const; + + /** + * @brief Render class methods to MermaidJS + * + * @param methods List of class methods + * @param ostr Output stream + */ + void generate_methods( + const std::vector &methods, std::ostream &ostr) const; + + /** + * @brief Render class methods to MermaidJS in groups + * + * @param methods Methods grouped by method type + * @param ostr Output stream + */ + void generate_methods( + const method_groups_t &methods, std::ostream &ostr) const; + + /** + * @brief Render class method to MermaidJS + * + * @param m Class method + * @param ostr Output stream + */ + void generate_method(const class_method &m, std::ostream &ostr) const; + + /** + * @brief Render class member to MermaidJS + * + * @param m Class member + * @param ostr Output stream + */ + void generate_member(const class_member &m, std::ostream &ostr) const; + + /** + * @brief Render all relationships in the diagram to MermaidJS + * + * @param ostr Output stream + */ + void generate_relationships(std::ostream &ostr) const; + + /** + * @brief Render all relationships originating from class element. + * + * @param c Class element + * @param ostr Output stream + */ + void generate_relationships(const class_ &c, std::ostream &ostr) const; + + /** + * @brief Render a specific relationship to MermaidJS. + * + * @param r Relationship model + * @param rendered_relations Set of already rendered relationships, to + * ensure that there are no duplicate + * relationships + */ + void generate_relationship( + const relationship &r, std::set &rendered_relations) const; + + /** + * @brief Render enum element to MermaidJS + * + * @param e Enum element + * @param ostr Output stream + */ + void generate(const enum_ &e, std::ostream &ostr) const; + + /** + * @brief Render all relationships originating from enum element. + * + * @param c Enum element + * @param ostr Output stream + */ + void generate_relationships(const enum_ &c, std::ostream &ostr) const; + + /** + * @brief Render concept element to MermaidJS + * + * @param c Concept element + * @param ostr Output stream + */ + void generate(const concept_ &c, std::ostream &ostr) const; + + /** + * @brief Render all relationships originating from concept element. + * + * @param c Concept element + * @param ostr Output stream + */ + void generate_relationships(const concept_ &c, std::ostream &ostr) const; + + /** + * @brief Render package element to MermaidJS + * + * @param p Package element + * @param ostr Output stream + */ + void generate(const package &p, std::ostream &ostr) const; + + /** + * @brief Render all relationships originating from package element. + * + * @param p Package element + * @param ostr Output stream + */ + void generate_relationships(const package &p, std::ostream &ostr) const; + + /** + * @brief Generate any notes attached specifically to some class element. + * + * @param ostream Output stream + * @param member Class element (member or method) + * @param alias MermaidJS class alias + */ + void generate_member_notes(std::ostream &ostream, + const class_element &member, const std::string &alias) const; + + /** + * @brief Generate elements grouped together in `together` groups. + * + * @param ostr Output stream + */ + void generate_groups(std::ostream &ostr) const; + + /** + * @brief Group class methods based on method type. + * + * @param methods List of class methods. + * + * @return Map of method groups. + */ + method_groups_t group_methods( + const std::vector &methods) const; + +private: + const std::vector method_groups_{ + "constructors", "assignment", "operators", "other"}; + + template + void sort_class_elements(std::vector &elements) const + { + if (config().member_order() == config::member_order_t::lexical) { + std::sort(elements.begin(), elements.end(), + [](const auto &m1, const auto &m2) { + return m1.name() < m2.name(); + }); + } + } + + mutable common::generators::nested_element_stack + together_group_stack_; +}; + +} // namespace mermaid +} // namespace generators +} // namespace class_diagram +} // namespace clanguml diff --git a/src/cli/cli_handler.cc b/src/cli/cli_handler.cc index 1079aeba..12b902e3 100644 --- a/src/cli/cli_handler.cc +++ b/src/cli/cli_handler.cc @@ -72,7 +72,8 @@ cli_flow_t cli_handler::parse(int argc, const char **argv) static const std::map generator_type_names{ {"plantuml", clanguml::common::generator_type_t::plantuml}, - {"json", clanguml::common::generator_type_t::json}}; + {"json", clanguml::common::generator_type_t::json}, + {"mermaid", clanguml::common::generator_type_t::mermaid}}; app.add_option("-c,--config", config_path, "Location of configuration file, when '-' read from stdin"); diff --git a/src/common/generators/generators.cc b/src/common/generators/generators.cc index d417f113..9ae2f2e7 100644 --- a/src/common/generators/generators.cc +++ b/src/common/generators/generators.cc @@ -124,6 +124,10 @@ void generate_diagram_impl(const std::string &od, const std::string &name, generate_diagram_select_generator(od, name, diagram, model); } + else if (generator_type == generator_type_t::mermaid) { + generate_diagram_select_generator(od, name, diagram, model); + } } } } // namespace detail diff --git a/src/common/generators/generators.h b/src/common/generators/generators.h index 8f36e386..151da4be 100644 --- a/src/common/generators/generators.h +++ b/src/common/generators/generators.h @@ -18,6 +18,7 @@ #pragma once #include "class_diagram/generators/json/class_diagram_generator.h" +#include "class_diagram/generators/mermaid/class_diagram_generator.h" #include "class_diagram/generators/plantuml/class_diagram_generator.h" #include "cli/cli_handler.h" #include "common/compilation_database.h" @@ -25,11 +26,14 @@ #include "common/model/diagram_filter.h" #include "config/config.h" #include "include_diagram/generators/json/include_diagram_generator.h" +#include "include_diagram/generators/mermaid/include_diagram_generator.h" #include "include_diagram/generators/plantuml/include_diagram_generator.h" #include "indicators/indicators.hpp" #include "package_diagram/generators/json/package_diagram_generator.h" +#include "package_diagram/generators/mermaid/package_diagram_generator.h" #include "package_diagram/generators/plantuml/package_diagram_generator.h" #include "sequence_diagram/generators/json/sequence_diagram_generator.h" +#include "sequence_diagram/generators/mermaid/sequence_diagram_generator.h" #include "sequence_diagram/generators/plantuml/sequence_diagram_generator.h" #include "util/util.h" #include "version.h" @@ -105,6 +109,9 @@ struct plantuml_generator_tag { struct json_generator_tag { inline static const std::string extension = "json"; }; +struct mermaid_generator_tag { + inline static const std::string extension = "mmd"; +}; /** @} */ /** @defgroup diagram_generator_t Diagram generator selector @@ -114,6 +121,7 @@ struct json_generator_tag { * * @{ */ +// plantuml template struct diagram_generator_t; template <> @@ -136,6 +144,7 @@ struct diagram_generator_t { using type = clanguml::include_diagram::generators::plantuml::generator; }; +// json template <> struct diagram_generator_t { @@ -156,6 +165,27 @@ struct diagram_generator_t { using type = clanguml::include_diagram::generators::json::generator; }; +// mermaid +template <> +struct diagram_generator_t { + using type = clanguml::class_diagram::generators::mermaid::generator; +}; +template <> +struct diagram_generator_t { + using type = clanguml::sequence_diagram::generators::mermaid::generator; +}; +template <> +struct diagram_generator_t { + using type = clanguml::package_diagram::generators::mermaid::generator; +}; +template <> +struct diagram_generator_t { + using type = clanguml::include_diagram::generators::mermaid::generator; +}; /** @} */ /** diff --git a/src/common/generators/mermaid/generator.cc b/src/common/generators/mermaid/generator.cc new file mode 100644 index 00000000..355995d4 --- /dev/null +++ b/src/common/generators/mermaid/generator.cc @@ -0,0 +1,93 @@ +/** + * @file src/common/generators/mermaid/generator.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * 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. + */ +#include "generator.h" + +namespace clanguml::common::generators::mermaid { + +std::string to_mermaid(relationship_t r, const std::string & /*style*/) +{ + switch (r) { + case relationship_t::kOwnership: + case relationship_t::kComposition: + return "*--"; + case relationship_t::kAggregation: + return "o--"; + case relationship_t::kContainment: + return "()--"; + case relationship_t::kAssociation: + return "-->"; + case relationship_t::kInstantiation: + return "..|>"; + case relationship_t::kFriendship: + return "<.."; + case relationship_t::kDependency: + return "..>"; + case relationship_t::kConstraint: + return "..>"; + case relationship_t::kAlias: + return ".."; + default: + return ""; + } +} + +std::string to_mermaid(access_t scope) +{ + switch (scope) { + case access_t::kPublic: + return "+"; + case access_t::kProtected: + return "#"; + case access_t::kPrivate: + return "-"; + default: + return ""; + } +} + +std::string to_mermaid(message_t r) +{ + switch (r) { + case message_t::kCall: + return "->>"; + case message_t::kReturn: + return "-->>"; + default: + return ""; + } +} + +std::string indent(const unsigned level) +{ + const auto kIndentWidth = 4UL; + return std::string(level * kIndentWidth, ' '); // NOLINT +} + +std::string render_name(std::string name) +{ + util::replace_all(name, "<", "<"); + util::replace_all(name, ">", ">"); + util::replace_all(name, "(", "("); + util::replace_all(name, ")", ")"); + util::replace_all(name, "##", "::"); + util::replace_all(name, "{", "{"); + util::replace_all(name, "}", "}"); + + return name; +} +} // namespace clanguml::common::generators::mermaid diff --git a/src/common/generators/mermaid/generator.h b/src/common/generators/mermaid/generator.h new file mode 100644 index 00000000..6917b968 --- /dev/null +++ b/src/common/generators/mermaid/generator.h @@ -0,0 +1,542 @@ +/** + * @file src/common/generators/mermaid/generator.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * 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. + */ +#pragma once + +#include "common/generators/generator.h" +#include "common/model/diagram_filter.h" +#include "config/config.h" +#include "util/error.h" +#include "util/util.h" +#include "version.h" + +#include +#include +#include +#include +#include +#include + +namespace clanguml::common::generators::mermaid { + +using clanguml::common::model::access_t; +using clanguml::common::model::element; +using clanguml::common::model::message_t; +using clanguml::common::model::relationship_t; + +std::string to_mermaid(relationship_t r, const std::string &style); +std::string to_mermaid(access_t scope); +std::string to_mermaid(message_t r); + +std::string indent(unsigned level); + +std::string render_name(std::string name); + +/** + * @brief Base class for diagram generators + * + * @tparam ConfigType Configuration type + * @tparam DiagramType Diagram model type + */ +template +class generator + : public clanguml::common::generators::generator { +public: + /** + * @brief Constructor + * + * @param config Reference to instance of @link clanguml::config::diagram + * @param model Reference to instance of @link clanguml::model::diagram + */ + generator(ConfigType &config, DiagramType &model) + : clanguml::common::generators::generator{ + config, model} + { + init_context(); + init_env(); + } + + ~generator() override = default; + + /** + * @brief Generate diagram + * + * This is the main diagram generation entrypoint. It is responsible for + * calling other methods in appropriate order to generate the diagram into + * the output stream. It generates diagram elements, that are common + * to all types of diagrams in a given generator. + * + * @param ostr Output stream + */ + void generate(std::ostream &ostr) const override; + + /** + * @brief Generate diagram specific part + * + * This method must be implemented in subclasses for specific diagram + * types. + * + * @param ostr Output stream + */ + virtual void generate_diagram(std::ostream &ostr) const = 0; + + /** + * @brief Generate MermaidJS directives from config file. + * + * This method renders the MermaidJS directives provided in the + * configuration file, including resolving any element aliases and Jinja + * templates. + * + * @param ostr Output stream + * @param directives List of directives from the configuration file + */ + void generate_mermaid_directives( + std::ostream &ostr, const std::vector &directives) const; + + /** + * @brief Generate the diagram type + * + * This method must be overriden for each diagram type (e.g. it renders + * a single line `classDiagram` for Mermaid class diagrams. + * + * @param ostr Output stream + */ + virtual void generate_diagram_type(std::ostream &ostr) const = 0; + + /** + * @brief Generate diagram notes + * + * This method adds any notes in the diagram, which were declared in the + * code using inline directives + * + * @param ostr Output stream + * @param element Element to which the note should be attached + */ + virtual void generate_notes( + std::ostream &ostr, const model::diagram_element &element) const; + + /** + * @brief Generate comment with diagram metadata + * + * @param ostr Output stream + */ + void generate_metadata(std::ostream &ostr) const; + + /** + * @brief Generate hyper link to element + * + * This method renders links to URL's based on templates provided + * in the configuration file (e.g. Git browser with specific line and + * column offset) + * + * @param ostr Output stream + * @param e Reference to diagram element + * @tparam E Diagram element type + */ + template + void generate_link(std::ostream &ostr, const E &e) const; + + /** + * @brief Print debug information in diagram comments + * + * @param m Diagram element to describe + * @param ostr Output stream + */ + void print_debug( + const common::model::source_location &e, std::ostream &ostr) const; + /** + * @brief Update diagram Jinja context + * + * This method updates the diagram context with models properties + * which can be used to render Jinja templates in the diagram (e.g. + * in notes or links) + */ + void update_context() const; + +protected: + const inja::json &context() const; + + inja::Environment &env() const; + + template inja::json element_context(const E &e) const; + +private: + void init_context(); + + void init_env(); + +protected: + mutable std::set m_generated_aliases; + mutable inja::json m_context; + mutable inja::Environment m_env; +}; + +template +const inja::json &generator::context() const +{ + return m_context; +} + +template +inja::Environment &generator::env() const +{ + return m_env; +} + +template +template +inja::json generator::element_context(const E &e) const +{ + auto ctx = context(); + + ctx["element"] = e.context(); + + if (!e.file().empty()) { + std::filesystem::path file{e.file()}; + std::string relative_path = file.string(); +#if _MSC_VER + if (file.is_absolute() && ctx.contains("git")) +#else + if (file.is_absolute() && ctx.template contains("git")) +#endif + relative_path = + std::filesystem::relative(file, ctx["git"]["toplevel"]) + .string(); + + ctx["element"]["source"]["path"] = util::path_to_url(relative_path); + ctx["element"]["source"]["full_path"] = file.string(); + ctx["element"]["source"]["name"] = file.filename().string(); + ctx["element"]["source"]["line"] = e.line(); + } + + const auto maybe_comment = e.comment(); + if (maybe_comment) { + ctx["element"]["comment"] = maybe_comment.value(); + } + + return ctx; +} + +template +void generator::generate(std::ostream &ostr) const +{ + const auto &config = generators::generator::config(); + + update_context(); + + generate_diagram_type(ostr); + + generate_mermaid_directives(ostr, config.mermaid().before); + + generate_diagram(ostr); + + generate_mermaid_directives(ostr, config.mermaid().after); + + generate_metadata(ostr); +} + +template +template +void generator::generate_link(std::ostream &ostr, const E &e) const +{ + const auto &config = generators::generator::config(); + + if (e.file().empty()) + return; + + if (config.generate_links().link.empty() && + config.generate_links().tooltip.empty()) + return; + + ostr << indent(1) << "click " << e.alias() << " href \""; + try { + std::string link{}; + if (!config.generate_links().link.empty()) { + link = env().render(std::string_view{config.generate_links().link}, + element_context(e)); + } + if (link.empty()) + link = " "; + ostr << link; + } + catch (const inja::json::parse_error &e) { + LOG_ERROR( + "Failed to parse Jinja template: {}", config.generate_links().link); + ostr << " "; + } + catch (const inja::json::exception &e) { + LOG_ERROR("Failed to render comment directive: \n{}\n due to: {}", + config.generate_links().link, e.what()); + ostr << " "; + } + ostr << "\""; + + if (!config.generate_links().tooltip.empty()) { + ostr << " \""; + try { + auto tooltip_text = + env().render(std::string_view{config.generate_links().tooltip}, + element_context(e)); + util::replace_all(tooltip_text, "\"", "„"); + ostr << tooltip_text; + } + catch (const inja::json::parse_error &e) { + LOG_ERROR("Failed to parse Jinja template: {}", + config.generate_links().link); + ostr << " "; + } + catch (const inja::json::exception &e) { + LOG_ERROR("Failed to render PlantUML directive: \n{}\n due to: {}", + config.generate_links().link, e.what()); + ostr << " "; + } + + ostr << "\""; + } + ostr << "\n"; +} + +template +void generator::generate_mermaid_directives( + std::ostream &ostr, const std::vector &directives) const +{ + + const auto &config = generators::generator::config(); + const auto &model = generators::generator::model(); + + using common::model::namespace_; + + for (const auto &d : directives) { + try { + // Render the directive with template engine first + std::string directive{env().render(std::string_view{d}, context())}; + + // Now search for alias `@A()` directives in the text + // (this is deprecated) + std::tuple alias_match; + while (util::find_element_alias(directive, alias_match)) { + const auto full_name = + config.using_namespace() | std::get<0>(alias_match); + auto element_opt = model.get(full_name.to_string()); + + if (element_opt) + directive.replace(std::get<1>(alias_match), + std::get<2>(alias_match), element_opt.value().alias()); + else { + LOG_ERROR("Cannot find clang-uml alias for element {}", + full_name.to_string()); + directive.replace(std::get<1>(alias_match), + std::get<2>(alias_match), "UNKNOWN_ALIAS"); + } + } + + ostr << indent(1) << directive << '\n'; + } + catch (const clanguml::error::uml_alias_missing &e) { + LOG_ERROR( + "Failed to render MermaidJS directive due to unresolvable " + "alias: {}", + e.what()); + } + catch (const inja::json::parse_error &e) { + LOG_ERROR("Failed to parse Jinja template: {}", d); + } + catch (const inja::json::exception &e) { + LOG_ERROR("Failed to render MermaidJS directive: \n{}\n due to: {}", + d, e.what()); + } + catch (const std::regex_error &e) { + LOG_ERROR("Failed to render MermaidJS directive: \n{}\n due to " + "std::regex_error: {}", + d, e.what()); + } + catch (const std::exception &e) { + LOG_ERROR("Failed to render PlantUML directive: \n{}\n due to: {}", + d, e.what()); + } + } +} + +template +void generator::generate_notes( + std::ostream &ostr, const model::diagram_element &e) const +{ + const auto &config = generators::generator::config(); + + for (const auto &decorator : e.decorators()) { + auto note = std::dynamic_pointer_cast(decorator); + if (note && note->applies_to_diagram(config.name)) { + ostr << indent(1) << "note for " << e.alias() << " \"" << note->text + << "\"" << '\n'; + } + } +} + +template +void generator::generate_metadata(std::ostream &ostr) const +{ + const auto &config = generators::generator::config(); + + if (config.generate_metadata()) { + ostr << '\n' + << "%% Generated with clang-uml, version " + << clanguml::version::CLANG_UML_VERSION << '\n' + << "%% LLVM version " << clang::getClangFullVersion() << '\n'; + } +} + +template +void generator::print_debug( + const common::model::source_location &e, std::ostream &ostr) const +{ + const auto &config = generators::generator::config(); + + if (config.debug_mode()) + ostr << "%% " << e.file() << ":" << e.line() << '\n'; +} + +template +std::ostream &operator<<( + std::ostream &os, const generator &g) +{ + g.generate(os); + return os; +} + +template void generator::init_context() +{ + const auto &config = generators::generator::config(); + + if (config.git) { + m_context["git"]["branch"] = config.git().branch; + m_context["git"]["revision"] = config.git().revision; + m_context["git"]["commit"] = config.git().commit; + m_context["git"]["toplevel"] = config.git().toplevel; + } +} + +template void generator::update_context() const +{ + m_context["diagram"] = generators::generator::model().context(); +} + +template void generator::init_env() +{ + const auto &model = generators::generator::model(); + const auto &config = generators::generator::config(); + + // + // Add basic string functions to inja environment + // + + // Check if string is empty + m_env.add_callback("empty", 1, [](inja::Arguments &args) { + return args.at(0)->get().empty(); + }); + + // Remove spaces from the left of a string + m_env.add_callback("ltrim", 1, [](inja::Arguments &args) { + return util::ltrim(args.at(0)->get()); + }); + + // Remove trailing spaces from a string + m_env.add_callback("rtrim", 1, [](inja::Arguments &args) { + return util::rtrim(args.at(0)->get()); + }); + + // Remove spaces before and after a string + m_env.add_callback("trim", 1, [](inja::Arguments &args) { + return util::trim(args.at(0)->get()); + }); + + // Make a string shorted with a limit to + m_env.add_callback("abbrv", 2, [](inja::Arguments &args) { + return util::abbreviate( + args.at(0)->get(), args.at(1)->get()); + }); + + m_env.add_callback("replace", 3, [](inja::Arguments &args) { + std::string result = args[0]->get(); + std::regex pattern(args[1]->get()); + return std::regex_replace(result, pattern, args[2]->get()); + }); + + m_env.add_callback("split", 2, [](inja::Arguments &args) { + return util::split( + args[0]->get(), args[1]->get()); + }); + + // + // Add MermaidJS specific functions + // + + // Return the entire element JSON context based on element name + // e.g.: + // {{ element("clanguml::t00050::A").comment }} + // + m_env.add_callback("element", 1, [&model, &config](inja::Arguments &args) { + inja::json res{}; + auto element_opt = model.get_with_namespace( + args[0]->get(), config.using_namespace()); + + if (element_opt.has_value()) + res = element_opt.value().context(); + + return res; + }); + + // Convert C++ entity to MermaidJS alias, e.g. + // "note left of {{ alias("A") }}: This is a note" + // Shortcut to: + // {{ element("A").alias }} + // + m_env.add_callback("alias", 1, [&model, &config](inja::Arguments &args) { + auto element_opt = model.get_with_namespace( + args[0]->get(), config.using_namespace()); + + if (!element_opt.has_value()) + throw clanguml::error::uml_alias_missing( + args[0]->get()); + + return element_opt.value().alias(); + }); + + // Get elements' comment: + // "note left of {{ alias("A") }}: {{ comment("A") }}" + // Shortcut to: + // {{ element("A").comment }} + // + m_env.add_callback("comment", 1, [&model, &config](inja::Arguments &args) { + inja::json res{}; + auto element_opt = model.get_with_namespace( + args[0]->get(), config.using_namespace()); + + if (!element_opt.has_value()) + throw clanguml::error::uml_alias_missing( + args[0]->get()); + + auto comment = element_opt.value().comment(); + + if (comment.has_value()) { + assert(comment.value().is_object()); + res = comment.value(); + } + + return res; + }); +} +} // namespace clanguml::common::generators::mermaid \ No newline at end of file diff --git a/src/common/types.h b/src/common/types.h index 3541d61f..272135bf 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -36,7 +36,8 @@ using id_t = int64_t; */ enum class generator_type_t { plantuml, /*!< Diagrams will be gnerated in PlantUML format */ - json /*!< Diagrams will be generated in JSON format */ + json, /*!< Diagrams will be generated in JSON format */ + mermaid /*!< Diagrams will be generated in MermaidJS format */ }; std::string to_string(const std::string &s); diff --git a/src/config/config.cc b/src/config/config.cc index a77571ea..9a7b39e4 100644 --- a/src/config/config.cc +++ b/src/config/config.cc @@ -172,6 +172,12 @@ void plantuml::append(const plantuml &r) after.insert(after.end(), r.after.begin(), r.after.end()); } +void mermaid::append(const mermaid &r) +{ + before.insert(before.end(), r.before.begin(), r.before.end()); + after.insert(after.end(), r.after.begin(), r.after.end()); +} + void inheritable_diagram_options::inherit( const inheritable_diagram_options &parent) { diff --git a/src/config/config.h b/src/config/config.h index 8a634c39..a6c95c35 100644 --- a/src/config/config.h +++ b/src/config/config.h @@ -125,6 +125,22 @@ struct plantuml { void append(const plantuml &r); }; +/** + * @brief MermaidJS diagram config section + * + * This configuration option can be used to add any MermaidJS directives + * before or after the generated diagram, such as diagram name, or custom + * notes. + */ +struct mermaid { + /*! List of directives to add before diagram */ + std::vector before; + /*! List of directives to add before diagram */ + std::vector after; + + void append(const mermaid &r); +}; + /** * @brief Definition of diagram template */ @@ -430,6 +446,7 @@ struct inheritable_diagram_options { option include{"include"}; option exclude{"exclude"}; option puml{"plantuml", option_inherit_mode::kAppend}; + option mermaid{"mermaid", option_inherit_mode::kAppend}; option generate_method_arguments{ "generate_method_arguments", method_arguments::full}; option group_methods{"group_methods", true}; diff --git a/src/config/schema.h b/src/config/schema.h index 54996bc8..a14e55fa 100644 --- a/src/config/schema.h +++ b/src/config/schema.h @@ -150,6 +150,9 @@ types: plantuml: !optional before: !optional [string] after: !optional [string] + mermaid: !optional + before: !optional [string] + after: !optional [string] relative_to: !optional string using_namespace: !optional [string, [string]] generate_metadata: !optional bool @@ -183,6 +186,9 @@ types: plantuml: !optional before: !optional [string] after: !optional [string] + mermaid: !optional + before: !optional [string] + after: !optional [string] relative_to: !optional string using_namespace: !optional [string, [string]] generate_metadata: !optional bool @@ -214,6 +220,9 @@ types: plantuml: !optional before: !optional [string] after: !optional [string] + mermaid: !optional + before: !optional [string] + after: !optional [string] relative_to: !optional string using_namespace: !optional [string, [string]] generate_metadata: !optional bool @@ -239,6 +248,9 @@ types: plantuml: !optional before: !optional [string] after: !optional [string] + mermaid: !optional + before: !optional [string] + after: !optional [string] relative_to: !optional string using_namespace: !optional [string, [string]] generate_metadata: !optional bool @@ -281,6 +293,9 @@ root: plantuml: !optional before: !optional [string] after: !optional [string] + mermaid: !optional + before: !optional [string] + after: !optional [string] relative_to: !optional string using_namespace: !optional [string, [string]] generate_metadata: !optional bool diff --git a/src/config/yaml_decoders.cc b/src/config/yaml_decoders.cc index 1c0a9f45..c281f02b 100644 --- a/src/config/yaml_decoders.cc +++ b/src/config/yaml_decoders.cc @@ -42,6 +42,7 @@ using clanguml::config::include_diagram; using clanguml::config::layout_hint; using clanguml::config::location_t; using clanguml::config::member_order_t; +using clanguml::config::mermaid; using clanguml::config::method_arguments; using clanguml::config::method_type; using clanguml::config::package_diagram; @@ -389,6 +390,18 @@ template <> struct convert { } }; +template <> struct convert { + static bool decode(const Node &node, mermaid &rhs) + { + if (node["before"]) + rhs.before = node["before"].as(); + + if (node["after"]) + rhs.after = node["after"].as(); + return true; + } +}; + template <> struct convert { static bool decode(const Node &node, string_or_regex &rhs) { @@ -531,6 +544,7 @@ template bool decode_diagram(const Node &node, T &rhs) get_option(node, rhs.include); get_option(node, rhs.exclude); get_option(node, rhs.puml); + get_option(node, rhs.mermaid); get_option(node, rhs.git); get_option(node, rhs.generate_links); get_option(node, rhs.type_aliases); @@ -762,6 +776,7 @@ template <> struct convert { get_option(node, rhs.remove_compile_flags); get_option(node, rhs.include_relations_also_as_members); get_option(node, rhs.puml); + get_option(node, rhs.mermaid); get_option(node, rhs.generate_method_arguments); get_option(node, rhs.generate_packages); get_option(node, rhs.package_type); diff --git a/src/include_diagram/generators/mermaid/include_diagram_generator.cc b/src/include_diagram/generators/mermaid/include_diagram_generator.cc new file mode 100644 index 00000000..48cf3472 --- /dev/null +++ b/src/include_diagram/generators/mermaid/include_diagram_generator.cc @@ -0,0 +1,137 @@ +/** + * @file src/include_diagram/generators/mermaid/include_diagram_generator.cc + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * 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. + */ + +#include "include_diagram_generator.h" + +#include "util/error.h" + +namespace clanguml::include_diagram::generators::mermaid { + +using clanguml::common::generators::mermaid::indent; + +generator::generator(diagram_config &config, diagram_model &model) + : common_generator{config, model} +{ +} + +void generator::generate_diagram_type(std::ostream &ostr) const +{ + ostr << "flowchart\n"; +} + +void generator::generate_relationships( + const source_file &f, std::ostream &ostr) const +{ + if (!util::contains(m_generated_aliases, f.alias())) + return; + + LOG_DBG("Generating relationships for file {}", f.full_name(true)); + + if (f.type() == common::model::source_file_t::kDirectory) { + util::for_each(f, [this, &ostr](const auto &file) { + generate_relationships( + dynamic_cast(*file), ostr); + }); + } + else { + util::for_each_if( + f.relationships(), + [this](const auto &r) { + return model().should_include(r.type()) && + util::contains(m_generated_aliases, + model().get(r.destination()).value().alias()); + }, + [&f, &ostr, this](const auto &r) { + ostr << indent(1) << f.alias() << " " + << (r.type() == common::model::relationship_t::kDependency + ? "-.->" + : "-->") + << " " << model().get(r.destination()).value().alias() + << '\n'; + }); + } +} + +void generator::generate(const source_file &f, std::ostream &ostr) const +{ + if (f.type() == common::model::source_file_t::kDirectory) { + LOG_DBG("Generating directory {}", f.name()); + + ostr << indent(1) << "subgraph " << f.alias() << "[" << f.name() + << "]\n"; + + util::for_each(f, [this, &ostr](const auto &file) { + generate(dynamic_cast(*file), ostr); + }); + + ostr << indent(1) << "end" << '\n'; + + m_generated_aliases.emplace(f.alias()); + } + else { + LOG_DBG("Generating file {}", f.name()); + + if (model().should_include(f)) { + ostr << indent(1) << f.alias() << "[" << f.name() << "]\n"; + + m_generated_aliases.emplace(f.alias()); + } + } + + if (config().generate_links) { + common_generator::generate_link(ostr, f); + } +} + +void generator::generate_notes( + std::ostream &ostr, const common::model::diagram_element &element) const +{ + const auto &config = + common_generator::config(); + + for (const auto &decorator : element.decorators()) { + auto note = std::dynamic_pointer_cast(decorator); + if (note && note->applies_to_diagram(config.name)) { + auto note_id_str = fmt::format("N_{}", note_id_++); + + ostr << indent(1) << note_id_str << "(" << note->text << ")\n"; + + ostr << indent(1) << note_id_str << "-.-" << element.alias() + << '\n'; + } + } +} + +void generator::generate_diagram(std::ostream &ostr) const +{ + // Generate files and folders + util::for_each(model(), [this, &ostr](const auto &f) { + generate(dynamic_cast(*f), ostr); + }); + + // Process file include relationships + util::for_each(model(), [this, &ostr](const auto &f) { + generate_relationships(dynamic_cast(*f), ostr); + }); + + // Process file notes + util::for_each(model(), [this, &ostr](const auto &f) { + generate_notes(ostr, dynamic_cast(*f)); + }); +} +} // namespace clanguml::include_diagram::generators::mermaid diff --git a/src/include_diagram/generators/mermaid/include_diagram_generator.h b/src/include_diagram/generators/mermaid/include_diagram_generator.h new file mode 100644 index 00000000..4efaf94e --- /dev/null +++ b/src/include_diagram/generators/mermaid/include_diagram_generator.h @@ -0,0 +1,103 @@ +/** + * @file src/include_diagram/generators/mermaid/include_diagram_generator.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * 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. + */ +#pragma once + +#include "common/generators/mermaid/generator.h" +#include "common/model/package.h" +#include "common/model/relationship.h" +#include "common/model/source_file.h" +#include "config/config.h" +#include "include_diagram/model/diagram.h" +#include "include_diagram/visitor/translation_unit_visitor.h" +#include "util/util.h" + +#include +#include +#include +#include + +namespace clanguml::include_diagram::generators::mermaid { + +using diagram_config = clanguml::config::include_diagram; +using diagram_model = clanguml::include_diagram::model::diagram; + +template +using common_generator = clanguml::common::generators::mermaid::generator; + +using clanguml::common::model::access_t; +using clanguml::common::model::package; +using clanguml::common::model::relationship_t; +using clanguml::common::model::source_file; +using namespace clanguml::util; + +/** + * @brief Include diagram MermaidJS generator + */ +class generator : public common_generator { +public: + generator(diagram_config &config, diagram_model &model); + + using common_generator::generate; + + /** + * @brief Main generator method. + * + * This method is called first and coordinates the entire diagram + * generation. + * + * @param ostr Output stream. + */ + void generate_diagram(std::ostream &ostr) const override; + + /** + * @brief Generate the diagram type + * + * @param ostr Output stream + */ + void generate_diagram_type(std::ostream &ostr) const override; + + /** + * @brief Generate relationships originating from source_file `f` + * + * @param p Diagram element + * @param parent Output stream + */ + void generate_relationships(const source_file &p, std::ostream &ostr) const; + + /** + * @brief Generate notes attached to files + * + * @param ostr Output stream + * @param element Element with a note + */ + void generate_notes(std::ostream &ostr, + const common::model::diagram_element &element) const override; + + /** + * @brief Generate diagram element + * + * @param e Source file diagram element + * @param parent Output stream + */ + void generate(const source_file &e, std::ostream &ostr) const; + +private: + mutable uint64_t note_id_{0UL}; +}; + +} // namespace clanguml::include_diagram::generators::mermaid diff --git a/src/package_diagram/generators/mermaid/package_diagram_generator.cc b/src/package_diagram/generators/mermaid/package_diagram_generator.cc new file mode 100644 index 00000000..1b68d131 --- /dev/null +++ b/src/package_diagram/generators/mermaid/package_diagram_generator.cc @@ -0,0 +1,176 @@ +/** + * @file src/package_diagram/generators/mermaid/package_diagram_generator.cc + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * 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. + */ + +#include "package_diagram_generator.h" + +#include "util/error.h" + +namespace clanguml::package_diagram::generators::mermaid { + +using clanguml::common::generators::mermaid::indent; + +generator::generator(diagram_config &config, diagram_model &model) + : common_generator{config, model} + , together_group_stack_{false} +{ +} + +void generator::generate_diagram_type(std::ostream &ostr) const +{ + ostr << "flowchart\n"; +} + +void generator::generate_relationships( + const package &p, std::ostream &ostr) const +{ + LOG_DBG("Generating relationships for package {}", p.full_name(true)); + + // Generate this packages relationship + if (model().should_include(relationship_t::kDependency)) { + for (const auto &r : p.relationships()) { + std::stringstream relstr; + try { + auto destination = model().to_alias(r.destination()); + if (!destination.empty()) { + relstr << p.alias() << " -.-> " << destination << '\n'; + ostr << indent(1) << relstr.str(); + } + } + catch (error::uml_alias_missing &e) { + LOG_DBG("=== Skipping dependency relation from {} to {} due " + "to: {}", + p.full_name(false), r.destination(), e.what()); + } + } + } + + // Process it's subpackages relationships + for (const auto &subpackage : p) { + generate_relationships( + dynamic_cast(*subpackage), ostr); + } +} + +void generator::generate(const package &p, std::ostream &ostr) const +{ + LOG_DBG("Generating package {}", p.name()); + + together_group_stack_.enter(); + + const auto &uns = config().using_namespace(); + + // Don't generate packages from namespaces filtered out by + // using_namespace + if (!uns.starts_with({p.full_name(false)})) { + ostr << indent(1) << "subgraph " << p.alias() << "[" << p.name() + << "]\n"; + + if (p.is_deprecated()) + ostr << indent(1) << "%% <>"; + } + + for (const auto &subpackage : p) { + auto &pkg = dynamic_cast(*subpackage); + if (model().should_include(pkg)) { + auto together_group = + config().get_together_group(pkg.full_name(false)); + if (together_group) { + together_group_stack_.group_together( + together_group.value(), &pkg); + } + else { + generate(pkg, ostr); + } + } + } + + generate_groups(ostr); + + if (!uns.starts_with({p.full_name(false)})) { + ostr << indent(1) << "end" << '\n'; + } + + if (config().generate_links) { + common_generator::generate_link(ostr, p); + } + + generate_notes(ostr, p); + + together_group_stack_.leave(); +} + +void generator::generate_groups(std::ostream &ostr) const +{ + for (const auto &[group_name, group_elements] : + together_group_stack_.get_current_groups()) { + ostr << indent(1) << "%% together group - not rendered in MermaidJS \n"; + + for (auto *pkg : group_elements) { + generate(*pkg, ostr); + } + + ostr << indent(1) << "%% end together group\n"; + } +} + +void generator::generate_notes( + std::ostream &ostr, const common::model::diagram_element &element) const +{ + const auto &config = + common_generator::config(); + + for (const auto &decorator : element.decorators()) { + auto note = std::dynamic_pointer_cast(decorator); + if (note && note->applies_to_diagram(config.name)) { + auto note_id_str = fmt::format("N_{}", note_id_++); + + ostr << indent(1) << note_id_str << "(" << note->text << ")\n"; + + ostr << indent(1) << note_id_str << "-.-" << element.alias() + << '\n'; + } + } +} + +void generator::generate_diagram(std::ostream &ostr) const +{ + for (const auto &p : model()) { + auto &pkg = dynamic_cast(*p); + if (model().should_include(pkg)) { + auto together_group = + config().get_together_group(pkg.full_name(false)); + if (together_group) { + together_group_stack_.group_together( + together_group.value(), &pkg); + } + else { + generate(pkg, ostr); + } + } + } + + generate_groups(ostr); + + // Process package relationships + for (const auto &p : model()) { + if (model().should_include(dynamic_cast(*p))) + generate_relationships(dynamic_cast(*p), ostr); + } +} + +} // namespace clanguml::package_diagram::generators::mermaid diff --git a/src/package_diagram/generators/mermaid/package_diagram_generator.h b/src/package_diagram/generators/mermaid/package_diagram_generator.h new file mode 100644 index 00000000..e17ca55c --- /dev/null +++ b/src/package_diagram/generators/mermaid/package_diagram_generator.h @@ -0,0 +1,117 @@ +/** + * @file src/package_diagram/generators/mermaid/package_diagram_generator.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * 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. + */ +#pragma once + +#include "common/generators/mermaid/generator.h" +#include "common/generators/nested_element_stack.h" +#include "common/model/package.h" +#include "common/model/relationship.h" +#include "config/config.h" +#include "package_diagram/model/diagram.h" +#include "package_diagram/visitor/translation_unit_visitor.h" +#include "util/util.h" + +#include +#include +#include +#include + +namespace clanguml { +namespace package_diagram { +namespace generators { +namespace mermaid { + +using diagram_config = clanguml::config::package_diagram; +using diagram_model = clanguml::package_diagram::model::diagram; + +template +using common_generator = clanguml::common::generators::mermaid::generator; + +using clanguml::common::model::access_t; +using clanguml::common::model::package; +using clanguml::common::model::relationship_t; +using namespace clanguml::util; + +/** + * @brief Package diagram MermaidJS generator + */ +class generator : public common_generator { +public: + generator(diagram_config &config, diagram_model &model); + + using common_generator::generate; + + /** + * @brief Main generator method. + * + * This method is called first and coordinates the entire diagram + * generation. + * + * @param ostr Output stream. + */ + void generate_diagram(std::ostream &ostr) const override; + + /** + * @brief Generate the diagram type + * + * @param ostr Output stream + */ + void generate_diagram_type(std::ostream &ostr) const override; + + /** + * @brief Generate relationships originating from package `p` + * + * @param p Diagram element + * @param parent Output stream + */ + void generate_relationships(const package &p, std::ostream &ostr) const; + + /** + * @brief Generate diagram package element + * + * @param p Package diagram element + * @param parent Output stream + */ + void generate(const package &e, std::ostream &ostr) const; + + /** + * @brief Generate package elements grouped using `together` MermaidJS tag + * + * @param ostr Output stream + */ + void generate_groups(std::ostream &ostr) const; + + /** + * @brief Generate notes attached to packages + * + * @param ostr Output stream + * @param element Element with a note + */ + void generate_notes(std::ostream &ostr, + const common::model::diagram_element &element) const override; + +private: + mutable uint64_t note_id_{0UL}; + mutable common::generators::nested_element_stack + together_group_stack_; +}; + +} // namespace mermaid +} // namespace generators +} // namespace package_diagram +} // namespace clanguml diff --git a/src/sequence_diagram/generators/mermaid/sequence_diagram_generator.cc b/src/sequence_diagram/generators/mermaid/sequence_diagram_generator.cc new file mode 100644 index 00000000..63f84a5f --- /dev/null +++ b/src/sequence_diagram/generators/mermaid/sequence_diagram_generator.cc @@ -0,0 +1,580 @@ +/** + * @file src/sequence_diagram/generators/mermaid/sequence_diagram_generator.cc + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * 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. + */ + +#include "sequence_diagram_generator.h" + +namespace clanguml::sequence_diagram::generators::mermaid { + +using clanguml::common::model::message_t; +using clanguml::config::location_t; +using clanguml::sequence_diagram::model::activity; +using clanguml::sequence_diagram::model::message; +using namespace clanguml::util; + +using clanguml::common::generators::mermaid::indent; + +std::string render_participant_name(std::string name) +{ + util::replace_all(name, "##", "::"); + + return name; +} + +std::string render_message_text(std::string text) +{ + util::replace_all(text, ";", "#59;"); + + return text; +} + +generator::generator( + clanguml::config::sequence_diagram &config, diagram_model &model) + : common_generator{config, model} +{ +} + +void generator::generate_diagram_type(std::ostream &ostr) const +{ + ostr << "sequenceDiagram\n"; +} + +void generator::generate_call(const message &m, std::ostream &ostr) const +{ + const auto &from = model().get_participant(m.from()); + const auto &to = model().get_participant(m.to()); + + if (!from || !to) { + LOG_DBG("Skipping empty call from '{}' to '{}'", m.from(), m.to()); + return; + } + + generate_participant(ostr, m.from()); + generate_participant(ostr, m.to()); + + std::string message; + + model::function::message_render_mode render_mode = + select_method_arguments_render_mode(); + + if (to.value().type_name() == "method") { + const auto &f = dynamic_cast(to.value()); + message = f.message_name(render_mode); + } + else if (config().combine_free_functions_into_file_participants()) { + if (to.value().type_name() == "function") { + message = dynamic_cast(to.value()) + .message_name(render_mode); + } + else if (to.value().type_name() == "function_template") { + message = dynamic_cast(to.value()) + .message_name(render_mode); + } + } + + const std::string from_alias = generate_alias(from.value()); + const std::string to_alias = generate_alias(to.value()); + + print_debug(m, ostr); + + ostr << indent(1) << from_alias << " " + << common::generators::mermaid::to_mermaid(message_t::kCall) << " "; + + ostr << to_alias; + + ostr << " : "; + + if (m.message_scope() == common::model::message_scope_t::kCondition) + ostr << "["; + + ostr << message; + + if (m.message_scope() == common::model::message_scope_t::kCondition) + ostr << "]"; + + ostr << '\n'; + + LOG_DBG("Generated call '{}' from {} [{}] to {} [{}]", message, from, + m.from(), to, m.to()); +} + +void generator::generate_return(const message &m, std::ostream &ostr) const +{ + // Add return activity only for messages between different actors and + // only if the return type is different than void + const auto &from = model().get_participant(m.from()); + const auto &to = model().get_participant(m.to()); + if ((m.from() != m.to()) && !to.value().is_void()) { + const std::string from_alias = generate_alias(from.value()); + + const std::string to_alias = generate_alias(to.value()); + + ostr << indent(1) << to_alias << " " + << common::generators::mermaid::to_mermaid(message_t::kReturn) + << " " << from_alias << " : "; + + if (config().generate_return_types()) { + ostr << m.return_type(); + } + + ostr << '\n'; + } +} + +void generator::generate_activity(const activity &a, std::ostream &ostr, + std::vector &visited) const +{ + for (const auto &m : a.messages()) { + if (m.type() == message_t::kCall) { + const auto &to = + model().get_participant(m.to()); + + visited.push_back(m.from()); + + LOG_DBG("Generating message [{}] --> [{}]", m.from(), m.to()); + + generate_call(m, ostr); + + std::string to_alias = generate_alias(to.value()); + + ostr << indent(1) << "activate " << to_alias << std::endl; + + if (model().sequences().find(m.to()) != model().sequences().end()) { + if (std::find(visited.begin(), visited.end(), m.to()) == + visited + .end()) { // break infinite recursion on recursive calls + LOG_DBG("Creating activity {} --> {} - missing sequence {}", + m.from(), m.to(), m.to()); + generate_activity( + model().get_activity(m.to()), ostr, visited); + } + } + else + LOG_DBG("Skipping activity {} --> {} - missing sequence {}", + m.from(), m.to(), m.to()); + + generate_return(m, ostr); + + ostr << indent(1) << "deactivate " << to_alias << std::endl; + + visited.pop_back(); + } + else if (m.type() == message_t::kIf) { + print_debug(m, ostr); + ostr << indent(1) << "alt"; + if (const auto &text = m.condition_text(); text.has_value()) + ostr << " " << render_message_text(text.value()); + ostr << '\n'; + } + else if (m.type() == message_t::kElseIf) { + print_debug(m, ostr); + ostr << indent(1) << "else"; + if (const auto &text = m.condition_text(); text.has_value()) + ostr << " " << render_message_text(text.value()); + ostr << '\n'; + } + else if (m.type() == message_t::kElse) { + print_debug(m, ostr); + ostr << indent(1) << "else\n"; + } + else if (m.type() == message_t::kIfEnd) { + ostr << indent(1) << "end\n"; + } + else if (m.type() == message_t::kWhile) { + print_debug(m, ostr); + ostr << indent(1) << "loop"; + if (const auto &text = m.condition_text(); text.has_value()) + ostr << " " << render_message_text(text.value()); + ostr << '\n'; + } + else if (m.type() == message_t::kWhileEnd) { + ostr << indent(1) << "end\n"; + } + else if (m.type() == message_t::kFor) { + print_debug(m, ostr); + ostr << indent(1) << "loop"; + if (const auto &text = m.condition_text(); text.has_value()) + ostr << " " << render_message_text(text.value()); + ostr << '\n'; + } + else if (m.type() == message_t::kForEnd) { + ostr << "end\n"; + } + else if (m.type() == message_t::kDo) { + print_debug(m, ostr); + ostr << indent(1) << "loop"; + if (const auto &text = m.condition_text(); text.has_value()) + ostr << " " << render_message_text(text.value()); + ostr << '\n'; + } + else if (m.type() == message_t::kDoEnd) { + ostr << indent(1) << "end\n"; + } + else if (m.type() == message_t::kTry) { + print_debug(m, ostr); + ostr << indent(1) << "critical\n"; + } + else if (m.type() == message_t::kCatch) { + print_debug(m, ostr); + ostr << indent(1) << "option " + << render_message_text(m.message_name()) << '\n'; + } + else if (m.type() == message_t::kTryEnd) { + print_debug(m, ostr); + ostr << indent(1) << "end\n"; + } + else if (m.type() == message_t::kSwitch) { + print_debug(m, ostr); + ostr << indent(1) << "alt\n"; + } + else if (m.type() == message_t::kCase) { + print_debug(m, ostr); + ostr << indent(1) << "else " + << render_message_text(m.message_name()) << '\n'; + } + else if (m.type() == message_t::kSwitchEnd) { + ostr << indent(1) << "end\n"; + } + else if (m.type() == message_t::kConditional) { + print_debug(m, ostr); + ostr << indent(1) << "alt"; + if (const auto &text = m.condition_text(); text.has_value()) + ostr << " " << render_message_text(text.value()); + ostr << '\n'; + } + else if (m.type() == message_t::kConditionalElse) { + print_debug(m, ostr); + ostr << indent(1) << "else\n"; + } + else if (m.type() == message_t::kConditionalEnd) { + ostr << indent(1) << "end\n"; + } + } +} + +void generator::generate_participant( + std::ostream &ostr, const std::string &name) const +{ + auto p = model().get(name); + + if (!p.has_value()) { + LOG_WARN("Cannot find participant {} from `participants_order` option", + name); + return; + } + + generate_participant(ostr, p.value().id(), true); +} + +void generator::generate_participant( + std::ostream &ostr, common::id_t id, bool force) const +{ + common::id_t participant_id{0}; + + if (!force) { + for (const auto pid : model().active_participants()) { + if (pid == id) { + participant_id = pid; + break; + } + } + } + else + participant_id = id; + + if (participant_id == 0) + return; + + if (is_participant_generated(participant_id)) + return; + + const auto &participant = + model().get_participant(participant_id).value(); + + if (participant.type_name() == "method") { + const auto class_id = + model() + .get_participant(participant_id) + .value() + .class_id(); + + if (is_participant_generated(class_id)) + return; + + const auto &class_participant = + model().get_participant(class_id).value(); + + print_debug(class_participant, ostr); + + ostr << indent(1) << "participant " << class_participant.alias() + << " as " + << render_participant_name(config().using_namespace().relative( + class_participant.full_name(false))); + + ostr << '\n'; + + generated_participants_.emplace(class_id); + } + else if ((participant.type_name() == "function" || + participant.type_name() == "function_template") && + config().combine_free_functions_into_file_participants()) { + // Create a single participant for all functions declared in a + // single file + const auto &file_path = + model() + .get_participant(participant_id) + .value() + .file(); + + assert(!file_path.empty()); + + const auto file_id = common::to_id(file_path); + + if (is_participant_generated(file_id)) + return; + + auto participant_name = util::path_to_url(std::filesystem::relative( + std::filesystem::path{file_path}, config().root_directory()) + .string()); + + ostr << indent(1) << "participant " << fmt::format("C_{:022}", file_id) + << " as " << render_participant_name(participant_name); + ostr << '\n'; + + generated_participants_.emplace(file_id); + } + else { + print_debug(participant, ostr); + + ostr << indent(1) << "participant " << participant.alias() << " as " + << config().using_namespace().relative( + participant.full_name(false)); + ostr << '\n'; + + generated_participants_.emplace(participant_id); + } +} + +bool generator::is_participant_generated(common::id_t id) const +{ + return std::find(generated_participants_.begin(), + generated_participants_.end(), + id) != generated_participants_.end(); +} + +std::string generator::generate_alias( + const model::participant &participant) const +{ + if ((participant.type_name() == "function" || + participant.type_name() == "function_template") && + config().combine_free_functions_into_file_participants()) { + const auto file_id = common::to_id(participant.file()); + + return fmt::format("C_{:022}", file_id); + } + + return participant.alias(); +} + +void generator::generate_diagram(std::ostream &ostr) const +{ + model().print(); + + if (config().participants_order.has_value) { + for (const auto &p : config().participants_order()) { + LOG_DBG("Pregenerating participant {}", p); + generate_participant(ostr, p); + } + } + + bool star_participant_generated{false}; + + for (const auto &ft : config().from_to()) { + // First, find the sequence of activities from 'from' location + // to 'to' location + assert(ft.size() == 2); + + const auto &from_location = ft.front(); + const auto &to_location = ft.back(); + + auto from_activity_id = model().get_from_activity_id(from_location); + auto to_activity_id = model().get_to_activity_id(to_location); + + if (from_activity_id == 0 || to_activity_id == 0) + continue; + + auto message_chains_unique = model().get_all_from_to_message_chains( + from_activity_id, to_activity_id); + + for (const auto &mc : message_chains_unique) { + const auto &from = + model().get_participant(from_activity_id); + + if (from.value().type_name() == "method" || + config().combine_free_functions_into_file_participants()) { + if (!star_participant_generated) { + ostr << indent(1) << "participant *\n"; + star_participant_generated = true; + } + generate_participant(ostr, from_activity_id); + ostr << indent(1) << "* " + << common::generators::mermaid::to_mermaid( + message_t::kCall) + << " " << generate_alias(from.value()) << " : " + << from.value().message_name( + select_method_arguments_render_mode()) + << std::endl; + } + + for (const auto &m : mc) { + generate_call(m, ostr); + } + } + } + + for (const auto &to_location : config().to()) { + auto to_activity_id = model().get_to_activity_id(to_location); + + if (to_activity_id == 0) + continue; + + auto message_chains_unique = + model().get_all_from_to_message_chains(0, to_activity_id); + + for (const auto &mc : message_chains_unique) { + const auto from_activity_id = mc.front().from(); + + const auto &from = + model().get_participant(from_activity_id); + + if (from.value().type_name() == "method" || + config().combine_free_functions_into_file_participants()) { + generate_participant(ostr, from_activity_id); + ostr << indent(1) << "* " + << common::generators::mermaid::to_mermaid( + message_t::kCall) + << " " << generate_alias(from.value()) << " : " + << from.value().message_name( + select_method_arguments_render_mode()) + << std::endl; + } + + for (const auto &m : mc) { + generate_call(m, ostr); + } + } + } + + for (const auto &sf : config().from()) { + if (sf.location_type == location_t::function) { + common::model::diagram_element::id_t start_from{0}; + for (const auto &[k, v] : model().sequences()) { + const auto &caller = *model().participants().at(v.from()); + std::string vfrom = caller.full_name(false); + if (vfrom == sf.location) { + LOG_DBG("Found sequence diagram start point: {}", k); + start_from = k; + break; + } + } + + if (start_from == 0) { + LOG_WARN("Failed to find participant with {} for start_from " + "condition", + sf.location); + continue; + } + + // Use this to break out of recurrent loops + std::vector + visited_participants; + + const auto &from = + model().get_participant(start_from); + + if (!from.has_value()) { + LOG_WARN("Failed to find participant {} for start_from " + "condition", + sf.location); + continue; + } + + generate_participant(ostr, start_from); + + std::string from_alias = generate_alias(from.value()); + + model::function::message_render_mode render_mode = + select_method_arguments_render_mode(); + + // For methods or functions in diagrams where they are combined into + // file participants, we need to add an 'entry' point call to know + // which method relates to the first activity for this 'start_from' + // condition + if (from.value().type_name() == "method" || + config().combine_free_functions_into_file_participants()) { + ostr << indent(1) << "* " + << common::generators::mermaid::to_mermaid( + message_t::kCall) + << " " << from_alias << " : " + << from.value().message_name(render_mode) << std::endl; + } + + ostr << indent(1) << "activate " << from_alias << std::endl; + + generate_activity( + model().get_activity(start_from), ostr, visited_participants); + + if (from.value().type_name() == "method" || + config().combine_free_functions_into_file_participants()) { + + if (!from.value().is_void()) { + ostr << indent(1) << from_alias << " " + << common::generators::mermaid::to_mermaid( + message_t::kReturn) + << " *" + << " : "; + + if (config().generate_return_types()) + ostr << from.value().return_type(); + + ostr << '\n'; + } + } + + ostr << indent(1) << "deactivate " << from_alias << std::endl; + } + else { + // TODO: Add support for other sequence start location types + continue; + } + } +} + +model::function::message_render_mode +generator::select_method_arguments_render_mode() const +{ + if (config().generate_method_arguments() == + config::method_arguments::abbreviated) + return model::function::message_render_mode::abbreviated; + + if (config().generate_method_arguments() == config::method_arguments::none) + return model::function::message_render_mode::no_arguments; + + return model::function::message_render_mode::full; +} + +} // namespace clanguml::sequence_diagram::generators::mermaid diff --git a/src/sequence_diagram/generators/mermaid/sequence_diagram_generator.h b/src/sequence_diagram/generators/mermaid/sequence_diagram_generator.h new file mode 100644 index 00000000..c6bbd33d --- /dev/null +++ b/src/sequence_diagram/generators/mermaid/sequence_diagram_generator.h @@ -0,0 +1,148 @@ +/** + * @file src/sequence_diagram/generators/mermaid/sequence_diagram_generator.h + * + * Copyright (c) 2021-2023 Bartek Kryza + * + * 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. + */ +#pragma once + +#include "common/generators/mermaid/generator.h" +#include "config/config.h" +#include "sequence_diagram/model/diagram.h" +#include "sequence_diagram/visitor/translation_unit_visitor.h" +#include "util/util.h" + +#include + +#include +#include +#include +#include + +namespace clanguml { +namespace sequence_diagram { +namespace generators { +namespace mermaid { + +using diagram_config = clanguml::config::sequence_diagram; +using diagram_model = clanguml::sequence_diagram::model::diagram; + +template +using common_generator = clanguml::common::generators::mermaid::generator; + +/** + * @brief Sequence diagram MermaidJS generator + */ +class generator : public common_generator { +public: + generator(diagram_config &config, diagram_model &model); + + using common_generator::generate; + + /** + * @brief Main generator method. + * + * This method is called first and coordinates the entire diagram + * generation. + * + * @param ostr Output stream. + */ + void generate_diagram(std::ostream &ostr) const override; + + /** + * @brief Generate the diagram type + * + * @param ostr Output stream + */ + void generate_diagram_type(std::ostream &ostr) const override; + + /** + * @brief Generate sequence diagram message. + * + * @param m Message model + * @param ostr Output stream + */ + void generate_call(const clanguml::sequence_diagram::model::message &m, + std::ostream &ostr) const; + + /** + * @brief Generate sequence diagram return message + * + * @param m Message model + * @param ostr Output stream + */ + void generate_return(const clanguml::sequence_diagram::model::message &m, + std::ostream &ostr) const; + + /** + * @brief Generate sequence diagram participant + * + * @param ostr Output stream + * @param id Participant id + * @param force If true, generate the participant even if its not in + * the set of active participants + * @return Id of the generated participant + */ + void generate_participant( + std::ostream &ostr, common::id_t id, bool force = false) const; + + /** + * @brief Generate sequence diagram participant by name + * + * This is convenience wrapper over `generate_participant()` by id. + * + * @param ostr Output stream + * @param name Full participant name + */ + void generate_participant( + std::ostream &ostr, const std::string &name) const; + + /** + * @brief Generate sequence diagram activity. + * + * @param a Activity model + * @param ostr Output stream + * @param visited List of already visited participants, this is necessary + * for breaking infinite recursion on recursive calls + */ + void generate_activity(const clanguml::sequence_diagram::model::activity &a, + std::ostream &ostr, + std::vector &visited) const; + +private: + /** + * @brief Check if specified participant has already been generated. + * + * @param id Participant id. + * @return True, if participant has already been generated. + */ + bool is_participant_generated(common::id_t id) const; + + /** + * @brief Generate MermaidJS alias for participant + * + * @param participant Sequence diagram participant model + * @return Particpant alias + */ + std::string generate_alias(const model::participant &participant) const; + + mutable std::set generated_participants_; + model::function::message_render_mode + select_method_arguments_render_mode() const; +}; + +} // namespace mermaid +} // namespace generators +} // namespace sequence_diagram +} // namespace clanguml diff --git a/tests/catch.h b/tests/catch.h index c3237aad..27888c9d 100644 --- a/tests/catch.h +++ b/tests/catch.h @@ -13301,11 +13301,15 @@ bool RegexMatcher::match(std::string const &matchee) const { auto flags = std::regex::ECMAScript; // ECMAScript is the default syntax // option anyway +#if !defined(_WIN32) + flags |= std::regex::multiline; +#endif + if (m_caseSensitivity == CaseSensitive::Choice::No) { flags |= std::regex::icase; } auto reg = std::regex(m_regex, flags); - return std::regex_match(matchee, reg); + return std::regex_search(matchee, reg); } std::string RegexMatcher::describe() const diff --git a/tests/t00002/.clang-uml b/tests/t00002/.clang-uml index c27c8e78..772207d9 100644 --- a/tests/t00002/.clang-uml +++ b/tests/t00002/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00002_class: type: class @@ -18,4 +18,9 @@ diagrams: - | note right of {{ alias("D") }} {{ comment("D").text }} - end note \ No newline at end of file + end note + mermaid: + after: + - '{% set e=element("A") %} note for {{ e.alias }} "{{ trim(e.comment.brief.0) }}"' + - '{% set e=element("clanguml::t00002::B") %} note for {{ e.alias }} "{{ trim(e.comment.brief.0) }}"' + - 'note for {{ alias("D") }} "{{ comment("D").text }}"' \ No newline at end of file diff --git a/tests/t00002/test_case.h b/tests/t00002/test_case.h index 4cfd2cfd..78eb6e66 100644 --- a/tests/t00002/test_case.h +++ b/tests/t00002/test_case.h @@ -85,8 +85,7 @@ TEST_CASE("t00002", "[test-case][class]") clanguml::util::get_git_commit()), "as")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", puml); } { auto j = generate_class_json(diagram, *model); @@ -105,6 +104,47 @@ TEST_CASE("t00002", "[test-case][class]") REQUIRE(IsField(j, "E", "as", "std::vector")); REQUIRE(IsAssociation(j, "D", "A", "as")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto mmd = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(mmd); + using mermaid::HasNote; + using mermaid::IsAbstractClass; + + REQUIRE_THAT(mmd, StartsWith("classDiagram")); + REQUIRE_THAT(mmd, IsAbstractClass(_A("A"))); + REQUIRE_THAT(mmd, IsClass(_A("B"))); + REQUIRE_THAT(mmd, IsClass(_A("C"))); + REQUIRE_THAT(mmd, IsClass(_A("D"))); + REQUIRE_THAT(mmd, IsBaseClass(_A("A"), _A("B"))); + REQUIRE_THAT(mmd, IsBaseClass(_A("A"), _A("C"))); + REQUIRE_THAT(mmd, IsBaseClass(_A("B"), _A("D"))); + REQUIRE_THAT(mmd, IsBaseClass(_A("C"), _A("D"))); + + REQUIRE_THAT(mmd, IsAssociation(_A("D"), _A("A"), "-as")); + + REQUIRE_THAT(mmd, (mermaid::IsMethod("foo_a"))); + REQUIRE_THAT(mmd, (mermaid::IsMethod("foo_c"))); + + REQUIRE_THAT(mmd, HasNote(_A("A"), "left", "This is class A")); + REQUIRE_THAT(mmd, HasNote(_A("B"), "top", "This is class B")); + + REQUIRE_THAT(mmd, + mermaid::HasLink(_A("A"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t00002/t00002.cc#L7", + clanguml::util::get_git_commit()), + "This is class A")); + + REQUIRE_THAT(mmd, + mermaid::HasLink(_A("B"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t00002/t00002.cc#L16", + clanguml::util::get_git_commit()), + "This is class B")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", mmd); } } \ No newline at end of file diff --git a/tests/t00003/.clang-uml b/tests/t00003/.clang-uml index b783db86..e57c3032 100644 --- a/tests/t00003/.clang-uml +++ b/tests/t00003/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00003_class: type: class diff --git a/tests/t00003/test_case.h b/tests/t00003/test_case.h index 33f1774b..d58bd6a1 100644 --- a/tests/t00003/test_case.h +++ b/tests/t00003/test_case.h @@ -73,8 +73,7 @@ TEST_CASE("t00003", "[test-case][class]") REQUIRE_THAT(puml, (IsField("b_", "int"))); REQUIRE_THAT(puml, (IsField("c_", "int"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", puml); } { @@ -93,6 +92,51 @@ TEST_CASE("t00003", "[test-case][class]") REQUIRE(!IsDependency(j, "A", "A")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto mmd = generate_class_mermaid(diagram, *model); + mermaid::AliasMatcher _A(mmd); + + REQUIRE_THAT(mmd, IsClass(_A("A"))); + + REQUIRE_THAT(mmd, !IsDependency(_A("A"), _A("A"))); + + REQUIRE_THAT(mmd, (mermaid::IsMethod("A"))); + REQUIRE_THAT( + mmd, (mermaid::IsMethod("A", "void", "A &&"))); + REQUIRE_THAT(mmd, + (mermaid::IsMethod("A", "void", "const A &"))); + + REQUIRE_THAT(mmd, (mermaid::IsMethod("~A"))); + + REQUIRE_THAT(mmd, (mermaid::IsMethod("basic_method"))); + REQUIRE_THAT( + mmd, (mermaid::IsMethod("static_method", "int"))); + REQUIRE_THAT(mmd, (mermaid::IsMethod("const_method"))); + REQUIRE_THAT(mmd, + (mermaid::IsMethod("default_int", "int", "int i = 12"))); + REQUIRE_THAT(mmd, + (mermaid::IsMethod("default_string", "std::string", + "int i, std::string s = \"abc\""))); + + REQUIRE_THAT(mmd, + (mermaid::IsMethod( + "size", "std::size_t"))); + + REQUIRE_THAT(mmd, (mermaid::IsMethod("protected_method"))); + REQUIRE_THAT(mmd, (mermaid::IsMethod("private_method"))); + + REQUIRE_THAT(mmd, (IsField("public_member", "int"))); + REQUIRE_THAT(mmd, (IsField("protected_member", "int"))); + REQUIRE_THAT(mmd, (IsField("private_member", "int"))); + REQUIRE_THAT(mmd, + (IsField("auto_member", "const unsigned long"))); + + REQUIRE_THAT(mmd, (IsField("a_", "int"))); + REQUIRE_THAT(mmd, (IsField("b_", "int"))); + REQUIRE_THAT(mmd, (IsField("c_", "int"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", mmd); + } +} \ No newline at end of file diff --git a/tests/t00004/.clang-uml b/tests/t00004/.clang-uml index d9231e66..dceb4e5c 100644 --- a/tests/t00004/.clang-uml +++ b/tests/t00004/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00004_class: type: class diff --git a/tests/t00004/test_case.h b/tests/t00004/test_case.h index a41d6a2b..c0f54989 100644 --- a/tests/t00004/test_case.h +++ b/tests/t00004/test_case.h @@ -65,8 +65,7 @@ TEST_CASE("t00004", "[test-case][class]") REQUIRE_THAT(puml, IsClass(_A("detail::D::DD"))); REQUIRE_THAT(puml, IsEnum(_A("detail::D::AA"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", puml); } { @@ -89,6 +88,37 @@ TEST_CASE("t00004", "[test-case][class]") REQUIRE(IsClass(j, "detail::D::DD")); REQUIRE(IsEnum(j, "detail::D::AA")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto mmd = generate_class_mermaid(diagram, *model); + mermaid::AliasMatcher _A(mmd); + + REQUIRE_THAT(mmd, IsClass(_A("A"))); + REQUIRE_THAT(mmd, IsClass(_A("A::AA"))); + REQUIRE_THAT(mmd, IsClass(_A("A::AA::AAA"))); + REQUIRE_THAT(mmd, mermaid::IsEnum(_A("B::AA"))); + REQUIRE_THAT(mmd, mermaid::IsEnum(_A("A::AA::Lights"))); + REQUIRE_THAT(mmd, mermaid::IsInnerClass(_A("A"), _A("A::AA"))); + REQUIRE_THAT(mmd, mermaid::IsInnerClass(_A("A::AA"), _A("A::AA::AAA"))); + REQUIRE_THAT( + mmd, mermaid::IsInnerClass(_A("A::AA"), _A("A::AA::Lights"))); + + REQUIRE_THAT(mmd, IsClass(_A("C"))); + REQUIRE_THAT(mmd, mermaid::IsInnerClass(_A("C"), _A("C::AA"))); + REQUIRE_THAT(mmd, mermaid::IsInnerClass(_A("C::AA"), _A("C::AA::AAA"))); + REQUIRE_THAT(mmd, mermaid::IsInnerClass(_A("C"), _A("C::CC"))); + REQUIRE_THAT(mmd, mermaid::IsInnerClass(_A("C::AA"), _A("C::AA::CCC"))); + + REQUIRE_THAT(mmd, mermaid::IsInnerClass(_A("C"), _A("C::B"))); + REQUIRE_THAT(mmd, IsAggregation(_A("C"), _A("C::B"), "+b_int")); + REQUIRE_THAT(mmd, !mermaid::IsInnerClass(_A("C"), _A("C::B"))); + REQUIRE_THAT(mmd, IsInstantiation(_A("C::B"), _A("C::B"))); + + REQUIRE_THAT(mmd, IsClass(_A("detail::D"))); + REQUIRE_THAT(mmd, IsClass(_A("detail::D::DD"))); + REQUIRE_THAT(mmd, mermaid::IsEnum(_A("detail::D::AA"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", mmd); + } +} \ No newline at end of file diff --git a/tests/t00005/.clang-uml b/tests/t00005/.clang-uml index d433a5d5..010559a3 100644 --- a/tests/t00005/.clang-uml +++ b/tests/t00005/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00005_class: type: class diff --git a/tests/t00005/test_case.h b/tests/t00005/test_case.h index 0383deb9..7912b25d 100644 --- a/tests/t00005/test_case.h +++ b/tests/t00005/test_case.h @@ -64,8 +64,7 @@ TEST_CASE("t00005", "[test-case][class]") REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("J"), "+j")); REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "+k")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", puml); } { @@ -98,6 +97,43 @@ TEST_CASE("t00005", "[test-case][class]") REQUIRE(IsAssociation(j, "R", "J", "j")); REQUIRE(IsAssociation(j, "R", "K", "k")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto mmd = generate_class_mermaid(diagram, *model); + mermaid::AliasMatcher _A(mmd); + + REQUIRE_THAT(mmd, StartsWith("classDiagram")); + REQUIRE_THAT(mmd, IsClass(_A("A"))); + REQUIRE_THAT(mmd, IsClass(_A("B"))); + REQUIRE_THAT(mmd, IsClass(_A("C"))); + REQUIRE_THAT(mmd, IsClass(_A("D"))); + REQUIRE_THAT(mmd, IsClass(_A("E"))); + REQUIRE_THAT(mmd, IsClass(_A("F"))); + REQUIRE_THAT(mmd, IsClass(_A("G"))); + REQUIRE_THAT(mmd, IsClass(_A("H"))); + REQUIRE_THAT(mmd, IsClass(_A("I"))); + REQUIRE_THAT(mmd, IsClass(_A("J"))); + REQUIRE_THAT(mmd, IsClass(_A("K"))); + REQUIRE_THAT(mmd, IsClass(_A("R"))); + + REQUIRE_THAT(mmd, (IsField("some_int", "int"))); + REQUIRE_THAT(mmd, (IsField("some_int_pointer", "int *"))); + REQUIRE_THAT( + mmd, (IsField("some_int_pointer_pointer", "int **"))); + + REQUIRE_THAT(mmd, IsAggregation(_A("R"), _A("A"), "+a")); + REQUIRE_THAT(mmd, IsAssociation(_A("R"), _A("B"), "+b")); + REQUIRE_THAT(mmd, IsAssociation(_A("R"), _A("C"), "+c")); + REQUIRE_THAT(mmd, IsAssociation(_A("R"), _A("D"), "+d")); + REQUIRE_THAT(mmd, IsAssociation(_A("R"), _A("E"), "+e")); + REQUIRE_THAT(mmd, IsAggregation(_A("R"), _A("F"), "+f")); + REQUIRE_THAT(mmd, IsAssociation(_A("R"), _A("G"), "+g")); + REQUIRE_THAT(mmd, IsAssociation(_A("R"), _A("H"), "+h")); + REQUIRE_THAT(mmd, IsAssociation(_A("R"), _A("I"), "+i")); + REQUIRE_THAT(mmd, IsAssociation(_A("R"), _A("J"), "+j")); + REQUIRE_THAT(mmd, IsAssociation(_A("R"), _A("K"), "+k")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", mmd); + } +} \ No newline at end of file diff --git a/tests/t00006/.clang-uml b/tests/t00006/.clang-uml index 9b44b117..1c2231a0 100644 --- a/tests/t00006/.clang-uml +++ b/tests/t00006/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00006_class: type: class diff --git a/tests/t00006/test_case.h b/tests/t00006/test_case.h index 3ed43aa1..2c28e1c1 100644 --- a/tests/t00006/test_case.h +++ b/tests/t00006/test_case.h @@ -29,52 +29,51 @@ TEST_CASE("t00006", "[test-case][class]") REQUIRE(model->name() == "t00006_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("G"))); - REQUIRE_THAT(puml, IsClass(_A("H"))); - REQUIRE_THAT(puml, IsClass(_A("I"))); - REQUIRE_THAT(puml, IsClass(_A("J"))); - REQUIRE_THAT(puml, IsClass(_A("K"))); - REQUIRE_THAT(puml, IsClass(_A("L"))); - REQUIRE_THAT(puml, IsClass(_A("M"))); - REQUIRE_THAT(puml, IsClass(_A("N"))); - REQUIRE_THAT(puml, IsClass(_A("NN"))); - REQUIRE_THAT(puml, IsClass(_A("NNN"))); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsClass(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("G"))); + REQUIRE_THAT(src, IsClass(_A("H"))); + REQUIRE_THAT(src, IsClass(_A("I"))); + REQUIRE_THAT(src, IsClass(_A("J"))); + REQUIRE_THAT(src, IsClass(_A("K"))); + REQUIRE_THAT(src, IsClass(_A("L"))); + REQUIRE_THAT(src, IsClass(_A("M"))); + REQUIRE_THAT(src, IsClass(_A("N"))); + REQUIRE_THAT(src, IsClass(_A("NN"))); + REQUIRE_THAT(src, IsClass(_A("NNN"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation( _A("custom_container"), _A("custom_container"))); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "+a")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("C"), "+c")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "+d")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("A"), "+a")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("B"), "+b")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("C"), "+c")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("D"), "+d")); REQUIRE_THAT( - puml, IsAggregation(_A("R"), _A("custom_container"), "+e")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("F"), "+f")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G"), "+g")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("H"), "+h")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("I"), "+i")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("J"), "+j")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "+k")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("L"), "+lm")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("M"), "+lm")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("N"), "+ns")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("NN"), "+ns")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("NNN"), "+ns")); + src, IsAggregation(_A("R"), _A("custom_container"), "+e")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("F"), "+f")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("G"), "+g")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("H"), "+h")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("I"), "+i")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("J"), "+j")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("K"), "+k")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("L"), "+lm")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("M"), "+lm")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("N"), "+ns")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("NN"), "+ns")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("NNN"), "+ns")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -104,6 +103,53 @@ TEST_CASE("t00006", "[test-case][class]") REQUIRE(IsInstantiation( j, "custom_container", "custom_container")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + using mermaid::AliasMatcher; + + AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsClass(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("G"))); + REQUIRE_THAT(src, IsClass(_A("H"))); + REQUIRE_THAT(src, IsClass(_A("I"))); + REQUIRE_THAT(src, IsClass(_A("J"))); + REQUIRE_THAT(src, IsClass(_A("K"))); + REQUIRE_THAT(src, IsClass(_A("L"))); + REQUIRE_THAT(src, IsClass(_A("M"))); + REQUIRE_THAT(src, IsClass(_A("N"))); + REQUIRE_THAT(src, IsClass(_A("NN"))); + REQUIRE_THAT(src, IsClass(_A("NNN"))); + + REQUIRE_THAT(src, + IsInstantiation( + _A("custom_container"), _A("custom_container"))); + + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("A"), "+a")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("B"), "+b")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("C"), "+c")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("D"), "+d")); + REQUIRE_THAT( + src, IsAggregation(_A("R"), _A("custom_container"), "+e")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("F"), "+f")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("G"), "+g")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("H"), "+h")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("I"), "+i")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("J"), "+j")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("K"), "+k")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("L"), "+lm")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("M"), "+lm")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("N"), "+ns")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("NN"), "+ns")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("NNN"), "+ns")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00007/.clang-uml b/tests/t00007/.clang-uml index 6bd80b76..c6e2cab5 100644 --- a/tests/t00007/.clang-uml +++ b/tests/t00007/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00007_class: type: class diff --git a/tests/t00007/test_case.h b/tests/t00007/test_case.h index ce80ef52..eaa3102f 100644 --- a/tests/t00007/test_case.h +++ b/tests/t00007/test_case.h @@ -29,22 +29,21 @@ TEST_CASE("t00007", "[test-case][class]") REQUIRE(model->name() == "t00007_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("R"))); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "+a")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "+b")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("C"), "+c")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("A"), "+a")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("B"), "+b")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("C"), "+c")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -59,6 +58,22 @@ TEST_CASE("t00007", "[test-case][class]") REQUIRE(IsAssociation(j, "R", "B", "b")); REQUIRE(IsAssociation(j, "R", "C", "c")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("R"))); + + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("A"), "+a")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("B"), "+b")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("C"), "+c")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00008/.clang-uml b/tests/t00008/.clang-uml index 07c18890..a46ad77c 100644 --- a/tests/t00008/.clang-uml +++ b/tests/t00008/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00008_class: type: class diff --git a/tests/t00008/test_case.h b/tests/t00008/test_case.h index f3288622..c0a03a36 100644 --- a/tests/t00008/test_case.h +++ b/tests/t00008/test_case.h @@ -29,35 +29,34 @@ TEST_CASE("t00008", "[test-case][class]") REQUIRE(model->name() == "t00008_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // TODO: add option to resolve using declared types // REQUIRE_THAT(puml, IsClassTemplate("A", "T, P, bool (*)(int, int), // int N")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T,P=T,CMP=nullptr,int N=3")); - REQUIRE_THAT(puml, IsClassTemplate("B", "T,C<>")); + REQUIRE_THAT(src, IsClassTemplate("A", "T,P=T,CMP=nullptr,int N=3")); + REQUIRE_THAT(src, IsClassTemplate("B", "T,C<>")); - REQUIRE_THAT(puml, (IsField("value", "T"))); - REQUIRE_THAT(puml, (IsField("pointer", "T *"))); - REQUIRE_THAT(puml, (IsField("reference", "T &"))); - REQUIRE_THAT(puml, (IsField("values", "std::vector

"))); - REQUIRE_THAT(puml, (IsField("ints", "std::array"))); + REQUIRE_THAT(src, (IsField("value", "T"))); + REQUIRE_THAT(src, (IsField("pointer", "T *"))); + REQUIRE_THAT(src, (IsField("reference", "T &"))); + REQUIRE_THAT(src, (IsField("values", "std::vector

"))); + REQUIRE_THAT(src, (IsField("ints", "std::array"))); // TODO: add option to resolve using declared types // REQUIRE_THAT(puml, IsField(Public("bool (*)(int, int) comparator"))); - REQUIRE_THAT(puml, (IsField("comparator", "CMP"))); + REQUIRE_THAT(src, (IsField("comparator", "CMP"))); - REQUIRE_THAT(puml, !IsClass(_A("E::nested_template"))); - REQUIRE_THAT(puml, IsClassTemplate("E::nested_template", "ET")); - REQUIRE_THAT(puml, IsClassTemplate("E::nested_template", "char")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, !IsClass(_A("E::nested_template"))); + REQUIRE_THAT(src, IsClassTemplate("E::nested_template", "ET")); + REQUIRE_THAT(src, IsClassTemplate("E::nested_template", "char")); + REQUIRE_THAT(src, IsInstantiation( _A("E::nested_template"), _A("E::nested_template"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -73,6 +72,34 @@ TEST_CASE("t00008", "[test-case][class]") REQUIRE(IsClassTemplate(j, "E::nested_template")); REQUIRE(IsClass(j, "E::nested_template")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + using mermaid::IsField; + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B>"))); + + REQUIRE_THAT(src, (IsField("value", "T"))); + REQUIRE_THAT(src, (IsField("pointer", "T *"))); + REQUIRE_THAT(src, (IsField("reference", "T &"))); + REQUIRE_THAT(src, (IsField("values", "std::vector

"))); + REQUIRE_THAT(src, (IsField("ints", "std::array"))); + // TODO: add option to resolve using declared types + // REQUIRE_THAT(puml, IsField(Public("bool (*)(int, int) comparator"))); + REQUIRE_THAT(src, (IsField("comparator", "CMP"))); + + REQUIRE_THAT(src, !IsClass(_A("E::nested_template"))); + REQUIRE_THAT(src, IsClass(_A("E::nested_template"))); + REQUIRE_THAT(src, IsClass(_A("E::nested_template"))); + REQUIRE_THAT(src, + IsInstantiation( + _A("E::nested_template"), _A("E::nested_template"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00009/.clang-uml b/tests/t00009/.clang-uml index fd2b5b38..fe115036 100644 --- a/tests/t00009/.clang-uml +++ b/tests/t00009/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00009_class: type: class diff --git a/tests/t00009/test_case.h b/tests/t00009/test_case.h index cbcae450..1946f432 100644 --- a/tests/t00009/test_case.h +++ b/tests/t00009/test_case.h @@ -29,32 +29,31 @@ TEST_CASE("t00009", "[test-case][class]") REQUIRE(model->name() == "t00009_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T")); - REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsClassTemplate("A", "T")); + REQUIRE_THAT(src, IsClass(_A("B"))); - REQUIRE_THAT(puml, (IsField("value", "T"))); - REQUIRE_THAT(puml, (IsField("aint", "A"))); - REQUIRE_THAT(puml, (IsField("astring", "A *"))); - REQUIRE_THAT(puml, - (IsField("avector", "A> &"))); - - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - - REQUIRE_THAT(puml, IsAggregation(_A("B"), _A("A"), "+aint")); + REQUIRE_THAT(src, (IsField("value", "T"))); + REQUIRE_THAT(src, (IsField("aint", "A"))); + REQUIRE_THAT(src, (IsField("astring", "A *"))); REQUIRE_THAT( - puml, IsAssociation(_A("B"), _A("A"), "+astring")); - REQUIRE_THAT(puml, + src, (IsField("avector", "A> &"))); + + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + + REQUIRE_THAT(src, IsAggregation(_A("B"), _A("A"), "+aint")); + REQUIRE_THAT( + src, IsAssociation(_A("B"), _A("A"), "+astring")); + REQUIRE_THAT(src, IsAssociation( _A("B"), _A("A>"), "+avector")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -71,6 +70,33 @@ TEST_CASE("t00009", "[test-case][class]") REQUIRE(IsField(j, "B", "astring", "A *")); REQUIRE(IsField(j, "B", "avector", "A> &")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsField; + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + + REQUIRE_THAT(src, (IsField("value", "T"))); + REQUIRE_THAT(src, (IsField("aint", "A"))); + REQUIRE_THAT(src, (IsField("astring", "A *"))); + REQUIRE_THAT( + src, (IsField("avector", "A> &"))); + + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + + REQUIRE_THAT(src, IsAggregation(_A("B"), _A("A"), "+aint")); + REQUIRE_THAT( + src, IsAssociation(_A("B"), _A("A"), "+astring")); + REQUIRE_THAT(src, + IsAssociation( + _A("B"), _A("A>"), "+avector")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00010/.clang-uml b/tests/t00010/.clang-uml index 1388e6f1..40230948 100644 --- a/tests/t00010/.clang-uml +++ b/tests/t00010/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00010_class: type: class diff --git a/tests/t00010/test_case.h b/tests/t00010/test_case.h index b527ab49..cd86ec6a 100644 --- a/tests/t00010/test_case.h +++ b/tests/t00010/test_case.h @@ -29,27 +29,26 @@ TEST_CASE("t00010", "[test-case][class]") REQUIRE(model->name() == "t00010_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T,P")); - REQUIRE_THAT(puml, IsClassTemplate("B", "T")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsClassTemplate("A", "T,P")); + REQUIRE_THAT(src, IsClassTemplate("B", "T")); - REQUIRE_THAT(puml, (IsField("astring", "A"))); - REQUIRE_THAT(puml, (IsField("aintstring", "B"))); + REQUIRE_THAT(src, (IsField("astring", "A"))); + REQUIRE_THAT(src, (IsField("aintstring", "B"))); REQUIRE_THAT( - puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("B"), _A("B"))); + src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("B"), _A("B"))); - REQUIRE_THAT(puml, - IsAggregation(_A("B"), _A("A"), "+astring")); - REQUIRE_THAT(puml, IsAggregation(_A("C"), _A("B"), "+aintstring")); + REQUIRE_THAT( + src, IsAggregation(_A("B"), _A("A"), "+astring")); + REQUIRE_THAT(src, IsAggregation(_A("C"), _A("B"), "+aintstring")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -64,6 +63,28 @@ TEST_CASE("t00010", "[test-case][class]") REQUIRE(IsField(j, "C", "aintstring", "B")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsField; + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + + REQUIRE_THAT(src, (IsField("astring", "A"))); + REQUIRE_THAT(src, (IsField("aintstring", "B"))); + + REQUIRE_THAT( + src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("B"), _A("B"))); + + REQUIRE_THAT( + src, IsAggregation(_A("B"), _A("A"), "+astring")); + REQUIRE_THAT(src, IsAggregation(_A("C"), _A("B"), "+aintstring")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00011/.clang-uml b/tests/t00011/.clang-uml index 69ef8449..96f0f3bb 100644 --- a/tests/t00011/.clang-uml +++ b/tests/t00011/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00011_class: type: class diff --git a/tests/t00011/test_case.h b/tests/t00011/test_case.h index 99eabbdb..a59c6155 100644 --- a/tests/t00011/test_case.h +++ b/tests/t00011/test_case.h @@ -29,22 +29,19 @@ TEST_CASE("t00011", "[test-case][class]") REQUIRE(model->name() == "t00011_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, !IsClass(_A("external::C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, !IsClass(_A("external::C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsAssociation(_A("B"), _A("A"))); - REQUIRE_THAT(puml, IsFriend(_A("A"), _A("B"))); + REQUIRE_THAT(src, IsAssociation(_A("B"), _A("A"))); + REQUIRE_THAT(src, IsFriend(_A("A"), _A("B"))); // REQUIRE_THAT(puml, IsFriend(_A("A"), _A("D"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -56,6 +53,23 @@ TEST_CASE("t00011", "[test-case][class]") REQUIRE(IsClassTemplate(j, "D")); REQUIRE(IsFriend(j, "A", "B")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsFriend; + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, !IsClass(_A("external::C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + + REQUIRE_THAT(src, IsAssociation(_A("B"), _A("A"))); + REQUIRE_THAT(src, IsFriend(_A("A"), _A("B"))); + // REQUIRE_THAT(src, IsFriend(_A("A"), _A("D"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00012/.clang-uml b/tests/t00012/.clang-uml index a841c472..bb52415c 100644 --- a/tests/t00012/.clang-uml +++ b/tests/t00012/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00012_class: type: class diff --git a/tests/t00012/test_case.h b/tests/t00012/test_case.h index 0d3d4d59..3145eda6 100644 --- a/tests/t00012/test_case.h +++ b/tests/t00012/test_case.h @@ -29,25 +29,24 @@ TEST_CASE("t00012", "[test-case][class]") REQUIRE(model->name() == "t00012_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T,Ts...")); - REQUIRE_THAT(puml, IsClassTemplate("B", "int... Is")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsClassTemplate("A", "T,Ts...")); + REQUIRE_THAT(src, IsClassTemplate("B", "int... Is")); - REQUIRE_THAT(puml, IsInstantiation(_A("B"), _A("B<3,2,1>"))); + REQUIRE_THAT(src, IsInstantiation(_A("B"), _A("B<3,2,1>"))); REQUIRE_THAT( - puml, IsInstantiation(_A("B"), _A("B<1,1,1,1>"))); - REQUIRE_THAT(puml, + src, IsInstantiation(_A("B"), _A("B<1,1,1,1>"))); + REQUIRE_THAT(src, IsInstantiation(_A("C"), _A("C>>>,3,3," "3>"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -62,6 +61,25 @@ TEST_CASE("t00012", "[test-case][class]") "C>>>" ",3,3,3>")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + + REQUIRE_THAT(src, IsInstantiation(_A("B"), _A("B<3,2,1>"))); + REQUIRE_THAT( + src, IsInstantiation(_A("B"), _A("B<1,1,1,1>"))); + REQUIRE_THAT(src, + IsInstantiation(_A("C"), + _A("C>>>,3,3," + "3>"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00013/.clang-uml b/tests/t00013/.clang-uml index 0b71bf39..60c3939d 100644 --- a/tests/t00013/.clang-uml +++ b/tests/t00013/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00013_class: type: class diff --git a/tests/t00013/test_case.h b/tests/t00013/test_case.h index 14db1799..9dfd2281 100644 --- a/tests/t00013/test_case.h +++ b/tests/t00013/test_case.h @@ -29,41 +29,40 @@ TEST_CASE("t00013", "[test-case][class]") REQUIRE(model->name() == "t00013_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClassTemplate("E", "T")); - REQUIRE_THAT(puml, IsClassTemplate("G", "T,Args...")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClassTemplate("E", "T")); + REQUIRE_THAT(src, IsClassTemplate("G", "T,Args...")); - REQUIRE_THAT(puml, !IsDependency(_A("R"), _A("R"))); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A"))); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("B"))); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("C"))); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("D"))); - REQUIRE_THAT(puml, IsDependency(_A("D"), _A("R"))); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("E"))); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("E"))); - REQUIRE_THAT(puml, IsInstantiation(_A("E"), _A("E"))); - REQUIRE_THAT(puml, IsInstantiation(_A("E"), _A("E"))); + REQUIRE_THAT(src, !IsDependency(_A("R"), _A("R"))); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("A"))); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("B"))); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("C"))); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("D"))); + REQUIRE_THAT(src, IsDependency(_A("D"), _A("R"))); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("E"))); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("E"))); + REQUIRE_THAT(src, IsInstantiation(_A("E"), _A("E"))); + REQUIRE_THAT(src, IsInstantiation(_A("E"), _A("E"))); REQUIRE_THAT( - puml, IsAggregation(_A("R"), _A("E"), "-estring")); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("ABCD::F"))); + src, IsAggregation(_A("R"), _A("E"), "-estring")); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("ABCD::F"))); REQUIRE_THAT( - puml, IsInstantiation(_A("ABCD::F"), _A("ABCD::F"))); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("ABCD::F"))); + src, IsInstantiation(_A("ABCD::F"), _A("ABCD::F"))); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("ABCD::F"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation( _A("G"), _A("G"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -83,6 +82,41 @@ TEST_CASE("t00013", "[test-case][class]") REQUIRE(IsDependency(j, "R", "E")); REQUIRE(IsInstantiation(j, "G", "G")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsClass(_A("G"))); + + REQUIRE_THAT(src, !IsDependency(_A("R"), _A("R"))); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("A"))); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("B"))); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("C"))); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("D"))); + REQUIRE_THAT(src, IsDependency(_A("D"), _A("R"))); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("E"))); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("E"))); + REQUIRE_THAT(src, IsInstantiation(_A("E"), _A("E"))); + REQUIRE_THAT(src, IsInstantiation(_A("E"), _A("E"))); + REQUIRE_THAT( + src, IsAggregation(_A("R"), _A("E"), "-estring")); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("ABCD::F"))); + REQUIRE_THAT( + src, IsInstantiation(_A("ABCD::F"), _A("ABCD::F"))); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("ABCD::F"))); + + REQUIRE_THAT(src, + IsInstantiation( + _A("G"), _A("G"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00014/.clang-uml b/tests/t00014/.clang-uml index 9c3c64e6..59ebf08d 100644 --- a/tests/t00014/.clang-uml +++ b/tests/t00014/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00014_class: type: class @@ -12,4 +12,7 @@ diagrams: - clanguml::t00014 plantuml: before: - - left to right direction \ No newline at end of file + - left to right direction + mermaid: + before: + - direction LR \ No newline at end of file diff --git a/tests/t00014/test_case.h b/tests/t00014/test_case.h index 2fb40c44..50ab931f 100644 --- a/tests/t00014/test_case.h +++ b/tests/t00014/test_case.h @@ -29,125 +29,121 @@ TEST_CASE("t00014", "[test-case][class]") REQUIRE(model->name() == "t00014_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, !Contains("type-parameter-")); + REQUIRE_THAT(src, !Contains("type-parameter-")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T,P")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T,std::string")); + REQUIRE_THAT(src, IsClassTemplate("A", "T,P")); + REQUIRE_THAT(src, IsClassTemplate("A", "T,std::string")); REQUIRE_THAT( - puml, IsClassTemplate("A", "T,std::unique_ptr")); - REQUIRE_THAT(puml, IsClassTemplate("A", "double,T")); + src, IsClassTemplate("A", "T,std::unique_ptr")); + REQUIRE_THAT(src, IsClassTemplate("A", "double,T")); // TODO: Figure out how to handle the same templates with different // template // parameter names // REQUIRE_THAT(puml, !IsClassTemplate("A", "long,U")); - REQUIRE_THAT(puml, IsClassTemplate("A", "long,T")); - REQUIRE_THAT(puml, IsClassTemplate("A", "long,bool")); - REQUIRE_THAT(puml, IsClassTemplate("A", "double,bool")); - REQUIRE_THAT(puml, IsClassTemplate("A", "long,float")); - REQUIRE_THAT(puml, IsClassTemplate("A", "double,float")); - REQUIRE_THAT(puml, IsClassTemplate("A", "bool,std::string")); - REQUIRE_THAT(puml, IsClassTemplate("A", "std::string,std::string")); - REQUIRE_THAT(puml, IsClassTemplate("A", "char,std::string")); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClassTemplate("R", "T")); + REQUIRE_THAT(src, IsClassTemplate("A", "long,T")); + REQUIRE_THAT(src, IsClassTemplate("A", "long,bool")); + REQUIRE_THAT(src, IsClassTemplate("A", "double,bool")); + REQUIRE_THAT(src, IsClassTemplate("A", "long,float")); + REQUIRE_THAT(src, IsClassTemplate("A", "double,float")); + REQUIRE_THAT(src, IsClassTemplate("A", "bool,std::string")); + REQUIRE_THAT(src, IsClassTemplate("A", "std::string,std::string")); + REQUIRE_THAT(src, IsClassTemplate("A", "char,std::string")); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClassTemplate("R", "T")); - REQUIRE_THAT(puml, IsField("bapair", "PairPairBA")); - REQUIRE_THAT(puml, IsField("abool", "APtr")); - REQUIRE_THAT(puml, IsField("aboolfloat", "AAPtr")); - REQUIRE_THAT(puml, IsField("afloat", "ASharedPtr")); + REQUIRE_THAT(src, IsField("bapair", "PairPairBA")); + REQUIRE_THAT(src, IsField("abool", "APtr")); + REQUIRE_THAT(src, IsField("aboolfloat", "AAPtr")); + REQUIRE_THAT(src, IsField("afloat", "ASharedPtr")); REQUIRE_THAT( - puml, IsField("boolstring", "A")); - REQUIRE_THAT( - puml, IsField("floatstring", "AStringPtr")); - REQUIRE_THAT(puml, IsField("atfloat", "AAPtr")); + src, IsField("boolstring", "A")); + REQUIRE_THAT(src, IsField("floatstring", "AStringPtr")); + REQUIRE_THAT(src, IsField("atfloat", "AAPtr")); - REQUIRE_THAT(puml, IsField("intstring", "AIntString")); - REQUIRE_THAT(puml, IsField("stringstring", "AStringString")); - REQUIRE_THAT(puml, IsField("bstringstring", "BStringString")); + REQUIRE_THAT(src, IsField("intstring", "AIntString")); + REQUIRE_THAT(src, IsField("stringstring", "AStringString")); + REQUIRE_THAT(src, IsField("bstringstring", "BStringString")); - REQUIRE_THAT(puml, IsField("bs", "BVector")); + REQUIRE_THAT(src, IsField("bs", "BVector")); - REQUIRE_THAT( - puml, IsField("cb", "SimpleCallback")); + REQUIRE_THAT(src, IsField("cb", "SimpleCallback")); #if LLVM_VERSION_MAJOR >= 16 REQUIRE_THAT( - puml, IsField("gcb", "GenericCallback")); + src, IsField("gcb", "GenericCallback")); #else REQUIRE_THAT( - puml, IsField("gcb", "GenericCallback")); + src, IsField("gcb", "GenericCallback")); #endif - REQUIRE_THAT(puml, IsField("vcb", "VoidCallback")); - - REQUIRE_THAT(puml, - !IsClassTemplate("std::std::function", "void(T...,int),int)")); + REQUIRE_THAT(src, IsField("vcb", "VoidCallback")); REQUIRE_THAT( - puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT( - puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT( - puml, IsInstantiation(_A("A"), _A("A"))); + src, !IsClassTemplate("std::std::function", "void(T...,int),int)")); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT( + src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT( + src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); // REQUIRE_THAT(puml, !IsInstantiation(_A("A"), // _A("A"))); REQUIRE_THAT( - puml, IsInstantiation(_A("A"), _A("A"))); + src, IsInstantiation(_A("A"), _A("A"))); REQUIRE_THAT( - puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); REQUIRE_THAT( - puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, + src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation( _A("A"), _A("A"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation(_A("A>"), _A("A>"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation( _A("A"), _A("A>"))); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "+vps")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("B"), "-bapair")); - REQUIRE_THAT(puml, - IsAggregation(_A("R"), _A("A"), "-aboolfloat")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("B"), "+vps")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("B"), "-bapair")); REQUIRE_THAT( - puml, IsAggregation(_A("R"), _A("A"), "-bapair")); - REQUIRE_THAT(puml, + src, IsAggregation(_A("R"), _A("A"), "-aboolfloat")); + REQUIRE_THAT( + src, IsAggregation(_A("R"), _A("A"), "-bapair")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("A"), "-aboolfloat")); REQUIRE_THAT( - puml, IsAggregation(_A("R"), _A("A"), "-atfloat")); + src, IsAggregation(_A("R"), _A("A"), "-atfloat")); REQUIRE_THAT( - puml, IsAggregation(_A("R"), _A("A"), "-atfloat")); + src, IsAggregation(_A("R"), _A("A"), "-atfloat")); REQUIRE_THAT( - puml, IsAssociation(_A("R"), _A("A"), "-afloat")); - REQUIRE_THAT(puml, + src, IsAssociation(_A("R"), _A("A"), "-afloat")); + REQUIRE_THAT(src, IsAggregation( _A("R"), _A("A"), "-boolstring")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("A>"), "-floatstring")); #if !defined(__APPLE__) // TODO(#176) - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("A"))); + REQUIRE_THAT(src, IsDependency(_A("R"), _A("A"))); REQUIRE_THAT( - puml, IsDependency(_A("R"), _A("A"))); + src, IsDependency(_A("R"), _A("A"))); #endif - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -168,6 +164,122 @@ TEST_CASE("t00014", "[test-case][class]") REQUIRE(json::IsClass(j, "A")); REQUIRE(json::IsClass(j, "A")); REQUIRE(json::IsClass(j, "B")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsField; + + REQUIRE_THAT(src, !Contains("type-parameter-")); + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A>"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + // TODO: Figure out how to handle the same templates with different + // template + // parameter names + // REQUIRE_THAT(puml, !IsClass("A", "long,U")); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("R"))); + + REQUIRE_THAT(src, IsField("bapair", "PairPairBA")); + REQUIRE_THAT(src, IsField("abool", "APtr")); + REQUIRE_THAT(src, IsField("aboolfloat", "AAPtr")); + REQUIRE_THAT(src, IsField("afloat", "ASharedPtr")); + REQUIRE_THAT( + src, IsField("boolstring", "A")); + REQUIRE_THAT(src, IsField("floatstring", "AStringPtr")); + REQUIRE_THAT(src, IsField("atfloat", "AAPtr")); + + REQUIRE_THAT(src, IsField("intstring", "AIntString")); + REQUIRE_THAT(src, IsField("stringstring", "AStringString")); + REQUIRE_THAT(src, IsField("bstringstring", "BStringString")); + + REQUIRE_THAT(src, IsField("bs", "BVector")); + + REQUIRE_THAT(src, IsField("cb", "SimpleCallback")); +#if LLVM_VERSION_MAJOR >= 16 + REQUIRE_THAT( + src, IsField("gcb", "GenericCallback")); +#else + REQUIRE_THAT( + src, IsField("gcb", "GenericCallback")); +#endif + REQUIRE_THAT(src, IsField("vcb", "VoidCallback")); + + REQUIRE_THAT( + src, !IsClassTemplate("std::std::function", "void(T...,int),int)")); + + REQUIRE_THAT( + src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT( + src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + // REQUIRE_THAT(puml, !IsInstantiation(_A("A"), + // _A("A"))); + REQUIRE_THAT( + src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT( + src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT( + src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, + IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, + IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, + IsInstantiation( + _A("A"), _A("A"))); + + REQUIRE_THAT(src, + IsInstantiation(_A("A>"), + _A("A>"))); + REQUIRE_THAT(src, + IsInstantiation( + _A("A"), _A("A>"))); + + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("B"), "+vps")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("B"), "-bapair")); + REQUIRE_THAT( + src, IsAggregation(_A("R"), _A("A"), "-aboolfloat")); + REQUIRE_THAT( + src, IsAggregation(_A("R"), _A("A"), "-bapair")); + REQUIRE_THAT(src, + IsAggregation(_A("R"), _A("A"), "-aboolfloat")); + REQUIRE_THAT( + src, IsAggregation(_A("R"), _A("A"), "-atfloat")); + REQUIRE_THAT( + src, IsAggregation(_A("R"), _A("A"), "-atfloat")); + REQUIRE_THAT( + src, IsAssociation(_A("R"), _A("A"), "-afloat")); + REQUIRE_THAT(src, + IsAggregation( + _A("R"), _A("A"), "-boolstring")); + REQUIRE_THAT(src, + IsAggregation(_A("R"), + _A("A>"), "-floatstring")); +#if !defined(__APPLE__) + // TODO(#176) + REQUIRE_THAT(src, IsDependency(_A("R"), _A("A"))); + REQUIRE_THAT( + src, IsDependency(_A("R"), _A("A"))); +#endif + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00015/.clang-uml b/tests/t00015/.clang-uml index 38a6ceb5..205cf0a3 100644 --- a/tests/t00015/.clang-uml +++ b/tests/t00015/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00015_class: type: class diff --git a/tests/t00015/test_case.h b/tests/t00015/test_case.h index 604c968c..17e930d6 100644 --- a/tests/t00015/test_case.h +++ b/tests/t00015/test_case.h @@ -29,19 +29,18 @@ TEST_CASE("t00015", "[test-case][class]") REQUIRE(model->name() == "t00015_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("ns1::A"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::ns2_v0_9_0::A"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::Anon"))); - REQUIRE_THAT(puml, IsClass(_A("ns3::ns1::ns2::Anon"))); - REQUIRE_THAT(puml, IsClass(_A("ns3::B"))); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsClass(_A("ns1::A"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2_v0_9_0::A"))); + REQUIRE_THAT(src, IsClass(_A("ns1::Anon"))); + REQUIRE_THAT(src, IsClass(_A("ns3::ns1::ns2::Anon"))); + REQUIRE_THAT(src, IsClass(_A("ns3::B"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -54,6 +53,19 @@ TEST_CASE("t00015", "[test-case][class]") REQUIRE(IsClass(j, "ns3::ns1::ns2::Anon")); REQUIRE(IsClass(j, "ns3::B")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("ns1::A"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2_v0_9_0::A"))); + REQUIRE_THAT(src, IsClass(_A("ns1::Anon"))); + REQUIRE_THAT(src, IsClass(_A("ns3::ns1::ns2::Anon"))); + REQUIRE_THAT(src, IsClass(_A("ns3::B"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00016/.clang-uml b/tests/t00016/.clang-uml index 31881559..300fb4b6 100644 --- a/tests/t00016/.clang-uml +++ b/tests/t00016/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00016_class: type: class diff --git a/tests/t00016/test_case.h b/tests/t00016/test_case.h index e4ead1e0..bbafe446 100644 --- a/tests/t00016/test_case.h +++ b/tests/t00016/test_case.h @@ -29,31 +29,30 @@ TEST_CASE("t00016", "[test-case][class]") REQUIRE(model->name() == "t00016_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "typename")); - REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "int")); - REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "bool")); - REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "char")); - REQUIRE_THAT(puml, IsClassTemplate("is_numeric", "float")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsClassTemplate("is_numeric", "typename")); + REQUIRE_THAT(src, IsClassTemplate("is_numeric", "int")); + REQUIRE_THAT(src, IsClassTemplate("is_numeric", "bool")); + REQUIRE_THAT(src, IsClassTemplate("is_numeric", "char")); + REQUIRE_THAT(src, IsClassTemplate("is_numeric", "float")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation(_A("is_numeric"), _A("is_numeric"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation( _A("is_numeric"), _A("is_numeric"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation( _A("is_numeric"), _A("is_numeric"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation( _A("is_numeric"), _A("is_numeric"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -66,6 +65,31 @@ TEST_CASE("t00016", "[test-case][class]") REQUIRE(IsClass(j, "is_numeric")); REQUIRE(IsClass(j, "is_numeric")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("is_numeric"))); + REQUIRE_THAT(src, IsClass(_A("is_numeric"))); + REQUIRE_THAT(src, IsClass(_A("is_numeric"))); + REQUIRE_THAT(src, IsClass(_A("is_numeric"))); + REQUIRE_THAT(src, IsClass(_A("is_numeric"))); + + REQUIRE_THAT(src, + IsInstantiation(_A("is_numeric"), _A("is_numeric"))); + REQUIRE_THAT(src, + IsInstantiation( + _A("is_numeric"), _A("is_numeric"))); + REQUIRE_THAT(src, + IsInstantiation( + _A("is_numeric"), _A("is_numeric"))); + REQUIRE_THAT(src, + IsInstantiation( + _A("is_numeric"), _A("is_numeric"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00017/.clang-uml b/tests/t00017/.clang-uml index e6942ec3..d0f1302b 100644 --- a/tests/t00017/.clang-uml +++ b/tests/t00017/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00017_class: type: class diff --git a/tests/t00017/test_case.h b/tests/t00017/test_case.h index 41db6e1e..f41b6b5a 100644 --- a/tests/t00017/test_case.h +++ b/tests/t00017/test_case.h @@ -29,47 +29,46 @@ TEST_CASE("t00017", "[test-case][class]") REQUIRE(model->name() == "t00017_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("G"))); - REQUIRE_THAT(puml, IsClass(_A("H"))); - REQUIRE_THAT(puml, IsClass(_A("I"))); - REQUIRE_THAT(puml, IsClass(_A("J"))); - REQUIRE_THAT(puml, IsClass(_A("K"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsClass(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("G"))); + REQUIRE_THAT(src, IsClass(_A("H"))); + REQUIRE_THAT(src, IsClass(_A("I"))); + REQUIRE_THAT(src, IsClass(_A("J"))); + REQUIRE_THAT(src, IsClass(_A("K"))); + REQUIRE_THAT(src, IsClass(_A("R"))); - REQUIRE_THAT(puml, (IsField("some_int", "int"))); - REQUIRE_THAT(puml, (IsField("some_int_pointer", "int *"))); + REQUIRE_THAT(src, (IsField("some_int", "int"))); + REQUIRE_THAT(src, (IsField("some_int_pointer", "int *"))); REQUIRE_THAT( - puml, (IsField("some_int_pointer_pointer", "int **"))); + src, (IsField("some_int_pointer_pointer", "int **"))); // Relationship members should not be rendered as part of this testcase - REQUIRE_THAT(puml, !(IsField("a", _A("A")))); - REQUIRE_THAT(puml, !(IsField("b", _A("B")))); + REQUIRE_THAT(src, !(IsField("a", _A("A")))); + REQUIRE_THAT(src, !(IsField("b", _A("B")))); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("A"), "-a")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("B"), "-b")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("C"), "-c")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "-d")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("E"), "-e")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("F"), "-f")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G"), "-g")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("H"), "-h")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("I"), "-i")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("J"), "-j")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("K"), "-k")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("A"), "-a")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("B"), "-b")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("C"), "-c")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("D"), "-d")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("E"), "-e")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("F"), "-f")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("G"), "-g")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("H"), "-h")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("I"), "-i")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("J"), "-j")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("K"), "-k")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -89,6 +88,47 @@ TEST_CASE("t00017", "[test-case][class]") REQUIRE(IsClass(j, "K")); REQUIRE(IsClass(j, "R")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + mermaid::AliasMatcher _A(src); + using mermaid::IsField; + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsClass(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("G"))); + REQUIRE_THAT(src, IsClass(_A("H"))); + REQUIRE_THAT(src, IsClass(_A("I"))); + REQUIRE_THAT(src, IsClass(_A("J"))); + REQUIRE_THAT(src, IsClass(_A("K"))); + REQUIRE_THAT(src, IsClass(_A("R"))); + + REQUIRE_THAT(src, (IsField("some_int", "int"))); + REQUIRE_THAT(src, (IsField("some_int_pointer", "int *"))); + REQUIRE_THAT( + src, (IsField("some_int_pointer_pointer", "int **"))); + + // Relationship members should not be rendered as part of this testcase + REQUIRE_THAT(src, !(IsField("a", _A("A")))); + REQUIRE_THAT(src, !(IsField("b", _A("B")))); + + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("A"), "-a")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("B"), "-b")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("C"), "-c")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("D"), "-d")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("E"), "-e")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("F"), "-f")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("G"), "-g")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("H"), "-h")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("I"), "-i")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("J"), "-j")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("K"), "-k")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00018/.clang-uml b/tests/t00018/.clang-uml index ed13b17f..ab7fa538 100644 --- a/tests/t00018/.clang-uml +++ b/tests/t00018/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00018_class: type: class diff --git a/tests/t00018/test_case.h b/tests/t00018/test_case.h index a35be404..9f3f2f0f 100644 --- a/tests/t00018/test_case.h +++ b/tests/t00018/test_case.h @@ -29,21 +29,20 @@ TEST_CASE("t00018", "[test-case][class]") REQUIRE(model->name() == "t00018_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("widget"))); - REQUIRE_THAT(puml, IsClass(_A("impl::widget"))); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsClass(_A("widget"))); + REQUIRE_THAT(src, IsClass(_A("impl::widget"))); REQUIRE_THAT( - puml, IsAggregation(_A("widget"), _A("impl::widget"), "-pImpl")); - REQUIRE_THAT(puml, IsDependency(_A("impl::widget"), _A("widget"))); - REQUIRE_THAT(puml, !IsDependency(_A("widget"), _A("widget"))); + src, IsAggregation(_A("widget"), _A("impl::widget"), "-pImpl")); + REQUIRE_THAT(src, IsDependency(_A("impl::widget"), _A("widget"))); + REQUIRE_THAT(src, !IsDependency(_A("widget"), _A("widget"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -54,6 +53,20 @@ TEST_CASE("t00018", "[test-case][class]") REQUIRE(IsClass(j, "impl::widget")); REQUIRE(IsDependency(j, "impl::widget", "widget")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("widget"))); + REQUIRE_THAT(src, IsClass(_A("impl::widget"))); + + REQUIRE_THAT( + src, IsAggregation(_A("widget"), _A("impl::widget"), "-pImpl")); + REQUIRE_THAT(src, IsDependency(_A("impl::widget"), _A("widget"))); + REQUIRE_THAT(src, !IsDependency(_A("widget"), _A("widget"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00019/.clang-uml b/tests/t00019/.clang-uml index 6a6df084..b4c73903 100644 --- a/tests/t00019/.clang-uml +++ b/tests/t00019/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00019_class: type: class diff --git a/tests/t00019/test_case.h b/tests/t00019/test_case.h index 8b0a4332..b8b4dc35 100644 --- a/tests/t00019/test_case.h +++ b/tests/t00019/test_case.h @@ -29,48 +29,47 @@ TEST_CASE("t00019", "[test-case][class]") REQUIRE(model->name() == "t00019_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("Base"))); - REQUIRE_THAT(puml, IsClassTemplate("Layer1", "LowerLayer")); - REQUIRE_THAT(puml, IsClassTemplate("Layer2", "LowerLayer")); - REQUIRE_THAT(puml, IsClassTemplate("Layer3", "LowerLayer")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsClass(_A("Base"))); + REQUIRE_THAT(src, IsClassTemplate("Layer1", "LowerLayer")); + REQUIRE_THAT(src, IsClassTemplate("Layer2", "LowerLayer")); + REQUIRE_THAT(src, IsClassTemplate("Layer3", "LowerLayer")); - REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("Layer3"))); - REQUIRE_THAT(puml, !IsDependency(_A("Base"), _A("Layer3"))); + REQUIRE_THAT(src, IsBaseClass(_A("Base"), _A("Layer3"))); + REQUIRE_THAT(src, !IsDependency(_A("Base"), _A("Layer3"))); REQUIRE_THAT( - puml, IsBaseClass(_A("Layer3"), _A("Layer2>"))); - REQUIRE_THAT(puml, - !IsDependency(_A("Layer3"), _A("Layer2>"))); + src, IsBaseClass(_A("Layer3"), _A("Layer2>"))); + REQUIRE_THAT( + src, !IsDependency(_A("Layer3"), _A("Layer2>"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsBaseClass(_A("Layer2>"), _A("Layer1>>"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, !IsDependency(_A("Layer2>"), _A("Layer1>>"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsAggregation( _A("A"), _A("Layer1>>"), "+layers")); REQUIRE_THAT( - puml, !IsDependency(_A("A"), _A("Layer1>>"))); + src, !IsDependency(_A("A"), _A("Layer1>>"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, !IsAggregation(_A("A"), _A("Layer2>"), "+layers")); REQUIRE_THAT( - puml, !IsAggregation(_A("A"), _A("Layer3"), "+layers")); + src, !IsAggregation(_A("A"), _A("Layer3"), "+layers")); - REQUIRE_THAT(puml, !IsAggregation(_A("A"), _A("Base"), "+layers")); + REQUIRE_THAT(src, !IsAggregation(_A("A"), _A("Base"), "+layers")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -82,6 +81,48 @@ TEST_CASE("t00019", "[test-case][class]") REQUIRE(IsClassTemplate(j, "Layer2")); REQUIRE(IsClassTemplate(j, "Layer3")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("Base"))); + REQUIRE_THAT(src, IsClass(_A("Layer1"))); + REQUIRE_THAT(src, IsClass(_A("Layer2"))); + REQUIRE_THAT(src, IsClass(_A("Layer3"))); + + REQUIRE_THAT(src, IsBaseClass(_A("Base"), _A("Layer3"))); + REQUIRE_THAT(src, !IsDependency(_A("Base"), _A("Layer3"))); + + REQUIRE_THAT( + src, IsBaseClass(_A("Layer3"), _A("Layer2>"))); + REQUIRE_THAT( + src, !IsDependency(_A("Layer3"), _A("Layer2>"))); + + REQUIRE_THAT(src, + IsBaseClass(_A("Layer2>"), + _A("Layer1>>"))); + + REQUIRE_THAT(src, + !IsDependency(_A("Layer2>"), + _A("Layer1>>"))); + + REQUIRE_THAT(src, + IsAggregation( + _A("A"), _A("Layer1>>"), "+layers")); + REQUIRE_THAT( + src, !IsDependency(_A("A"), _A("Layer1>>"))); + + REQUIRE_THAT(src, + !IsAggregation(_A("A"), _A("Layer2>"), "+layers")); + + REQUIRE_THAT( + src, !IsAggregation(_A("A"), _A("Layer3"), "+layers")); + + REQUIRE_THAT(src, !IsAggregation(_A("A"), _A("Base"), "+layers")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00020/.clang-uml b/tests/t00020/.clang-uml index b24214be..5bac46fb 100644 --- a/tests/t00020/.clang-uml +++ b/tests/t00020/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00020_class: type: class diff --git a/tests/t00020/test_case.h b/tests/t00020/test_case.h index e712d770..e64a9463 100644 --- a/tests/t00020/test_case.h +++ b/tests/t00020/test_case.h @@ -29,23 +29,22 @@ TEST_CASE("t00020", "[test-case][class]") REQUIRE(model->name() == "t00020_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsAbstractClass(_A("ProductA"))); - REQUIRE_THAT(puml, IsAbstractClass(_A("ProductB"))); - REQUIRE_THAT(puml, IsClass(_A("ProductA1"))); - REQUIRE_THAT(puml, IsClass(_A("ProductA2"))); - REQUIRE_THAT(puml, IsClass(_A("ProductB1"))); - REQUIRE_THAT(puml, IsClass(_A("ProductB2"))); - REQUIRE_THAT(puml, IsAbstractClass(_A("AbstractFactory"))); - REQUIRE_THAT(puml, IsClass(_A("Factory1"))); - REQUIRE_THAT(puml, IsClass(_A("Factory2"))); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsAbstractClass(_A("ProductA"))); + REQUIRE_THAT(src, IsAbstractClass(_A("ProductB"))); + REQUIRE_THAT(src, IsClass(_A("ProductA1"))); + REQUIRE_THAT(src, IsClass(_A("ProductA2"))); + REQUIRE_THAT(src, IsClass(_A("ProductB1"))); + REQUIRE_THAT(src, IsClass(_A("ProductB2"))); + REQUIRE_THAT(src, IsAbstractClass(_A("AbstractFactory"))); + REQUIRE_THAT(src, IsClass(_A("Factory1"))); + REQUIRE_THAT(src, IsClass(_A("Factory2"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -58,6 +57,24 @@ TEST_CASE("t00020", "[test-case][class]") REQUIRE(IsClass(j, "ProductB2")); REQUIRE(IsAbstractClass(j, "AbstractFactory")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsAbstractClass; + + REQUIRE_THAT(src, IsAbstractClass(_A("ProductA"))); + REQUIRE_THAT(src, IsAbstractClass(_A("ProductB"))); + REQUIRE_THAT(src, IsClass(_A("ProductA1"))); + REQUIRE_THAT(src, IsClass(_A("ProductA2"))); + REQUIRE_THAT(src, IsClass(_A("ProductB1"))); + REQUIRE_THAT(src, IsClass(_A("ProductB2"))); + REQUIRE_THAT(src, IsAbstractClass(_A("AbstractFactory"))); + REQUIRE_THAT(src, IsClass(_A("Factory1"))); + REQUIRE_THAT(src, IsClass(_A("Factory2"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00021/.clang-uml b/tests/t00021/.clang-uml index 0f7c063a..f221d426 100644 --- a/tests/t00021/.clang-uml +++ b/tests/t00021/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00021_class: type: class diff --git a/tests/t00021/test_case.h b/tests/t00021/test_case.h index 953f22a4..1451d2ec 100644 --- a/tests/t00021/test_case.h +++ b/tests/t00021/test_case.h @@ -29,21 +29,20 @@ TEST_CASE("t00021", "[test-case][class]") REQUIRE(model->name() == "t00021_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsAbstractClass(_A("Item"))); - REQUIRE_THAT(puml, IsAbstractClass(_A("Visitor"))); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("Visitor1"))); - REQUIRE_THAT(puml, IsClass(_A("Visitor2"))); - REQUIRE_THAT(puml, IsClass(_A("Visitor3"))); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsAbstractClass(_A("Item"))); + REQUIRE_THAT(src, IsAbstractClass(_A("Visitor"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("Visitor1"))); + REQUIRE_THAT(src, IsClass(_A("Visitor2"))); + REQUIRE_THAT(src, IsClass(_A("Visitor3"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -54,6 +53,22 @@ TEST_CASE("t00021", "[test-case][class]") REQUIRE(IsClass(j, "Visitor2")); REQUIRE(IsAbstractClass(j, "Item")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsAbstractClass; + + REQUIRE_THAT(src, IsAbstractClass(_A("Item"))); + REQUIRE_THAT(src, IsAbstractClass(_A("Visitor"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("Visitor1"))); + REQUIRE_THAT(src, IsClass(_A("Visitor2"))); + REQUIRE_THAT(src, IsClass(_A("Visitor3"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00022/.clang-uml b/tests/t00022/.clang-uml index 6cebb830..08421149 100644 --- a/tests/t00022/.clang-uml +++ b/tests/t00022/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00022_class: type: class diff --git a/tests/t00022/test_case.h b/tests/t00022/test_case.h index 6c258ab7..3294ce30 100644 --- a/tests/t00022/test_case.h +++ b/tests/t00022/test_case.h @@ -29,17 +29,16 @@ TEST_CASE("t00022", "[test-case][class]") REQUIRE(model->name() == "t00022_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsAbstractClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("A1"))); - REQUIRE_THAT(puml, IsClass(_A("A2"))); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsAbstractClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A1"))); + REQUIRE_THAT(src, IsClass(_A("A2"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -50,6 +49,17 @@ TEST_CASE("t00022", "[test-case][class]") REQUIRE(IsClass(j, "A2")); REQUIRE(IsAbstractClass(j, "A")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + mermaid::AliasMatcher _A(src); + using mermaid::IsAbstractClass; + + REQUIRE_THAT(src, IsAbstractClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A1"))); + REQUIRE_THAT(src, IsClass(_A("A2"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t00023/.clang-uml b/tests/t00023/.clang-uml index 90645897..145dd839 100644 --- a/tests/t00023/.clang-uml +++ b/tests/t00023/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00023_class: type: class diff --git a/tests/t00023/test_case.h b/tests/t00023/test_case.h index ba772ce6..c76f72eb 100644 --- a/tests/t00023/test_case.h +++ b/tests/t00023/test_case.h @@ -29,17 +29,16 @@ TEST_CASE("t00023", "[test-case][class]") REQUIRE(model->name() == "t00023_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsAbstractClass(_A("Strategy"))); - REQUIRE_THAT(puml, IsClass(_A("StrategyA"))); - REQUIRE_THAT(puml, IsClass(_A("StrategyB"))); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsAbstractClass(_A("Strategy"))); + REQUIRE_THAT(src, IsClass(_A("StrategyA"))); + REQUIRE_THAT(src, IsClass(_A("StrategyB"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -50,6 +49,18 @@ TEST_CASE("t00023", "[test-case][class]") REQUIRE(IsClass(j, "StrategyB")); REQUIRE(IsAbstractClass(j, "Strategy")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsAbstractClass; + + REQUIRE_THAT(src, IsAbstractClass(_A("Strategy"))); + REQUIRE_THAT(src, IsClass(_A("StrategyA"))); + REQUIRE_THAT(src, IsClass(_A("StrategyB"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00024/.clang-uml b/tests/t00024/.clang-uml index f8750c86..79c516f6 100644 --- a/tests/t00024/.clang-uml +++ b/tests/t00024/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00024_class: type: class diff --git a/tests/t00024/test_case.h b/tests/t00024/test_case.h index efd14550..1d30537d 100644 --- a/tests/t00024/test_case.h +++ b/tests/t00024/test_case.h @@ -29,21 +29,20 @@ TEST_CASE("t00024", "[test-case][class]") REQUIRE(model->name() == "t00024_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsAbstractClass(_A("Target"))); - REQUIRE_THAT(puml, IsClass(_A("Target1"))); - REQUIRE_THAT(puml, IsClass(_A("Target2"))); - REQUIRE_THAT(puml, IsClass(_A("Proxy"))); - REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Target1"))); - REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Target2"))); - REQUIRE_THAT(puml, IsBaseClass(_A("Target"), _A("Proxy"))); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsAbstractClass(_A("Target"))); + REQUIRE_THAT(src, IsClass(_A("Target1"))); + REQUIRE_THAT(src, IsClass(_A("Target2"))); + REQUIRE_THAT(src, IsClass(_A("Proxy"))); + REQUIRE_THAT(src, IsBaseClass(_A("Target"), _A("Target1"))); + REQUIRE_THAT(src, IsBaseClass(_A("Target"), _A("Target2"))); + REQUIRE_THAT(src, IsBaseClass(_A("Target"), _A("Proxy"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -57,6 +56,22 @@ TEST_CASE("t00024", "[test-case][class]") REQUIRE(IsBaseClass(j, "Target", "Target2")); REQUIRE(IsBaseClass(j, "Target", "Proxy")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsAbstractClass; + + REQUIRE_THAT(src, IsAbstractClass(_A("Target"))); + REQUIRE_THAT(src, IsClass(_A("Target1"))); + REQUIRE_THAT(src, IsClass(_A("Target2"))); + REQUIRE_THAT(src, IsClass(_A("Proxy"))); + REQUIRE_THAT(src, IsBaseClass(_A("Target"), _A("Target1"))); + REQUIRE_THAT(src, IsBaseClass(_A("Target"), _A("Target2"))); + REQUIRE_THAT(src, IsBaseClass(_A("Target"), _A("Proxy"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00025/.clang-uml b/tests/t00025/.clang-uml index 4a32003c..1dd15940 100644 --- a/tests/t00025/.clang-uml +++ b/tests/t00025/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00025_class: type: class diff --git a/tests/t00025/test_case.h b/tests/t00025/test_case.h index ebf745b5..061dfb95 100644 --- a/tests/t00025/test_case.h +++ b/tests/t00025/test_case.h @@ -29,31 +29,30 @@ TEST_CASE("t00025", "[test-case][class]") REQUIRE(model->name() == "t00025_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("Target1"))); - REQUIRE_THAT(puml, IsClass(_A("Target2"))); - REQUIRE_THAT(puml, IsClassTemplate("Proxy", "T")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsClass(_A("Target1"))); + REQUIRE_THAT(src, IsClass(_A("Target2"))); + REQUIRE_THAT(src, IsClassTemplate("Proxy", "T")); REQUIRE_THAT( - puml, IsInstantiation(_A("Proxy"), _A("Proxy"))); + src, IsInstantiation(_A("Proxy"), _A("Proxy"))); REQUIRE_THAT( - puml, IsInstantiation(_A("Proxy"), _A("Proxy"))); - REQUIRE_THAT(puml, + src, IsInstantiation(_A("Proxy"), _A("Proxy"))); + REQUIRE_THAT(src, IsAggregation(_A("ProxyHolder"), _A("Proxy"), "+proxy1")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsAggregation(_A("ProxyHolder"), _A("Proxy"), "+proxy2")); REQUIRE_THAT( - puml, !IsAggregation(_A("ProxyHolder"), _A("Target1"), "+proxy1")); + src, !IsAggregation(_A("ProxyHolder"), _A("Target1"), "+proxy1")); REQUIRE_THAT( - puml, !IsAggregation(_A("ProxyHolder"), _A("Target2"), "+proxy2")); - REQUIRE_THAT(puml, IsDependency(_A("Proxy"), _A("Target1"))); - REQUIRE_THAT(puml, IsDependency(_A("Proxy"), _A("Target2"))); + src, !IsAggregation(_A("ProxyHolder"), _A("Target2"), "+proxy2")); + REQUIRE_THAT(src, IsDependency(_A("Proxy"), _A("Target1"))); + REQUIRE_THAT(src, IsDependency(_A("Proxy"), _A("Target2"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -66,6 +65,31 @@ TEST_CASE("t00025", "[test-case][class]") REQUIRE(IsDependency(j, "Proxy", "Target1")); REQUIRE(IsDependency(j, "Proxy", "Target2")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("Target1"))); + REQUIRE_THAT(src, IsClass(_A("Target2"))); + REQUIRE_THAT(src, IsClass(_A("Proxy"))); + REQUIRE_THAT( + src, IsInstantiation(_A("Proxy"), _A("Proxy"))); + REQUIRE_THAT( + src, IsInstantiation(_A("Proxy"), _A("Proxy"))); + REQUIRE_THAT(src, + IsAggregation(_A("ProxyHolder"), _A("Proxy"), "+proxy1")); + REQUIRE_THAT(src, + IsAggregation(_A("ProxyHolder"), _A("Proxy"), "+proxy2")); + REQUIRE_THAT( + src, !IsAggregation(_A("ProxyHolder"), _A("Target1"), "+proxy1")); + REQUIRE_THAT( + src, !IsAggregation(_A("ProxyHolder"), _A("Target2"), "+proxy2")); + REQUIRE_THAT(src, IsDependency(_A("Proxy"), _A("Target1"))); + REQUIRE_THAT(src, IsDependency(_A("Proxy"), _A("Target2"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00026/.clang-uml b/tests/t00026/.clang-uml index 33224cee..d406ef09 100644 --- a/tests/t00026/.clang-uml +++ b/tests/t00026/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00026_class: type: class diff --git a/tests/t00026/test_case.h b/tests/t00026/test_case.h index f2ea212c..4b1ffdc6 100644 --- a/tests/t00026/test_case.h +++ b/tests/t00026/test_case.h @@ -29,22 +29,21 @@ TEST_CASE("t00026", "[test-case][class]") REQUIRE(model->name() == "t00026_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("Memento", "T")); - REQUIRE_THAT(puml, IsClassTemplate("Originator", "T")); - REQUIRE_THAT(puml, IsClassTemplate("Caretaker", "T")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsClassTemplate("Memento", "T")); + REQUIRE_THAT(src, IsClassTemplate("Originator", "T")); + REQUIRE_THAT(src, IsClassTemplate("Caretaker", "T")); + REQUIRE_THAT(src, IsInstantiation( _A("Originator"), _A("Originator"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation(_A("Caretaker"), _A("Caretaker"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -55,6 +54,22 @@ TEST_CASE("t00026", "[test-case][class]") REQUIRE(IsClassTemplate(j, "Originator")); REQUIRE(IsInstantiation(j, "Originator", "Originator")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("Memento"))); + REQUIRE_THAT(src, IsClass(_A("Originator"))); + REQUIRE_THAT(src, IsClass(_A("Caretaker"))); + REQUIRE_THAT(src, + IsInstantiation( + _A("Originator"), _A("Originator"))); + REQUIRE_THAT(src, + IsInstantiation(_A("Caretaker"), _A("Caretaker"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00027/.clang-uml b/tests/t00027/.clang-uml index 27103b8e..64dc709e 100644 --- a/tests/t00027/.clang-uml +++ b/tests/t00027/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00027_class: type: class diff --git a/tests/t00027/test_case.h b/tests/t00027/test_case.h index 376ab6ab..df0534a6 100644 --- a/tests/t00027/test_case.h +++ b/tests/t00027/test_case.h @@ -29,35 +29,34 @@ TEST_CASE("t00027", "[test-case][class]") REQUIRE(model->name() == "t00027_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsAbstractClass(_A("Shape"))); - REQUIRE_THAT(puml, IsAbstractClass(_A("ShapeDecorator"))); - REQUIRE_THAT(puml, IsClassTemplate("Line", "T<>...")); - REQUIRE_THAT(puml, IsClassTemplate("Text", "T<>...")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsAbstractClass(_A("Shape"))); + REQUIRE_THAT(src, IsAbstractClass(_A("ShapeDecorator"))); + REQUIRE_THAT(src, IsClassTemplate("Line", "T<>...")); + REQUIRE_THAT(src, IsClassTemplate("Text", "T<>...")); REQUIRE_THAT( - puml, IsInstantiation(_A("Line...>"), _A("Line"))); - REQUIRE_THAT(puml, - IsInstantiation(_A("Line...>"), _A("Line"))); + src, IsInstantiation(_A("Line...>"), _A("Line"))); REQUIRE_THAT( - puml, IsInstantiation(_A("Text...>"), _A("Text"))); - REQUIRE_THAT(puml, - IsInstantiation(_A("Text...>"), _A("Text"))); + src, IsInstantiation(_A("Line...>"), _A("Line"))); + REQUIRE_THAT( + src, IsInstantiation(_A("Text...>"), _A("Text"))); + REQUIRE_THAT( + src, IsInstantiation(_A("Text...>"), _A("Text"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsAggregation(_A("Window"), _A("Line"), "+border")); REQUIRE_THAT( - puml, IsAggregation(_A("Window"), _A("Line"), "+divider")); - REQUIRE_THAT(puml, + src, IsAggregation(_A("Window"), _A("Line"), "+divider")); + REQUIRE_THAT(src, IsAggregation(_A("Window"), _A("Text"), "+title")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsAggregation(_A("Window"), _A("Text"), "+description")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -75,6 +74,36 @@ TEST_CASE("t00027", "[test-case][class]") REQUIRE(IsAggregation( j, "Window", "Text", "description")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsAbstractClass; + + REQUIRE_THAT(src, IsAbstractClass(_A("Shape"))); + REQUIRE_THAT(src, IsAbstractClass(_A("ShapeDecorator"))); + REQUIRE_THAT(src, IsClass(_A("Line...>"))); + REQUIRE_THAT(src, IsClass(_A("Text...>"))); + REQUIRE_THAT( + src, IsInstantiation(_A("Line...>"), _A("Line"))); + REQUIRE_THAT( + src, IsInstantiation(_A("Line...>"), _A("Line"))); + REQUIRE_THAT( + src, IsInstantiation(_A("Text...>"), _A("Text"))); + REQUIRE_THAT( + src, IsInstantiation(_A("Text...>"), _A("Text"))); + + REQUIRE_THAT(src, + IsAggregation(_A("Window"), _A("Line"), "+border")); + REQUIRE_THAT( + src, IsAggregation(_A("Window"), _A("Line"), "+divider")); + REQUIRE_THAT(src, + IsAggregation(_A("Window"), _A("Text"), "+title")); + REQUIRE_THAT(src, + IsAggregation(_A("Window"), _A("Text"), "+description")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00028/.clang-uml b/tests/t00028/.clang-uml index 3588d932..ac0f8f09 100644 --- a/tests/t00028/.clang-uml +++ b/tests/t00028/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00028_class: type: class diff --git a/tests/t00028/test_case.h b/tests/t00028/test_case.h index 642d424a..372a1038 100644 --- a/tests/t00028/test_case.h +++ b/tests/t00028/test_case.h @@ -29,48 +29,77 @@ TEST_CASE("t00028", "[test-case][class]") REQUIRE(model->name() == "t00028_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClassTemplate("E", "T")); - REQUIRE_THAT(puml, IsEnum(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); - REQUIRE_THAT(puml, HasNote(_A("A"), "top", "A class note.")); - REQUIRE_THAT(puml, HasNote(_A("B"), "left", "B class note.")); - REQUIRE_THAT(puml, HasNote(_A("C"), "bottom", "C class note.")); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClassTemplate("E", "T")); + REQUIRE_THAT(src, IsEnum(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("R"))); + REQUIRE_THAT(src, HasNote(_A("A"), "top", "A class note.")); + REQUIRE_THAT(src, HasNote(_A("B"), "left", "B class note.")); + REQUIRE_THAT(src, HasNote(_A("C"), "bottom", "C class note.")); const auto d_note = R"( D class note.)"; - REQUIRE_THAT(puml, HasNote(_A("D"), "left", d_note)); + REQUIRE_THAT(src, HasNote(_A("D"), "left", d_note)); REQUIRE_THAT( - puml, HasNote(_A("E"), "left", "E template class note.")); - REQUIRE_THAT(puml, HasNote(_A("F"), "bottom", "F enum note.")); - REQUIRE_THAT(puml, !HasNote(_A("G"), "left", "G class note.")); - REQUIRE_THAT(puml, HasNote(_A("R"), "right", "R class note.")); - REQUIRE_THAT(puml, + src, HasNote(_A("E"), "left", "E template class note.")); + REQUIRE_THAT(src, HasNote(_A("F"), "bottom", "F enum note.")); + REQUIRE_THAT(src, !HasNote(_A("G"), "left", "G class note.")); + REQUIRE_THAT(src, HasNote(_A("R"), "right", "R class note.")); + REQUIRE_THAT(src, HasMemberNote( _A("R"), "aaa", "left", "R contains an instance of A.")); REQUIRE_THAT( - puml, !HasMemberNote(_A("R"), "bbb", "right", "R class note.")); + src, !HasMemberNote(_A("R"), "bbb", "right", "R class note.")); REQUIRE_THAT( - puml, HasMemberNote(_A("R"), "ccc", "left", "Reference to C.")); + src, HasMemberNote(_A("R"), "ccc", "left", "Reference to C.")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); using namespace json; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::HasNote; + using mermaid::IsEnum; + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsEnum(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("R"))); + REQUIRE_THAT(src, HasNote(_A("A"), "top", "A class note.")); + REQUIRE_THAT(src, HasNote(_A("B"), "left", "B class note.")); + REQUIRE_THAT(src, HasNote(_A("C"), "bottom", "C class note.")); + const auto d_note = R"( +D +class +note.)"; + REQUIRE_THAT(src, HasNote(_A("D"), "left", d_note)); + REQUIRE_THAT( + src, HasNote(_A("E"), "left", "E template class note.")); + REQUIRE_THAT(src, HasNote(_A("F"), "bottom", "F enum note.")); + REQUIRE_THAT(src, !HasNote(_A("G"), "left", "G class note.")); + REQUIRE_THAT(src, HasNote(_A("R"), "right", "R class note.")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00029/.clang-uml b/tests/t00029/.clang-uml index 9c673a31..b856a2cd 100644 --- a/tests/t00029/.clang-uml +++ b/tests/t00029/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00029_class: type: class diff --git a/tests/t00029/test_case.h b/tests/t00029/test_case.h index bafe9330..de139312 100644 --- a/tests/t00029/test_case.h +++ b/tests/t00029/test_case.h @@ -29,32 +29,31 @@ TEST_CASE("t00029", "[test-case][class]") REQUIRE(model->name() == "t00029_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, !IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClassTemplate("C", "T")); - REQUIRE_THAT(puml, !IsClassTemplate("D", "T")); - REQUIRE_THAT(puml, IsEnum(_A("E"))); - REQUIRE_THAT(puml, !IsEnum(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("G1"))); - REQUIRE_THAT(puml, IsClass(_A("G2"))); - REQUIRE_THAT(puml, IsClass(_A("G3"))); - REQUIRE_THAT(puml, IsClass(_A("G4"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, !IsClass(_A("B"))); + REQUIRE_THAT(src, IsClassTemplate("C", "T")); + REQUIRE_THAT(src, !IsClassTemplate("D", "T")); + REQUIRE_THAT(src, IsEnum(_A("E"))); + REQUIRE_THAT(src, !IsEnum(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("G1"))); + REQUIRE_THAT(src, IsClass(_A("G2"))); + REQUIRE_THAT(src, IsClass(_A("G3"))); + REQUIRE_THAT(src, IsClass(_A("G4"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(src, IsClass(_A("R"))); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("G1"), "+g1")); - REQUIRE_THAT(puml, !IsAggregation(_A("R"), _A("G2"), "+g2")); - REQUIRE_THAT(puml, !IsAggregation(_A("R"), _A("G3"), "+g3")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("G4"), "+g4")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("G1"), "+g1")); + REQUIRE_THAT(src, !IsAggregation(_A("R"), _A("G2"), "+g2")); + REQUIRE_THAT(src, !IsAggregation(_A("R"), _A("G3"), "+g3")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("G4"), "+g4")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -63,6 +62,32 @@ TEST_CASE("t00029", "[test-case][class]") REQUIRE(IsAggregation(j, "R", "G1", "g1")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsEnum; + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, !IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, !IsClass(_A("D"))); + REQUIRE_THAT(src, IsEnum(_A("E"))); + REQUIRE_THAT(src, !IsEnum(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("G1"))); + REQUIRE_THAT(src, IsClass(_A("G2"))); + REQUIRE_THAT(src, IsClass(_A("G3"))); + REQUIRE_THAT(src, IsClass(_A("G4"))); + + REQUIRE_THAT(src, IsClass(_A("R"))); + + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("G1"), "+g1")); + REQUIRE_THAT(src, !IsAggregation(_A("R"), _A("G2"), "+g2")); + REQUIRE_THAT(src, !IsAggregation(_A("R"), _A("G3"), "+g3")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("G4"), "+g4")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00030/.clang-uml b/tests/t00030/.clang-uml index 1795565b..8c9e6b2c 100644 --- a/tests/t00030/.clang-uml +++ b/tests/t00030/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00030_class: type: class diff --git a/tests/t00030/test_case.h b/tests/t00030/test_case.h index 282943a7..cb4ca72c 100644 --- a/tests/t00030/test_case.h +++ b/tests/t00030/test_case.h @@ -29,27 +29,26 @@ TEST_CASE("t00030", "[test-case][class]") REQUIRE(model->name() == "t00030_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("A"), "+aaa")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("A"), "+aaa")); REQUIRE_THAT( - puml, IsComposition(_A("R"), _A("B"), "+bbb", "0..1", "1..*")); + src, IsComposition(_A("R"), _A("B"), "+bbb", "0..1", "1..*")); REQUIRE_THAT( - puml, IsAggregation(_A("R"), _A("C"), "+ccc", "0..1", "1..5")); - REQUIRE_THAT(puml, IsAssociation(_A("R"), _A("D"), "+ddd", "", "1")); - REQUIRE_THAT(puml, IsAggregation(_A("R"), _A("E"), "+eee", "", "1")); + src, IsAggregation(_A("R"), _A("C"), "+ccc", "0..1", "1..5")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("D"), "+ddd", "", "1")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("E"), "+eee", "", "1")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -58,6 +57,26 @@ TEST_CASE("t00030", "[test-case][class]") REQUIRE(IsAggregation(j, "R", "C", "ccc")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("A"), "+aaa")); + REQUIRE_THAT( + src, IsComposition(_A("R"), _A("B"), "+bbb", "0..1", "1..*")); + REQUIRE_THAT( + src, IsAggregation(_A("R"), _A("C"), "+ccc", "0..1", "1..5")); + REQUIRE_THAT(src, IsAssociation(_A("R"), _A("D"), "+ddd", "", "1")); + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("E"), "+eee", "", "1")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00031/.clang-uml b/tests/t00031/.clang-uml index f06027c1..affa76b5 100644 --- a/tests/t00031/.clang-uml +++ b/tests/t00031/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00031_class: type: class diff --git a/tests/t00031/test_case.h b/tests/t00031/test_case.h index f86f88a0..921a4293 100644 --- a/tests/t00031/test_case.h +++ b/tests/t00031/test_case.h @@ -29,33 +29,32 @@ TEST_CASE("t00031", "[test-case][class]") REQUIRE(model->name() == "t00031_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsEnum(_A("B"))); - REQUIRE_THAT(puml, IsClassTemplate("C", "T")); - REQUIRE_THAT(puml, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsEnum(_A("B"))); + REQUIRE_THAT(src, IsClassTemplate("C", "T")); + REQUIRE_THAT(src, IsClass(_A("D"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsAssociationWithStyle( _A("R"), _A("A"), "+aaa", "#red,dashed,thickness=2")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsCompositionWithStyle( _A("R"), _A("B"), "+bbb", "#green,dashed,thickness=4")); - REQUIRE_THAT(puml, IsDependency(_A("R"), _A("B"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsDependency(_A("R"), _A("B"))); + REQUIRE_THAT(src, IsAggregationWithStyle( _A("R"), _A("C"), "+ccc", "#blue,dotted,thickness=8")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsAssociationWithStyle( _A("R"), _A("D"), "+ddd", "#blue,plain,thickness=16")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -65,6 +64,19 @@ TEST_CASE("t00031", "[test-case][class]") REQUIRE(IsClass(j, "A")); REQUIRE(IsClassTemplate(j, "C")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsEnum; + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsEnum(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00032/.clang-uml b/tests/t00032/.clang-uml index 58018aa0..0c5d4e93 100644 --- a/tests/t00032/.clang-uml +++ b/tests/t00032/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00032_class: type: class diff --git a/tests/t00032/test_case.h b/tests/t00032/test_case.h index 587fd72f..b444be75 100644 --- a/tests/t00032/test_case.h +++ b/tests/t00032/test_case.h @@ -29,41 +29,40 @@ TEST_CASE("t00032", "[test-case][class]") REQUIRE(model->name() == "t00032_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("Base"))); - REQUIRE_THAT(puml, IsClass(_A("TBase"))); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(src, IsClass(_A("Base"))); + REQUIRE_THAT(src, IsClass(_A("TBase"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("R"))); - REQUIRE_THAT(puml, IsClassTemplate("Overload", "T,L,Ts...")); + REQUIRE_THAT(src, IsClassTemplate("Overload", "T,L,Ts...")); - REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("Overload"))); + REQUIRE_THAT(src, IsBaseClass(_A("Base"), _A("Overload"))); REQUIRE_THAT( - puml, IsBaseClass(_A("TBase"), _A("Overload"))); + src, IsBaseClass(_A("TBase"), _A("Overload"))); REQUIRE_THAT( - puml, IsBaseClass(_A("A"), _A("Overload"))); + src, IsBaseClass(_A("A"), _A("Overload"))); REQUIRE_THAT( - puml, IsBaseClass(_A("B"), _A("Overload"))); + src, IsBaseClass(_A("B"), _A("Overload"))); REQUIRE_THAT( - puml, IsBaseClass(_A("C"), _A("Overload"))); + src, IsBaseClass(_A("C"), _A("Overload"))); REQUIRE_THAT( - puml, !IsDependency(_A("Overload"), _A("TBase"))); + src, !IsDependency(_A("Overload"), _A("TBase"))); REQUIRE_THAT( - puml, !IsDependency(_A("Overload"), _A("A"))); + src, !IsDependency(_A("Overload"), _A("A"))); REQUIRE_THAT( - puml, !IsDependency(_A("Overload"), _A("B"))); + src, !IsDependency(_A("Overload"), _A("B"))); REQUIRE_THAT( - puml, !IsDependency(_A("Overload"), _A("C"))); + src, !IsDependency(_A("Overload"), _A("C"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -74,6 +73,40 @@ TEST_CASE("t00032", "[test-case][class]") "Overload")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("Base"))); + REQUIRE_THAT(src, IsClass(_A("TBase"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("R"))); + + REQUIRE_THAT(src, IsClass(_A("Overload"))); + + REQUIRE_THAT(src, IsBaseClass(_A("Base"), _A("Overload"))); + REQUIRE_THAT( + src, IsBaseClass(_A("TBase"), _A("Overload"))); + REQUIRE_THAT( + src, IsBaseClass(_A("A"), _A("Overload"))); + REQUIRE_THAT( + src, IsBaseClass(_A("B"), _A("Overload"))); + REQUIRE_THAT( + src, IsBaseClass(_A("C"), _A("Overload"))); + REQUIRE_THAT( + src, !IsDependency(_A("Overload"), _A("TBase"))); + REQUIRE_THAT( + src, !IsDependency(_A("Overload"), _A("A"))); + REQUIRE_THAT( + src, !IsDependency(_A("Overload"), _A("B"))); + REQUIRE_THAT( + src, !IsDependency(_A("Overload"), _A("C"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00033/.clang-uml b/tests/t00033/.clang-uml index 5b474474..74d0bd30 100644 --- a/tests/t00033/.clang-uml +++ b/tests/t00033/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00033_class: type: class diff --git a/tests/t00033/test_case.h b/tests/t00033/test_case.h index f6a1e6da..f07ce69d 100644 --- a/tests/t00033/test_case.h +++ b/tests/t00033/test_case.h @@ -29,33 +29,32 @@ TEST_CASE("t00033", "[test-case][class]") REQUIRE(model->name() == "t00033_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T")); - REQUIRE_THAT(puml, IsClassTemplate("B", "T")); - REQUIRE_THAT(puml, IsClassTemplate("C", "T")); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(src, IsClassTemplate("A", "T")); + REQUIRE_THAT(src, IsClassTemplate("B", "T")); + REQUIRE_THAT(src, IsClassTemplate("C", "T")); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("R"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsDependency(_A("A>>>"), _A("B>>"))); REQUIRE_THAT( - puml, IsDependency(_A("B>>"), _A("C"))); - REQUIRE_THAT(puml, IsDependency(_A("C"), _A("D"))); + src, IsDependency(_A("B>>"), _A("C"))); + REQUIRE_THAT(src, IsDependency(_A("C"), _A("D"))); - REQUIRE_THAT(puml, IsInstantiation(_A("C"), _A("C"))); + REQUIRE_THAT(src, IsInstantiation(_A("C"), _A("C"))); REQUIRE_THAT( - puml, IsInstantiation(_A("B"), _A("B>>"))); - REQUIRE_THAT(puml, + src, IsInstantiation(_A("B"), _A("B>>"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A>>>"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -70,6 +69,32 @@ TEST_CASE("t00033", "[test-case][class]") "clanguml::t00033::D>>>>", "B>>")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("R"))); + + REQUIRE_THAT(src, + IsDependency(_A("A>>>"), + _A("B>>"))); + REQUIRE_THAT( + src, IsDependency(_A("B>>"), _A("C"))); + REQUIRE_THAT(src, IsDependency(_A("C"), _A("D"))); + + REQUIRE_THAT(src, IsInstantiation(_A("C"), _A("C"))); + REQUIRE_THAT( + src, IsInstantiation(_A("B"), _A("B>>"))); + REQUIRE_THAT(src, + IsInstantiation(_A("A"), _A("A>>>"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00034/.clang-uml b/tests/t00034/.clang-uml index 64c130fc..b8198a99 100644 --- a/tests/t00034/.clang-uml +++ b/tests/t00034/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00034_class: type: class diff --git a/tests/t00034/test_case.h b/tests/t00034/test_case.h index 03cc52f1..c6894e43 100644 --- a/tests/t00034/test_case.h +++ b/tests/t00034/test_case.h @@ -29,25 +29,24 @@ TEST_CASE("t00034", "[test-case][class]") REQUIRE(model->name() == "t00034_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("lift_void", "T")); - REQUIRE_THAT(puml, IsClassTemplate("drop_void", "T")); - REQUIRE_THAT(puml, IsClass(_A("Void"))); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(src, IsClassTemplate("lift_void", "T")); + REQUIRE_THAT(src, IsClassTemplate("drop_void", "T")); + REQUIRE_THAT(src, IsClass(_A("Void"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("R"))); REQUIRE_THAT( - puml, IsInstantiation(_A("lift_void"), _A("lift_void"))); + src, IsInstantiation(_A("lift_void"), _A("lift_void"))); REQUIRE_THAT( - puml, IsInstantiation(_A("drop_void"), _A("drop_void"))); + src, IsInstantiation(_A("drop_void"), _A("drop_void"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -57,6 +56,24 @@ TEST_CASE("t00034", "[test-case][class]") REQUIRE(IsClass(j, "A")); REQUIRE(IsClassTemplate(j, "lift_void")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("lift_void"))); + REQUIRE_THAT(src, IsClass(_A("drop_void"))); + REQUIRE_THAT(src, IsClass(_A("Void"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("R"))); + + REQUIRE_THAT( + src, IsInstantiation(_A("lift_void"), _A("lift_void"))); + REQUIRE_THAT( + src, IsInstantiation(_A("drop_void"), _A("drop_void"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00035/.clang-uml b/tests/t00035/.clang-uml index e2ab858d..ac19e302 100644 --- a/tests/t00035/.clang-uml +++ b/tests/t00035/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00035_class: type: class diff --git a/tests/t00035/test_case.h b/tests/t00035/test_case.h index 2da5cb57..59b9976b 100644 --- a/tests/t00035/test_case.h +++ b/tests/t00035/test_case.h @@ -29,25 +29,24 @@ TEST_CASE("t00035", "[test-case][class]") REQUIRE(model->name() == "t00035_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("Top"))); - REQUIRE_THAT(puml, IsClass(_A("Bottom"))); - REQUIRE_THAT(puml, IsClass(_A("Center"))); - REQUIRE_THAT(puml, IsClass(_A("Left"))); - REQUIRE_THAT(puml, IsClass(_A("Right"))); + REQUIRE_THAT(src, IsClass(_A("Top"))); + REQUIRE_THAT(src, IsClass(_A("Bottom"))); + REQUIRE_THAT(src, IsClass(_A("Center"))); + REQUIRE_THAT(src, IsClass(_A("Left"))); + REQUIRE_THAT(src, IsClass(_A("Right"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "up", _A("Top"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "left", _A("Left"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "right", _A("Right"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("Center"), "down", _A("Bottom"))); + REQUIRE_THAT(src, IsLayoutHint(_A("Center"), "up", _A("Top"))); + REQUIRE_THAT(src, IsLayoutHint(_A("Center"), "left", _A("Left"))); + REQUIRE_THAT(src, IsLayoutHint(_A("Center"), "right", _A("Right"))); + REQUIRE_THAT(src, IsLayoutHint(_A("Center"), "down", _A("Bottom"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -60,6 +59,19 @@ TEST_CASE("t00035", "[test-case][class]") REQUIRE(IsClass(j, "Left")); REQUIRE(IsClass(j, "Right")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("Top"))); + REQUIRE_THAT(src, IsClass(_A("Bottom"))); + REQUIRE_THAT(src, IsClass(_A("Center"))); + REQUIRE_THAT(src, IsClass(_A("Left"))); + REQUIRE_THAT(src, IsClass(_A("Right"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00036/.clang-uml b/tests/t00036/.clang-uml index 0c09a1c0..87ac943a 100644 --- a/tests/t00036/.clang-uml +++ b/tests/t00036/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00036_class: type: class diff --git a/tests/t00036/test_case.h b/tests/t00036/test_case.h index fe307bcb..80643126 100644 --- a/tests/t00036/test_case.h +++ b/tests/t00036/test_case.h @@ -30,27 +30,26 @@ TEST_CASE("t00036", "[test-case][class]") REQUIRE(model->name() == "t00036_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T")); - REQUIRE_THAT(puml, IsClassTemplate("A", "int")); - REQUIRE_THAT(puml, IsEnum(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, !IsClass(_A("DImpl"))); - REQUIRE_THAT(puml, IsPackage("ns111")); - REQUIRE_THAT(puml, IsPackage("ns22")); - REQUIRE_THAT(puml, !IsPackage("ns3")); - REQUIRE_THAT(puml, !IsPackage("ns33")); + REQUIRE_THAT(src, IsClassTemplate("A", "T")); + REQUIRE_THAT(src, IsClassTemplate("A", "int")); + REQUIRE_THAT(src, IsEnum(_A("E"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, !IsClass(_A("DImpl"))); + REQUIRE_THAT(src, IsPackage("ns111")); + REQUIRE_THAT(src, IsPackage("ns22")); + REQUIRE_THAT(src, !IsPackage("ns3")); + REQUIRE_THAT(src, !IsPackage("ns33")); - REQUIRE_THAT(puml, IsAggregation(_A("B"), _A("A"), "+a_int")); + REQUIRE_THAT(src, IsAggregation(_A("B"), _A("A"), "+a_int")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -67,6 +66,25 @@ TEST_CASE("t00036", "[test-case][class]") REQUIRE(IsPackage(j, "ns1::ns11::ns111")); REQUIRE(IsPackage(j, "ns2")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsEnum; + + REQUIRE_THAT(src, IsClass(_A("ns1::ns11::A"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns11::A"))); + REQUIRE_THAT(src, IsEnum(_A("ns1::E"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns11::ns111::B"))); + REQUIRE_THAT(src, IsClass(_A("ns2::ns22::C"))); + REQUIRE_THAT(src, !IsClass(_A("DImpl"))); + + REQUIRE_THAT(src, + IsAggregation( + _A("ns1::ns11::ns111::B"), _A("ns1::ns11::A"), "+a_int")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00037/.clang-uml b/tests/t00037/.clang-uml index 9a8cd532..f2616bd8 100644 --- a/tests/t00037/.clang-uml +++ b/tests/t00037/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00037_class: type: class diff --git a/tests/t00037/test_case.h b/tests/t00037/test_case.h index e3b20bd8..6742a1d1 100644 --- a/tests/t00037/test_case.h +++ b/tests/t00037/test_case.h @@ -30,23 +30,21 @@ TEST_CASE("t00037", "[test-case][class]") REQUIRE(model->name() == "t00037_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("ST"))); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("ST::(units)"))); - REQUIRE_THAT(puml, IsClass(_A("ST::(dimensions)"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsClass(_A("ST"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("ST::(units)"))); + REQUIRE_THAT(src, IsClass(_A("ST::(dimensions)"))); + REQUIRE_THAT(src, IsAggregation(_A("ST"), _A("ST::(dimensions)"), "+dimensions")); - REQUIRE_THAT( - puml, IsAggregation(_A("ST"), _A("ST::(units)"), "-units")); + REQUIRE_THAT(src, IsAggregation(_A("ST"), _A("ST::(units)"), "-units")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -59,6 +57,21 @@ TEST_CASE("t00037", "[test-case][class]") REQUIRE(IsClass(j, "ST::(dimensions)")); REQUIRE(IsAggregation(j, "ST", "ST::(dimensions)", "dimensions")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("ST"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("ST::(units)"))); + REQUIRE_THAT(src, IsClass(_A("ST::(dimensions)"))); + REQUIRE_THAT(src, + IsAggregation(_A("ST"), _A("ST::(dimensions)"), "+dimensions")); + REQUIRE_THAT(src, IsAggregation(_A("ST"), _A("ST::(units)"), "-units")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00038/.clang-uml b/tests/t00038/.clang-uml index a0f321ac..ab17a394 100644 --- a/tests/t00038/.clang-uml +++ b/tests/t00038/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00038_class: type: class diff --git a/tests/t00038/test_case.h b/tests/t00038/test_case.h index b253ef73..b9d1e47c 100644 --- a/tests/t00038/test_case.h +++ b/tests/t00038/test_case.h @@ -30,74 +30,73 @@ TEST_CASE("t00038", "[test-case][class]") REQUIRE(model->name() == "t00038_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("thirdparty::ns1::E"))); - REQUIRE_THAT(puml, IsClass(_A("key_t"))); - REQUIRE_THAT(puml, IsClassTemplate("map", "T")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("thirdparty::ns1::E"))); + REQUIRE_THAT(src, IsClass(_A("key_t"))); + REQUIRE_THAT(src, IsClassTemplate("map", "T")); + REQUIRE_THAT(src, IsClassTemplate("map", "std::integral_constant")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsClassTemplate("map", "std::vector>")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsClassTemplate("map", "std::map>>")); - REQUIRE_THAT(puml, IsEnum(_A("property_t"))); + REQUIRE_THAT(src, IsEnum(_A("property_t"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation(_A("map"), _A("map>>>"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsDependency(_A("map>"), _A("property_t"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsDependency(_A("map<" "std::vector>>"), _A("property_t"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsDependency( _A("map>>>"), _A("property_t"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsDependency( _A("map>>>"), _A("key_t"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsDependency( _A("map>"), _A("thirdparty::ns1::color_t"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsBaseClass(_A("thirdparty::ns1::E"), _A("map>"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -108,6 +107,74 @@ TEST_CASE("t00038", "[test-case][class]") REQUIRE(IsClass(j, "B")); REQUIRE(IsClass(j, "C")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsEnum; + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("thirdparty::ns1::E"))); + REQUIRE_THAT(src, IsClass(_A("key_t"))); + REQUIRE_THAT(src, IsClass(_A("map"))); + REQUIRE_THAT(src, + IsClass(_A("map>"))); + REQUIRE_THAT(src, + IsClass(_A( + "map>>"))); + REQUIRE_THAT(src, + IsClass(_A("map>>>"))); + + REQUIRE_THAT(src, IsEnum(_A("property_t"))); + + REQUIRE_THAT(src, + IsInstantiation(_A("map"), + _A("map>>>"))); + + REQUIRE_THAT(src, + IsDependency(_A("map>"), + _A("property_t"))); + + REQUIRE_THAT(src, + IsDependency(_A("map<" + "std::vector>>"), + _A("property_t"))); + + REQUIRE_THAT(src, + IsDependency( + _A("map>>>"), + _A("property_t"))); + + REQUIRE_THAT(src, + IsDependency( + _A("map>>>"), + _A("key_t"))); + + REQUIRE_THAT(src, + IsDependency( + _A("map>"), + _A("thirdparty::ns1::color_t"))); + + REQUIRE_THAT(src, + IsBaseClass(_A("thirdparty::ns1::E"), + _A("map>"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00039/.clang-uml b/tests/t00039/.clang-uml index 4ba5bdca..31a1d55c 100644 --- a/tests/t00039/.clang-uml +++ b/tests/t00039/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00039_class: type: class diff --git a/tests/t00039/test_case.h b/tests/t00039/test_case.h index e3871e20..d5edad61 100644 --- a/tests/t00039/test_case.h +++ b/tests/t00039/test_case.h @@ -29,42 +29,41 @@ TEST_CASE("t00039", "[test-case][class]") REQUIRE(model->name() == "t00039_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("AA"))); - REQUIRE_THAT(puml, IsClass(_A("AAA"))); - REQUIRE_THAT(puml, IsClass(_A("ns2::AAAA"))); - REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("AA"))); - REQUIRE_THAT(puml, IsBaseClass(_A("AA"), _A("AAA"))); - REQUIRE_THAT(puml, IsBaseClass(_A("AAA"), _A("ns2::AAAA"))); - REQUIRE_THAT(puml, !IsClass(_A("detail::AA"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("AA"))); + REQUIRE_THAT(src, IsClass(_A("AAA"))); + REQUIRE_THAT(src, IsClass(_A("ns2::AAAA"))); + REQUIRE_THAT(src, IsBaseClass(_A("A"), _A("AA"))); + REQUIRE_THAT(src, IsBaseClass(_A("AA"), _A("AAA"))); + REQUIRE_THAT(src, IsBaseClass(_A("AAA"), _A("ns2::AAAA"))); + REQUIRE_THAT(src, !IsClass(_A("detail::AA"))); - REQUIRE_THAT(puml, !IsClass(_A("B"))); - REQUIRE_THAT(puml, !IsClass(_A("ns1::BB"))); + REQUIRE_THAT(src, !IsClass(_A("B"))); + REQUIRE_THAT(src, !IsClass(_A("ns1::BB"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("CD"))); - REQUIRE_THAT(puml, IsBaseClass(_A("D"), _A("CD"))); - REQUIRE_THAT(puml, IsBaseClass(_A("D"), _A("DE"))); - REQUIRE_THAT(puml, IsBaseClass(_A("E"), _A("DE"))); - REQUIRE_THAT(puml, IsBaseClass(_A("C"), _A("CDE"))); - REQUIRE_THAT(puml, IsBaseClass(_A("D"), _A("CDE"))); - REQUIRE_THAT(puml, IsBaseClass(_A("E"), _A("CDE"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsBaseClass(_A("C"), _A("CD"))); + REQUIRE_THAT(src, IsBaseClass(_A("D"), _A("CD"))); + REQUIRE_THAT(src, IsBaseClass(_A("D"), _A("DE"))); + REQUIRE_THAT(src, IsBaseClass(_A("E"), _A("DE"))); + REQUIRE_THAT(src, IsBaseClass(_A("C"), _A("CDE"))); + REQUIRE_THAT(src, IsBaseClass(_A("D"), _A("CDE"))); + REQUIRE_THAT(src, IsBaseClass(_A("E"), _A("CDE"))); - REQUIRE_THAT(puml, IsClassTemplate("ns3::F", "T")); - REQUIRE_THAT(puml, IsClassTemplate("ns3::FF", "T,M")); - REQUIRE_THAT(puml, IsClassTemplate("ns3::FE", "T,M")); - REQUIRE_THAT(puml, IsClassTemplate("ns3::FFF", "T,M,N")); + REQUIRE_THAT(src, IsClassTemplate("ns3::F", "T")); + REQUIRE_THAT(src, IsClassTemplate("ns3::FF", "T,M")); + REQUIRE_THAT(src, IsClassTemplate("ns3::FE", "T,M")); + REQUIRE_THAT(src, IsClassTemplate("ns3::FFF", "T,M,N")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -84,6 +83,41 @@ TEST_CASE("t00039", "[test-case][class]") REQUIRE(IsClassTemplate(j, "ns3::F")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("AA"))); + REQUIRE_THAT(src, IsClass(_A("AAA"))); + REQUIRE_THAT(src, IsClass(_A("ns2::AAAA"))); + REQUIRE_THAT(src, IsBaseClass(_A("A"), _A("AA"))); + REQUIRE_THAT(src, IsBaseClass(_A("AA"), _A("AAA"))); + REQUIRE_THAT(src, IsBaseClass(_A("AAA"), _A("ns2::AAAA"))); + REQUIRE_THAT(src, !IsClass(_A("detail::AA"))); + + REQUIRE_THAT(src, !IsClass(_A("B"))); + REQUIRE_THAT(src, !IsClass(_A("ns1::BB"))); + + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsBaseClass(_A("C"), _A("CD"))); + REQUIRE_THAT(src, IsBaseClass(_A("D"), _A("CD"))); + REQUIRE_THAT(src, IsBaseClass(_A("D"), _A("DE"))); + REQUIRE_THAT(src, IsBaseClass(_A("E"), _A("DE"))); + REQUIRE_THAT(src, IsBaseClass(_A("C"), _A("CDE"))); + REQUIRE_THAT(src, IsBaseClass(_A("D"), _A("CDE"))); + REQUIRE_THAT(src, IsBaseClass(_A("E"), _A("CDE"))); + + REQUIRE_THAT(src, IsClass(_A("ns3::F"))); + REQUIRE_THAT(src, IsClass(_A("ns3::FF"))); + REQUIRE_THAT(src, IsClass(_A("ns3::FE"))); + REQUIRE_THAT(src, IsClass(_A("ns3::FFF"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t00040/.clang-uml b/tests/t00040/.clang-uml index 20744d33..ea120d19 100644 --- a/tests/t00040/.clang-uml +++ b/tests/t00040/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00040_class: type: class diff --git a/tests/t00040/test_case.h b/tests/t00040/test_case.h index 7d58e4b6..8305da37 100644 --- a/tests/t00040/test_case.h +++ b/tests/t00040/test_case.h @@ -29,24 +29,23 @@ TEST_CASE("t00040", "[test-case][class]") REQUIRE(model->name() == "t00040_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("AA"))); - REQUIRE_THAT(puml, IsClass(_A("AAA"))); - REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("AA"))); - REQUIRE_THAT(puml, IsBaseClass(_A("AA"), _A("AAA"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("AA"))); + REQUIRE_THAT(src, IsClass(_A("AAA"))); + REQUIRE_THAT(src, IsBaseClass(_A("A"), _A("AA"))); + REQUIRE_THAT(src, IsBaseClass(_A("AA"), _A("AAA"))); - REQUIRE_THAT(puml, !IsClass(_A("B"))); + REQUIRE_THAT(src, !IsClass(_A("B"))); - REQUIRE_THAT(puml, !IsDependency(_A("R"), _A("A"))); + REQUIRE_THAT(src, !IsDependency(_A("R"), _A("A"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -57,6 +56,23 @@ TEST_CASE("t00040", "[test-case][class]") REQUIRE(IsClass(j, "AA")); REQUIRE(IsClass(j, "AAA")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("AA"))); + REQUIRE_THAT(src, IsClass(_A("AAA"))); + REQUIRE_THAT(src, IsBaseClass(_A("A"), _A("AA"))); + REQUIRE_THAT(src, IsBaseClass(_A("AA"), _A("AAA"))); + + REQUIRE_THAT(src, !IsClass(_A("B"))); + + REQUIRE_THAT(src, !IsDependency(_A("R"), _A("A"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00041/.clang-uml b/tests/t00041/.clang-uml index 502eba3f..191ba681 100644 --- a/tests/t00041/.clang-uml +++ b/tests/t00041/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00041_class: type: class diff --git a/tests/t00041/test_case.h b/tests/t00041/test_case.h index 9d1e634e..5d7f19cd 100644 --- a/tests/t00041/test_case.h +++ b/tests/t00041/test_case.h @@ -30,43 +30,42 @@ TEST_CASE("t00041", "[test-case][class]") REQUIRE(model->name() == "t00041_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, !IsClass(_A("A"))); - REQUIRE_THAT(puml, !IsClass(_A("AA"))); - REQUIRE_THAT(puml, !IsClass(_A("AAA"))); + REQUIRE_THAT(src, !IsClass(_A("A"))); + REQUIRE_THAT(src, !IsClass(_A("AA"))); + REQUIRE_THAT(src, !IsClass(_A("AAA"))); - REQUIRE_THAT(puml, !IsClass(_A("B"))); + REQUIRE_THAT(src, !IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); - REQUIRE_THAT(puml, IsClass(_A("RR"))); - REQUIRE_THAT(puml, IsClass(_A("RRR"))); - REQUIRE_THAT(puml, !IsClass(_A("detail::G"))); - REQUIRE_THAT(puml, !IsClass(_A("H"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsClass(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("R"))); + REQUIRE_THAT(src, IsClass(_A("RR"))); + REQUIRE_THAT(src, IsClass(_A("RRR"))); + REQUIRE_THAT(src, !IsClass(_A("detail::G"))); + REQUIRE_THAT(src, !IsClass(_A("H"))); - REQUIRE_THAT(puml, IsBaseClass(_A("R"), _A("RR"))); - REQUIRE_THAT(puml, IsBaseClass(_A("RR"), _A("RRR"))); + REQUIRE_THAT(src, IsBaseClass(_A("R"), _A("RR"))); + REQUIRE_THAT(src, IsBaseClass(_A("RR"), _A("RRR"))); - REQUIRE_THAT(puml, IsAssociation(_A("D"), _A("RR"), "+rr")); - REQUIRE_THAT(puml, IsAssociation(_A("RR"), _A("E"), "+e")); - REQUIRE_THAT(puml, IsAssociation(_A("RR"), _A("F"), "+f")); - REQUIRE_THAT(puml, !IsDependency(_A("RR"), _A("H"))); + REQUIRE_THAT(src, IsAssociation(_A("D"), _A("RR"), "+rr")); + REQUIRE_THAT(src, IsAssociation(_A("RR"), _A("E"), "+e")); + REQUIRE_THAT(src, IsAssociation(_A("RR"), _A("F"), "+f")); + REQUIRE_THAT(src, !IsDependency(_A("RR"), _A("H"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::N"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::NN"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::NM"))); - REQUIRE_THAT(puml, IsBaseClass(_A("ns1::N"), _A("ns1::NN"))); - REQUIRE_THAT(puml, IsBaseClass(_A("ns1::N"), _A("ns1::NM"))); + REQUIRE_THAT(src, IsClass(_A("ns1::N"))); + REQUIRE_THAT(src, IsClass(_A("ns1::NN"))); + REQUIRE_THAT(src, IsClass(_A("ns1::NM"))); + REQUIRE_THAT(src, IsBaseClass(_A("ns1::N"), _A("ns1::NN"))); + REQUIRE_THAT(src, IsBaseClass(_A("ns1::N"), _A("ns1::NM"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -83,6 +82,42 @@ TEST_CASE("t00041", "[test-case][class]") REQUIRE(IsAssociation(j, "D", "RR", "rr")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, !IsClass(_A("A"))); + REQUIRE_THAT(src, !IsClass(_A("AA"))); + REQUIRE_THAT(src, !IsClass(_A("AAA"))); + + REQUIRE_THAT(src, !IsClass(_A("B"))); + + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsClass(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("R"))); + REQUIRE_THAT(src, IsClass(_A("RR"))); + REQUIRE_THAT(src, IsClass(_A("RRR"))); + REQUIRE_THAT(src, !IsClass(_A("detail::G"))); + REQUIRE_THAT(src, !IsClass(_A("H"))); + + REQUIRE_THAT(src, IsBaseClass(_A("R"), _A("RR"))); + REQUIRE_THAT(src, IsBaseClass(_A("RR"), _A("RRR"))); + + REQUIRE_THAT(src, IsAssociation(_A("D"), _A("RR"), "+rr")); + REQUIRE_THAT(src, IsAssociation(_A("RR"), _A("E"), "+e")); + REQUIRE_THAT(src, IsAssociation(_A("RR"), _A("F"), "+f")); + REQUIRE_THAT(src, !IsDependency(_A("RR"), _A("H"))); + + REQUIRE_THAT(src, IsClass(_A("ns1::N"))); + REQUIRE_THAT(src, IsClass(_A("ns1::NN"))); + REQUIRE_THAT(src, IsClass(_A("ns1::NM"))); + REQUIRE_THAT(src, IsBaseClass(_A("ns1::N"), _A("ns1::NN"))); + REQUIRE_THAT(src, IsBaseClass(_A("ns1::N"), _A("ns1::NM"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00042/.clang-uml b/tests/t00042/.clang-uml index c15333de..cdd55719 100644 --- a/tests/t00042/.clang-uml +++ b/tests/t00042/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00042_class: type: class diff --git a/tests/t00042/test_case.h b/tests/t00042/test_case.h index 3b662d5c..008cb13b 100644 --- a/tests/t00042/test_case.h +++ b/tests/t00042/test_case.h @@ -30,18 +30,17 @@ TEST_CASE("t00042", "[test-case][class]") REQUIRE(model->name() == "t00042_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("A", "T")); - REQUIRE_THAT(puml, IsClassTemplate("B", "T,K")); - REQUIRE_THAT(puml, !IsClassTemplate("C", "T")); + REQUIRE_THAT(src, IsClassTemplate("A", "T")); + REQUIRE_THAT(src, IsClassTemplate("B", "T,K")); + REQUIRE_THAT(src, !IsClassTemplate("C", "T")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -51,6 +50,17 @@ TEST_CASE("t00042", "[test-case][class]") REQUIRE(IsClassTemplate(j, "A")); REQUIRE(IsClassTemplate(j, "B")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, !IsClass(_A("C"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00043/.clang-uml b/tests/t00043/.clang-uml index 404fc413..6ca42b14 100644 --- a/tests/t00043/.clang-uml +++ b/tests/t00043/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00043_class: type: class diff --git a/tests/t00043/test_case.h b/tests/t00043/test_case.h index 58f1ca9f..5355d787 100644 --- a/tests/t00043/test_case.h +++ b/tests/t00043/test_case.h @@ -30,41 +30,40 @@ TEST_CASE("t00043", "[test-case][class]") REQUIRE(model->name() == "t00043_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check dependants filter - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("BB"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, !IsClass(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("BB"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, !IsClass(_A("F"))); - REQUIRE_THAT(puml, IsDependency(_A("B"), _A("A"))); - REQUIRE_THAT(puml, IsDependency(_A("BB"), _A("A"))); - REQUIRE_THAT(puml, IsDependency(_A("C"), _A("B"))); - REQUIRE_THAT(puml, IsDependency(_A("D"), _A("C"))); - REQUIRE_THAT(puml, IsDependency(_A("E"), _A("D"))); + REQUIRE_THAT(src, IsDependency(_A("B"), _A("A"))); + REQUIRE_THAT(src, IsDependency(_A("BB"), _A("A"))); + REQUIRE_THAT(src, IsDependency(_A("C"), _A("B"))); + REQUIRE_THAT(src, IsDependency(_A("D"), _A("C"))); + REQUIRE_THAT(src, IsDependency(_A("E"), _A("D"))); // Check dependencies filter - REQUIRE_THAT(puml, IsClass(_A("G"))); - REQUIRE_THAT(puml, IsClass(_A("GG"))); - REQUIRE_THAT(puml, IsClass(_A("H"))); - REQUIRE_THAT(puml, !IsClass(_A("HH"))); - REQUIRE_THAT(puml, IsClass(_A("I"))); - REQUIRE_THAT(puml, IsClass(_A("J"))); + REQUIRE_THAT(src, IsClass(_A("G"))); + REQUIRE_THAT(src, IsClass(_A("GG"))); + REQUIRE_THAT(src, IsClass(_A("H"))); + REQUIRE_THAT(src, !IsClass(_A("HH"))); + REQUIRE_THAT(src, IsClass(_A("I"))); + REQUIRE_THAT(src, IsClass(_A("J"))); - REQUIRE_THAT(puml, IsDependency(_A("H"), _A("G"))); - REQUIRE_THAT(puml, IsDependency(_A("H"), _A("GG"))); - REQUIRE_THAT(puml, IsDependency(_A("I"), _A("H"))); - REQUIRE_THAT(puml, IsDependency(_A("J"), _A("I"))); + REQUIRE_THAT(src, IsDependency(_A("H"), _A("G"))); + REQUIRE_THAT(src, IsDependency(_A("H"), _A("GG"))); + REQUIRE_THAT(src, IsDependency(_A("I"), _A("H"))); + REQUIRE_THAT(src, IsDependency(_A("J"), _A("I"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -85,6 +84,49 @@ TEST_CASE("t00043", "[test-case][class]") REQUIRE(IsDependency(j, "dependencies::J", "dependencies::I")); REQUIRE(IsDependency(j, "dependencies::H", "dependencies::G")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + // Check dependants filter + REQUIRE_THAT(src, IsClass(_A("dependants::A"))); + REQUIRE_THAT(src, IsClass(_A("dependants::B"))); + REQUIRE_THAT(src, IsClass(_A("dependants::BB"))); + REQUIRE_THAT(src, IsClass(_A("dependants::D"))); + REQUIRE_THAT(src, IsClass(_A("dependants::E"))); + REQUIRE_THAT(src, !IsClass(_A("dependants::F"))); + + REQUIRE_THAT( + src, IsDependency(_A("dependants::B"), _A("dependants::A"))); + REQUIRE_THAT( + src, IsDependency(_A("dependants::BB"), _A("dependants::A"))); + REQUIRE_THAT( + src, IsDependency(_A("dependants::C"), _A("dependants::B"))); + REQUIRE_THAT( + src, IsDependency(_A("dependants::D"), _A("dependants::C"))); + REQUIRE_THAT( + src, IsDependency(_A("dependants::E"), _A("dependants::D"))); + + // Check dependencies filter + REQUIRE_THAT(src, IsClass(_A("dependencies::G"))); + REQUIRE_THAT(src, IsClass(_A("dependencies::GG"))); + REQUIRE_THAT(src, IsClass(_A("dependencies::H"))); + REQUIRE_THAT(src, !IsClass(_A("dependencies::HH"))); + REQUIRE_THAT(src, IsClass(_A("dependencies::I"))); + REQUIRE_THAT(src, IsClass(_A("dependencies::J"))); + + REQUIRE_THAT( + src, IsDependency(_A("dependencies::H"), _A("dependencies::G"))); + REQUIRE_THAT( + src, IsDependency(_A("dependencies::H"), _A("dependencies::GG"))); + REQUIRE_THAT( + src, IsDependency(_A("dependencies::I"), _A("dependencies::H"))); + REQUIRE_THAT( + src, IsDependency(_A("dependencies::J"), _A("dependencies::I"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00044/.clang-uml b/tests/t00044/.clang-uml index 69dab8ac..b0e819d2 100644 --- a/tests/t00044/.clang-uml +++ b/tests/t00044/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00044_class: type: class diff --git a/tests/t00044/test_case.h b/tests/t00044/test_case.h index ef2010e3..e20a1e6d 100644 --- a/tests/t00044/test_case.h +++ b/tests/t00044/test_case.h @@ -30,42 +30,41 @@ TEST_CASE("t00044", "[test-case][class]") REQUIRE(model->name() == "t00044_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, !Contains("type-parameter-")); + REQUIRE_THAT(src, !Contains("type-parameter-")); - REQUIRE_THAT(puml, IsClassTemplate("sink", "T")); - REQUIRE_THAT(puml, IsClassTemplate("signal_handler", "T,A")); + REQUIRE_THAT(src, IsClassTemplate("sink", "T")); + REQUIRE_THAT(src, IsClassTemplate("signal_handler", "T,A")); - REQUIRE_THAT(puml, IsClassTemplate("signal_handler", "Ret(Args...),A")); - REQUIRE_THAT(puml, IsClassTemplate("signal_handler", "void(int),bool")); + REQUIRE_THAT(src, IsClassTemplate("signal_handler", "Ret(Args...),A")); + REQUIRE_THAT(src, IsClassTemplate("signal_handler", "void(int),bool")); REQUIRE_THAT( - puml, IsClassTemplate("sink", "signal_handler")); + src, IsClassTemplate("sink", "signal_handler")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation( _A("sink"), _A("sink>"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation(_A("sink>"), _A("sink>"))); - REQUIRE_THAT(puml, IsClassTemplate("signal_handler", "T,A")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsClassTemplate("signal_handler", "T,A")); + REQUIRE_THAT(src, IsInstantiation(_A("signal_handler"), _A("signal_handler"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation(_A("signal_handler"), _A("signal_handler"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -80,6 +79,40 @@ TEST_CASE("t00044", "[test-case][class]") j, "sink>")); REQUIRE(IsClass(j, "R")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + REQUIRE_THAT(src, !Contains("type-parameter-")); + + REQUIRE_THAT(src, IsClass(_A("sink"))); + REQUIRE_THAT(src, IsClass(_A("signal_handler"))); + + REQUIRE_THAT(src, IsClass(_A("signal_handler"))); + REQUIRE_THAT(src, IsClass(_A("signal_handler"))); + + REQUIRE_THAT(src, IsClass(_A("sink>"))); + + REQUIRE_THAT(src, + IsInstantiation( + _A("sink"), _A("sink>"))); + + REQUIRE_THAT(src, + IsInstantiation(_A("sink>"), + _A("sink>"))); + + REQUIRE_THAT(src, IsClass(_A("signal_handler"))); + REQUIRE_THAT(src, + IsInstantiation(_A("signal_handler"), + _A("signal_handler"))); + + REQUIRE_THAT(src, + IsInstantiation(_A("signal_handler"), + _A("signal_handler"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00045/.clang-uml b/tests/t00045/.clang-uml index 84b35cfc..51184d16 100644 --- a/tests/t00045/.clang-uml +++ b/tests/t00045/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00045_class: type: class diff --git a/tests/t00045/test_case.h b/tests/t00045/test_case.h index c198c0e2..f2f2e2c5 100644 --- a/tests/t00045/test_case.h +++ b/tests/t00045/test_case.h @@ -29,45 +29,43 @@ TEST_CASE("t00045", "[test-case][class]") REQUIRE(model->name() == "t00045_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::A"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::A"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::B"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::C"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::D"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::E"))); - REQUIRE_THAT(puml, IsClass(_A("ns1::ns2::R"))); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("ns1::A"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::A"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::B"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::C"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::D"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::E"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::R"))); - REQUIRE_THAT(puml, IsBaseClass(_A("ns1::ns2::A"), _A("ns1::ns2::B"))); - REQUIRE_THAT(puml, IsBaseClass(_A("ns1::A"), _A("ns1::ns2::C"))); - REQUIRE_THAT(puml, IsBaseClass(_A("ns1::ns2::A"), _A("ns1::ns2::D"))); - REQUIRE_THAT(puml, IsBaseClass(_A("A"), _A("ns1::ns2::E"))); + REQUIRE_THAT(src, IsBaseClass(_A("ns1::ns2::A"), _A("ns1::ns2::B"))); + REQUIRE_THAT(src, IsBaseClass(_A("ns1::A"), _A("ns1::ns2::C"))); + REQUIRE_THAT(src, IsBaseClass(_A("ns1::ns2::A"), _A("ns1::ns2::D"))); + REQUIRE_THAT(src, IsBaseClass(_A("A"), _A("ns1::ns2::E"))); REQUIRE_THAT( - puml, IsAssociation(_A("ns1::ns2::R"), _A("ns1::ns2::A"), "+a")); + src, IsAssociation(_A("ns1::ns2::R"), _A("ns1::ns2::A"), "+a")); REQUIRE_THAT( - puml, IsAssociation(_A("ns1::ns2::R"), _A("ns1::A"), "+ns1_a")); - REQUIRE_THAT(puml, + src, IsAssociation(_A("ns1::ns2::R"), _A("ns1::A"), "+ns1_a")); + REQUIRE_THAT(src, IsAssociation(_A("ns1::ns2::R"), _A("ns1::ns2::A"), "+ns1_ns2_a")); - REQUIRE_THAT( - puml, IsAssociation(_A("ns1::ns2::R"), _A("A"), "+root_a")); + REQUIRE_THAT(src, IsAssociation(_A("ns1::ns2::R"), _A("A"), "+root_a")); - REQUIRE_THAT(puml, IsDependency(_A("ns1::ns2::R"), _A("AA"))); + REQUIRE_THAT(src, IsDependency(_A("ns1::ns2::R"), _A("AA"))); - REQUIRE_THAT(puml, IsFriend(_A("ns1::ns2::R"), _A("AAA"))); + REQUIRE_THAT(src, IsFriend(_A("ns1::ns2::R"), _A("AAA"))); REQUIRE_THAT( - puml, !IsFriend(_A("ns1::ns2::R"), _A("ns1::ns2::AAA"))); + src, !IsFriend(_A("ns1::ns2::R"), _A("ns1::ns2::AAA"))); // TODO: // REQUIRE_THAT(puml, IsFriend(_A("ns1::ns2::R"), // _A("AAAA"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -85,6 +83,42 @@ TEST_CASE("t00045", "[test-case][class]") REQUIRE(IsBaseClass(j, "ns1::ns2::A", "ns1::ns2::B")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsFriend; + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("ns1::A"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::A"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::B"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::C"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::D"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::E"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::R"))); + + REQUIRE_THAT(src, IsBaseClass(_A("ns1::ns2::A"), _A("ns1::ns2::B"))); + REQUIRE_THAT(src, IsBaseClass(_A("ns1::A"), _A("ns1::ns2::C"))); + REQUIRE_THAT(src, IsBaseClass(_A("ns1::ns2::A"), _A("ns1::ns2::D"))); + REQUIRE_THAT(src, IsBaseClass(_A("A"), _A("ns1::ns2::E"))); + + REQUIRE_THAT( + src, IsAssociation(_A("ns1::ns2::R"), _A("ns1::ns2::A"), "+a")); + REQUIRE_THAT( + src, IsAssociation(_A("ns1::ns2::R"), _A("ns1::A"), "+ns1_a")); + REQUIRE_THAT(src, + IsAssociation(_A("ns1::ns2::R"), _A("ns1::ns2::A"), "+ns1_ns2_a")); + REQUIRE_THAT(src, IsAssociation(_A("ns1::ns2::R"), _A("A"), "+root_a")); + + REQUIRE_THAT(src, IsDependency(_A("ns1::ns2::R"), _A("AA"))); + + REQUIRE_THAT(src, IsFriend(_A("ns1::ns2::R"), _A("AAA"))); + REQUIRE_THAT( + src, !IsFriend(_A("ns1::ns2::R"), _A("ns1::ns2::AAA"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00046/.clang-uml b/tests/t00046/.clang-uml index cea73ccf..9a3b0f50 100644 --- a/tests/t00046/.clang-uml +++ b/tests/t00046/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00046_class: type: class diff --git a/tests/t00046/test_case.h b/tests/t00046/test_case.h index bae8a3c1..11272ee2 100644 --- a/tests/t00046/test_case.h +++ b/tests/t00046/test_case.h @@ -29,22 +29,21 @@ TEST_CASE("t00046", "[test-case][class]") REQUIRE(model->name() == "t00046_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsClass(_A("R"))); - REQUIRE_THAT(puml, IsField("i", "std::vector")); + REQUIRE_THAT(src, IsField("i", "std::vector")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -56,6 +55,24 @@ TEST_CASE("t00046", "[test-case][class]") REQUIRE(get_element(j, "ns1::A").value()["type"] == "class"); REQUIRE(get_element(j, "ns1::ns2::D").value()["type"] == "class"); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } -} + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsField; + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("AA"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::B"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::C"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::D"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::E"))); + REQUIRE_THAT(src, IsClass(_A("ns1::ns2::R"))); + + REQUIRE_THAT(src, IsField("i", "std::vector")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); + } +} \ No newline at end of file diff --git a/tests/t00047/.clang-uml b/tests/t00047/.clang-uml index 9ea39aed..0072a2cc 100644 --- a/tests/t00047/.clang-uml +++ b/tests/t00047/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00047_class: type: class diff --git a/tests/t00047/test_case.h b/tests/t00047/test_case.h index 4a83feb2..69d341b8 100644 --- a/tests/t00047/test_case.h +++ b/tests/t00047/test_case.h @@ -29,22 +29,21 @@ TEST_CASE("t00047", "[test-case][class]") REQUIRE(model->name() == "t00047_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if class templates exist - REQUIRE_THAT(puml, IsClassTemplate("conditional_t", "Ts...")); - REQUIRE_THAT(puml, IsClassTemplate("conditional_t", "Else")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsClassTemplate("conditional_t", "Ts...")); + REQUIRE_THAT(src, IsClassTemplate("conditional_t", "Else")); + REQUIRE_THAT(src, IsClassTemplate("conditional_t", "std::true_type,Result,Tail...")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsClassTemplate("conditional_t", "std::false_type,Result,Tail...")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -56,6 +55,21 @@ TEST_CASE("t00047", "[test-case][class]") REQUIRE(IsClass(j, "conditional_t")); REQUIRE(IsClass(j, "conditional_t")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + // Check if class templates exist + REQUIRE_THAT(src, IsClass(_A("conditional_t"))); + REQUIRE_THAT(src, IsClass(_A("conditional_t"))); + REQUIRE_THAT( + src, IsClass(_A("conditional_t"))); + REQUIRE_THAT( + src, IsClass(_A("conditional_t"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00048/.clang-uml b/tests/t00048/.clang-uml index e3e44fbc..ecbc732a 100644 --- a/tests/t00048/.clang-uml +++ b/tests/t00048/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00048_class: type: class diff --git a/tests/t00048/test_case.h b/tests/t00048/test_case.h index 3cd4616f..3bea43d1 100644 --- a/tests/t00048/test_case.h +++ b/tests/t00048/test_case.h @@ -29,28 +29,27 @@ TEST_CASE("t00048", "[test-case][class]") REQUIRE(model->name() == "t00048_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all classes exist - REQUIRE_THAT(puml, IsAbstractClass(_A("Base"))); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); + REQUIRE_THAT(src, IsAbstractClass(_A("Base"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); // Check if class templates exist - REQUIRE_THAT(puml, IsAbstractClassTemplate("BaseTemplate", "T")); - REQUIRE_THAT(puml, IsClassTemplate("ATemplate", "T")); - REQUIRE_THAT(puml, IsClassTemplate("BTemplate", "T")); + REQUIRE_THAT(src, IsAbstractClassTemplate("BaseTemplate", "T")); + REQUIRE_THAT(src, IsClassTemplate("ATemplate", "T")); + REQUIRE_THAT(src, IsClassTemplate("BTemplate", "T")); // Check if all inheritance relationships exist - REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("A"))); - REQUIRE_THAT(puml, IsBaseClass(_A("Base"), _A("B"))); + REQUIRE_THAT(src, IsBaseClass(_A("Base"), _A("A"))); + REQUIRE_THAT(src, IsBaseClass(_A("Base"), _A("B"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -64,6 +63,28 @@ TEST_CASE("t00048", "[test-case][class]") REQUIRE(IsBaseClass(j, "Base", "A")); REQUIRE(IsBaseClass(j, "Base", "B")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsAbstractClass; + + // Check if all classes exist + REQUIRE_THAT(src, IsAbstractClass(_A("Base"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + + // Check if class templates exist + REQUIRE_THAT(src, IsAbstractClass(_A("BaseTemplate"))); + REQUIRE_THAT(src, IsClass(_A("ATemplate"))); + REQUIRE_THAT(src, IsClass(_A("BTemplate"))); + + // Check if all inheritance relationships exist + REQUIRE_THAT(src, IsBaseClass(_A("Base"), _A("A"))); + REQUIRE_THAT(src, IsBaseClass(_A("Base"), _A("B"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00049/.clang-uml b/tests/t00049/.clang-uml index b8653678..13eb1cea 100644 --- a/tests/t00049/.clang-uml +++ b/tests/t00049/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00049_class: type: class diff --git a/tests/t00049/test_case.h b/tests/t00049/test_case.h index 1b94a090..bf2f6474 100644 --- a/tests/t00049/test_case.h +++ b/tests/t00049/test_case.h @@ -29,36 +29,35 @@ TEST_CASE("t00049", "[test-case][class]") REQUIRE(model->name() == "t00049_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(src, IsClass(_A("R"))); // Check if class templates exist - REQUIRE_THAT(puml, IsClassTemplate("A", "T")); + REQUIRE_THAT(src, IsClassTemplate("A", "T")); // Check if all methods exist - REQUIRE_THAT(puml, (IsMethod("get_int_map", "A"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, (IsMethod("get_int_map", "A"))); + REQUIRE_THAT(src, (IsMethod("set_int_map", "void", "A && int_map"))); // Check if all fields exist - REQUIRE_THAT(puml, (IsField("a_string", "A"))); + REQUIRE_THAT(src, (IsField("a_string", "A"))); REQUIRE_THAT( - puml, (IsField("a_vector_string", "A"))); - REQUIRE_THAT(puml, (IsField("a_int_map", "A"))); + src, (IsField("a_vector_string", "A"))); + REQUIRE_THAT(src, (IsField("a_int_map", "A"))); // Check if all relationships exist - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -69,6 +68,37 @@ TEST_CASE("t00049", "[test-case][class]") REQUIRE(IsClassTemplate(j, "A")); REQUIRE(IsInstantiation(j, "A", "A")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsField; + using mermaid::IsMethod; + + // Check if all classes exist + REQUIRE_THAT(src, IsClass(_A("R"))); + + // Check if class templates exist + REQUIRE_THAT(src, IsClass(_A("A"))); + + // Check if all methods exist + REQUIRE_THAT(src, (IsMethod("get_int_map", "A"))); + REQUIRE_THAT(src, + (IsMethod("set_int_map", "void", "A && int_map"))); + + // Check if all fields exist + REQUIRE_THAT(src, (IsField("a_string", "A"))); + REQUIRE_THAT( + src, (IsField("a_vector_string", "A"))); + REQUIRE_THAT(src, (IsField("a_int_map", "A"))); + + // Check if all relationships exist + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00050/.clang-uml b/tests/t00050/.clang-uml index bf7ef914..9a80b579 100644 --- a/tests/t00050/.clang-uml +++ b/tests/t00050/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00050_class: type: class @@ -62,7 +62,7 @@ diagrams: {% endfor %} {% endif %} - {# Render template paramete if any #} + {# Render template parameters if any #} {% if existsIn(e, "comment") and existsIn(e.comment, "tparam") %} {% set c=e.comment %} @@ -75,3 +75,29 @@ diagrams: {% endif %} {% endfor %} + mermaid: + after: + - | + note for {{ alias("NoSuchClass") }} "{{ comment("NoSuchClass").formatted }}" + - | + note for {{ alias("A") }} "{{ comment("clanguml::t00050::A").formatted }}" + - | + note for {{ element("clanguml::t00050::A").alias }} {% set e=element("clanguml::t00050::A") %} "{{ e.comment.formatted }}" + note for {{ alias("C") }} "{{ trim(comment("clanguml::t00050::C").text) }}" + {% set cmt=comment("clanguml::t00050::G").paragraph %} + note for {{ alias("G") }} "{{ trim(cmt.0) }}" + note for {{ alias("G") }} "{{ trim(cmt.1) }}" + note for {{ alias("G") }} "{{ trim(cmt.2) }}" + - | + {# Render brief comments and todos, if any were written for an element #} + {% for e in diagram.elements %} + {% if existsIn(e, "comment") and existsIn(e.comment, "brief") %} + note for {{ e.alias }} {% set c=e.comment %} "{{ c.brief.0 }}" + {% endif %} + {% if existsIn(e, "comment") and existsIn(e.comment, "todo") %} + {% set c=e.comment %} + {% for t in c.todo %} + note for {{ e.alias }} "**TODO** {{ t }}" + {% endfor %} + {% endif %} + {% endfor %} diff --git a/tests/t00050/test_case.h b/tests/t00050/test_case.h index 5f4ae9f0..cdb593b8 100644 --- a/tests/t00050/test_case.h +++ b/tests/t00050/test_case.h @@ -29,33 +29,32 @@ TEST_CASE("t00050", "[test-case][class]") REQUIRE(model->name() == "t00050_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("utils::D"))); - REQUIRE_THAT(puml, IsEnum(_A("E"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("utils::D"))); + REQUIRE_THAT(src, IsEnum(_A("E"))); - REQUIRE_THAT(puml, HasNote(_A("A"), "left")); - REQUIRE_THAT(puml, HasNote(_A("A"), "right")); - REQUIRE_THAT(puml, HasNote(_A("B"), "top")); - REQUIRE_THAT(puml, HasNote(_A("C"), "top")); - REQUIRE_THAT(puml, HasNote(_A("utils::D"), "top")); - REQUIRE_THAT(puml, !HasNote(_A("E"), "bottom")); - REQUIRE_THAT(puml, !HasNote(_A("NoComment"), "top")); - REQUIRE_THAT(puml, HasNote(_A("F"), "top")); - REQUIRE_THAT(puml, HasNote(_A("G"), "top")); - REQUIRE_THAT(puml, HasNote(_A("G"), "bottom")); - REQUIRE_THAT(puml, HasNote(_A("G"), "right")); + REQUIRE_THAT(src, HasNote(_A("A"), "left")); + REQUIRE_THAT(src, HasNote(_A("A"), "right")); + REQUIRE_THAT(src, HasNote(_A("B"), "top")); + REQUIRE_THAT(src, HasNote(_A("C"), "top")); + REQUIRE_THAT(src, HasNote(_A("utils::D"), "top")); + REQUIRE_THAT(src, !HasNote(_A("E"), "bottom")); + REQUIRE_THAT(src, !HasNote(_A("NoComment"), "top")); + REQUIRE_THAT(src, HasNote(_A("F"), "top")); + REQUIRE_THAT(src, HasNote(_A("G"), "top")); + REQUIRE_THAT(src, HasNote(_A("G"), "bottom")); + REQUIRE_THAT(src, HasNote(_A("G"), "right")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -68,6 +67,34 @@ TEST_CASE("t00050", "[test-case][class]") REQUIRE(IsClass(j, "utils::D")); REQUIRE(IsEnum(j, "E")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::HasNote; + using mermaid::IsEnum; + + // Check if all classes exist + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("utils::D"))); + REQUIRE_THAT(src, IsEnum(_A("E"))); + + REQUIRE_THAT(src, HasNote(_A("A"), "left")); + REQUIRE_THAT(src, HasNote(_A("A"), "right")); + REQUIRE_THAT(src, HasNote(_A("B"), "top")); + REQUIRE_THAT(src, HasNote(_A("C"), "top")); + REQUIRE_THAT(src, HasNote(_A("utils::D"), "top")); + REQUIRE_THAT(src, !HasNote(_A("E"), "bottom")); + REQUIRE_THAT(src, !HasNote(_A("NoComment"), "top")); + REQUIRE_THAT(src, HasNote(_A("F"), "top")); + REQUIRE_THAT(src, HasNote(_A("G"), "top")); + REQUIRE_THAT(src, HasNote(_A("G"), "bottom")); + REQUIRE_THAT(src, HasNote(_A("G"), "right")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00051/.clang-uml b/tests/t00051/.clang-uml index 4cb46059..1e6daa3a 100644 --- a/tests/t00051/.clang-uml +++ b/tests/t00051/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00051_class: type: class diff --git a/tests/t00051/test_case.h b/tests/t00051/test_case.h index a90f27b9..ea66c8e0 100644 --- a/tests/t00051/test_case.h +++ b/tests/t00051/test_case.h @@ -29,54 +29,52 @@ TEST_CASE("t00051", "[test-case][class]") REQUIRE(model->name() == "t00051_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("A::custom_thread1"))); - REQUIRE_THAT(puml, IsInnerClass(_A("A"), _A("A::custom_thread2"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsInnerClass(_A("A"), _A("A::custom_thread1"))); + REQUIRE_THAT(src, IsInnerClass(_A("A"), _A("A::custom_thread2"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, (IsMethod("custom_thread1", "void", "Function && f, Args &&... args"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, (IsMethod("thread", "void", "(lambda at ../../tests/t00051/t00051.cc:59:27) &&"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, (IsMethod("start_thread3", "B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at " "../../tests/t00051/t00051.cc:43:27)>"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, (IsMethod("get_function", "(lambda at ../../tests/t00051/t00051.cc:48:16)"))); - REQUIRE_THAT(puml, IsClassTemplate("B", "F,FF=F")); - REQUIRE_THAT(puml, (IsMethod("f", "void"))); - REQUIRE_THAT(puml, (IsMethod("ff", "void"))); + REQUIRE_THAT(src, IsClassTemplate("B", "F,FF=F")); + REQUIRE_THAT(src, (IsMethod("f", "void"))); + REQUIRE_THAT(src, (IsMethod("ff", "void"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsClassTemplate("B", "(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at " "../../tests/t00051/t00051.cc:43:27)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation(_A("B"), _A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda " "at ../../tests/t00051/t00051.cc:43:27)>"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsDependency(_A("A"), _A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda " "at ../../tests/t00051/t00051.cc:43:27)>"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } - { auto j = generate_class_json(diagram, *model); @@ -86,6 +84,53 @@ TEST_CASE("t00051", "[test-case][class]") REQUIRE(IsInnerClass(j, "A", "A::custom_thread1")); REQUIRE(IsInnerClass(j, "A", "A::custom_thread2")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsInnerClass; + using mermaid::IsMethod; + + // Check if all classes exist + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsInnerClass(_A("A"), _A("A::custom_thread1"))); + REQUIRE_THAT(src, IsInnerClass(_A("A"), _A("A::custom_thread2"))); + + REQUIRE_THAT(src, + (IsMethod("custom_thread1", "void", + "Function && f, Args &&... args"))); + REQUIRE_THAT(src, + (IsMethod("thread", "void", + "(lambda at ../../tests/t00051/t00051.cc:59:27) &&"))); + REQUIRE_THAT(src, + (IsMethod("start_thread3", + "B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at " + "../../tests/t00051/t00051.cc:43:27)>"))); + REQUIRE_THAT(src, + (IsMethod("get_function", + "(lambda at ../../tests/t00051/t00051.cc:48:16)"))); + + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, (IsMethod("f", "void"))); + REQUIRE_THAT(src, (IsMethod("ff", "void"))); + + REQUIRE_THAT(src, + IsClass(_A( + "B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda at " + "../../tests/t00051/t00051.cc:43:27)>"))); + + REQUIRE_THAT(src, + IsInstantiation(_A("B"), + _A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda " + "at ../../tests/t00051/t00051.cc:43:27)>"))); + + REQUIRE_THAT(src, + IsDependency(_A("A"), + _A("B<(lambda at ../../tests/t00051/t00051.cc:43:18),(lambda " + "at ../../tests/t00051/t00051.cc:43:27)>"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00052/.clang-uml b/tests/t00052/.clang-uml index c02dbe15..aa5a68c0 100644 --- a/tests/t00052/.clang-uml +++ b/tests/t00052/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00052_class: type: class diff --git a/tests/t00052/test_case.h b/tests/t00052/test_case.h index b15b080a..264bf190 100644 --- a/tests/t00052/test_case.h +++ b/tests/t00052/test_case.h @@ -29,27 +29,25 @@ TEST_CASE("t00052", "[test-case][class]") REQUIRE(model->name() == "t00052_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); // Check if class templates exist - REQUIRE_THAT(puml, IsClassTemplate("B", "T")); + REQUIRE_THAT(src, IsClassTemplate("B", "T")); // Check if all methods exist - REQUIRE_THAT(puml, (IsMethod("a", "T", "T p"))); - REQUIRE_THAT( - puml, (IsMethod("aa", "void", "F && f, Q q"))); - REQUIRE_THAT(puml, (IsMethod("b", "T", "T t"))); - REQUIRE_THAT(puml, (IsMethod("bb", "T", "F && f, T t"))); + REQUIRE_THAT(src, (IsMethod("a", "T", "T p"))); + REQUIRE_THAT(src, (IsMethod("aa", "void", "F && f, Q q"))); + REQUIRE_THAT(src, (IsMethod("b", "T", "T t"))); + REQUIRE_THAT(src, (IsMethod("bb", "T", "F && f, T t"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -59,6 +57,26 @@ TEST_CASE("t00052", "[test-case][class]") REQUIRE(IsClass(j, "A")); REQUIRE(IsClassTemplate(j, "B")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsMethod; + + // Check if all classes exist + REQUIRE_THAT(src, IsClass(_A("A"))); + + // Check if class templates exist + REQUIRE_THAT(src, IsClass(_A("B"))); + + // Check if all methods exist + REQUIRE_THAT(src, (IsMethod("a", "T", "T p"))); + REQUIRE_THAT(src, (IsMethod("aa", "void", "F && f, Q q"))); + REQUIRE_THAT(src, (IsMethod("b", "T", "T t"))); + REQUIRE_THAT(src, (IsMethod("bb", "T", "F && f, T t"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00053/.clang-uml b/tests/t00053/.clang-uml index 45e67c0b..628a1237 100644 --- a/tests/t00053/.clang-uml +++ b/tests/t00053/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00053_class: type: class diff --git a/tests/t00053/test_case.h b/tests/t00053/test_case.h index 71edfe48..528b23ff 100644 --- a/tests/t00053/test_case.h +++ b/tests/t00053/test_case.h @@ -29,31 +29,30 @@ TEST_CASE("t00053", "[test-case][class]") REQUIRE(model->name() == "t00053_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("a"))); - REQUIRE_THAT(puml, IsClass(_A("b"))); - REQUIRE_THAT(puml, IsClass(_A("c"))); - REQUIRE_THAT(puml, IsClass(_A("d"))); - REQUIRE_THAT(puml, IsClass(_A("e"))); - REQUIRE_THAT(puml, IsClass(_A("f"))); - REQUIRE_THAT(puml, IsClass(_A("g"))); + REQUIRE_THAT(src, IsClass(_A("a"))); + REQUIRE_THAT(src, IsClass(_A("b"))); + REQUIRE_THAT(src, IsClass(_A("c"))); + REQUIRE_THAT(src, IsClass(_A("d"))); + REQUIRE_THAT(src, IsClass(_A("e"))); + REQUIRE_THAT(src, IsClass(_A("f"))); + REQUIRE_THAT(src, IsClass(_A("g"))); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("G"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsClass(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("G"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -77,6 +76,30 @@ TEST_CASE("t00053", "[test-case][class]") REQUIRE(IsClass(j, "F")); REQUIRE(IsClass(j, "G")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + // Check if all classes exist + REQUIRE_THAT(src, IsClass(_A("a"))); + REQUIRE_THAT(src, IsClass(_A("b"))); + REQUIRE_THAT(src, IsClass(_A("c"))); + REQUIRE_THAT(src, IsClass(_A("d"))); + REQUIRE_THAT(src, IsClass(_A("e"))); + REQUIRE_THAT(src, IsClass(_A("f"))); + REQUIRE_THAT(src, IsClass(_A("g"))); + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsClass(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("G"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00054/.clang-uml b/tests/t00054/.clang-uml index 3bd9b035..6000cf79 100644 --- a/tests/t00054/.clang-uml +++ b/tests/t00054/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00054_class: type: class diff --git a/tests/t00054/test_case.h b/tests/t00054/test_case.h index b7cdecd9..060c4900 100644 --- a/tests/t00054/test_case.h +++ b/tests/t00054/test_case.h @@ -29,35 +29,34 @@ TEST_CASE("t00054", "[test-case][class]") REQUIRE(model->name() == "t00054_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("a"))); - REQUIRE_THAT(puml, IsClass(_A("b"))); - REQUIRE_THAT(puml, IsClass(_A("c"))); - REQUIRE_THAT(puml, IsClass(_A("d"))); - REQUIRE_THAT(puml, IsClass(_A("e"))); - REQUIRE_THAT(puml, IsClass(_A("f"))); - REQUIRE_THAT(puml, IsClass(_A("g"))); + REQUIRE_THAT(src, IsClass(_A("a"))); + REQUIRE_THAT(src, IsClass(_A("b"))); + REQUIRE_THAT(src, IsClass(_A("c"))); + REQUIRE_THAT(src, IsClass(_A("d"))); + REQUIRE_THAT(src, IsClass(_A("e"))); + REQUIRE_THAT(src, IsClass(_A("f"))); + REQUIRE_THAT(src, IsClass(_A("g"))); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("G"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsClass(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("G"))); - REQUIRE_THAT(puml, IsEnum(_A("i"))); - REQUIRE_THAT(puml, IsEnum(_A("h"))); - REQUIRE_THAT(puml, IsEnum(_A("j"))); + REQUIRE_THAT(src, IsEnum(_A("i"))); + REQUIRE_THAT(src, IsEnum(_A("h"))); + REQUIRE_THAT(src, IsEnum(_A("j"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -85,6 +84,35 @@ TEST_CASE("t00054", "[test-case][class]") REQUIRE(IsEnum(j, "detail4::h")); REQUIRE(IsEnum(j, "detail4::j")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsEnum; + + // Check if all classes exist + REQUIRE_THAT(src, IsClass(_A("a"))); + REQUIRE_THAT(src, IsClass(_A("b"))); + REQUIRE_THAT(src, IsClass(_A("detail::c"))); + REQUIRE_THAT(src, IsClass(_A("detail::d"))); + REQUIRE_THAT(src, IsClass(_A("detail::e"))); + REQUIRE_THAT(src, IsClass(_A("f"))); + REQUIRE_THAT(src, IsClass(_A("g"))); + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("detail2::C"))); + REQUIRE_THAT(src, IsClass(_A("detail2::detail3::D"))); + REQUIRE_THAT(src, IsClass(_A("detail2::detail3::E"))); + REQUIRE_THAT(src, IsClass(_A("detail2::F"))); + REQUIRE_THAT(src, IsClass(_A("G"))); + + REQUIRE_THAT(src, IsEnum(_A("detail4::i"))); + REQUIRE_THAT(src, IsEnum(_A("detail4::h"))); + REQUIRE_THAT(src, IsEnum(_A("detail4::j"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00055/.clang-uml b/tests/t00055/.clang-uml index f7bcd5b2..88c6a6f2 100644 --- a/tests/t00055/.clang-uml +++ b/tests/t00055/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00055_class: type: class diff --git a/tests/t00055/test_case.h b/tests/t00055/test_case.h index 44247877..9f238ba7 100644 --- a/tests/t00055/test_case.h +++ b/tests/t00055/test_case.h @@ -29,36 +29,35 @@ TEST_CASE("t00055", "[test-case][class]") REQUIRE(model->name() == "t00055_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, IsClass(_A("E"))); - REQUIRE_THAT(puml, IsClass(_A("F"))); - REQUIRE_THAT(puml, IsClass(_A("G"))); - REQUIRE_THAT(puml, IsClass(_A("H"))); - REQUIRE_THAT(puml, IsClass(_A("I"))); - REQUIRE_THAT(puml, IsClass(_A("J"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsClass(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("G"))); + REQUIRE_THAT(src, IsClass(_A("H"))); + REQUIRE_THAT(src, IsClass(_A("I"))); + REQUIRE_THAT(src, IsClass(_A("J"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("A"), "right", _A("C"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("C"), "right", _A("E"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("E"), "right", _A("G"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("G"), "right", _A("I"))); + REQUIRE_THAT(src, IsLayoutHint(_A("A"), "right", _A("C"))); + REQUIRE_THAT(src, IsLayoutHint(_A("C"), "right", _A("E"))); + REQUIRE_THAT(src, IsLayoutHint(_A("E"), "right", _A("G"))); + REQUIRE_THAT(src, IsLayoutHint(_A("G"), "right", _A("I"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("B"), "down", _A("D"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("D"), "down", _A("F"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("F"), "down", _A("H"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("H"), "down", _A("J"))); + REQUIRE_THAT(src, IsLayoutHint(_A("B"), "down", _A("D"))); + REQUIRE_THAT(src, IsLayoutHint(_A("D"), "down", _A("F"))); + REQUIRE_THAT(src, IsLayoutHint(_A("F"), "down", _A("H"))); + REQUIRE_THAT(src, IsLayoutHint(_A("H"), "down", _A("J"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -77,6 +76,25 @@ TEST_CASE("t00055", "[test-case][class]") REQUIRE(IsClass(j, "I")); REQUIRE(IsClass(j, "J")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + // Check if all classes exist + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsClass(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("G"))); + REQUIRE_THAT(src, IsClass(_A("H"))); + REQUIRE_THAT(src, IsClass(_A("I"))); + REQUIRE_THAT(src, IsClass(_A("J"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00056/.clang-uml b/tests/t00056/.clang-uml index 64345fc7..58b5f2af 100644 --- a/tests/t00056/.clang-uml +++ b/tests/t00056/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00056_class: type: class diff --git a/tests/t00056/test_case.h b/tests/t00056/test_case.h index ae8a6a3b..d523766f 100644 --- a/tests/t00056/test_case.h +++ b/tests/t00056/test_case.h @@ -29,95 +29,94 @@ TEST_CASE("t00056", "[test-case][class]") REQUIRE(model->name() == "t00056_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all classes exist - REQUIRE_THAT(puml, IsConcept(_A("greater_than_simple"))); - REQUIRE_THAT(puml, IsConcept(_A("greater_than_with_requires"))); - REQUIRE_THAT(puml, IsConcept(_A("max_four_bytes"))); - REQUIRE_THAT(puml, IsConcept(_A("iterable"))); - REQUIRE_THAT(puml, IsConcept(_A("has_value_type"))); - REQUIRE_THAT(puml, IsConcept(_A("convertible_to_string"))); - REQUIRE_THAT(puml, IsConcept(_A("iterable_with_value_type"))); - REQUIRE_THAT(puml, IsConcept(_A("iterable_or_small_value_type"))); + REQUIRE_THAT(src, IsConcept(_A("greater_than_simple"))); + REQUIRE_THAT(src, IsConcept(_A("greater_than_with_requires"))); + REQUIRE_THAT(src, IsConcept(_A("max_four_bytes"))); + REQUIRE_THAT(src, IsConcept(_A("iterable"))); + REQUIRE_THAT(src, IsConcept(_A("has_value_type"))); + REQUIRE_THAT(src, IsConcept(_A("convertible_to_string"))); + REQUIRE_THAT(src, IsConcept(_A("iterable_with_value_type"))); + REQUIRE_THAT(src, IsConcept(_A("iterable_or_small_value_type"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConceptRequirement(_A("greater_than_with_requires"), "sizeof (l) > sizeof (r)")); REQUIRE_THAT( - puml, IsConceptRequirement(_A("iterable"), "container.begin()")); + src, IsConceptRequirement(_A("iterable"), "container.begin()")); REQUIRE_THAT( - puml, IsConceptRequirement(_A("iterable"), "container.end()")); + src, IsConceptRequirement(_A("iterable"), "container.end()")); #ifdef _MSC_VER - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConceptRequirement( _A("convertible_to_string"), "std::string{s}")); #else - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConceptRequirement( _A("convertible_to_string"), "std::string{s}")); #endif - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConceptRequirement(_A("convertible_to_string"), "{std::to_string(s)} noexcept")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConceptRequirement(_A("convertible_to_string"), "{std::to_string(s)} -> std::same_as")); // Check if class templates exist - REQUIRE_THAT(puml, IsClassTemplate("A", "max_four_bytes T")); - REQUIRE_THAT(puml, IsClassTemplate("B", "T")); - REQUIRE_THAT(puml, IsClassTemplate("C", "convertible_to_string T")); + REQUIRE_THAT(src, IsClassTemplate("A", "max_four_bytes T")); + REQUIRE_THAT(src, IsClassTemplate("B", "T")); + REQUIRE_THAT(src, IsClassTemplate("C", "convertible_to_string T")); REQUIRE_THAT( - puml, IsClassTemplate("D", "iterable T1,T2,iterable T3,T4,T5")); - REQUIRE_THAT(puml, IsClassTemplate("E", "T1,T2,T3")); - REQUIRE_THAT(puml, IsClassTemplate("F", "T1,T2,T3")); + src, IsClassTemplate("D", "iterable T1,T2,iterable T3,T4,T5")); + REQUIRE_THAT(src, IsClassTemplate("E", "T1,T2,T3")); + REQUIRE_THAT(src, IsClassTemplate("F", "T1,T2,T3")); // Check if all relationships exist - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConstraint( _A("A"), _A("max_four_bytes"), "T")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConstraint(_A("D"), _A("max_four_bytes"), "T2")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConstraint(_A("D"), _A("max_four_bytes"), "T5")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConstraint(_A("D"), _A("iterable"), "T1")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConstraint(_A("D"), _A("iterable"), "T3")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConstraint(_A("iterable_with_value_type"), _A("has_value_type"), "T")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConstraint(_A("iterable_or_small_value_type"), _A("max_four_bytes"), "T")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConstraint(_A("iterable_or_small_value_type"), _A("iterable_with_value_type"), "T")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConstraint(_A("E"), _A("greater_than_with_requires"), "T1,T3")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConstraint( _A("F"), _A("greater_than_simple"), "T1,T3")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_class_json(diagram, *model); @@ -133,6 +132,96 @@ TEST_CASE("t00056", "[test-case][class]") REQUIRE(IsConcept(j, "iterable_with_value_type")); REQUIRE(IsConcept(j, "iterable_or_small_value_type")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsConcept; + using mermaid::IsConceptRequirement; + using mermaid::IsConstraint; + + // Check if all classes exist + REQUIRE_THAT(src, IsConcept(_A("greater_than_simple"))); + REQUIRE_THAT(src, IsConcept(_A("greater_than_with_requires"))); + REQUIRE_THAT(src, IsConcept(_A("max_four_bytes"))); + REQUIRE_THAT(src, IsConcept(_A("iterable"))); + REQUIRE_THAT(src, IsConcept(_A("has_value_type"))); + REQUIRE_THAT(src, IsConcept(_A("convertible_to_string"))); + REQUIRE_THAT(src, IsConcept(_A("iterable_with_value_type"))); + REQUIRE_THAT(src, IsConcept(_A("iterable_or_small_value_type"))); + + REQUIRE_THAT(src, + IsConceptRequirement(_A("greater_than_with_requires"), + "sizeof (l) > sizeof (r)")); + + REQUIRE_THAT( + src, IsConceptRequirement(_A("iterable"), "container.begin()")); + REQUIRE_THAT( + src, IsConceptRequirement(_A("iterable"), "container.end()")); + +#ifdef _MSC_VER + REQUIRE_THAT(src, + IsConceptRequirement( + _A("convertible_to_string"), "std::string{s}")); +#else + REQUIRE_THAT(src, + IsConceptRequirement( + _A("convertible_to_string"), "std::string{s}")); +#endif + REQUIRE_THAT(src, + IsConceptRequirement(_A("convertible_to_string"), + "{std::to_string(s)} noexcept")); + REQUIRE_THAT(src, + IsConceptRequirement(_A("convertible_to_string"), + "{std::to_string(s)} -> std::same_as")); + + // Check if class templates exist + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, IsClass(_A("E"))); + REQUIRE_THAT(src, IsClass(_A("F"))); + + // Check if all relationships exist + REQUIRE_THAT(src, + IsConstraint( + _A("A"), _A("max_four_bytes"), "T")); + + REQUIRE_THAT(src, + IsConstraint(_A("D"), + _A("max_four_bytes"), "T2")); + REQUIRE_THAT(src, + IsConstraint(_A("D"), + _A("max_four_bytes"), "T5")); + REQUIRE_THAT(src, + IsConstraint(_A("D"), + _A("iterable"), "T1")); + REQUIRE_THAT(src, + IsConstraint(_A("D"), + _A("iterable"), "T3")); + + REQUIRE_THAT(src, + IsConstraint(_A("iterable_with_value_type"), + _A("has_value_type"), "T")); + + REQUIRE_THAT(src, + IsConstraint(_A("iterable_or_small_value_type"), + _A("max_four_bytes"), "T")); + REQUIRE_THAT(src, + IsConstraint(_A("iterable_or_small_value_type"), + _A("iterable_with_value_type"), "T")); + + REQUIRE_THAT(src, + IsConstraint(_A("E"), + _A("greater_than_with_requires"), "T1,T3")); + + REQUIRE_THAT(src, + IsConstraint( + _A("F"), _A("greater_than_simple"), "T1,T3")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00057/.clang-uml b/tests/t00057/.clang-uml index 6ce6b2aa..1bd80828 100644 --- a/tests/t00057/.clang-uml +++ b/tests/t00057/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00057_class: type: class diff --git a/tests/t00057/test_case.h b/tests/t00057/test_case.h index 1d5eddc5..e033db34 100644 --- a/tests/t00057/test_case.h +++ b/tests/t00057/test_case.h @@ -29,38 +29,37 @@ TEST_CASE("t00057", "[test-case][class]") REQUIRE(model->name() == "t00057_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("t00057_A"))); - REQUIRE_THAT(puml, IsClass(_A("t00057_B"))); - REQUIRE_THAT(puml, IsClass(_A("t00057_C"))); - REQUIRE_THAT(puml, IsUnion(_A("t00057_D"))); - REQUIRE_THAT(puml, IsClass(_A("t00057_E"))); - REQUIRE_THAT(puml, IsClass(_A("t00057_F"))); - REQUIRE_THAT(puml, IsClass(_A("t00057_G"))); - REQUIRE_THAT(puml, !IsClass(_A("(anonymous)"))); - REQUIRE_THAT(puml, IsClass(_A("t00057_R"))); + REQUIRE_THAT(src, IsClass(_A("t00057_A"))); + REQUIRE_THAT(src, IsClass(_A("t00057_B"))); + REQUIRE_THAT(src, IsClass(_A("t00057_C"))); + REQUIRE_THAT(src, IsUnion(_A("t00057_D"))); + REQUIRE_THAT(src, IsClass(_A("t00057_E"))); + REQUIRE_THAT(src, IsClass(_A("t00057_F"))); + REQUIRE_THAT(src, IsClass(_A("t00057_G"))); + REQUIRE_THAT(src, !IsClass(_A("(anonymous)"))); + REQUIRE_THAT(src, IsClass(_A("t00057_R"))); // Check if all relationships exist - REQUIRE_THAT(puml, IsAggregation(_A("t00057_R"), _A("t00057_A"), "+a")); - REQUIRE_THAT(puml, IsAggregation(_A("t00057_R"), _A("t00057_B"), "+b")); - REQUIRE_THAT(puml, IsAssociation(_A("t00057_R"), _A("t00057_C"), "+c")); - REQUIRE_THAT(puml, IsAggregation(_A("t00057_R"), _A("t00057_D"), "+d")); - REQUIRE_THAT(puml, IsAssociation(_A("t00057_R"), _A("t00057_E"), "+e")); - REQUIRE_THAT(puml, IsAssociation(_A("t00057_R"), _A("t00057_F"), "+f")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsAggregation(_A("t00057_R"), _A("t00057_A"), "+a")); + REQUIRE_THAT(src, IsAggregation(_A("t00057_R"), _A("t00057_B"), "+b")); + REQUIRE_THAT(src, IsAssociation(_A("t00057_R"), _A("t00057_C"), "+c")); + REQUIRE_THAT(src, IsAggregation(_A("t00057_R"), _A("t00057_D"), "+d")); + REQUIRE_THAT(src, IsAssociation(_A("t00057_R"), _A("t00057_E"), "+e")); + REQUIRE_THAT(src, IsAssociation(_A("t00057_R"), _A("t00057_F"), "+f")); + REQUIRE_THAT(src, IsAggregation( _A("t00057_E"), _A("t00057_E::(coordinates)"), "+coordinates")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsAggregation(_A("t00057_E"), _A("t00057_E::(height)"), "+height")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -77,6 +76,38 @@ TEST_CASE("t00057", "[test-case][class]") REQUIRE(get_element(j, "t00057_G").value()["type"] == "class"); REQUIRE(get_element(j, "t00057_R").value()["type"] == "class"); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsUnion; + + // Check if all classes exist + REQUIRE_THAT(src, IsClass(_A("t00057_A"))); + REQUIRE_THAT(src, IsClass(_A("t00057_B"))); + REQUIRE_THAT(src, IsClass(_A("t00057_C"))); + REQUIRE_THAT(src, IsUnion(_A("t00057_D"))); + REQUIRE_THAT(src, IsClass(_A("t00057_E"))); + REQUIRE_THAT(src, IsClass(_A("t00057_F"))); + REQUIRE_THAT(src, IsClass(_A("t00057_G"))); + REQUIRE_THAT(src, !IsClass(_A("(anonymous)"))); + REQUIRE_THAT(src, IsClass(_A("t00057_R"))); + + // Check if all relationships exist + REQUIRE_THAT(src, IsAggregation(_A("t00057_R"), _A("t00057_A"), "+a")); + REQUIRE_THAT(src, IsAggregation(_A("t00057_R"), _A("t00057_B"), "+b")); + REQUIRE_THAT(src, IsAssociation(_A("t00057_R"), _A("t00057_C"), "+c")); + REQUIRE_THAT(src, IsAggregation(_A("t00057_R"), _A("t00057_D"), "+d")); + REQUIRE_THAT(src, IsAssociation(_A("t00057_R"), _A("t00057_E"), "+e")); + REQUIRE_THAT(src, IsAssociation(_A("t00057_R"), _A("t00057_F"), "+f")); + REQUIRE_THAT(src, + IsAggregation( + _A("t00057_E"), _A("t00057_E::(coordinates)"), "+coordinates")); + REQUIRE_THAT(src, + IsAggregation(_A("t00057_E"), _A("t00057_E::(height)"), "+height")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00058/.clang-uml b/tests/t00058/.clang-uml index dfc6afb4..2732bc62 100644 --- a/tests/t00058/.clang-uml +++ b/tests/t00058/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00058_class: type: class diff --git a/tests/t00058/test_case.h b/tests/t00058/test_case.h index 198f9aba..aabb26a5 100644 --- a/tests/t00058/test_case.h +++ b/tests/t00058/test_case.h @@ -29,45 +29,44 @@ TEST_CASE("t00058", "[test-case][class]") REQUIRE(model->name() == "t00058_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClassTemplate("A", "int,int,double,std::string")); - REQUIRE_THAT(puml, - IsClassTemplate("B", "int,std::string,int,double,A")); + REQUIRE_THAT(src, IsClassTemplate("A", "int,int,double,std::string")); + REQUIRE_THAT( + src, IsClassTemplate("B", "int,std::string,int,double,A")); - REQUIRE_THAT(puml, IsConcept(_A("same_as_first_type"))); + REQUIRE_THAT(src, IsConcept(_A("same_as_first_type"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConstraint(_A("A"), _A("same_as_first_type"), "T,Args...")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsConstraint(_A("B"), _A("same_as_first_type"), "T,Args...")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("A"), "+aa")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("B>"), "+bb")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation( _A("A"), _A("A"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation(_A("B"), _A("B>"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsDependency(_A("same_as_first_type"), _A("first_type"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -79,6 +78,47 @@ TEST_CASE("t00058", "[test-case][class]") REQUIRE(IsClass( j, "B>")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsConcept; + using mermaid::IsConstraint; + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT( + src, IsClass(_A("B>"))); + + REQUIRE_THAT(src, IsConcept(_A("same_as_first_type"))); + + REQUIRE_THAT(src, + IsConstraint(_A("A"), + _A("same_as_first_type"), "T,Args...")); + + REQUIRE_THAT(src, + IsConstraint(_A("B"), + _A("same_as_first_type"), "T,Args...")); + + REQUIRE_THAT(src, + IsAggregation(_A("R"), _A("A"), "+aa")); + REQUIRE_THAT(src, + IsAggregation(_A("R"), + _A("B>"), "+bb")); + + REQUIRE_THAT(src, + IsInstantiation( + _A("A"), _A("A"))); + REQUIRE_THAT(src, + IsInstantiation(_A("B"), + _A("B>"))); + + // TODO + // REQUIRE_THAT(src, + // IsDependency(_A("same_as_first_type"), + // _A("first_type"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00059/.clang-uml b/tests/t00059/.clang-uml index 94adde8e..aea07570 100644 --- a/tests/t00059/.clang-uml +++ b/tests/t00059/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00059_class: type: class diff --git a/tests/t00059/test_case.h b/tests/t00059/test_case.h index 0ec40ec7..8449ca80 100644 --- a/tests/t00059/test_case.h +++ b/tests/t00059/test_case.h @@ -29,65 +29,64 @@ TEST_CASE("t00059", "[test-case][class]") REQUIRE(model->name() == "t00059_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsConcept(_A("fruit_c"))); - REQUIRE_THAT(puml, IsConcept(_A("apple_c"))); - REQUIRE_THAT(puml, IsConcept(_A("orange_c"))); + REQUIRE_THAT(src, IsConcept(_A("fruit_c"))); + REQUIRE_THAT(src, IsConcept(_A("apple_c"))); + REQUIRE_THAT(src, IsConcept(_A("orange_c"))); REQUIRE_THAT( - puml, IsConstraint(_A("apple_c"), _A("fruit_c"), "T")); + src, IsConstraint(_A("apple_c"), _A("fruit_c"), "T")); REQUIRE_THAT( - puml, IsConstraint(_A("orange_c"), _A("fruit_c"), "T")); + src, IsConstraint(_A("orange_c"), _A("fruit_c"), "T")); REQUIRE_THAT( - puml, IsConceptRequirement(_A("apple_c"), "t.get_sweetness()")); + src, IsConceptRequirement(_A("apple_c"), "t.get_sweetness()")); REQUIRE_THAT( - puml, IsConceptRequirement(_A("apple_c"), "t.get_bitterness()")); + src, IsConceptRequirement(_A("apple_c"), "t.get_bitterness()")); - REQUIRE_THAT(puml, IsClass(_A("gala_apple"))); - REQUIRE_THAT(puml, IsClass(_A("empire_apple"))); - REQUIRE_THAT(puml, IsClass(_A("valencia_orange"))); - REQUIRE_THAT(puml, IsClass(_A("lima_orange"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(src, IsClass(_A("gala_apple"))); + REQUIRE_THAT(src, IsClass(_A("empire_apple"))); + REQUIRE_THAT(src, IsClass(_A("valencia_orange"))); + REQUIRE_THAT(src, IsClass(_A("lima_orange"))); + REQUIRE_THAT(src, IsClass(_A("R"))); REQUIRE_THAT( - puml, IsClassTemplate("fruit_factory", "apple_c TA,orange_c TO")); + src, IsClassTemplate("fruit_factory", "apple_c TA,orange_c TO")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsDependency(_A("fruit_factory"), _A("gala_apple"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsDependency(_A("fruit_factory"), _A("valencia_orange"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsDependency(_A("fruit_factory"), _A("empire_apple"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsDependency(_A("fruit_factory"), _A("lima_orange"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("fruit_factory"), "+factory_1")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsAggregation(_A("R"), _A("fruit_factory"), "+factory_2")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation(_A("fruit_factory"), _A("fruit_factory"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation(_A("fruit_factory"), _A("fruit_factory"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -99,6 +98,66 @@ TEST_CASE("t00059", "[test-case][class]") REQUIRE(IsConcept(j, "apple_c")); REQUIRE(IsConcept(j, "orange_c")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsConcept; + using mermaid::IsConceptRequirement; + using mermaid::IsConstraint; + + REQUIRE_THAT(src, IsConcept(_A("fruit_c"))); + REQUIRE_THAT(src, IsConcept(_A("apple_c"))); + REQUIRE_THAT(src, IsConcept(_A("orange_c"))); + + REQUIRE_THAT( + src, IsConstraint(_A("apple_c"), _A("fruit_c"), "T")); + REQUIRE_THAT( + src, IsConstraint(_A("orange_c"), _A("fruit_c"), "T")); + + REQUIRE_THAT( + src, IsConceptRequirement(_A("apple_c"), "t.get_sweetness()")); + REQUIRE_THAT( + src, IsConceptRequirement(_A("apple_c"), "t.get_bitterness()")); + + REQUIRE_THAT(src, IsClass(_A("gala_apple"))); + REQUIRE_THAT(src, IsClass(_A("empire_apple"))); + REQUIRE_THAT(src, IsClass(_A("valencia_orange"))); + REQUIRE_THAT(src, IsClass(_A("lima_orange"))); + REQUIRE_THAT(src, IsClass(_A("R"))); + + REQUIRE_THAT(src, IsClass(_A("fruit_factory"))); + + REQUIRE_THAT(src, + IsDependency(_A("fruit_factory"), + _A("gala_apple"))); + REQUIRE_THAT(src, + IsDependency(_A("fruit_factory"), + _A("valencia_orange"))); + + REQUIRE_THAT(src, + IsDependency(_A("fruit_factory"), + _A("empire_apple"))); + REQUIRE_THAT(src, + IsDependency(_A("fruit_factory"), + _A("lima_orange"))); + + REQUIRE_THAT(src, + IsAggregation(_A("R"), + _A("fruit_factory"), "+factory_1")); + REQUIRE_THAT(src, + IsAggregation(_A("R"), + _A("fruit_factory"), "+factory_2")); + + REQUIRE_THAT(src, + IsInstantiation(_A("fruit_factory"), + _A("fruit_factory"))); + REQUIRE_THAT(src, + IsInstantiation(_A("fruit_factory"), + _A("fruit_factory"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00060/.clang-uml b/tests/t00060/.clang-uml index 8e127f89..a3e0feb5 100644 --- a/tests/t00060/.clang-uml +++ b/tests/t00060/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00060_class: type: class diff --git a/tests/t00060/test_case.h b/tests/t00060/test_case.h index c280890c..3481b8a8 100644 --- a/tests/t00060/test_case.h +++ b/tests/t00060/test_case.h @@ -29,26 +29,25 @@ TEST_CASE("t00060", "[test-case][class]") REQUIRE(model->name() == "t00060_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("D"))); - REQUIRE_THAT(puml, !IsClass(_A("E"))); - REQUIRE_THAT(puml, !IsClass(_A("F"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, !IsClass(_A("E"))); + REQUIRE_THAT(src, !IsClass(_A("F"))); // Check if class templates exist - REQUIRE_THAT(puml, IsClassTemplate("G", "T")); - REQUIRE_THAT(puml, IsClassTemplate("H", "T,P")); + REQUIRE_THAT(src, IsClassTemplate("G", "T")); + REQUIRE_THAT(src, IsClassTemplate("H", "T,P")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -63,6 +62,25 @@ TEST_CASE("t00060", "[test-case][class]") REQUIRE(!IsClass(j, "E")); REQUIRE(!IsClass(j, "F")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + // Check if all classes exist + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("D"))); + REQUIRE_THAT(src, !IsClass(_A("E"))); + REQUIRE_THAT(src, !IsClass(_A("F"))); + + // Check if class templates exist + REQUIRE_THAT(src, IsClass(_A("G"))); + REQUIRE_THAT(src, IsClass(_A("H"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00061/.clang-uml b/tests/t00061/.clang-uml index c7c9ca95..7746905a 100644 --- a/tests/t00061/.clang-uml +++ b/tests/t00061/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00061_class: type: class diff --git a/tests/t00061/test_case.h b/tests/t00061/test_case.h index 38903fc8..38df0dd5 100644 --- a/tests/t00061/test_case.h +++ b/tests/t00061/test_case.h @@ -29,19 +29,18 @@ TEST_CASE("t00061", "[test-case][class]") REQUIRE(model->name() == "t00061_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, !IsClass(_A("B"))); - REQUIRE_THAT(puml, !IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, !IsClass(_A("B"))); + REQUIRE_THAT(src, !IsClass(_A("C"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -53,6 +52,18 @@ TEST_CASE("t00061", "[test-case][class]") REQUIRE(!IsClass(j, "B")); REQUIRE(!IsClass(j, "C")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + + // Check if all classes exist + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, !IsClass(_A("B"))); + REQUIRE_THAT(src, !IsClass(_A("C"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00062/.clang-uml b/tests/t00062/.clang-uml index 50736f34..23540c84 100644 --- a/tests/t00062/.clang-uml +++ b/tests/t00062/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00062_class: type: class diff --git a/tests/t00062/test_case.h b/tests/t00062/test_case.h index 054419d5..d441f901 100644 --- a/tests/t00062/test_case.h +++ b/tests/t00062/test_case.h @@ -29,62 +29,61 @@ TEST_CASE("t00062", "[test-case][class]") REQUIRE(model->name() == "t00062_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, !Contains("type-parameter-")); + REQUIRE_THAT(src, !Contains("type-parameter-")); // Check if all classes exist - REQUIRE_THAT(puml, IsClassTemplate("A", "T")); - REQUIRE_THAT(puml, IsClassTemplate("A", "U &")); - REQUIRE_THAT(puml, IsClassTemplate("A", "U &&")); - REQUIRE_THAT(puml, IsClassTemplate("A", "U const&")); - REQUIRE_THAT(puml, IsClassTemplate("A", "M C::*")); - REQUIRE_THAT(puml, IsClassTemplate("A", "M C::* &&")); - REQUIRE_THAT(puml, IsClassTemplate("A", "M (C::*)(Arg)")); - REQUIRE_THAT(puml, IsClassTemplate("A", "int (C::*)(bool)")); - REQUIRE_THAT(puml, IsClassTemplate("A", "M (C::*)(Arg) &&")); - REQUIRE_THAT(puml, IsClassTemplate("A", "M (C::*)(Arg1,Arg2,Arg3)")); - REQUIRE_THAT(puml, IsClassTemplate("A", "float (C::*)(int) &&")); + REQUIRE_THAT(src, IsClassTemplate("A", "T")); + REQUIRE_THAT(src, IsClassTemplate("A", "U &")); + REQUIRE_THAT(src, IsClassTemplate("A", "U &&")); + REQUIRE_THAT(src, IsClassTemplate("A", "U const&")); + REQUIRE_THAT(src, IsClassTemplate("A", "M C::*")); + REQUIRE_THAT(src, IsClassTemplate("A", "M C::* &&")); + REQUIRE_THAT(src, IsClassTemplate("A", "M (C::*)(Arg)")); + REQUIRE_THAT(src, IsClassTemplate("A", "int (C::*)(bool)")); + REQUIRE_THAT(src, IsClassTemplate("A", "M (C::*)(Arg) &&")); + REQUIRE_THAT(src, IsClassTemplate("A", "M (C::*)(Arg1,Arg2,Arg3)")); + REQUIRE_THAT(src, IsClassTemplate("A", "float (C::*)(int) &&")); - REQUIRE_THAT(puml, IsClassTemplate("A", "char[N]")); - REQUIRE_THAT(puml, IsClassTemplate("A", "char[1000]")); + REQUIRE_THAT(src, IsClassTemplate("A", "char[N]")); + REQUIRE_THAT(src, IsClassTemplate("A", "char[1000]")); - REQUIRE_THAT(puml, IsClassTemplate("A", "U(...)")); - REQUIRE_THAT(puml, IsClassTemplate("A", "C")); - REQUIRE_THAT(puml, IsClassTemplate("A", "C")); + REQUIRE_THAT(src, IsClassTemplate("A", "U(...)")); + REQUIRE_THAT(src, IsClassTemplate("A", "C")); + REQUIRE_THAT(src, IsClassTemplate("A", "C")); - REQUIRE_THAT(puml, (IsField("u", "U &"))); - REQUIRE_THAT(puml, (IsField("u", "U **"))); - REQUIRE_THAT(puml, (IsField("u", "U ***"))); - REQUIRE_THAT(puml, (IsField("u", "U &&"))); - REQUIRE_THAT(puml, (IsField("u", "const U &"))); - REQUIRE_THAT(puml, (IsField("c", "C &"))); - REQUIRE_THAT(puml, (IsField("m", "M C::*"))); + REQUIRE_THAT(src, (IsField("u", "U &"))); + REQUIRE_THAT(src, (IsField("u", "U **"))); + REQUIRE_THAT(src, (IsField("u", "U ***"))); + REQUIRE_THAT(src, (IsField("u", "U &&"))); + REQUIRE_THAT(src, (IsField("u", "const U &"))); + REQUIRE_THAT(src, (IsField("c", "C &"))); + REQUIRE_THAT(src, (IsField("m", "M C::*"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); REQUIRE_THAT( - puml, IsInstantiation(_A("A"), _A("A"))); + src, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A>"))); - REQUIRE_THAT(puml, IsInstantiation(_A("A"), _A("A>"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A>"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A>"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -92,6 +91,62 @@ TEST_CASE("t00062", "[test-case][class]") using namespace json; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsField; + + REQUIRE_THAT(src, !Contains("type-parameter-")); + + // Check if all classes exist + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A>"))); + REQUIRE_THAT(src, IsClass(_A("A>"))); + + REQUIRE_THAT(src, (IsField("u", "U &"))); + REQUIRE_THAT(src, (IsField("u", "U **"))); + REQUIRE_THAT(src, (IsField("u", "U ***"))); + REQUIRE_THAT(src, (IsField("u", "U &&"))); + REQUIRE_THAT(src, (IsField("u", "const U &"))); + REQUIRE_THAT(src, (IsField("c", "C &"))); + REQUIRE_THAT(src, (IsField("m", "M C::*"))); + + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, + IsInstantiation(_A("A"), _A("A"))); + + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT( + src, IsInstantiation(_A("A"), _A("A"))); + + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A>"))); + REQUIRE_THAT(src, IsInstantiation(_A("A"), _A("A>"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00063/.clang-uml b/tests/t00063/.clang-uml index e3704069..46e5bb1a 100644 --- a/tests/t00063/.clang-uml +++ b/tests/t00063/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00063_class: type: class diff --git a/tests/t00063/test_case.h b/tests/t00063/test_case.h index 258f89b9..3afc52b1 100644 --- a/tests/t00063/test_case.h +++ b/tests/t00063/test_case.h @@ -29,18 +29,17 @@ TEST_CASE("t00063", "[test-case][class]") REQUIRE(model->name() == "t00063_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, !IsEnum(_A("B"))); - REQUIRE_THAT(puml, !IsEnum(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, !IsEnum(_A("B"))); + REQUIRE_THAT(src, !IsEnum(_A("C"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -52,6 +51,18 @@ TEST_CASE("t00063", "[test-case][class]") REQUIRE(!IsEnum(j, "B")); REQUIRE(!IsEnum(j, "C")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsEnum; + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, !IsEnum(_A("B"))); + REQUIRE_THAT(src, !IsEnum(_A("C"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00064/.clang-uml b/tests/t00064/.clang-uml index 7a15ca17..313c0bac 100644 --- a/tests/t00064/.clang-uml +++ b/tests/t00064/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00064_class: type: class diff --git a/tests/t00064/test_case.h b/tests/t00064/test_case.h index d10e290e..6cc3dfb8 100644 --- a/tests/t00064/test_case.h +++ b/tests/t00064/test_case.h @@ -29,57 +29,55 @@ TEST_CASE("t00064", "[test-case][class]") REQUIRE(model->name() == "t00064_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, !Contains("type-parameter-")); + REQUIRE_THAT(src, !Contains("type-parameter-")); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("B"))); - REQUIRE_THAT(puml, IsClass(_A("C"))); - REQUIRE_THAT(puml, IsClass(_A("R"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("R"))); - REQUIRE_THAT(puml, IsClassTemplate("type_list", "Ts...")); - REQUIRE_THAT(puml, IsClassTemplate("type_list", "Ret(Arg &&),Ts...")); - REQUIRE_THAT(puml, IsClassTemplate("type_list", "T const,Ts...")); + REQUIRE_THAT(src, IsClassTemplate("type_list", "Ts...")); + REQUIRE_THAT(src, IsClassTemplate("type_list", "Ret(Arg &&),Ts...")); + REQUIRE_THAT(src, IsClassTemplate("type_list", "T const,Ts...")); - REQUIRE_THAT(puml, IsClassTemplate("head", "typename")); - REQUIRE_THAT(puml, IsClassTemplate("head", "type_list")); + REQUIRE_THAT(src, IsClassTemplate("head", "typename")); + REQUIRE_THAT(src, IsClassTemplate("head", "type_list")); REQUIRE_THAT( - puml, IsClassTemplate("type_group_pair", "typename,typename")); - REQUIRE_THAT(puml, + src, IsClassTemplate("type_group_pair", "typename,typename")); + REQUIRE_THAT(src, IsClassTemplate( "type_group_pair", "type_list,type_list")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsClassTemplate( "type_group_pair", "type_list,type_list")); - REQUIRE_THAT(puml, IsClassTemplate("optional_ref", "T")); + REQUIRE_THAT(src, IsClassTemplate("optional_ref", "T")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, IsClassTemplate("type_group_pair_it", "It,type_list,type_list")); - REQUIRE_THAT( - puml, (IsMethod("get", "ref_t", "unsigned int i"))); + REQUIRE_THAT(src, (IsMethod("get", "ref_t", "unsigned int i"))); #if LLVM_VERSION_MAJOR < 16 - REQUIRE_THAT(puml, + REQUIRE_THAT(src, (IsMethod("getp", "value_type const*", "unsigned int i"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, (IsMethod( "find", "unsigned int", "value_type const& v"))); #else - REQUIRE_THAT(puml, + REQUIRE_THAT(src, (IsMethod("getp", "const value_type *", "unsigned int i"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, (IsMethod( "find", "unsigned int", "const value_type & v"))); #endif - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -87,6 +85,56 @@ TEST_CASE("t00064", "[test-case][class]") using namespace json; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsMethod; + + REQUIRE_THAT(src, !Contains("type-parameter-")); + + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("B"))); + REQUIRE_THAT(src, IsClass(_A("C"))); + REQUIRE_THAT(src, IsClass(_A("R"))); + + REQUIRE_THAT(src, IsClass(_A("type_list"))); + REQUIRE_THAT(src, IsClass(_A("type_list"))); + REQUIRE_THAT(src, IsClass(_A("type_list"))); + + REQUIRE_THAT(src, IsClass(_A("head"))); + REQUIRE_THAT(src, IsClass(_A("head>"))); + REQUIRE_THAT(src, IsClass(_A("type_group_pair"))); + REQUIRE_THAT(src, + IsClass(_A( + "type_group_pair,type_list>"))); + REQUIRE_THAT(src, + IsClass(_A( + "type_group_pair,type_list>"))); + + REQUIRE_THAT(src, IsClass(_A("optional_ref"))); + + REQUIRE_THAT(src, + IsClass(_A("type_group_pair_it,type_list<" + "Second...>>"))); + REQUIRE_THAT(src, (IsMethod("get", "ref_t", "unsigned int i"))); +#if LLVM_VERSION_MAJOR < 16 + REQUIRE_THAT(src, + (IsMethod("getp", "value_type const*", "unsigned int i"))); + REQUIRE_THAT(src, + (IsMethod( + "find", "unsigned int", "value_type const& v"))); +#else + REQUIRE_THAT(src, + (IsMethod("getp", "const value_type *", "unsigned int i"))); + REQUIRE_THAT(src, + (IsMethod( + "find", "unsigned int", "const value_type & v"))); + +#endif + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00065/.clang-uml b/tests/t00065/.clang-uml index 4c7143fb..f77d743c 100644 --- a/tests/t00065/.clang-uml +++ b/tests/t00065/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00065_class: type: class diff --git a/tests/t00065/test_case.h b/tests/t00065/test_case.h index d8004889..0a1c0fdf 100644 --- a/tests/t00065/test_case.h +++ b/tests/t00065/test_case.h @@ -29,26 +29,25 @@ TEST_CASE("t00065", "[test-case][class]") REQUIRE(model->name() == "t00065_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all classes exist - REQUIRE_THAT(puml, IsClass(_A("R"))); - REQUIRE_THAT(puml, IsClass(_A("A"))); - REQUIRE_THAT(puml, IsClass(_A("AImpl"))); - REQUIRE_THAT(puml, IsEnum(_A("XYZ"))); - REQUIRE_THAT(puml, IsEnum(_A("ABC"))); + REQUIRE_THAT(src, IsClass(_A("R"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("AImpl"))); + REQUIRE_THAT(src, IsEnum(_A("XYZ"))); + REQUIRE_THAT(src, IsEnum(_A("ABC"))); - REQUIRE_THAT(puml, IsPackage("module1")); - REQUIRE_THAT(puml, IsPackage("module2")); - REQUIRE_THAT(puml, IsPackage("submodule1a")); - REQUIRE_THAT(puml, IsPackage("concepts")); + REQUIRE_THAT(src, IsPackage("module1")); + REQUIRE_THAT(src, IsPackage("module2")); + REQUIRE_THAT(src, IsPackage("submodule1a")); + REQUIRE_THAT(src, IsPackage("concepts")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -56,6 +55,21 @@ TEST_CASE("t00065", "[test-case][class]") using namespace json; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsEnum; + + // Check if all classes exist + REQUIRE_THAT(src, IsClass(_A("R"))); + REQUIRE_THAT(src, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("detail::AImpl"))); + REQUIRE_THAT(src, IsEnum(_A("XYZ"))); + REQUIRE_THAT(src, IsEnum(_A("ABC"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00066/.clang-uml b/tests/t00066/.clang-uml index f2066018..abab698f 100644 --- a/tests/t00066/.clang-uml +++ b/tests/t00066/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00066_class: type: class diff --git a/tests/t00066/test_case.h b/tests/t00066/test_case.h index 3619b55c..8492271c 100644 --- a/tests/t00066/test_case.h +++ b/tests/t00066/test_case.h @@ -29,48 +29,47 @@ TEST_CASE("t00066", "[test-case][class]") REQUIRE(model->name() == "t00066_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("A"))); + REQUIRE_THAT(src, IsClass(_A("A"))); - REQUIRE_THAT(puml, !IsDependency(_A("A"), _A("A"))); + REQUIRE_THAT(src, !IsDependency(_A("A"), _A("A"))); - REQUIRE_THAT(puml, (IsMethod("A"))); - REQUIRE_THAT(puml, (IsMethod("A", "void", "A &&"))); + REQUIRE_THAT(src, (IsMethod("A"))); + REQUIRE_THAT(src, (IsMethod("A", "void", "A &&"))); REQUIRE_THAT( - puml, (IsMethod("A", "void", "const A &"))); + src, (IsMethod("A", "void", "const A &"))); - REQUIRE_THAT(puml, (IsMethod("~A"))); + REQUIRE_THAT(src, (IsMethod("~A"))); - REQUIRE_THAT(puml, (IsMethod("basic_method"))); - REQUIRE_THAT(puml, (IsMethod("static_method", "int"))); - REQUIRE_THAT(puml, (IsMethod("const_method"))); + REQUIRE_THAT(src, (IsMethod("basic_method"))); + REQUIRE_THAT(src, (IsMethod("static_method", "int"))); + REQUIRE_THAT(src, (IsMethod("const_method"))); REQUIRE_THAT( - puml, (IsMethod("default_int", "int", "int i = 12"))); - REQUIRE_THAT(puml, + src, (IsMethod("default_int", "int", "int i = 12"))); + REQUIRE_THAT(src, (IsMethod("default_string", "std::string", "int i, std::string s = \"abc\""))); - REQUIRE_THAT(puml, (IsMethod("size", "std::size_t"))); + REQUIRE_THAT(src, (IsMethod("size", "std::size_t"))); - REQUIRE_THAT(puml, (IsMethod("protected_method"))); - REQUIRE_THAT(puml, (IsMethod("private_method"))); - REQUIRE_THAT(puml, (IsField("public_member", "int"))); - REQUIRE_THAT(puml, (IsField("protected_member", "int"))); - REQUIRE_THAT(puml, (IsField("private_member", "int"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, (IsMethod("protected_method"))); + REQUIRE_THAT(src, (IsMethod("private_method"))); + REQUIRE_THAT(src, (IsField("public_member", "int"))); + REQUIRE_THAT(src, (IsField("protected_member", "int"))); + REQUIRE_THAT(src, (IsField("private_member", "int"))); + REQUIRE_THAT(src, (IsField("auto_member", "const unsigned long"))); - REQUIRE_THAT(puml, (IsField("a_", "int"))); - REQUIRE_THAT(puml, (IsField("b_", "int"))); - REQUIRE_THAT(puml, (IsField("c_", "int"))); + REQUIRE_THAT(src, (IsField("a_", "int"))); + REQUIRE_THAT(src, (IsField("b_", "int"))); + REQUIRE_THAT(src, (IsField("c_", "int"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -78,6 +77,49 @@ TEST_CASE("t00066", "[test-case][class]") using namespace json; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsField; + using mermaid::IsMethod; + + REQUIRE_THAT(src, IsClass(_A("A"))); + + REQUIRE_THAT(src, !IsDependency(_A("A"), _A("A"))); + + REQUIRE_THAT(src, (IsMethod("A"))); + REQUIRE_THAT(src, (IsMethod("A", "void", "A &&"))); + REQUIRE_THAT( + src, (IsMethod("A", "void", "const A &"))); + + REQUIRE_THAT(src, (IsMethod("~A"))); + + REQUIRE_THAT(src, (IsMethod("basic_method"))); + REQUIRE_THAT(src, (IsMethod("static_method", "int"))); + REQUIRE_THAT(src, (IsMethod("const_method"))); + REQUIRE_THAT( + src, (IsMethod("default_int", "int", "int i = 12"))); + REQUIRE_THAT(src, + (IsMethod("default_string", "std::string", + "int i, std::string s = \"abc\""))); + + REQUIRE_THAT(src, (IsMethod("size", "std::size_t"))); + + REQUIRE_THAT(src, (IsMethod("protected_method"))); + REQUIRE_THAT(src, (IsMethod("private_method"))); + REQUIRE_THAT(src, (IsField("public_member", "int"))); + REQUIRE_THAT(src, (IsField("protected_member", "int"))); + REQUIRE_THAT(src, (IsField("private_member", "int"))); + REQUIRE_THAT(src, + (IsField("auto_member", "const unsigned long"))); + + REQUIRE_THAT(src, (IsField("a_", "int"))); + REQUIRE_THAT(src, (IsField("b_", "int"))); + REQUIRE_THAT(src, (IsField("c_", "int"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t00067/.clang-uml b/tests/t00067/.clang-uml index d2b5cc5b..b2a26a0e 100644 --- a/tests/t00067/.clang-uml +++ b/tests/t00067/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t00067_class: type: class diff --git a/tests/t00067/test_case.h b/tests/t00067/test_case.h index e9fb3cc5..45d77b35 100644 --- a/tests/t00067/test_case.h +++ b/tests/t00067/test_case.h @@ -29,23 +29,22 @@ TEST_CASE("t00067", "[test-case][class]") REQUIRE(model->name() == "t00067_class"); { - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_class_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, !(IsMethod("A"))); - REQUIRE_THAT(puml, !(IsMethod("A", "void", "A &&"))); + REQUIRE_THAT(src, !(IsMethod("A"))); + REQUIRE_THAT(src, !(IsMethod("A", "void", "A &&"))); REQUIRE_THAT( - puml, !(IsMethod("A", "void", "const A &"))); + src, !(IsMethod("A", "void", "const A &"))); - REQUIRE_THAT(puml, !(IsMethod("~A"))); + REQUIRE_THAT(src, !(IsMethod("~A"))); - REQUIRE_THAT(puml, !(IsMethod("~A"))); + REQUIRE_THAT(src, !(IsMethod("~A"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -53,6 +52,24 @@ TEST_CASE("t00067", "[test-case][class]") using namespace json; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_class_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsMethod; + + REQUIRE_THAT(src, !(IsMethod("A"))); + REQUIRE_THAT(src, !(IsMethod("A", "void", "A &&"))); + REQUIRE_THAT( + src, !(IsMethod("A", "void", "const A &"))); + + REQUIRE_THAT(src, !(IsMethod("~A"))); + + REQUIRE_THAT(src, !(IsMethod("~A"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20001/.clang-uml b/tests/t20001/.clang-uml index 8cf49fdc..2124dc35 100644 --- a/tests/t20001/.clang-uml +++ b/tests/t20001/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20001_sequence: type: sequence @@ -20,3 +20,8 @@ diagrams: - "' t20001 test diagram of type {{ diagram.type }}" after: - '{% set e=element("clanguml::t20001::tmain()") %} note over {{ e.alias) }}: Main test function' + mermaid: + before: + - "%% t20001 test diagram of type {{ diagram.type }}" + after: + - '{% set e=element("clanguml::t20001::tmain()") %} Note over {{ e.alias) }}: Main test function' diff --git a/tests/t20001/test_case.h b/tests/t20001/test_case.h index 8713f443..45a315e2 100644 --- a/tests/t20001/test_case.h +++ b/tests/t20001/test_case.h @@ -29,22 +29,21 @@ TEST_CASE("t20001", "[test-case][sequence]") REQUIRE(model->name() == "t20001_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "add3(int,int,int)")); - REQUIRE_THAT(puml, HasCall(_A("A"), "add(int,int)")); - REQUIRE_THAT(puml, !HasCall(_A("A"), _A("detail::C"), "add(int,int)")); - REQUIRE_THAT(puml, HasCall(_A("A"), "__log_result(int)__")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "__log_result(int)__")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "add3(int,int,int)")); + REQUIRE_THAT(src, HasCall(_A("A"), "add(int,int)")); + REQUIRE_THAT(src, !HasCall(_A("A"), _A("detail::C"), "add(int,int)")); + REQUIRE_THAT(src, HasCall(_A("A"), "__log_result(int)__")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "__log_result(int)__")); - REQUIRE_THAT(puml, HasComment("t20001 test diagram of type sequence")); + REQUIRE_THAT(src, HasComment("t20001 test diagram of type sequence")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { auto j = generate_sequence_json(diagram, *model); @@ -65,6 +64,22 @@ TEST_CASE("t20001", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + { + auto src = generate_sequence_mermaid(diagram, *model); + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + using mermaid::HasComment; + + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "add3(int,int,int)")); + REQUIRE_THAT(src, HasCall(_A("A"), "add(int,int)")); + REQUIRE_THAT(src, !HasCall(_A("A"), _A("detail::C"), "add(int,int)")); + REQUIRE_THAT(src, HasCall(_A("A"), "log_result(int)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "log_result(int)")); + + REQUIRE_THAT(src, HasComment("t20001 test diagram of type sequence")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t20002/.clang-uml b/tests/t20002/.clang-uml index 8dfb0825..437d25a6 100644 --- a/tests/t20002/.clang-uml +++ b/tests/t20002/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20002_sequence: type: sequence diff --git a/tests/t20002/test_case.h b/tests/t20002/test_case.h index 092e514e..03986b0c 100644 --- a/tests/t20002/test_case.h +++ b/tests/t20002/test_case.h @@ -29,18 +29,17 @@ TEST_CASE("t20002", "[test-case][sequence]") REQUIRE(model->name() == "t20002_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, HasCall(_A("m1()"), _A("m2()"), "")); - REQUIRE_THAT(puml, HasCall(_A("m2()"), _A("m3()"), "")); - REQUIRE_THAT(puml, HasCall(_A("m3()"), _A("m4()"), "")); + REQUIRE_THAT(src, HasCall(_A("m1()"), _A("m2()"), "")); + REQUIRE_THAT(src, HasCall(_A("m2()"), _A("m3()"), "")); + REQUIRE_THAT(src, HasCall(_A("m3()"), _A("m4()"), "")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -59,6 +58,19 @@ TEST_CASE("t20002", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("m1()"), _A("m2()"), "")); + REQUIRE_THAT(src, HasCall(_A("m2()"), _A("m3()"), "")); + REQUIRE_THAT(src, HasCall(_A("m3()"), _A("m4()"), "")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t20003/.clang-uml b/tests/t20003/.clang-uml index aee8374b..40cb7eee 100644 --- a/tests/t20003/.clang-uml +++ b/tests/t20003/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20003_sequence: type: sequence diff --git a/tests/t20003/test_case.h b/tests/t20003/test_case.h index 669a388e..7a5dce25 100644 --- a/tests/t20003/test_case.h +++ b/tests/t20003/test_case.h @@ -29,18 +29,17 @@ TEST_CASE("t20003", "[test-case][sequence]") REQUIRE(model->name() == "t20003_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, HasCall(_A("m1(T)"), _A("m2(T)"), "")); - REQUIRE_THAT(puml, HasCall(_A("m2(T)"), _A("m3(T)"), "")); - REQUIRE_THAT(puml, HasCall(_A("m3(T)"), _A("m4(T)"), "")); + REQUIRE_THAT(src, HasCall(_A("m1(T)"), _A("m2(T)"), "")); + REQUIRE_THAT(src, HasCall(_A("m2(T)"), _A("m3(T)"), "")); + REQUIRE_THAT(src, HasCall(_A("m3(T)"), _A("m4(T)"), "")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -54,6 +53,19 @@ TEST_CASE("t20003", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("m1(T)"), _A("m2(T)"), "")); + REQUIRE_THAT(src, HasCall(_A("m2(T)"), _A("m3(T)"), "")); + REQUIRE_THAT(src, HasCall(_A("m3(T)"), _A("m4(T)"), "")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t20004/.clang-uml b/tests/t20004/.clang-uml index 0e1618e9..00ef7901 100644 --- a/tests/t20004/.clang-uml +++ b/tests/t20004/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20004_sequence: type: sequence diff --git a/tests/t20004/test_case.h b/tests/t20004/test_case.h index 8de05566..70747fb6 100644 --- a/tests/t20004/test_case.h +++ b/tests/t20004/test_case.h @@ -29,36 +29,35 @@ TEST_CASE("t20004", "[test-case][sequence]") REQUIRE(model->name() == "t20004_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1(float)"), "")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, HasCall(_A("main()"), _A("m1(float)"), "")); REQUIRE_THAT( - puml, !HasCall(_A("m1(float)"), _A("m1(float)"), "")); + src, !HasCall(_A("m1(float)"), _A("m1(float)"), "")); REQUIRE_THAT( - puml, !HasCall(_A("m1(float)"), _A("m1(float)"), "")); + src, !HasCall(_A("m1(float)"), _A("m1(float)"), "")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("main()"), _A("m1(unsigned long)"), "")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("m1(unsigned long)"), _A("m4(unsigned long)"), "")); - REQUIRE_THAT(puml, - HasCall(_A("main()"), _A("m1(std::string)"), "")); - REQUIRE_THAT(puml, + REQUIRE_THAT( + src, HasCall(_A("main()"), _A("m1(std::string)"), "")); + REQUIRE_THAT(src, HasCall(_A("m1(std::string)"), _A("m2(std::string)"), "")); - REQUIRE_THAT(puml, HasCall(_A("main()"), _A("m1(int)"), "")); - REQUIRE_THAT(puml, HasCall(_A("m1(int)"), _A("m2(int)"), "")); - REQUIRE_THAT(puml, HasCall(_A("m2(int)"), _A("m3(int)"), "")); - REQUIRE_THAT(puml, HasCall(_A("m3(int)"), _A("m4(int)"), "")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, HasCall(_A("main()"), _A("m1(int)"), "")); + REQUIRE_THAT(src, HasCall(_A("m1(int)"), _A("m2(int)"), "")); + REQUIRE_THAT(src, HasCall(_A("m2(int)"), _A("m3(int)"), "")); + REQUIRE_THAT(src, HasCall(_A("m3(int)"), _A("m4(int)"), "")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -81,6 +80,38 @@ TEST_CASE("t20004", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("main()"), _A("m1(float)"), "")); + REQUIRE_THAT( + src, !HasCall(_A("m1(float)"), _A("m1(float)"), "")); + REQUIRE_THAT( + src, !HasCall(_A("m1(float)"), _A("m1(float)"), "")); + + REQUIRE_THAT(src, + HasCall(_A("main()"), _A("m1(unsigned long)"), "")); + REQUIRE_THAT(src, + HasCall(_A("m1(unsigned long)"), + _A("m4(unsigned long)"), "")); + + REQUIRE_THAT( + src, HasCall(_A("main()"), _A("m1(std::string)"), "")); + REQUIRE_THAT(src, + HasCall(_A("m1(std::string)"), + _A("m2(std::string)"), "")); + + REQUIRE_THAT(src, HasCall(_A("main()"), _A("m1(int)"), "")); + REQUIRE_THAT(src, HasCall(_A("m1(int)"), _A("m2(int)"), "")); + REQUIRE_THAT(src, HasCall(_A("m2(int)"), _A("m3(int)"), "")); + REQUIRE_THAT(src, HasCall(_A("m3(int)"), _A("m4(int)"), "")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20005/.clang-uml b/tests/t20005/.clang-uml index 5b298510..7c497c16 100644 --- a/tests/t20005/.clang-uml +++ b/tests/t20005/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20005_sequence: type: sequence diff --git a/tests/t20005/test_case.h b/tests/t20005/test_case.h index 79172e7c..ac336b83 100644 --- a/tests/t20005/test_case.h +++ b/tests/t20005/test_case.h @@ -29,20 +29,19 @@ TEST_CASE("t20005", "[test-case][sequence]") REQUIRE(model->name() == "t20005_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasEntrypoint(_A("C"), "c(T)")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b(T)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a(T)")); - REQUIRE_THAT(puml, HasExitpoint(_A("C"))); + REQUIRE_THAT(src, HasEntrypoint(_A("C"), "c(T)")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("B"), "b(T)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a(T)")); + REQUIRE_THAT(src, HasExitpoint(_A("C"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -55,6 +54,22 @@ TEST_CASE("t20005", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + using mermaid::HasEntrypoint; + using mermaid::HasExitpoint; + + REQUIRE_THAT(src, HasEntrypoint(_A("C"), "c(T)")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("B"), "b(T)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a(T)")); + REQUIRE_THAT(src, HasExitpoint(_A("C"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20006/.clang-uml b/tests/t20006/.clang-uml index 47360f32..a99a842e 100644 --- a/tests/t20006/.clang-uml +++ b/tests/t20006/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20006_sequence: type: sequence diff --git a/tests/t20006/test_case.h b/tests/t20006/test_case.h index 6d1cb553..65c2bed2 100644 --- a/tests/t20006/test_case.h +++ b/tests/t20006/test_case.h @@ -29,54 +29,53 @@ TEST_CASE("t20006", "[test-case][sequence]") REQUIRE(model->name() == "t20006_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(int)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b(int)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a1(int)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b(std::string)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall( _A("B"), _A("A"), "a2(std::string)")); REQUIRE_THAT( - puml, HasCall(_A("tmain()"), _A("BB"), "bb1(int,int)")); + src, HasCall(_A("tmain()"), _A("BB"), "bb1(int,int)")); REQUIRE_THAT( - puml, HasCall(_A("BB"), _A("AA"), "aa1(int)")); + src, HasCall(_A("BB"), _A("AA"), "aa1(int)")); REQUIRE_THAT( - puml, HasCall(_A("tmain()"), _A("BB"), "bb2(int,int)")); + src, HasCall(_A("tmain()"), _A("BB"), "bb2(int,int)")); REQUIRE_THAT( - puml, HasCall(_A("BB"), _A("AA"), "aa2(int)")); + src, HasCall(_A("BB"), _A("AA"), "aa2(int)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("BB"), "bb1(int,std::string)")); - REQUIRE_THAT(puml, - HasCall(_A("BB"), _A("AA"), "aa2(int)")); + REQUIRE_THAT( + src, HasCall(_A("BB"), _A("AA"), "aa2(int)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("BB"), "bb2(int,std::string)")); - REQUIRE_THAT(puml, - HasCall(_A("BB"), _A("AA"), "aa1(int)")); + REQUIRE_THAT( + src, HasCall(_A("BB"), _A("AA"), "aa1(int)")); - REQUIRE_THAT(puml, - HasCall(_A("tmain()"), _A("BB"), "bb1(int,float)")); - REQUIRE_THAT(puml, + REQUIRE_THAT( + src, HasCall(_A("tmain()"), _A("BB"), "bb1(int,float)")); + REQUIRE_THAT(src, HasCall( _A("BB"), _A("BB"), "bb2(int,float)")); REQUIRE_THAT( - puml, HasCall(_A("BB"), _A("AA"), "aa2(int)")); + src, HasCall(_A("BB"), _A("AA"), "aa2(int)")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -95,6 +94,54 @@ TEST_CASE("t20006", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b(int)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a1(int)")); + + REQUIRE_THAT(src, + HasCall(_A("tmain()"), _A("B"), "b(std::string)")); + REQUIRE_THAT(src, + HasCall( + _A("B"), _A("A"), "a2(std::string)")); + + REQUIRE_THAT( + src, HasCall(_A("tmain()"), _A("BB"), "bb1(int,int)")); + REQUIRE_THAT( + src, HasCall(_A("BB"), _A("AA"), "aa1(int)")); + + REQUIRE_THAT( + src, HasCall(_A("tmain()"), _A("BB"), "bb2(int,int)")); + REQUIRE_THAT( + src, HasCall(_A("BB"), _A("AA"), "aa2(int)")); + + REQUIRE_THAT(src, + HasCall(_A("tmain()"), _A("BB"), + "bb1(int,std::string)")); + REQUIRE_THAT( + src, HasCall(_A("BB"), _A("AA"), "aa2(int)")); + + REQUIRE_THAT(src, + HasCall(_A("tmain()"), _A("BB"), + "bb2(int,std::string)")); + REQUIRE_THAT( + src, HasCall(_A("BB"), _A("AA"), "aa1(int)")); + + REQUIRE_THAT( + src, HasCall(_A("tmain()"), _A("BB"), "bb1(int,float)")); + REQUIRE_THAT(src, + HasCall( + _A("BB"), _A("BB"), "bb2(int,float)")); + REQUIRE_THAT( + src, HasCall(_A("BB"), _A("AA"), "aa2(int)")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20007/.clang-uml b/tests/t20007/.clang-uml index e0324ed3..953db3ed 100644 --- a/tests/t20007/.clang-uml +++ b/tests/t20007/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20007_sequence: type: sequence diff --git a/tests/t20007/test_case.h b/tests/t20007/test_case.h index 39585d6d..d6ee8025 100644 --- a/tests/t20007/test_case.h +++ b/tests/t20007/test_case.h @@ -29,25 +29,24 @@ TEST_CASE("t20007", "[test-case][sequence]") REQUIRE(model->name() == "t20007_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("Adder"), "add(int &&,int &&)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("Adder"), "add(int &&,float &&,double &&)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("Adder"), "add(std::string &&,std::string &&,std::string &&)")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -65,6 +64,25 @@ TEST_CASE("t20007", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, + HasCall(_A("tmain()"), _A("Adder"), "add(int &&,int &&)")); + REQUIRE_THAT(src, + HasCall(_A("tmain()"), _A("Adder"), + "add(int &&,float &&,double &&)")); + REQUIRE_THAT(src, + HasCall(_A("tmain()"), + _A("Adder"), + "add(std::string &&,std::string &&,std::string &&)")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20008/.clang-uml b/tests/t20008/.clang-uml index 5aa1c79d..adecc8e0 100644 --- a/tests/t20008/.clang-uml +++ b/tests/t20008/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20008_sequence: type: sequence diff --git a/tests/t20008/test_case.h b/tests/t20008/test_case.h index 05fff42f..c6bc3497 100644 --- a/tests/t20008/test_case.h +++ b/tests/t20008/test_case.h @@ -29,33 +29,32 @@ TEST_CASE("t20008", "[test-case][sequence]") REQUIRE(model->name() == "t20008_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(int)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b(int)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a1(int)")); // REQUIRE_THAT(puml, !HasCall(_A("B"), _A("A"), // "a2(int)")); REQUIRE_THAT(puml, !HasCall(_A("B"), // _A("A"), "a3(int)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b(const char *)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2(const char *)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b(std::string)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall( _A("B"), _A("A"), "a3(std::string)")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -75,6 +74,33 @@ TEST_CASE("t20008", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b(int)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a1(int)")); + // REQUIRE_THAT(puml, !HasCall(_A("B"), _A("A"), + // "a2(int)")); REQUIRE_THAT(puml, !HasCall(_A("B"), + // _A("A"), "a3(int)")); + + REQUIRE_THAT(src, + HasCall(_A("tmain()"), _A("B"), "b(const char *)")); + REQUIRE_THAT(src, + HasCall(_A("B"), _A("A"), + "a2(const char *)")); + + REQUIRE_THAT(src, + HasCall(_A("tmain()"), _A("B"), "b(std::string)")); + REQUIRE_THAT(src, + HasCall( + _A("B"), _A("A"), "a3(std::string)")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20009/.clang-uml b/tests/t20009/.clang-uml index 3bc94e92..a316f367 100644 --- a/tests/t20009/.clang-uml +++ b/tests/t20009/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20009_sequence: type: sequence diff --git a/tests/t20009/test_case.h b/tests/t20009/test_case.h index 1994e2c5..905d034f 100644 --- a/tests/t20009/test_case.h +++ b/tests/t20009/test_case.h @@ -29,26 +29,26 @@ TEST_CASE("t20009", "[test-case][sequence]") REQUIRE(model->name() == "t20009_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b(std::string)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall( _A("B"), _A("A"), "a(std::string)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(int)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a(int)")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b(int)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a(int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b(float)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a(float)")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b(float)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a(float)")); + + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -67,6 +67,27 @@ TEST_CASE("t20009", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, + HasCall(_A("tmain()"), _A("B"), "b(std::string)")); + REQUIRE_THAT(src, + HasCall( + _A("B"), _A("A"), "a(std::string)")); + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b(int)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a(int)")); + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b(float)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a(float)")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20010/.clang-uml b/tests/t20010/.clang-uml index 0af678b5..1b708ad2 100644 --- a/tests/t20010/.clang-uml +++ b/tests/t20010/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20010_sequence: type: sequence diff --git a/tests/t20010/test_case.h b/tests/t20010/test_case.h index 9e3082c7..99f842d4 100644 --- a/tests/t20010/test_case.h +++ b/tests/t20010/test_case.h @@ -29,27 +29,26 @@ TEST_CASE("t20010", "[test-case][sequence]") REQUIRE(model->name() == "t20010_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b1()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a1()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b2()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b3()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a3()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b3()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a3()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b4()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a4()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b4()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a4()")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -69,6 +68,27 @@ TEST_CASE("t20010", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b1()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a1()")); + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b2()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2()")); + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b3()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a3()")); + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b4()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a4()")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20011/.clang-uml b/tests/t20011/.clang-uml index 8b1586e5..9c59bd5b 100644 --- a/tests/t20011/.clang-uml +++ b/tests/t20011/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20011_sequence: type: sequence diff --git a/tests/t20011/test_case.h b/tests/t20011/test_case.h index 917fd6f1..bda7d30b 100644 --- a/tests/t20011/test_case.h +++ b/tests/t20011/test_case.h @@ -28,23 +28,22 @@ TEST_CASE("t20011", "[test-case][sequence]") REQUIRE(model->name() == "t20011_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a(int)")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a(int)")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a(int)")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a(int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "b(int)")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "c(int)")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "d(int)")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "b(int)")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "b(int)")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "c(int)")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "d(int)")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "b(int)")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -62,6 +61,23 @@ TEST_CASE("t20011", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a(int)")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a(int)")); + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "b(int)")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "c(int)")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "d(int)")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "b(int)")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20012/.clang-uml b/tests/t20012/.clang-uml index a4d1882c..318c2e6b 100644 --- a/tests/t20012/.clang-uml +++ b/tests/t20012/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20012_sequence: type: sequence diff --git a/tests/t20012/test_case.h b/tests/t20012/test_case.h index e71c2385..1ffbf6df 100644 --- a/tests/t20012/test_case.h +++ b/tests/t20012/test_case.h @@ -28,57 +28,56 @@ TEST_CASE("t20012", "[test-case][sequence]") REQUIRE(model->name() == "t20012_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"), "operator()()")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"), _A("A"), "a()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "aa()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "aaa()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "aa()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "aaa()")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"), _A("B"), "b()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "bb()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "bbb()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("B"), "bb()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("B"), "bbb()")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:80:20)"), _A("C"), "c()")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "cc()")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc()")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "cc()")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "ccc()")); + REQUIRE_THAT(src, HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:80:20)"), _A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"), "operator()()")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "ccc()")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "ccc()")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("R"), "r()")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("R"), _A("tmain()::(lambda ../../tests/t20012/t20012.cc:86:9)"), "operator()()")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:86:9)"), _A("C"), "c()")); // @todo #168 // REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("D"), "add5(int)")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -120,6 +119,54 @@ TEST_CASE("t20012", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, + HasCall(_A("tmain()"), + _A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"), + "operator()()")); + REQUIRE_THAT(src, + HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"), + _A("A"), "a()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "aa()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "aaa()")); + + REQUIRE_THAT(src, + HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"), + _A("B"), "b()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("B"), "bb()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("B"), "bbb()")); + + REQUIRE_THAT(src, + HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:80:20)"), + _A("C"), "c()")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "cc()")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "ccc()")); + REQUIRE_THAT(src, + HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:80:20)"), + _A("tmain()::(lambda ../../tests/t20012/t20012.cc:67:20)"), + "operator()()")); + + REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "ccc()")); + + REQUIRE_THAT(src, + HasCall(_A("tmain()"), + _A("R"), "r()")); + REQUIRE_THAT(src, + HasCall(_A("R"), + _A("tmain()::(lambda ../../tests/t20012/t20012.cc:86:9)"), + "operator()()")); + REQUIRE_THAT(src, + HasCall(_A("tmain()::(lambda ../../tests/t20012/t20012.cc:86:9)"), + _A("C"), "c()")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t20013/.clang-uml b/tests/t20013/.clang-uml index 650e6e87..a8620c1a 100644 --- a/tests/t20013/.clang-uml +++ b/tests/t20013/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20013_sequence: type: sequence diff --git a/tests/t20013/test_case.h b/tests/t20013/test_case.h index dc005e7a..3f3144d2 100644 --- a/tests/t20013/test_case.h +++ b/tests/t20013/test_case.h @@ -28,27 +28,25 @@ TEST_CASE("t20013", "[test-case][sequence]") REQUIRE(model->name() == "t20013_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT( - puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(int)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); + REQUIRE_THAT(src, HasCall(_A("tmain(int,char **)"), _A("B"), "b(int)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a1(int)")); REQUIRE_THAT( - puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(double)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(double)")); + src, HasCall(_A("tmain(int,char **)"), _A("B"), "b(double)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2(double)")); - REQUIRE_THAT(puml, - HasCall(_A("tmain(int,char **)"), _A("B"), "b(const char *)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a3(const char *)")); + REQUIRE_THAT( + src, HasCall(_A("tmain(int,char **)"), _A("B"), "b(const char *)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a3(const char *)")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -66,6 +64,26 @@ TEST_CASE("t20013", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain(int,char **)"), _A("B"), "b(int)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a1(int)")); + + REQUIRE_THAT( + src, HasCall(_A("tmain(int,char **)"), _A("B"), "b(double)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2(double)")); + + REQUIRE_THAT( + src, HasCall(_A("tmain(int,char **)"), _A("B"), "b(const char *)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a3(const char *)")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20014/.clang-uml b/tests/t20014/.clang-uml index 464dba5d..26cb0913 100644 --- a/tests/t20014/.clang-uml +++ b/tests/t20014/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20014_sequence: type: sequence diff --git a/tests/t20014/test_case.h b/tests/t20014/test_case.h index 91f6d7de..6f99d24e 100644 --- a/tests/t20014/test_case.h +++ b/tests/t20014/test_case.h @@ -28,25 +28,24 @@ TEST_CASE("t20014", "[test-case][sequence]") REQUIRE(model->name() == "t20014_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1(int,int)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int,int)")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b1(int,int)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a1(int,int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2(int,int)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(int,int)")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b2(int,int)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2(int,int)")); REQUIRE_THAT( - puml, HasCall(_A("tmain()"), _A("C"), "c1(int,int)")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b1(int,int)")); + src, HasCall(_A("tmain()"), _A("C"), "c1(int,int)")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("B"), "b1(int,int)")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -65,6 +64,25 @@ TEST_CASE("t20014", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b1(int,int)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a1(int,int)")); + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b2(int,int)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2(int,int)")); + + REQUIRE_THAT( + src, HasCall(_A("tmain()"), _A("C"), "c1(int,int)")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("B"), "b1(int,int)")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20015/.clang-uml b/tests/t20015/.clang-uml index d858dba3..4f550ad4 100644 --- a/tests/t20015/.clang-uml +++ b/tests/t20015/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20015_sequence: type: sequence diff --git a/tests/t20015/test_case.h b/tests/t20015/test_case.h index 29116c7a..c2c50ddc 100644 --- a/tests/t20015/test_case.h +++ b/tests/t20015/test_case.h @@ -28,26 +28,25 @@ TEST_CASE("t20015", "[test-case][sequence]") REQUIRE(model->name() == "t20015_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "setup_a(std::shared_ptr &)")); - REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_x(int)")); - REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_y(int)")); - REQUIRE_THAT(puml, !HasCall(_A("B"), _A("detail::A"), "set_z(int)")); + REQUIRE_THAT(src, !HasCall(_A("B"), _A("detail::A"), "set_x(int)")); + REQUIRE_THAT(src, !HasCall(_A("B"), _A("detail::A"), "set_y(int)")); + REQUIRE_THAT(src, !HasCall(_A("B"), _A("detail::A"), "set_z(int)")); - REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_x(int)")); - REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_y(int)")); - REQUIRE_THAT(puml, !HasCall(_A("B"), _A("B"), "set_z(int)")); + REQUIRE_THAT(src, !HasCall(_A("B"), _A("B"), "set_x(int)")); + REQUIRE_THAT(src, !HasCall(_A("B"), _A("B"), "set_y(int)")); + REQUIRE_THAT(src, !HasCall(_A("B"), _A("B"), "set_z(int)")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -60,6 +59,26 @@ TEST_CASE("t20015", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, + HasCall(_A("tmain()"), _A("B"), + "setup_a(std::shared_ptr &)")); + REQUIRE_THAT(src, !HasCall(_A("B"), _A("detail::A"), "set_x(int)")); + REQUIRE_THAT(src, !HasCall(_A("B"), _A("detail::A"), "set_y(int)")); + REQUIRE_THAT(src, !HasCall(_A("B"), _A("detail::A"), "set_z(int)")); + + REQUIRE_THAT(src, !HasCall(_A("B"), _A("B"), "set_x(int)")); + REQUIRE_THAT(src, !HasCall(_A("B"), _A("B"), "set_y(int)")); + REQUIRE_THAT(src, !HasCall(_A("B"), _A("B"), "set_z(int)")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20016/.clang-uml b/tests/t20016/.clang-uml index ef2b94d6..d1bb343b 100644 --- a/tests/t20016/.clang-uml +++ b/tests/t20016/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20016_sequence: type: sequence diff --git a/tests/t20016/test_case.h b/tests/t20016/test_case.h index 4bc099f3..5110b8fe 100644 --- a/tests/t20016/test_case.h +++ b/tests/t20016/test_case.h @@ -28,21 +28,20 @@ TEST_CASE("t20016", "[test-case][sequence]") REQUIRE(model->name() == "t20016_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1(long)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b1(long)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a1(int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2(long)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(const long &)")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b2(long)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2(const long &)")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -58,6 +57,21 @@ TEST_CASE("t20016", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b1(long)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a1(int)")); + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b2(long)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2(const long &)")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20017/.clang-uml b/tests/t20017/.clang-uml index 23fc3539..30a4154d 100644 --- a/tests/t20017/.clang-uml +++ b/tests/t20017/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20017_sequence: type: sequence diff --git a/tests/t20017/test_case.h b/tests/t20017/test_case.h index fe94fd45..aa72a696 100644 --- a/tests/t20017/test_case.h +++ b/tests/t20017/test_case.h @@ -28,29 +28,28 @@ TEST_CASE("t20017", "[test-case][sequence]") REQUIRE(model->name() == "t20017_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasEntrypoint(_A("t20017.cc"), "tmain()")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasEntrypoint(_A("t20017.cc"), "tmain()")); + REQUIRE_THAT(src, HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a1(int,int)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a2(int,int)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a3(int,int)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("t20017.cc"), _A("include/t20017_b.h"), "b1(int,int)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall( _A("t20017.cc"), _A("include/t20017_b.h"), "b2(int,int)")); - REQUIRE_THAT(puml, HasExitpoint(_A("t20017.cc"))); + REQUIRE_THAT(src, HasExitpoint(_A("t20017.cc"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -72,6 +71,31 @@ TEST_CASE("t20017", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + using mermaid::HasEntrypoint; + using mermaid::HasExitpoint; + + REQUIRE_THAT(src, HasEntrypoint(_A("t20017.cc"), "tmain()")); + REQUIRE_THAT(src, + HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a1(int,int)")); + REQUIRE_THAT(src, + HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a2(int,int)")); + REQUIRE_THAT(src, + HasCall(_A("t20017.cc"), _A("include/t20017_a.h"), "a3(int,int)")); + REQUIRE_THAT(src, + HasCall(_A("t20017.cc"), _A("include/t20017_b.h"), "b1(int,int)")); + REQUIRE_THAT(src, + HasCall( + _A("t20017.cc"), _A("include/t20017_b.h"), "b2(int,int)")); + REQUIRE_THAT(src, HasExitpoint(_A("t20017.cc"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20018/.clang-uml b/tests/t20018/.clang-uml index 0babfeb5..6168917d 100644 --- a/tests/t20018/.clang-uml +++ b/tests/t20018/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20018_sequence: type: sequence diff --git a/tests/t20018/test_case.h b/tests/t20018/test_case.h index fb11d96d..5a2448f1 100644 --- a/tests/t20018/test_case.h +++ b/tests/t20018/test_case.h @@ -29,32 +29,31 @@ TEST_CASE("t20018", "[test-case][sequence]") REQUIRE(model->name() == "t20018_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall( _A("tmain()"), _A("Answer,120>"), "__print()__")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("Answer,120>"), _A("Factorial<5>"), "__print(int)__")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("Factorial<5>"), _A("Factorial<4>"), "__print(int)__")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("Factorial<4>"), _A("Factorial<3>"), "__print(int)__")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("Factorial<3>"), _A("Factorial<2>"), "__print(int)__")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("Factorial<2>"), _A("Factorial<1>"), "__print(int)__")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("Factorial<1>"), _A("Factorial<0>"), "__print(int)__")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -75,6 +74,31 @@ TEST_CASE("t20018", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, + HasCall(_A("tmain()"), _A("Answer,120>"), "print()")); + REQUIRE_THAT(src, + HasCall(_A("Answer,120>"), _A("Factorial<5>"), + "print(int)")); + REQUIRE_THAT( + src, HasCall(_A("Factorial<5>"), _A("Factorial<4>"), "print(int)")); + REQUIRE_THAT( + src, HasCall(_A("Factorial<4>"), _A("Factorial<3>"), "print(int)")); + REQUIRE_THAT( + src, HasCall(_A("Factorial<3>"), _A("Factorial<2>"), "print(int)")); + REQUIRE_THAT( + src, HasCall(_A("Factorial<2>"), _A("Factorial<1>"), "print(int)")); + REQUIRE_THAT( + src, HasCall(_A("Factorial<1>"), _A("Factorial<0>"), "print(int)")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20019/.clang-uml b/tests/t20019/.clang-uml index 3804e9cc..de0bffa3 100644 --- a/tests/t20019/.clang-uml +++ b/tests/t20019/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20019_sequence: type: sequence diff --git a/tests/t20019/test_case.h b/tests/t20019/test_case.h index e9394fc0..e7622860 100644 --- a/tests/t20019/test_case.h +++ b/tests/t20019/test_case.h @@ -29,20 +29,19 @@ TEST_CASE("t20019", "[test-case][sequence]") REQUIRE(model->name() == "t20019_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("Base"), "name()")); - REQUIRE_THAT(puml, HasCall(_A("Base"), _A("D1"), "impl()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("Base"), "name()")); - REQUIRE_THAT(puml, HasCall(_A("Base"), _A("D2"), "impl()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("Base"), "name()")); + REQUIRE_THAT(src, HasCall(_A("Base"), _A("D1"), "impl()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("Base"), "name()")); + REQUIRE_THAT(src, HasCall(_A("Base"), _A("D2"), "impl()")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -58,6 +57,20 @@ TEST_CASE("t20019", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("Base"), "name()")); + REQUIRE_THAT(src, HasCall(_A("Base"), _A("D1"), "impl()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("Base"), "name()")); + REQUIRE_THAT(src, HasCall(_A("Base"), _A("D2"), "impl()")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20020/.clang-uml b/tests/t20020/.clang-uml index a7679e65..891d3df2 100644 --- a/tests/t20020/.clang-uml +++ b/tests/t20020/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20020_sequence: type: sequence diff --git a/tests/t20020/test_case.h b/tests/t20020/test_case.h index 1dcfe826..b68a840d 100644 --- a/tests/t20020/test_case.h +++ b/tests/t20020/test_case.h @@ -28,33 +28,32 @@ TEST_CASE("t20020", "[test-case][sequence]") REQUIRE(model->name() == "t20020_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a1()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a1()")); REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()")); + src, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()")); REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a3()")); + src, HasCallInControlCondition(_A("tmain()"), _A("A"), "a3()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b1()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "log()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b1()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b2()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "log()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("C"), "c1() const")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("C"), "c1() const")); REQUIRE_THAT( - puml, HasCallInControlCondition(_A("C"), _A("C"), "c2() const")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "log() const")); + src, HasCallInControlCondition(_A("C"), _A("C"), "c2() const")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "log() const")); REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c3(int)")); + src, HasCallInControlCondition(_A("tmain()"), _A("C"), "c3(int)")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -78,6 +77,34 @@ TEST_CASE("t20020", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + using mermaid::HasCallInControlCondition; + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a1()")); + REQUIRE_THAT( + src, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()")); + REQUIRE_THAT( + src, HasCallInControlCondition(_A("tmain()"), _A("A"), "a3()")); + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b1()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b2()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "log()")); + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("C"), "c1() const")); + REQUIRE_THAT( + src, HasCallInControlCondition(_A("C"), _A("C"), "c2() const")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "log() const")); + + REQUIRE_THAT( + src, HasCallInControlCondition(_A("tmain()"), _A("C"), "c3(int)")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20021/.clang-uml b/tests/t20021/.clang-uml index 938b7a7e..8fdf0132 100644 --- a/tests/t20021/.clang-uml +++ b/tests/t20021/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20021_sequence: type: sequence diff --git a/tests/t20021/test_case.h b/tests/t20021/test_case.h index 130bd08a..2eed83c1 100644 --- a/tests/t20021/test_case.h +++ b/tests/t20021/test_case.h @@ -28,38 +28,37 @@ TEST_CASE("t20021", "[test-case][sequence]") REQUIRE(model->name() == "t20021_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a1()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a1()")); REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a3()")); + src, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a3()")); - REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("B"), "b1()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "b2()")); + REQUIRE_THAT(src, !HasCall(_A("tmain()"), _A("B"), "b1()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b2()")); REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c1()")); + src, HasCallInControlCondition(_A("tmain()"), _A("C"), "c1()")); REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c2()")); + src, HasCallInControlCondition(_A("tmain()"), _A("C"), "c2()")); // TODO: Why is this not working? // REQUIRE_THAT( // puml, HasCallInControlCondition(_A("tmain()"), _A("C"), // "c3()")); REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("C"), "c4()")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "c5()")); - REQUIRE_THAT(puml, + src, HasCallInControlCondition(_A("tmain()"), _A("C"), "c4()")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "c5()")); + REQUIRE_THAT(src, HasCallInControlCondition(_A("tmain()"), _A("C"), "contents()")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -84,6 +83,35 @@ TEST_CASE("t20021", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + using mermaid::HasCallInControlCondition; + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a1()")); + REQUIRE_THAT( + src, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a3()")); + + REQUIRE_THAT(src, !HasCall(_A("tmain()"), _A("B"), "b1()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "b2()")); + + REQUIRE_THAT( + src, HasCallInControlCondition(_A("tmain()"), _A("C"), "c1()")); + REQUIRE_THAT( + src, HasCallInControlCondition(_A("tmain()"), _A("C"), "c2()")); + + REQUIRE_THAT( + src, HasCallInControlCondition(_A("tmain()"), _A("C"), "c4()")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "c5()")); + REQUIRE_THAT(src, + HasCallInControlCondition(_A("tmain()"), _A("C"), "contents()")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20022/.clang-uml b/tests/t20022/.clang-uml index 08f05219..6fe768b8 100644 --- a/tests/t20022/.clang-uml +++ b/tests/t20022/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20022_sequence: type: sequence diff --git a/tests/t20022/test_case.h b/tests/t20022/test_case.h index 2c462ae2..19b88900 100644 --- a/tests/t20022/test_case.h +++ b/tests/t20022/test_case.h @@ -28,18 +28,17 @@ TEST_CASE("t20022", "[test-case][sequence]") REQUIRE(model->name() == "t20022_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("B"), "b()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("B"), "b()")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -52,6 +51,18 @@ TEST_CASE("t20022", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("B"), "b()")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20023/.clang-uml b/tests/t20023/.clang-uml index 086afe9d..49f82a99 100644 --- a/tests/t20023/.clang-uml +++ b/tests/t20023/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20023_sequence: type: sequence diff --git a/tests/t20023/test_case.h b/tests/t20023/test_case.h index d1b23027..ad50dbb6 100644 --- a/tests/t20023/test_case.h +++ b/tests/t20023/test_case.h @@ -28,21 +28,20 @@ TEST_CASE("t20023", "[test-case][sequence]") REQUIRE(model->name() == "t20023_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a1()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a2()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a3()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a4()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a1()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a2()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a3()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a4()")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -56,6 +55,21 @@ TEST_CASE("t20023", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a1()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a2()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a3()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a4()")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20024/.clang-uml b/tests/t20024/.clang-uml index 1420bf1f..52b29956 100644 --- a/tests/t20024/.clang-uml +++ b/tests/t20024/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20024_sequence: type: sequence diff --git a/tests/t20024/test_case.h b/tests/t20024/test_case.h index 84551392..00257fe8 100644 --- a/tests/t20024/test_case.h +++ b/tests/t20024/test_case.h @@ -28,26 +28,25 @@ TEST_CASE("t20024", "[test-case][sequence]") REQUIRE(model->name() == "t20024_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "select(enum_a)")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a0()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a1()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a2()")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "a3()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "select(enum_a)")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a0()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a1()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a2()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a3()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("B"), "select(colors)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "red()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "orange()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("B"), "green()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "select(colors)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("B"), "red()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("B"), "orange()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("B"), "green()")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -62,6 +61,26 @@ TEST_CASE("t20024", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "select(enum_a)")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a0()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a1()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a2()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "a3()")); + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("B"), "select(colors)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("B"), "red()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("B"), "orange()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("B"), "green()")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20025/.clang-uml b/tests/t20025/.clang-uml index 14e8ed22..0e72c357 100644 --- a/tests/t20025/.clang-uml +++ b/tests/t20025/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20025_sequence: type: sequence diff --git a/tests/t20025/test_case.h b/tests/t20025/test_case.h index a309e768..3ece860b 100644 --- a/tests/t20025/test_case.h +++ b/tests/t20025/test_case.h @@ -28,21 +28,20 @@ TEST_CASE("t20025", "[test-case][sequence]") REQUIRE(model->name() == "t20025_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); - REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "a1()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(src, !HasCall(_A("A"), _A("A"), "a1()")); // REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "a2()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("add(int,int)"), "")); - REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("add2(int,int)"), "")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("add(int,int)"), "")); + REQUIRE_THAT(src, !HasCall(_A("tmain()"), _A("add2(int,int)"), "")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -56,6 +55,21 @@ TEST_CASE("t20025", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(src, !HasCall(_A("A"), _A("A"), "a1()")); + // REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "a2()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("add(int,int)"), "")); + REQUIRE_THAT(src, !HasCall(_A("tmain()"), _A("add2(int,int)"), "")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20026/.clang-uml b/tests/t20026/.clang-uml index fc5e972e..0ade1944 100644 --- a/tests/t20026/.clang-uml +++ b/tests/t20026/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20026_sequence: type: sequence diff --git a/tests/t20026/test_case.h b/tests/t20026/test_case.h index 93949707..1151622a 100644 --- a/tests/t20026/test_case.h +++ b/tests/t20026/test_case.h @@ -28,17 +28,16 @@ TEST_CASE("t20026", "[test-case][sequence]") REQUIRE(model->name() == "t20026_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a()")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -50,6 +49,17 @@ TEST_CASE("t20026", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a()")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20027/.clang-uml b/tests/t20027/.clang-uml index 10737381..32752095 100644 --- a/tests/t20027/.clang-uml +++ b/tests/t20027/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20027_sequence: type: sequence diff --git a/tests/t20027/test_case.h b/tests/t20027/test_case.h index fca26ac9..d91b462b 100644 --- a/tests/t20027/test_case.h +++ b/tests/t20027/test_case.h @@ -28,19 +28,18 @@ TEST_CASE("t20027", "[test-case][sequence]") REQUIRE(model->name() == "t20027_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a()")); - REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "aa()")); - REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "aaa()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(src, !HasCall(_A("A"), _A("A"), "aa()")); + REQUIRE_THAT(src, !HasCall(_A("A"), _A("A"), "aaa()")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -52,6 +51,19 @@ TEST_CASE("t20027", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(src, !HasCall(_A("A"), _A("A"), "aa()")); + REQUIRE_THAT(src, !HasCall(_A("A"), _A("A"), "aaa()")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20028/.clang-uml b/tests/t20028/.clang-uml index 24d8ee97..cf295f8b 100644 --- a/tests/t20028/.clang-uml +++ b/tests/t20028/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20028_sequence: type: sequence diff --git a/tests/t20028/test_case.h b/tests/t20028/test_case.h index 89e49668..48feb7a7 100644 --- a/tests/t20028/test_case.h +++ b/tests/t20028/test_case.h @@ -28,22 +28,21 @@ TEST_CASE("t20028", "[test-case][sequence]") REQUIRE(model->name() == "t20028_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "b()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "c()")); - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "d()")); - REQUIRE_THAT(puml, !HasCall(_A("tmain()"), _A("B"), "e()")); + src, HasCallInControlCondition(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "b()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "c()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "d()")); + REQUIRE_THAT(src, !HasCall(_A("tmain()"), _A("B"), "e()")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -58,6 +57,23 @@ TEST_CASE("t20028", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + using mermaid::HasCallInControlCondition; + + REQUIRE_THAT( + src, HasCallInControlCondition(_A("tmain()"), _A("A"), "a()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "b()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "c()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "d()")); + REQUIRE_THAT(src, !HasCall(_A("tmain()"), _A("B"), "e()")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20029/.clang-uml b/tests/t20029/.clang-uml index ca543ed2..cc1ccd3a 100644 --- a/tests/t20029/.clang-uml +++ b/tests/t20029/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20029_sequence: type: sequence diff --git a/tests/t20029/test_case.h b/tests/t20029/test_case.h index 7a0c6ac7..80ac68e8 100644 --- a/tests/t20029/test_case.h +++ b/tests/t20029/test_case.h @@ -28,39 +28,38 @@ TEST_CASE("t20029", "[test-case][sequence]") REQUIRE(model->name() == "t20029_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist REQUIRE_THAT( - puml, HasCall(_A("tmain()"), _A("ConnectionPool"), "connect()")); - REQUIRE_THAT(puml, + src, HasCall(_A("tmain()"), _A("ConnectionPool"), "connect()")); + REQUIRE_THAT(src, HasCallInControlCondition(_A("tmain()"), _A("Encoder>"), "send(std::string &&)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("Encoder>"), _A("Encoder>"), "encode(std::string &&)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCall(_A("Encoder>"), _A("encode_b64(std::string &&)"), "")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasCallInControlCondition(_A("Retrier"), _A("ConnectionPool"), "send(const std::string &)")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, !HasCall( _A("ConnectionPool"), _A("ConnectionPool"), "connect_impl()")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -82,6 +81,40 @@ TEST_CASE("t20029", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + using mermaid::HasCallInControlCondition; + + REQUIRE_THAT( + src, HasCall(_A("tmain()"), _A("ConnectionPool"), "connect()")); + REQUIRE_THAT(src, + HasCallInControlCondition(_A("tmain()"), + _A("Encoder>"), + "send(std::string &&)")); + + REQUIRE_THAT(src, + HasCall(_A("Encoder>"), + _A("Encoder>"), + "encode(std::string &&)")); + + REQUIRE_THAT(src, + HasCall(_A("Encoder>"), + _A("encode_b64(std::string &&)"), "")); + + REQUIRE_THAT(src, + HasCallInControlCondition(_A("Retrier"), + _A("ConnectionPool"), "send(const std::string &)")); + + REQUIRE_THAT(src, + !HasCall( + _A("ConnectionPool"), _A("ConnectionPool"), "connect_impl()")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20030/.clang-uml b/tests/t20030/.clang-uml index a4d9f94a..a54e474d 100644 --- a/tests/t20030/.clang-uml +++ b/tests/t20030/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20030_sequence: type: sequence diff --git a/tests/t20030/test_case.h b/tests/t20030/test_case.h index 6e7da9f1..38b24cdb 100644 --- a/tests/t20030/test_case.h +++ b/tests/t20030/test_case.h @@ -29,31 +29,30 @@ TEST_CASE("t20030", "[test-case][sequence]") REQUIRE(model->name() == "t20030_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain(int)"), _A("magic()"), "")); + REQUIRE_THAT(src, HasCall(_A("tmain(int)"), _A("magic()"), "")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "create()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "create()")); REQUIRE_THAT( - puml, HasCall(_A("tmain(int)"), _A("A"), "operator+=(int)")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "add(int)")); + src, HasCall(_A("tmain(int)"), _A("A"), "operator+=(int)")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "add(int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain(bool,int)"), _A("A"), "A()")); + REQUIRE_THAT(src, HasCall(_A("tmain(bool,int)"), _A("A"), "A()")); REQUIRE_THAT( - puml, HasCall(_A("tmain(bool,int)"), _A("A"), "operator+=(int)")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "add(int)")); - REQUIRE_THAT(puml, + src, HasCall(_A("tmain(bool,int)"), _A("A"), "operator+=(int)")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "add(int)")); + REQUIRE_THAT(src, HasCall(_A("tmain(bool,int)"), _A("A"), "operator=(const A &)")); - REQUIRE_THAT(puml, HasCall(_A("A"), _A("A"), "set(int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain(bool,int)"), _A("A"), "value()")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "set(int)")); + REQUIRE_THAT(src, HasCall(_A("tmain(bool,int)"), _A("A"), "value()")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -61,6 +60,31 @@ TEST_CASE("t20030", "[test-case][sequence]") using namespace json; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain(int)"), _A("magic()"), "")); + + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "create()")); + REQUIRE_THAT( + src, HasCall(_A("tmain(int)"), _A("A"), "operator+=(int)")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "add(int)")); + + REQUIRE_THAT(src, HasCall(_A("tmain(bool,int)"), _A("A"), "A()")); + REQUIRE_THAT( + src, HasCall(_A("tmain(bool,int)"), _A("A"), "operator+=(int)")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "add(int)")); + REQUIRE_THAT(src, + HasCall(_A("tmain(bool,int)"), _A("A"), "operator=(const A &)")); + REQUIRE_THAT(src, HasCall(_A("A"), _A("A"), "set(int)")); + REQUIRE_THAT(src, HasCall(_A("tmain(bool,int)"), _A("A"), "value()")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20031/.clang-uml b/tests/t20031/.clang-uml index da8b7038..3907966f 100644 --- a/tests/t20031/.clang-uml +++ b/tests/t20031/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20031_sequence: type: sequence diff --git a/tests/t20031/test_case.h b/tests/t20031/test_case.h index 25e82b48..f9726b91 100644 --- a/tests/t20031/test_case.h +++ b/tests/t20031/test_case.h @@ -29,34 +29,33 @@ TEST_CASE("t20031", "[test-case][sequence]") REQUIRE(model->name() == "t20031_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, HasCall(_A("tmain(int)"), _A("magic()"), "")); + REQUIRE_THAT(src, HasCall(_A("tmain(int)"), _A("magic()"), "")); - REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "create()")); + REQUIRE_THAT(src, !HasCall(_A("A"), _A("A"), "create()")); REQUIRE_THAT( - puml, !HasCall(_A("tmain(int)"), _A("A"), "operator+=(int)")); - REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "add(int)")); + src, !HasCall(_A("tmain(int)"), _A("A"), "operator+=(int)")); + REQUIRE_THAT(src, !HasCall(_A("A"), _A("A"), "add(int)")); - REQUIRE_THAT(puml, !HasCall(_A("tmain(bool,int)"), _A("A"), "A()")); + REQUIRE_THAT(src, !HasCall(_A("tmain(bool,int)"), _A("A"), "A()")); REQUIRE_THAT( - puml, !HasCall(_A("tmain(bool,int)"), _A("A"), "operator+=(int)")); - REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "add(int)")); - REQUIRE_THAT(puml, + src, !HasCall(_A("tmain(bool,int)"), _A("A"), "operator+=(int)")); + REQUIRE_THAT(src, !HasCall(_A("A"), _A("A"), "add(int)")); + REQUIRE_THAT(src, !HasCall(_A("tmain(bool,int)"), _A("A"), "operator=(const A &)")); - REQUIRE_THAT(puml, !HasCall(_A("A"), _A("A"), "set(int)")); - REQUIRE_THAT(puml, HasCall(_A("tmain(bool,int)"), _A("A"), "value()")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, !HasCall(_A("A"), _A("A"), "set(int)")); + REQUIRE_THAT(src, HasCall(_A("tmain(bool,int)"), _A("A"), "value()")); + REQUIRE_THAT(src, !HasCall(_A("tmain(bool,int)::(lambda " "../../tests/t20031/t20031.cc:47:26)"), _A("zero()"), "")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -64,6 +63,35 @@ TEST_CASE("t20031", "[test-case][sequence]") using namespace json; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain(int)"), _A("magic()"), "")); + + REQUIRE_THAT(src, !HasCall(_A("A"), _A("A"), "create()")); + REQUIRE_THAT( + src, !HasCall(_A("tmain(int)"), _A("A"), "operator+=(int)")); + REQUIRE_THAT(src, !HasCall(_A("A"), _A("A"), "add(int)")); + + REQUIRE_THAT(src, !HasCall(_A("tmain(bool,int)"), _A("A"), "A()")); + REQUIRE_THAT( + src, !HasCall(_A("tmain(bool,int)"), _A("A"), "operator+=(int)")); + REQUIRE_THAT(src, !HasCall(_A("A"), _A("A"), "add(int)")); + REQUIRE_THAT(src, + !HasCall(_A("tmain(bool,int)"), _A("A"), "operator=(const A &)")); + REQUIRE_THAT(src, !HasCall(_A("A"), _A("A"), "set(int)")); + REQUIRE_THAT(src, HasCall(_A("tmain(bool,int)"), _A("A"), "value()")); + REQUIRE_THAT(src, + !HasCall(_A("tmain(bool,int)::(lambda " + "../../tests/t20031/t20031.cc:47:26)"), + _A("zero()"), "")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20032/.clang-uml b/tests/t20032/.clang-uml index 5c88e05a..104141ab 100644 --- a/tests/t20032/.clang-uml +++ b/tests/t20032/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20032_sequence: type: sequence diff --git a/tests/t20032/test_case.h b/tests/t20032/test_case.h index d693533a..5116c4ba 100644 --- a/tests/t20032/test_case.h +++ b/tests/t20032/test_case.h @@ -30,33 +30,31 @@ TEST_CASE("t20032", "[test-case][sequence]") REQUIRE(model->name() == "t20032_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist + REQUIRE_THAT(src, HasCall(_A("tmain(int,char **)"), _A("B"), "b(int)")); REQUIRE_THAT( - puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(int)")); - REQUIRE_THAT( - puml, HasResponse(_A("tmain(int,char **)"), _A("B"), "int")); + src, HasResponse(_A("tmain(int,char **)"), _A("B"), "int")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a1(int)")); - REQUIRE_THAT(puml, HasResponse(_A("B"), _A("A"), "int")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a1(int)")); + REQUIRE_THAT(src, HasResponse(_A("B"), _A("A"), "int")); REQUIRE_THAT( - puml, HasCall(_A("tmain(int,char **)"), _A("B"), "b(double)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2(double)")); - REQUIRE_THAT(puml, HasResponse(_A("B"), _A("A"), "double")); + src, HasCall(_A("tmain(int,char **)"), _A("B"), "b(double)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2(double)")); + REQUIRE_THAT(src, HasResponse(_A("B"), _A("A"), "double")); - REQUIRE_THAT(puml, - HasCall(_A("tmain(int,char **)"), _A("B"), "b(const char *)")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a3(const char *)")); - REQUIRE_THAT(puml, HasResponse(_A("B"), _A("A"), "const char *")); + REQUIRE_THAT( + src, HasCall(_A("tmain(int,char **)"), _A("B"), "b(const char *)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a3(const char *)")); + REQUIRE_THAT(src, HasResponse(_A("B"), _A("A"), "const char *")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -74,6 +72,33 @@ TEST_CASE("t20032", "[test-case][sequence]") REQUIRE(std::is_sorted(messages.begin(), messages.end())); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + using mermaid::HasResponse; + + REQUIRE_THAT(src, HasCall(_A("tmain(int,char **)"), _A("B"), "b(int)")); + REQUIRE_THAT( + src, HasResponse(_A("tmain(int,char **)"), _A("B"), "int")); + + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a1(int)")); + REQUIRE_THAT(src, HasResponse(_A("B"), _A("A"), "int")); + + REQUIRE_THAT( + src, HasCall(_A("tmain(int,char **)"), _A("B"), "b(double)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2(double)")); + REQUIRE_THAT(src, HasResponse(_A("B"), _A("A"), "double")); + + REQUIRE_THAT( + src, HasCall(_A("tmain(int,char **)"), _A("B"), "b(const char *)")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a3(const char *)")); + REQUIRE_THAT(src, HasResponse(_A("B"), _A("A"), "const char *")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20033/.clang-uml b/tests/t20033/.clang-uml index f081bdbc..0f230c2b 100644 --- a/tests/t20033/.clang-uml +++ b/tests/t20033/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20033_sequence: type: sequence diff --git a/tests/t20033/test_case.h b/tests/t20033/test_case.h index 36929b23..131acc81 100644 --- a/tests/t20033/test_case.h +++ b/tests/t20033/test_case.h @@ -29,23 +29,22 @@ TEST_CASE("t20033", "[test-case][sequence]") REQUIRE(model->name() == "t20033_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("tmain()"), _A("A"), "a1()")); + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a1()")); REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()")); + src, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()")); REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a3()")); + src, HasCallInControlCondition(_A("tmain()"), _A("A"), "a3()")); REQUIRE_THAT( - puml, HasCallInControlCondition(_A("tmain()"), _A("A"), "a4()")); + src, HasCallInControlCondition(_A("tmain()"), _A("A"), "a4()")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -53,6 +52,24 @@ TEST_CASE("t20033", "[test-case][sequence]") using namespace json; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + using mermaid::HasCallInControlCondition; + + REQUIRE_THAT(src, HasCall(_A("tmain()"), _A("A"), "a1()")); + REQUIRE_THAT( + src, HasCallInControlCondition(_A("tmain()"), _A("A"), "a2()")); + REQUIRE_THAT( + src, HasCallInControlCondition(_A("tmain()"), _A("A"), "a3()")); + REQUIRE_THAT( + src, HasCallInControlCondition(_A("tmain()"), _A("A"), "a4()")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20034/.clang-uml b/tests/t20034/.clang-uml index 83d964c9..3e970e05 100644 --- a/tests/t20034/.clang-uml +++ b/tests/t20034/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20034_sequence: type: sequence diff --git a/tests/t20034/test_case.h b/tests/t20034/test_case.h index 1363fca0..c08ef64f 100644 --- a/tests/t20034/test_case.h +++ b/tests/t20034/test_case.h @@ -29,26 +29,25 @@ TEST_CASE("t20034", "[test-case][sequence]") REQUIRE(model->name() == "t20034_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all calls exist - REQUIRE_THAT(puml, HasCall(_A("D"), _A("A"), "a2()")); + REQUIRE_THAT(src, HasCall(_A("D"), _A("A"), "a2()")); - REQUIRE_THAT(puml, HasCall(_A("D"), _A("C"), "c3()")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "c2()")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b2()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2()")); + REQUIRE_THAT(src, HasCall(_A("D"), _A("C"), "c3()")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "c2()")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("B"), "b2()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2()")); - REQUIRE_THAT(puml, HasCall(_A("D"), _A("C"), "c4()")); + REQUIRE_THAT(src, HasCall(_A("D"), _A("C"), "c4()")); - REQUIRE_THAT(puml, !HasCall(_A("C"), _A("B"), "b3()")); + REQUIRE_THAT(src, !HasCall(_A("C"), _A("B"), "b3()")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -72,6 +71,26 @@ TEST_CASE("t20034", "[test-case][sequence]") {{"D::d2()", "C::c2()", "void"}, {"C::c2()", "B::b2()", "void"}, {"B::b2()", "A::a2()", "void"}})); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("D"), _A("A"), "a2()")); + + REQUIRE_THAT(src, HasCall(_A("D"), _A("C"), "c3()")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "c2()")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("B"), "b2()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2()")); + + REQUIRE_THAT(src, HasCall(_A("D"), _A("C"), "c4()")); + + REQUIRE_THAT(src, !HasCall(_A("C"), _A("B"), "b3()")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20035/.clang-uml b/tests/t20035/.clang-uml index 7b1a708e..c7ee1c78 100644 --- a/tests/t20035/.clang-uml +++ b/tests/t20035/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20035_sequence: type: sequence diff --git a/tests/t20035/test_case.h b/tests/t20035/test_case.h index 50134794..d4eb26dc 100644 --- a/tests/t20035/test_case.h +++ b/tests/t20035/test_case.h @@ -29,18 +29,17 @@ TEST_CASE("t20035", "[test-case][sequence]") REQUIRE(model->name() == "t20035_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, 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)"), "")); + REQUIRE_THAT(src, HasCall(_A("tmain(int,char **)"), _A("a(int)"), "")); + REQUIRE_THAT(src, HasCall(_A("a(int)"), _A("b1(int)"), "")); + REQUIRE_THAT(src, HasCall(_A("b1(int)"), _A("c(int)"), "")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -52,6 +51,19 @@ TEST_CASE("t20035", "[test-case][sequence]") {{"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); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("tmain(int,char **)"), _A("a(int)"), "")); + REQUIRE_THAT(src, HasCall(_A("a(int)"), _A("b1(int)"), "")); + REQUIRE_THAT(src, HasCall(_A("b1(int)"), _A("c(int)"), "")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t20036/.clang-uml b/tests/t20036/.clang-uml index f6bc00ff..9339d814 100644 --- a/tests/t20036/.clang-uml +++ b/tests/t20036/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t20036_sequence: type: sequence diff --git a/tests/t20036/test_case.h b/tests/t20036/test_case.h index 67381a9f..3ecf5714 100644 --- a/tests/t20036/test_case.h +++ b/tests/t20036/test_case.h @@ -29,26 +29,25 @@ TEST_CASE("t20036", "[test-case][sequence]") REQUIRE(model->name() == "t20036_sequence"); { - auto puml = generate_sequence_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_sequence_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("C"), "c2()")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b2()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2()")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "c2()")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("B"), "b2()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2()")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b2()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2()")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("B"), "b2()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2()")); - REQUIRE_THAT(puml, HasCall(_A("D"), _A("A"), "a2()")); + REQUIRE_THAT(src, HasCall(_A("D"), _A("A"), "a2()")); - REQUIRE_THAT(puml, HasCall(_A("C"), _A("B"), "b1()")); - REQUIRE_THAT(puml, HasCall(_A("B"), _A("A"), "a2()")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("B"), "b1()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2()")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -68,6 +67,27 @@ TEST_CASE("t20036", "[test-case][sequence]") REQUIRE(HasMessageChain(j, {{"C::c1()", "B::b1()", "void"}, {"B::b1()", "A::a2()", "void"}})); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_sequence_mermaid(diagram, *model); + + mermaid::SequenceDiagramAliasMatcher _A(src); + using mermaid::HasCall; + + REQUIRE_THAT(src, HasCall(_A("C"), _A("C"), "c2()")); + REQUIRE_THAT(src, HasCall(_A("C"), _A("B"), "b2()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2()")); + + REQUIRE_THAT(src, HasCall(_A("C"), _A("B"), "b2()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2()")); + + REQUIRE_THAT(src, HasCall(_A("D"), _A("A"), "a2()")); + + REQUIRE_THAT(src, HasCall(_A("C"), _A("B"), "b1()")); + REQUIRE_THAT(src, HasCall(_A("B"), _A("A"), "a2()")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t30001/.clang-uml b/tests/t30001/.clang-uml index 0825068b..05767605 100644 --- a/tests/t30001/.clang-uml +++ b/tests/t30001/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30001_package: type: package @@ -20,3 +20,15 @@ diagrams: - 'note right of {{ alias("A::AA::AAA") }}: A AAA note...' - '{% set e=element("A::AA") %} note top of {{ alias("A::AA") }} : {{ e.comment.formatted }}' - '{% set e=element("B::AA") %} note top of {{ alias("B::AA") }} : {{ e.comment.formatted }}' + mermaid: + before: + - "%% t30001 test diagram of type {{ diagram.type }}" + after: + - 'N_0001(A AAA note...)' + - 'N_0001 -.- {{ alias("A::AA::AAA") }}' + - '{% set e=element("A::AA") %}N_0002({{ e.comment.formatted }})' + - '{% set e=element("B::AA") %}N_0003({{ e.comment.formatted }})' + - 'N_0002 -.- {{ alias("A::AA") }}' + - 'N_0003 -.- {{ alias("B::AA") }}' + + diff --git a/tests/t30001/test_case.h b/tests/t30001/test_case.h index 1442e8d9..0b5fab4a 100644 --- a/tests/t30001/test_case.h +++ b/tests/t30001/test_case.h @@ -29,40 +29,39 @@ TEST_CASE("t30001", "[test-case][package]") REQUIRE(model->name() == "t30001_package"); { - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_package_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("A")); - REQUIRE_THAT(puml, IsPackage("AAA")); - REQUIRE_THAT(puml, IsPackage("AAA")); + REQUIRE_THAT(src, IsPackage("A")); + REQUIRE_THAT(src, IsPackage("AAA")); + REQUIRE_THAT(src, IsPackage("AAA")); // TODO: Fix _A() to handle fully qualified names, right // now it only finds the first element with unqualified // name match - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasNote(_A("AA"), "top", "This is namespace AA in namespace A")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasLink(_A("AAA"), fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" "t30001/t30001.cc#L6", clanguml::util::get_git_commit()), "AAA")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasLink(_A("BBB"), fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" "t30001/t30001.cc#L8", clanguml::util::get_git_commit()), "BBB")); - REQUIRE_THAT(puml, HasComment("t30001 test diagram of type package")); + REQUIRE_THAT(src, HasComment("t30001 test diagram of type package")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -81,6 +80,45 @@ TEST_CASE("t30001", "[test-case][package]") REQUIRE(IsPackage(j, "B::AA::BBB")); REQUIRE(IsPackage(j, "B::BB")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_package_mermaid(diagram, *model); + mermaid::AliasMatcher _A(src); + + using mermaid::HasComment; + using mermaid::HasLink; + using mermaid::HasPackageNote; + using mermaid::IsPackage; + + REQUIRE_THAT(src, IsPackage(_A("A"))); + REQUIRE_THAT(src, IsPackage(_A("AAA"))); + REQUIRE_THAT(src, IsPackage(_A("AAA"))); + + // TODO: Fix _A() to handle fully qualified names, right + // now it only finds the first element with unqualified + // name match + REQUIRE_THAT(src, + HasPackageNote( + _A("AA"), "top", "This is namespace AA in namespace A")); + + REQUIRE_THAT(src, + HasLink(_A("AAA"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t30001/t30001.cc#L6", + clanguml::util::get_git_commit()), + "AAA")); + + REQUIRE_THAT(src, + HasLink(_A("BBB"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t30001/t30001.cc#L8", + clanguml::util::get_git_commit()), + "BBB")); + + REQUIRE_THAT(src, HasComment("t30001 test diagram of type package")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t30002/.clang-uml b/tests/t30002/.clang-uml index dbbd0717..c2111c65 100644 --- a/tests/t30002/.clang-uml +++ b/tests/t30002/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30002_package: type: package diff --git a/tests/t30002/test_case.h b/tests/t30002/test_case.h index b589496b..4d8c0df0 100644 --- a/tests/t30002/test_case.h +++ b/tests/t30002/test_case.h @@ -29,51 +29,50 @@ TEST_CASE("t30002", "[test-case][package]") REQUIRE(model->name() == "t30002_package"); { - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_package_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("A1")); - REQUIRE_THAT(puml, IsPackage("A2")); - REQUIRE_THAT(puml, IsPackage("A3")); - REQUIRE_THAT(puml, IsPackage("A4")); - REQUIRE_THAT(puml, IsPackage("A5")); - REQUIRE_THAT(puml, IsPackage("A6")); - REQUIRE_THAT(puml, IsPackage("A7")); - REQUIRE_THAT(puml, IsPackage("A8")); - REQUIRE_THAT(puml, IsPackage("A9")); - REQUIRE_THAT(puml, IsPackage("A11")); - REQUIRE_THAT(puml, IsPackage("A12")); - REQUIRE_THAT(puml, IsPackage("A13")); - REQUIRE_THAT(puml, IsPackage("A14")); - REQUIRE_THAT(puml, IsPackage("A15")); - REQUIRE_THAT(puml, IsPackage("A16")); - REQUIRE_THAT(puml, IsPackage("A17")); - REQUIRE_THAT(puml, IsPackage("A18")); + REQUIRE_THAT(src, IsPackage("A1")); + REQUIRE_THAT(src, IsPackage("A2")); + REQUIRE_THAT(src, IsPackage("A3")); + REQUIRE_THAT(src, IsPackage("A4")); + REQUIRE_THAT(src, IsPackage("A5")); + REQUIRE_THAT(src, IsPackage("A6")); + REQUIRE_THAT(src, IsPackage("A7")); + REQUIRE_THAT(src, IsPackage("A8")); + REQUIRE_THAT(src, IsPackage("A9")); + REQUIRE_THAT(src, IsPackage("A11")); + REQUIRE_THAT(src, IsPackage("A12")); + REQUIRE_THAT(src, IsPackage("A13")); + REQUIRE_THAT(src, IsPackage("A14")); + REQUIRE_THAT(src, IsPackage("A15")); + REQUIRE_THAT(src, IsPackage("A16")); + REQUIRE_THAT(src, IsPackage("A17")); + REQUIRE_THAT(src, IsPackage("A18")); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A1"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A2"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A3"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A4"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A5"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A6"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A7"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A8"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A9"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A10"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A11"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A12"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A13"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A14"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A15"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A16"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A17"))); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("A18"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A1"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A2"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A3"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A4"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A5"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A6"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A7"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A8"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A9"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A10"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A11"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A12"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A13"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A14"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A15"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A16"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A17"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("A18"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -120,6 +119,52 @@ TEST_CASE("t30002", "[test-case][package]") REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A16")); REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::A17")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_package_mermaid(diagram, *model); + mermaid::AliasMatcher _A(src); + using mermaid::IsPackage; + using mermaid::IsPackageDependency; + + REQUIRE_THAT(src, IsPackage(_A("A1"))); + REQUIRE_THAT(src, IsPackage(_A("A2"))); + REQUIRE_THAT(src, IsPackage(_A("A3"))); + REQUIRE_THAT(src, IsPackage(_A("A4"))); + REQUIRE_THAT(src, IsPackage(_A("A5"))); + REQUIRE_THAT(src, IsPackage(_A("A6"))); + REQUIRE_THAT(src, IsPackage(_A("A7"))); + REQUIRE_THAT(src, IsPackage(_A("A8"))); + REQUIRE_THAT(src, IsPackage(_A("A9"))); + REQUIRE_THAT(src, IsPackage(_A("A11"))); + REQUIRE_THAT(src, IsPackage(_A("A12"))); + REQUIRE_THAT(src, IsPackage(_A("A13"))); + REQUIRE_THAT(src, IsPackage(_A("A14"))); + REQUIRE_THAT(src, IsPackage(_A("A15"))); + REQUIRE_THAT(src, IsPackage(_A("A16"))); + REQUIRE_THAT(src, IsPackage(_A("A17"))); + REQUIRE_THAT(src, IsPackage(_A("A18"))); + + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A1"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A2"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A3"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A4"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A5"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A6"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A7"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A8"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A9"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A10"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A11"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A12"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A13"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A14"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A15"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A16"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A17"))); + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("A18"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t30003/.clang-uml b/tests/t30003/.clang-uml index 74318921..b4322243 100644 --- a/tests/t30003/.clang-uml +++ b/tests/t30003/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30003_package: type: package diff --git a/tests/t30003/test_case.h b/tests/t30003/test_case.h index c9b9e200..09082966 100644 --- a/tests/t30003/test_case.h +++ b/tests/t30003/test_case.h @@ -28,23 +28,22 @@ TEST_CASE("t30003", "[test-case][package]") REQUIRE(model->name() == "t30003_package"); { - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_package_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("ns1")); - REQUIRE_THAT(puml, IsPackage("ns2")); - REQUIRE_THAT(puml, IsPackage("ns3")); - REQUIRE_THAT(puml, IsPackage("ns2_v1_0_0")); - REQUIRE_THAT(puml, IsPackage("ns2_v0_9_0")); + REQUIRE_THAT(src, IsPackage("ns1")); + REQUIRE_THAT(src, IsPackage("ns2")); + REQUIRE_THAT(src, IsPackage("ns3")); + REQUIRE_THAT(src, IsPackage("ns2_v1_0_0")); + REQUIRE_THAT(src, IsPackage("ns2_v0_9_0")); - REQUIRE_THAT(puml, IsDeprecated(_A("ns2_v0_9_0"))); - REQUIRE_THAT(puml, IsDeprecated(_A("ns3"))); + REQUIRE_THAT(src, IsDeprecated(_A("ns2_v0_9_0"))); + REQUIRE_THAT(src, IsDeprecated(_A("ns3"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -62,6 +61,23 @@ TEST_CASE("t30003", "[test-case][package]") REQUIRE(IsDeprecated(j, "ns1::ns2_v0_9_0")); REQUIRE(IsDeprecated(j, "ns3")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_package_mermaid(diagram, *model); + mermaid::AliasMatcher _A(src); + using mermaid::IsPackage; + + REQUIRE_THAT(src, IsPackage(_A("ns1"))); + REQUIRE_THAT(src, IsPackage(_A("ns2"))); + REQUIRE_THAT(src, IsPackage(_A("ns3"))); + REQUIRE_THAT(src, IsPackage(_A("ns2_v1_0_0"))); + REQUIRE_THAT(src, IsPackage(_A("ns2_v0_9_0"))); + + // REQUIRE_THAT(src, IsDeprecated(_A("ns2_v0_9_0"))); + // REQUIRE_THAT(src, IsDeprecated(_A("ns3"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t30004/.clang-uml b/tests/t30004/.clang-uml index ac7fcc9a..c273c5f6 100644 --- a/tests/t30004/.clang-uml +++ b/tests/t30004/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30004_package: type: package diff --git a/tests/t30004/test_case.h b/tests/t30004/test_case.h index ef97bd49..0eb17be6 100644 --- a/tests/t30004/test_case.h +++ b/tests/t30004/test_case.h @@ -29,20 +29,19 @@ TEST_CASE("t30004", "[test-case][package]") REQUIRE(model->name() == "t30004_package"); { - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_package_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("AAA")); - REQUIRE_THAT(puml, IsPackage("BBB")); - REQUIRE_THAT(puml, IsPackage("CCC")); - REQUIRE_THAT(puml, !IsPackage("DDD")); - REQUIRE_THAT(puml, IsPackage("EEE")); + REQUIRE_THAT(src, IsPackage("AAA")); + REQUIRE_THAT(src, IsPackage("BBB")); + REQUIRE_THAT(src, IsPackage("CCC")); + REQUIRE_THAT(src, !IsPackage("DDD")); + REQUIRE_THAT(src, IsPackage("EEE")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -57,6 +56,20 @@ TEST_CASE("t30004", "[test-case][package]") REQUIRE(!IsPackage(j, "A::DDD")); REQUIRE(IsPackage(j, "A::EEE")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_package_mermaid(diagram, *model); + mermaid::AliasMatcher _A(src); + using mermaid::IsPackage; + + REQUIRE_THAT(src, IsPackage(_A("AAA"))); + REQUIRE_THAT(src, IsPackage(_A("BBB"))); + REQUIRE_THAT(src, IsPackage(_A("CCC"))); + REQUIRE_THAT(src, !IsPackage(_A("DDD"))); + REQUIRE_THAT(src, IsPackage(_A("EEE"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t30005/.clang-uml b/tests/t30005/.clang-uml index 1512c67f..bbfe0e64 100644 --- a/tests/t30005/.clang-uml +++ b/tests/t30005/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30005_package: type: package diff --git a/tests/t30005/test_case.h b/tests/t30005/test_case.h index 18665830..75e5d45c 100644 --- a/tests/t30005/test_case.h +++ b/tests/t30005/test_case.h @@ -29,21 +29,20 @@ TEST_CASE("t30005", "[test-case][package]") REQUIRE(model->name() == "t30005_package"); { - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_package_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("AAA")); - REQUIRE_THAT(puml, IsPackage("BBB")); - REQUIRE_THAT(puml, IsPackage("CCC")); + REQUIRE_THAT(src, IsPackage("AAA")); + REQUIRE_THAT(src, IsPackage("BBB")); + REQUIRE_THAT(src, IsPackage("CCC")); - REQUIRE_THAT(puml, IsDependency(_A("BBB"), _A("AAA"))); - REQUIRE_THAT(puml, IsDependency(_A("CCC"), _A("AAA"))); + REQUIRE_THAT(src, IsDependency(_A("BBB"), _A("AAA"))); + REQUIRE_THAT(src, IsDependency(_A("CCC"), _A("AAA"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -64,6 +63,23 @@ TEST_CASE("t30005", "[test-case][package]") REQUIRE(IsDependency(j, "B::BB::BBB", "A::AA::AAA")); REQUIRE(IsDependency(j, "C::CC::CCC", "A::AA::AAA")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_package_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::IsPackage; + using mermaid::IsPackageDependency; + + REQUIRE_THAT(src, IsPackage(_A("AAA"))); + REQUIRE_THAT(src, IsPackage(_A("BBB"))); + REQUIRE_THAT(src, IsPackage(_A("CCC"))); + + REQUIRE_THAT(src, IsPackageDependency(_A("BBB"), _A("AAA"))); + REQUIRE_THAT(src, IsPackageDependency(_A("CCC"), _A("AAA"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t30006/.clang-uml b/tests/t30006/.clang-uml index 7899d3cc..5f970f91 100644 --- a/tests/t30006/.clang-uml +++ b/tests/t30006/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30006_package: type: package diff --git a/tests/t30006/test_case.h b/tests/t30006/test_case.h index b238f55e..bed6eeca 100644 --- a/tests/t30006/test_case.h +++ b/tests/t30006/test_case.h @@ -29,21 +29,20 @@ TEST_CASE("t30006", "[test-case][package]") REQUIRE(model->name() == "t30006_package"); { - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_package_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("A")); - REQUIRE_THAT(puml, IsPackage("B")); - REQUIRE_THAT(puml, IsPackage("C")); + REQUIRE_THAT(src, IsPackage("A")); + REQUIRE_THAT(src, IsPackage("B")); + REQUIRE_THAT(src, IsPackage("C")); - REQUIRE_THAT(puml, IsDependency(_A("A"), _A("B"))); - REQUIRE_THAT(puml, IsDependency(_A("A"), _A("C"))); + REQUIRE_THAT(src, IsDependency(_A("A"), _A("B"))); + REQUIRE_THAT(src, IsDependency(_A("A"), _A("C"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -58,6 +57,22 @@ TEST_CASE("t30006", "[test-case][package]") REQUIRE(IsDependency(j, "A", "B")); REQUIRE(IsDependency(j, "A", "C")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_package_mermaid(diagram, *model); + mermaid::AliasMatcher _A(src); + using mermaid::IsPackage; + using mermaid::IsPackageDependency; + + REQUIRE_THAT(src, IsPackage(_A("A"))); + REQUIRE_THAT(src, IsPackage(_A("B"))); + REQUIRE_THAT(src, IsPackage(_A("C"))); + + REQUIRE_THAT(src, IsPackageDependency(_A("A"), _A("B"))); + REQUIRE_THAT(src, IsPackageDependency(_A("A"), _A("C"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t30007/.clang-uml b/tests/t30007/.clang-uml index 96c875a0..4551c4da 100644 --- a/tests/t30007/.clang-uml +++ b/tests/t30007/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30007_package: type: package diff --git a/tests/t30007/test_case.h b/tests/t30007/test_case.h index 6262c0c5..796f453b 100644 --- a/tests/t30007/test_case.h +++ b/tests/t30007/test_case.h @@ -29,24 +29,23 @@ TEST_CASE("t30007", "[test-case][package]") REQUIRE(model->name() == "t30007_package"); { - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_package_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("A")); - REQUIRE_THAT(puml, IsPackage("B")); - REQUIRE_THAT(puml, IsPackage("C")); + REQUIRE_THAT(src, IsPackage("A")); + REQUIRE_THAT(src, IsPackage("B")); + REQUIRE_THAT(src, IsPackage("C")); - REQUIRE_THAT(puml, IsDependency(_A("AA"), _A("B"))); - REQUIRE_THAT(puml, IsDependency(_A("AA"), _A("C"))); + REQUIRE_THAT(src, IsDependency(_A("AA"), _A("B"))); + REQUIRE_THAT(src, IsDependency(_A("AA"), _A("C"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("C"), "up", _A("AA"))); - REQUIRE_THAT(puml, IsLayoutHint(_A("C"), "left", _A("B"))); + REQUIRE_THAT(src, IsLayoutHint(_A("C"), "up", _A("AA"))); + REQUIRE_THAT(src, IsLayoutHint(_A("C"), "left", _A("B"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -62,6 +61,22 @@ TEST_CASE("t30007", "[test-case][package]") REQUIRE(IsDependency(j, "A::AA", "B")); REQUIRE(IsDependency(j, "A::AA", "C")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_package_mermaid(diagram, *model); + mermaid::AliasMatcher _A(src); + using mermaid::IsPackage; + using mermaid::IsPackageDependency; + + REQUIRE_THAT(src, IsPackage(_A("A"))); + REQUIRE_THAT(src, IsPackage(_A("B"))); + REQUIRE_THAT(src, IsPackage(_A("C"))); + + REQUIRE_THAT(src, IsPackageDependency(_A("AA"), _A("B"))); + REQUIRE_THAT(src, IsPackageDependency(_A("AA"), _A("C"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t30008/.clang-uml b/tests/t30008/.clang-uml index 60e4959d..9325c7af 100644 --- a/tests/t30008/.clang-uml +++ b/tests/t30008/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30008_package: type: package diff --git a/tests/t30008/test_case.h b/tests/t30008/test_case.h index a6bd9b7b..8d724055 100644 --- a/tests/t30008/test_case.h +++ b/tests/t30008/test_case.h @@ -29,30 +29,29 @@ TEST_CASE("t30008", "[test-case][package]") REQUIRE(model->name() == "t30008_package"); { - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_package_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("A")); - REQUIRE_THAT(puml, IsPackage("B")); - REQUIRE_THAT(puml, IsPackage("C")); - REQUIRE_THAT(puml, !IsPackage("X")); + REQUIRE_THAT(src, IsPackage("A")); + REQUIRE_THAT(src, IsPackage("B")); + REQUIRE_THAT(src, IsPackage("C")); + REQUIRE_THAT(src, !IsPackage("X")); - REQUIRE_THAT(puml, IsDependency(_A("B"), _A("A"))); - REQUIRE_THAT(puml, IsDependency(_A("C"), _A("B"))); + REQUIRE_THAT(src, IsDependency(_A("B"), _A("A"))); + REQUIRE_THAT(src, IsDependency(_A("C"), _A("B"))); - REQUIRE_THAT(puml, IsPackage("D")); - REQUIRE_THAT(puml, IsPackage("E")); - REQUIRE_THAT(puml, IsPackage("F")); - REQUIRE_THAT(puml, !IsPackage("Y")); + REQUIRE_THAT(src, IsPackage("D")); + REQUIRE_THAT(src, IsPackage("E")); + REQUIRE_THAT(src, IsPackage("F")); + REQUIRE_THAT(src, !IsPackage("Y")); - REQUIRE_THAT(puml, IsDependency(_A("E"), _A("D"))); - REQUIRE_THAT(puml, IsDependency(_A("F"), _A("E"))); + REQUIRE_THAT(src, IsDependency(_A("E"), _A("D"))); + REQUIRE_THAT(src, IsDependency(_A("F"), _A("E"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -76,6 +75,31 @@ TEST_CASE("t30008", "[test-case][package]") REQUIRE(IsDependency(j, "dependencies::E", "dependencies::D")); REQUIRE(IsDependency(j, "dependencies::F", "dependencies::E")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_package_mermaid(diagram, *model); + mermaid::AliasMatcher _A(src); + using mermaid::IsPackage; + using mermaid::IsPackageDependency; + + REQUIRE_THAT(src, IsPackage(_A("A"))); + REQUIRE_THAT(src, IsPackage(_A("B"))); + REQUIRE_THAT(src, IsPackage(_A("C"))); + REQUIRE_THAT(src, !IsPackage(_A("X"))); + + REQUIRE_THAT(src, IsPackageDependency(_A("B"), _A("A"))); + REQUIRE_THAT(src, IsPackageDependency(_A("C"), _A("B"))); + + REQUIRE_THAT(src, IsPackage(_A("D"))); + REQUIRE_THAT(src, IsPackage(_A("E"))); + REQUIRE_THAT(src, IsPackage(_A("F"))); + REQUIRE_THAT(src, !IsPackage(_A("Y"))); + + REQUIRE_THAT(src, IsPackageDependency(_A("E"), _A("D"))); + REQUIRE_THAT(src, IsPackageDependency(_A("F"), _A("E"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t30009/.clang-uml b/tests/t30009/.clang-uml index 9452c160..13e21029 100644 --- a/tests/t30009/.clang-uml +++ b/tests/t30009/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30009_package: type: package diff --git a/tests/t30009/test_case.h b/tests/t30009/test_case.h index 8ee85cfb..efb4902d 100644 --- a/tests/t30009/test_case.h +++ b/tests/t30009/test_case.h @@ -29,22 +29,21 @@ TEST_CASE("t30009", "[test-case][package]") REQUIRE(model->name() == "t30009_package"); { - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_package_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); // Check if all packages exist - REQUIRE_THAT(puml, IsPackage("One")); - REQUIRE_THAT(puml, IsPackage("Two")); - REQUIRE_THAT(puml, IsPackage("A")); - REQUIRE_THAT(puml, IsPackage("B")); - REQUIRE_THAT(puml, IsPackage("C")); - REQUIRE_THAT(puml, IsPackage("D")); + REQUIRE_THAT(src, IsPackage("One")); + REQUIRE_THAT(src, IsPackage("Two")); + REQUIRE_THAT(src, IsPackage("A")); + REQUIRE_THAT(src, IsPackage("B")); + REQUIRE_THAT(src, IsPackage("C")); + REQUIRE_THAT(src, IsPackage("D")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -63,6 +62,21 @@ TEST_CASE("t30009", "[test-case][package]") REQUIRE(IsPackage(j, "Two::C")); REQUIRE(IsPackage(j, "Two::D")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_package_mermaid(diagram, *model); + mermaid::AliasMatcher _A(src); + using mermaid::IsPackage; + + REQUIRE_THAT(src, IsPackage(_A("One"))); + REQUIRE_THAT(src, IsPackage(_A("Two"))); + REQUIRE_THAT(src, IsPackage(_A("A"))); + REQUIRE_THAT(src, IsPackage(_A("B"))); + REQUIRE_THAT(src, IsPackage(_A("C"))); + REQUIRE_THAT(src, IsPackage(_A("D"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t30010/.clang-uml b/tests/t30010/.clang-uml index 22f72ba3..9dc1339a 100644 --- a/tests/t30010/.clang-uml +++ b/tests/t30010/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30010_package: type: package diff --git a/tests/t30010/test_case.h b/tests/t30010/test_case.h index 943da222..03a1e1ca 100644 --- a/tests/t30010/test_case.h +++ b/tests/t30010/test_case.h @@ -29,26 +29,25 @@ TEST_CASE("t30010", "[test-case][package]") REQUIRE(model->name() == "t30010_package"); { - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_package_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("app")); - REQUIRE_THAT(puml, IsPackage("libraries")); - REQUIRE_THAT(puml, IsPackage("lib1")); - REQUIRE_THAT(puml, IsPackage("lib2")); - REQUIRE_THAT(puml, !IsPackage("library1")); - REQUIRE_THAT(puml, !IsPackage("library2")); + REQUIRE_THAT(src, IsPackage("app")); + REQUIRE_THAT(src, IsPackage("libraries")); + REQUIRE_THAT(src, IsPackage("lib1")); + REQUIRE_THAT(src, IsPackage("lib2")); + REQUIRE_THAT(src, !IsPackage("library1")); + REQUIRE_THAT(src, !IsPackage("library2")); - REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib1"))); - REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib2"))); - REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib3"))); - REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib4"))); + REQUIRE_THAT(src, IsDependency(_A("app"), _A("lib1"))); + REQUIRE_THAT(src, IsDependency(_A("app"), _A("lib2"))); + REQUIRE_THAT(src, IsDependency(_A("app"), _A("lib3"))); + REQUIRE_THAT(src, IsDependency(_A("app"), _A("lib4"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -56,6 +55,27 @@ TEST_CASE("t30010", "[test-case][package]") using namespace json; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_package_mermaid(diagram, *model); + mermaid::AliasMatcher _A(src); + using mermaid::IsPackage; + using mermaid::IsPackageDependency; + + REQUIRE_THAT(src, IsPackage(_A("app"))); + REQUIRE_THAT(src, IsPackage(_A("libraries"))); + REQUIRE_THAT(src, IsPackage(_A("lib1"))); + REQUIRE_THAT(src, IsPackage(_A("lib2"))); + REQUIRE_THAT(src, !IsPackage(_A("library1"))); + REQUIRE_THAT(src, !IsPackage(_A("library2"))); + + REQUIRE_THAT(src, IsPackageDependency(_A("app"), _A("lib1"))); + REQUIRE_THAT(src, IsPackageDependency(_A("app"), _A("lib2"))); + REQUIRE_THAT(src, IsPackageDependency(_A("app"), _A("lib3"))); + REQUIRE_THAT(src, IsPackageDependency(_A("app"), _A("lib4"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t30011/.clang-uml b/tests/t30011/.clang-uml index 33463e69..a379b981 100644 --- a/tests/t30011/.clang-uml +++ b/tests/t30011/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t30011_package: type: package diff --git a/tests/t30011/test_case.h b/tests/t30011/test_case.h index b78c2c41..ac66a448 100644 --- a/tests/t30011/test_case.h +++ b/tests/t30011/test_case.h @@ -29,26 +29,25 @@ TEST_CASE("t30011", "[test-case][package]") REQUIRE(model->name() == "t30011_package"); { - auto puml = generate_package_puml(diagram, *model); - AliasMatcher _A(puml); + auto src = generate_package_puml(diagram, *model); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsPackage("app")); - REQUIRE_THAT(puml, IsPackage("libraries")); - REQUIRE_THAT(puml, IsPackage("lib1")); - REQUIRE_THAT(puml, IsPackage("lib2")); - REQUIRE_THAT(puml, !IsPackage("library1")); - REQUIRE_THAT(puml, !IsPackage("library2")); + REQUIRE_THAT(src, IsPackage("app")); + REQUIRE_THAT(src, IsPackage("libraries")); + REQUIRE_THAT(src, IsPackage("lib1")); + REQUIRE_THAT(src, IsPackage("lib2")); + REQUIRE_THAT(src, !IsPackage("library1")); + REQUIRE_THAT(src, !IsPackage("library2")); - REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib1"))); - REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib2"))); - REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib3"))); - REQUIRE_THAT(puml, IsDependency(_A("app"), _A("lib4"))); + REQUIRE_THAT(src, IsDependency(_A("app"), _A("lib1"))); + REQUIRE_THAT(src, IsDependency(_A("app"), _A("lib2"))); + REQUIRE_THAT(src, IsDependency(_A("app"), _A("lib3"))); + REQUIRE_THAT(src, IsDependency(_A("app"), _A("lib4"))); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -56,6 +55,27 @@ TEST_CASE("t30011", "[test-case][package]") using namespace json; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_package_mermaid(diagram, *model); + mermaid::AliasMatcher _A(src); + using mermaid::IsPackage; + using mermaid::IsPackageDependency; + + REQUIRE_THAT(src, IsPackage(_A("app"))); + REQUIRE_THAT(src, IsPackage(_A("libraries"))); + REQUIRE_THAT(src, IsPackage(_A("lib1"))); + REQUIRE_THAT(src, IsPackage(_A("lib2"))); + REQUIRE_THAT(src, !IsPackage(_A("library1"))); + REQUIRE_THAT(src, !IsPackage(_A("library2"))); + + REQUIRE_THAT(src, IsPackageDependency(_A("app"), _A("lib1"))); + REQUIRE_THAT(src, IsPackageDependency(_A("app"), _A("lib2"))); + REQUIRE_THAT(src, IsPackageDependency(_A("app"), _A("lib3"))); + REQUIRE_THAT(src, IsPackageDependency(_A("app"), _A("lib4"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } \ No newline at end of file diff --git a/tests/t40001/.clang-uml b/tests/t40001/.clang-uml index 208c7397..14660735 100644 --- a/tests/t40001/.clang-uml +++ b/tests/t40001/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t40001_include: type: include @@ -20,4 +20,10 @@ diagrams: - "' t40001 test diagram of type {{ diagram.type }}" after: - 'note right of {{ alias("include/lib1") }}: This is a lib1 include dir' - - 'note right of {{ alias("include/t40001_include1.h") }}: This is a t40001_include1.h include file' \ No newline at end of file + - 'note right of {{ alias("include/t40001_include1.h") }}: This is a t40001_include1.h include file' + mermaid: + before: + - "%% t40001 test diagram of type {{ diagram.type }}" + after: + - 'N_00001(This is a lib1 include dir)-.-{{ alias("include/lib1") }}' + - 'N_00002(This is a t40001_include1.h include file)-.-{{ alias("include/t40001_include1.h") }}' \ No newline at end of file diff --git a/tests/t40001/test_case.h b/tests/t40001/test_case.h index 70b5ec90..545c8cd2 100644 --- a/tests/t40001/test_case.h +++ b/tests/t40001/test_case.h @@ -29,32 +29,30 @@ TEST_CASE("t40001", "[test-case][include]") REQUIRE(model->name() == "t40001_include"); { - auto puml = generate_include_puml(diagram, *model); + auto src = generate_include_puml(diagram, *model); - AliasMatcher _A(puml); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsFolder("lib1")); - REQUIRE_THAT(puml, IsFile("lib1.h")); - REQUIRE_THAT(puml, IsFile("t40001.cc")); - REQUIRE_THAT(puml, IsFile("t40001_include1.h")); + REQUIRE_THAT(src, IsFolder("lib1")); + REQUIRE_THAT(src, IsFile("lib1.h")); + REQUIRE_THAT(src, IsFile("t40001.cc")); + REQUIRE_THAT(src, IsFile("t40001_include1.h")); - REQUIRE_THAT(puml, IsFile("string")); - REQUIRE_THAT(puml, IsFile("yaml-cpp/yaml.h")); + REQUIRE_THAT(src, IsFile("string")); + REQUIRE_THAT(src, IsFile("yaml-cpp/yaml.h")); REQUIRE_THAT( - puml, IsAssociation(_A("t40001.cc"), _A("t40001_include1.h"))); - REQUIRE_THAT( - puml, IsAssociation(_A("t40001_include1.h"), _A("lib1.h"))); + src, IsAssociation(_A("t40001.cc"), _A("t40001_include1.h"))); + REQUIRE_THAT(src, IsAssociation(_A("t40001_include1.h"), _A("lib1.h"))); - REQUIRE_THAT(puml, IsDependency(_A("t40001_include1.h"), _A("string"))); + REQUIRE_THAT(src, IsDependency(_A("t40001_include1.h"), _A("string"))); - REQUIRE_THAT(puml, HasComment("t40001 test diagram of type include")); + REQUIRE_THAT(src, HasComment("t40001 test diagram of type include")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -78,6 +76,35 @@ TEST_CASE("t40001", "[test-case][include]") j, "include/t40001_include1.h", "include/lib1/lib1.h")); REQUIRE(IsDependency(j, "include/t40001_include1.h", "string")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_include_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::HasComment; + using mermaid::IsFile; + using mermaid::IsFolder; + using mermaid::IsIncludeDependency; + + REQUIRE_THAT(src, IsFolder(_A("lib1"))); + REQUIRE_THAT(src, IsFile(_A("lib1.h"))); + REQUIRE_THAT(src, IsFile(_A("t40001.cc"))); + REQUIRE_THAT(src, IsFile(_A("t40001_include1.h"))); + + REQUIRE_THAT(src, IsFile(_A("string"))); + REQUIRE_THAT(src, IsFile(_A("yaml-cpp/yaml.h"))); + + REQUIRE_THAT( + src, IsAssociation(_A("t40001.cc"), _A("t40001_include1.h"))); + REQUIRE_THAT(src, IsAssociation(_A("t40001_include1.h"), _A("lib1.h"))); + + REQUIRE_THAT( + src, IsIncludeDependency(_A("t40001_include1.h"), _A("string"))); + + REQUIRE_THAT(src, HasComment("t40001 test diagram of type include")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t40002/.clang-uml b/tests/t40002/.clang-uml index 84c790a2..21514d18 100644 --- a/tests/t40002/.clang-uml +++ b/tests/t40002/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t40002_include: type: include diff --git a/tests/t40002/test_case.h b/tests/t40002/test_case.h index 67bb22b2..5a6e451c 100644 --- a/tests/t40002/test_case.h +++ b/tests/t40002/test_case.h @@ -29,59 +29,58 @@ TEST_CASE("t40002", "[test-case][include]") REQUIRE(model->name() == "t40002_include"); { - auto puml = generate_include_puml(diagram, *model); + auto src = generate_include_puml(diagram, *model); - AliasMatcher _A(puml); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsFolder("lib1")); - REQUIRE_THAT(puml, IsFolder("lib2")); - REQUIRE_THAT(puml, IsFile("lib1.h")); - REQUIRE_THAT(puml, IsFile("lib2.h")); - REQUIRE_THAT(puml, !IsFile("lib2_detail.h")); - REQUIRE_THAT(puml, IsFile("t40002.cc")); - REQUIRE_THAT(puml, IsFile("lib1.cc")); - REQUIRE_THAT(puml, IsFile("lib2.cc")); + REQUIRE_THAT(src, IsFolder("lib1")); + REQUIRE_THAT(src, IsFolder("lib2")); + REQUIRE_THAT(src, IsFile("lib1.h")); + REQUIRE_THAT(src, IsFile("lib2.h")); + REQUIRE_THAT(src, !IsFile("lib2_detail.h")); + REQUIRE_THAT(src, IsFile("t40002.cc")); + REQUIRE_THAT(src, IsFile("lib1.cc")); + REQUIRE_THAT(src, IsFile("lib2.cc")); - REQUIRE_THAT(puml, !IsFile("string")); + REQUIRE_THAT(src, !IsFile("string")); - REQUIRE_THAT(puml, IsAssociation(_A("t40002.cc"), _A("lib1.h"))); - REQUIRE_THAT(puml, IsAssociation(_A("lib1.h"), _A("lib2.h"))); - REQUIRE_THAT(puml, IsAssociation(_A("lib1.cc"), _A("lib1.h"))); - REQUIRE_THAT(puml, IsAssociation(_A("lib2.cc"), _A("lib2.h"))); + REQUIRE_THAT(src, IsAssociation(_A("t40002.cc"), _A("lib1.h"))); + REQUIRE_THAT(src, IsAssociation(_A("lib1.h"), _A("lib2.h"))); + REQUIRE_THAT(src, IsAssociation(_A("lib1.cc"), _A("lib1.h"))); + REQUIRE_THAT(src, IsAssociation(_A("lib2.cc"), _A("lib2.h"))); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasLink(_A("t40002.cc"), fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" "t40002/src/t40002.cc#L0", clanguml::util::get_git_commit()), "t40002.cc")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasLink(_A("lib1.cc"), fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" "t40002/src/lib1/lib1.cc#L0", clanguml::util::get_git_commit()), "lib1.cc")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasLink(_A("lib1.h"), fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" "t40002/include/lib1/lib1.h#L0", clanguml::util::get_git_commit()), "lib1.h")); - REQUIRE_THAT(puml, + REQUIRE_THAT(src, HasLink(_A("lib2.h"), fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" "t40002/include/lib2/lib2.h#L0", clanguml::util::get_git_commit()), "lib2.h")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -109,6 +108,61 @@ TEST_CASE("t40002", "[test-case][include]") REQUIRE(IsAssociation(j, "src/lib1/lib1.cc", "include/lib1/lib1.h")); REQUIRE(IsAssociation(j, "src/lib2/lib2.cc", "include/lib2/lib2.h")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_include_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::HasLink; + using mermaid::IsFile; + using mermaid::IsFolder; + + REQUIRE_THAT(src, IsFolder(_A("lib1"))); + REQUIRE_THAT(src, IsFolder(_A("lib2"))); + REQUIRE_THAT(src, IsFile(_A("lib1.h"))); + REQUIRE_THAT(src, IsFile(_A("lib2.h"))); + REQUIRE_THAT(src, !IsFile(_A("lib2_detail.h"))); + REQUIRE_THAT(src, IsFile(_A("t40002.cc"))); + REQUIRE_THAT(src, IsFile(_A("lib1.cc"))); + REQUIRE_THAT(src, IsFile(_A("lib2.cc"))); + + REQUIRE_THAT(src, !IsFile(_A("string"))); + + REQUIRE_THAT(src, IsAssociation(_A("t40002.cc"), _A("lib1.h"))); + REQUIRE_THAT(src, IsAssociation(_A("lib1.h"), _A("lib2.h"))); + REQUIRE_THAT(src, IsAssociation(_A("lib1.cc"), _A("lib1.h"))); + REQUIRE_THAT(src, IsAssociation(_A("lib2.cc"), _A("lib2.h"))); + + REQUIRE_THAT(src, + HasLink(_A("t40002.cc"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t40002/src/t40002.cc#L0", + clanguml::util::get_git_commit()), + "t40002.cc")); + + REQUIRE_THAT(src, + HasLink(_A("lib1.cc"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t40002/src/lib1/lib1.cc#L0", + clanguml::util::get_git_commit()), + "lib1.cc")); + + REQUIRE_THAT(src, + HasLink(_A("lib1.h"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t40002/include/lib1/lib1.h#L0", + clanguml::util::get_git_commit()), + "lib1.h")); + + REQUIRE_THAT(src, + HasLink(_A("lib2.h"), + fmt::format("https://github.com/bkryza/clang-uml/blob/{}/tests/" + "t40002/include/lib2/lib2.h#L0", + clanguml::util::get_git_commit()), + "lib2.h")); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t40003/.clang-uml b/tests/t40003/.clang-uml index be81eb3a..782b375a 100644 --- a/tests/t40003/.clang-uml +++ b/tests/t40003/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t40003_include: type: include diff --git a/tests/t40003/test_case.h b/tests/t40003/test_case.h index 966c7fdc..88bb5bf7 100644 --- a/tests/t40003/test_case.h +++ b/tests/t40003/test_case.h @@ -29,26 +29,25 @@ TEST_CASE("t40003", "[test-case][include]") REQUIRE(model->name() == "t40003_include"); { - auto puml = generate_include_puml(diagram, *model); + auto src = generate_include_puml(diagram, *model); - AliasMatcher _A(puml); + AliasMatcher _A(src); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(src, StartsWith("@startuml")); + REQUIRE_THAT(src, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsFolder("dependants")); - REQUIRE_THAT(puml, IsFolder("dependencies")); + REQUIRE_THAT(src, IsFolder("dependants")); + REQUIRE_THAT(src, IsFolder("dependencies")); - REQUIRE_THAT(puml, IsFile("t1.h")); - REQUIRE_THAT(puml, IsFile("t2.h")); - REQUIRE_THAT(puml, IsFile("t3.h")); + REQUIRE_THAT(src, IsFile("t1.h")); + REQUIRE_THAT(src, IsFile("t2.h")); + REQUIRE_THAT(src, IsFile("t3.h")); - REQUIRE_THAT(puml, !IsFile("t4.h")); - REQUIRE_THAT(puml, IsFile("t5.h")); - REQUIRE_THAT(puml, !IsFile("t6.h")); + REQUIRE_THAT(src, !IsFile("t4.h")); + REQUIRE_THAT(src, IsFile("t5.h")); + REQUIRE_THAT(src, !IsFile("t6.h")); - save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", src); } { @@ -73,6 +72,28 @@ TEST_CASE("t40003", "[test-case][include]") REQUIRE(!IsFile(j, "include/dependencies/t4.h")); REQUIRE(IsFile(j, "src/dependencies/t2.cc")); - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto src = generate_include_mermaid(diagram, *model); + + mermaid::AliasMatcher _A(src); + using mermaid::HasLink; + using mermaid::IsFile; + using mermaid::IsFolder; + + REQUIRE_THAT(src, IsFolder(_A("dependants"))); + REQUIRE_THAT(src, IsFolder(_A("dependencies"))); + + REQUIRE_THAT(src, IsFile(_A("t1.h"))); + REQUIRE_THAT(src, IsFile(_A("t2.h"))); + REQUIRE_THAT(src, IsFile(_A("t3.h"))); + + REQUIRE_THAT(src, !IsFile(_A("t4.h"))); + REQUIRE_THAT(src, IsFile(_A("t5.h"))); + REQUIRE_THAT(src, !IsFile(_A("t6.h"))); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", src); } } diff --git a/tests/t90000/.clang-uml b/tests/t90000/.clang-uml index 86079718..7f12a85b 100644 --- a/tests/t90000/.clang-uml +++ b/tests/t90000/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: t90000_class: type: class @@ -18,3 +18,15 @@ diagrams: - 'class "Boo" as C_002' - 'class C_002 {' - '}' + mermaid: + before: + - 'class C_001["Foo"]' + - 'class C_001 {' + - ' +int value' + - '}' + - 'C_001 <|-- ArrayList' + - 'note for C_001 "This is a very important class."' + - 'note "This is a\nfloating note"' + - 'class C_002["Boo"]' + - 'class C_002 {' + - '}' diff --git a/tests/t90000/test_case.h b/tests/t90000/test_case.h index 5074f76e..84d50e58 100644 --- a/tests/t90000/test_case.h +++ b/tests/t90000/test_case.h @@ -26,14 +26,30 @@ TEST_CASE("t90000", "[test-case][config]") REQUIRE(model->name() == "t90000_class"); - auto puml = generate_class_puml(diagram, *model); - AliasMatcher _A(puml); + { + auto puml = generate_class_puml(diagram, *model); + AliasMatcher _A(puml); - REQUIRE_THAT(puml, StartsWith("@startuml")); - REQUIRE_THAT(puml, EndsWith("@enduml\n")); + REQUIRE_THAT(puml, StartsWith("@startuml")); + REQUIRE_THAT(puml, EndsWith("@enduml\n")); - REQUIRE_THAT(puml, IsClass(_A("Foo"))); - REQUIRE_THAT(puml, IsClass(_A("Boo"))); + REQUIRE_THAT(puml, IsClass(_A("Foo"))); + REQUIRE_THAT(puml, IsClass(_A("Boo"))); - save_puml(config.output_directory() + "/" + diagram->name + ".puml", puml); + save_puml(config.output_directory(), diagram->name + ".puml", puml); + } + + { + auto j = generate_class_json(diagram, *model); + + using namespace json; + + save_json(config.output_directory(), diagram->name + ".json", j); + } + + { + auto mmd = generate_class_mermaid(diagram, *model); + + save_mermaid(config.output_directory(), diagram->name + ".mmd", mmd); + } } diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 1c9b3919..b2e6222a 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -111,6 +111,24 @@ auto generate_diagram_json( return nlohmann::json::parse(ss.str()); } + +template +auto generate_diagram_mermaid( + std::shared_ptr config, DiagramModel &model) +{ + using diagram_config = DiagramConfig; + using diagram_model = DiagramModel; + using diagram_generator = + typename clanguml::common::generators::diagram_generator_t< + DiagramConfig, + clanguml::common::generators::mermaid_generator_tag>::type; + + std::stringstream ss; + + ss << diagram_generator(dynamic_cast(*config), model); + + return ss.str(); +} } std::unique_ptr generate_class_diagram( @@ -209,24 +227,79 @@ nlohmann::json generate_include_json( config, model); } -void save_puml(const std::string &path, const std::string &puml) +std::string generate_class_mermaid( + std::shared_ptr config, + clanguml::class_diagram::model::diagram &model) { - std::filesystem::path p{path}; - std::filesystem::create_directory(p.parent_path()); + return detail::generate_diagram_mermaid( + config, model); +} + +std::string generate_sequence_mermaid( + std::shared_ptr config, + clanguml::sequence_diagram::model::diagram &model) +{ + return detail::generate_diagram_mermaid( + config, model); +} + +std::string generate_package_mermaid( + std::shared_ptr config, + clanguml::package_diagram::model::diagram &model) +{ + return detail::generate_diagram_mermaid( + config, model); +} + +std::string generate_include_mermaid( + std::shared_ptr config, + clanguml::include_diagram::model::diagram &model) +{ + return detail::generate_diagram_mermaid( + config, model); +} + +template +void save_diagram(const std::filesystem::path &path, const T &diagram) +{ + static_assert( + std::same_as || std::same_as); + + std::filesystem::create_directories(path.parent_path()); std::ofstream ofs; - ofs.open(p, std::ofstream::out | std::ofstream::trunc); - ofs << puml; + ofs.open(path, std::ofstream::out | std::ofstream::trunc); + if constexpr (std::same_as) { + ofs << std::setw(2) << diagram; + } + else { + ofs << diagram; + } + ofs.close(); } -void save_json(const std::string &path, const nlohmann::json &j) +void save_puml(const std::string &path, const std::string &filename, + const std::string &puml) { std::filesystem::path p{path}; - std::filesystem::create_directory(p.parent_path()); - std::ofstream ofs; - ofs.open(p, std::ofstream::out | std::ofstream::trunc); - ofs << std::setw(2) << j; - ofs.close(); + p /= filename; + save_diagram(p, puml); +} + +void save_json(const std::string &path, const std::string &filename, + const nlohmann::json &j) +{ + std::filesystem::path p{path}; + p /= filename; + save_diagram(p, j); +} + +void save_mermaid(const std::string &path, const std::string &filename, + const std::string &mmd) +{ + std::filesystem::path p{path}; + p /= filename; + save_diagram(p, mmd); } using namespace clanguml::test::matchers; diff --git a/tests/test_cases.h b/tests/test_cases.h index 980cde6f..12d4a6de 100644 --- a/tests/test_cases.h +++ b/tests/test_cases.h @@ -19,6 +19,7 @@ #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG +#include "class_diagram/generators/mermaid/class_diagram_generator.h" #include "class_diagram/generators/plantuml/class_diagram_generator.h" #include "class_diagram/model/diagram.h" #include "class_diagram/visitor/translation_unit_visitor.h" @@ -135,14 +136,19 @@ struct HasCallWithResultMatcher : ContainsMatcher { template class HasCallMatcher : public Catch::MatcherBase { T m_from, m_to, m_message; bool m_is_response; + std::string m_call_arrow, m_return_arrow; std::string call_pattern, response_pattern; public: - HasCallMatcher(T from, T to, T message, bool is_response = false) + HasCallMatcher(T from, T to, T message, bool is_response = false, + const std::string &call_arrow = "->", + const std::string &return_arrow = "-->") : m_from(from) , m_to{to} , m_message{message} , m_is_response{is_response} + , m_call_arrow{call_arrow} + , m_return_arrow{return_arrow} { util::replace_all(m_message, "(", "\\("); util::replace_all(m_message, ")", "\\)"); @@ -151,12 +157,12 @@ public: util::replace_all(m_message, "]", "\\]"); util::replace_all(m_message, "+", "\\+"); - call_pattern = fmt::format("{} -> {} " + call_pattern = fmt::format("{} {} {} " "(\\[\\[.*\\]\\] )?: {}", - m_from, m_to, m_message); + m_from, m_call_arrow, m_to, m_message); - response_pattern = - fmt::format("{} --> {} : //{}//", m_from, m_to, m_message); + response_pattern = fmt::format( + "{} {} {} : //{}//", m_from, m_return_arrow, m_to, m_message); } bool match(T const &in) const override @@ -180,7 +186,8 @@ public: { std::ostringstream ss; ss << "has call " - << fmt::format("{} -> {} : {}", m_from, m_to, m_message); + << fmt::format( + "{} {} {} : {}", m_from, m_call_arrow, m_to, m_message); return ss.str(); } }; @@ -189,7 +196,7 @@ auto HasCall(std::string const &from, std::string const &to, std::string const &message, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { - return HasCallMatcher(from, to, message); + return HasCallMatcher(from, to, message, false); } auto HasResponse(std::string const &from, std::string const &to, @@ -212,13 +219,91 @@ auto HasCall(std::string const &from, std::string const &message, return HasCall(from, from, message, caseSensitivity); } -auto HasCallWithResponse(std::string const &from, std::string const &to, +namespace mermaid { +template class HasCallMatcher : public Catch::MatcherBase { + T m_from, m_to, m_message; + bool m_is_response; + std::string m_call_arrow, m_return_arrow; + std::string call_pattern, response_pattern; + +public: + HasCallMatcher(T from, T to, T message, bool is_response = false, + const std::string &call_arrow = "->>", + const std::string &return_arrow = "-->>") + : m_from(from) + , m_to{to} + , m_message{message} + , m_is_response{is_response} + , m_call_arrow{call_arrow} + , m_return_arrow{return_arrow} + { + util::replace_all(m_message, "(", "\\("); + util::replace_all(m_message, ")", "\\)"); + util::replace_all(m_message, "*", "\\*"); + util::replace_all(m_message, "[", "\\["); + util::replace_all(m_message, "]", "\\]"); + util::replace_all(m_message, "+", "\\+"); + + call_pattern = + fmt::format("{} {} {} : {}", m_from, m_call_arrow, m_to, m_message); + + response_pattern = fmt::format( + "{} {} {} : {}", m_from, m_return_arrow, m_to, m_message); + } + + bool match(T const &in) const override + { + std::istringstream fin(in); + std::string line; + + std::regex r{m_is_response ? response_pattern : call_pattern}; + + while (std::getline(fin, line)) { + std::smatch base_match; + std::regex_search(in, base_match, r); + if (base_match.size() > 0) + return true; + } + + return false; + } + + std::string describe() const override + { + std::ostringstream ss; + ss << "has call " + << fmt::format( + "{} {} {} : {}", m_from, m_call_arrow, m_to, m_message); + return ss.str(); + } +}; + +auto HasCall(std::string const &from, std::string const &to, std::string const &message, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { - return ContainsMatcher(CasedString( - fmt::format("{} --> {}", to, from), caseSensitivity)) && - HasCallMatcher(from, to, message); + return mermaid::HasCallMatcher(from, to, message, false); +} + +auto HasCallInControlCondition(std::string const &from, std::string const &to, + std::string const &message, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return mermaid::HasCallMatcher(from, to, fmt::format("[{}]", message)); +} + +auto HasResponse(std::string const &from, std::string const &to, + std::string const &message, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return HasCallMatcher(to, from, message, true, "->>", "-->>"); +} + +auto HasCall(std::string const &from, std::string const &message, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return mermaid::HasCall(from, from, message, caseSensitivity); +} } ContainsMatcher HasEntrypoint(std::string const &to, std::string const &message, @@ -228,6 +313,15 @@ ContainsMatcher HasEntrypoint(std::string const &to, std::string const &message, CasedString(fmt::format("[-> {} : {}", to, message), caseSensitivity)); } +namespace mermaid { +ContainsMatcher HasEntrypoint(std::string const &to, std::string const &message, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return ContainsMatcher(CasedString( + fmt::format("* ->> {} : {}", to, message), caseSensitivity)); +} +} + ContainsMatcher HasExitpoint(std::string const &to, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { @@ -235,6 +329,15 @@ ContainsMatcher HasExitpoint(std::string const &to, CasedString(fmt::format("[<-- {}", to), caseSensitivity)); } +namespace mermaid { +ContainsMatcher HasExitpoint(std::string const &to, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return ContainsMatcher( + CasedString(fmt::format("{} -->> *", to), caseSensitivity)); +} +} + std::string _NS(std::string_view s) { return fmt::format( @@ -301,12 +404,110 @@ struct AliasMatcher { const std::vector puml; }; +namespace mermaid { +struct AliasMatcher { + AliasMatcher(const std::string &mmd_) + : mmd{split(mmd_, "\n")} + { + } + + std::string operator()(std::string name) + { + std::vector patterns; + + const std::string alias_regex("([A-Z]_[0-9]+)"); + + util::replace_all(name, "(", "("); + util::replace_all(name, ")", ")"); + util::replace_all(name, " ", "\\s"); + util::replace_all(name, "*", "\\*"); + util::replace_all(name, "[", "\\["); + util::replace_all(name, "]", "\\]"); + util::replace_all(name, "<", "<"); + util::replace_all(name, ">", ">"); + + patterns.push_back( + std::regex{"class\\s" + alias_regex + "\\[\"" + name + "\"\\]"}); + patterns.push_back( + std::regex{"subgraph\\s" + alias_regex + "\\[" + name + "\\]"}); + patterns.push_back( + std::regex{"\\s\\s" + alias_regex + "\\[" + name + "\\]"}); // file + + std::smatch base_match; + + for (const auto &line : mmd) { + for (const auto &pattern : patterns) { + if (std::regex_search(line, base_match, pattern) && + base_match.size() == 2) { + std::ssub_match base_sub_match = base_match[1]; + std::string alias = base_sub_match.str(); + return trim(alias); + } + } + } + + return "__INVALID__ALIAS__"; + } + + const std::vector mmd; +}; + +struct SequenceDiagramAliasMatcher { + SequenceDiagramAliasMatcher(const std::string &mmd_) + : mmd{split(mmd_, "\n")} + { + } + + std::string operator()(std::string name) + { + std::vector patterns; + + const std::string alias_regex("([A-Z]_[0-9]+)"); + + util::replace_all(name, "(", "\\("); + util::replace_all(name, ")", "\\)"); + util::replace_all(name, " ", "\\s"); + util::replace_all(name, "*", "\\*"); + util::replace_all(name, "[", "\\["); + util::replace_all(name, "]", "\\]"); + + patterns.push_back( + std::regex{"participant\\s" + alias_regex + "\\sas\\s" + name}); + + std::smatch base_match; + + for (const auto &line : mmd) { + for (const auto &pattern : patterns) { + if (std::regex_search(line, base_match, pattern) && + base_match.size() == 2) { + std::ssub_match base_sub_match = base_match[1]; + std::string alias = base_sub_match.str(); + return trim(alias); + } + } + } + + return "__INVALID__ALIAS__"; + } + + const std::vector mmd; +}; +} + ContainsMatcher IsClass(std::string const &str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { return ContainsMatcher(CasedString("class " + str, caseSensitivity)); } +namespace mermaid { +auto IsClass(std::string const &str, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return ContainsMatcher(CasedString("class " + str, caseSensitivity)); +} +} + ContainsMatcher IsUnion(std::string const &str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { @@ -314,6 +515,16 @@ ContainsMatcher IsUnion(std::string const &str, CasedString("class " + str + " <>", caseSensitivity)); } +namespace mermaid { +auto IsUnion(std::string const &alias, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return Catch::Matchers::Matches( + std::string("class ") + alias + " \\{\\n\\s+<>", + caseSensitivity); +} +} + ContainsMatcher IsClassTemplate(std::string const &str, std::string const &tmplt, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) @@ -329,18 +540,48 @@ ContainsMatcher IsConcept(std::string const &str, CasedString("class " + str + " <>", caseSensitivity)); } +namespace mermaid { +auto IsConcept(std::string const &alias, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return Catch::Matchers::Matches( + std::string("class ") + alias + " \\{\\n\\s+<>", + caseSensitivity); +} +} + ContainsMatcher IsEnum(std::string const &str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { return ContainsMatcher(CasedString("enum " + str, caseSensitivity)); } +namespace mermaid { +auto IsEnum(std::string const &alias, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return Catch::Matchers::Matches( + std::string("class ") + alias + " \\{\\n\\s+<>", + caseSensitivity); +} +} + ContainsMatcher IsAbstractClass(std::string const &str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { return ContainsMatcher(CasedString("abstract " + str, caseSensitivity)); } +namespace mermaid { +auto IsAbstractClass(std::string const &alias, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return Catch::Matchers::Matches( + std::string("class ") + alias + " \\{\\n\\s+<>", + caseSensitivity); +} +} + ContainsMatcher IsAbstractClassTemplate(std::string const &str, std::string const &tmplt, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) @@ -355,6 +596,14 @@ ContainsMatcher IsBaseClass(std::string const &base, std::string const &sub, return ContainsMatcher(CasedString(base + " <|-- " + sub, caseSensitivity)); } +namespace mermaid { +ContainsMatcher IsBaseClass(std::string const &base, std::string const &sub, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return ContainsMatcher(CasedString(base + " <|-- " + sub, caseSensitivity)); +} +} + ContainsMatcher IsInnerClass(std::string const &parent, std::string const &inner, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) @@ -363,6 +612,16 @@ ContainsMatcher IsInnerClass(std::string const &parent, CasedString(inner + " --+ " + parent, caseSensitivity)); } +namespace mermaid { +ContainsMatcher IsInnerClass(std::string const &parent, + std::string const &inner, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return ContainsMatcher( + CasedString(parent + " ()-- " + inner + " : ", caseSensitivity)); +} +} + ContainsMatcher IsAssociation(std::string const &from, std::string const &to, std::string const &label = "", std::string multiplicity_source = "", std::string multiplicity_dest = "", @@ -474,6 +733,23 @@ ContainsMatcher IsDependency(std::string const &from, std::string const &to, CasedString(fmt::format("{} ..> {}", from, to), caseSensitivity)); } +namespace mermaid { +ContainsMatcher IsPackageDependency(std::string const &from, + std::string const &to, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return ContainsMatcher( + CasedString(fmt::format("{} -.-> {}", from, to), caseSensitivity)); +} +ContainsMatcher IsIncludeDependency(std::string const &from, + std::string const &to, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return ContainsMatcher( + CasedString(fmt::format("{} -.-> {}", from, to), caseSensitivity)); +} +} + ContainsMatcher IsConstraint(std::string const &from, std::string const &to, std::string const &label = {}, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) @@ -493,6 +769,43 @@ ContainsMatcher IsConceptRequirement(std::string const &cpt, return ContainsMatcher(CasedString(requirement, caseSensitivity)); } +namespace mermaid { +ContainsMatcher IsConstraint(std::string const &from, std::string const &to, + std::string label = {}, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + util::replace_all(label, "<", "<"); + util::replace_all(label, ">", ">"); + util::replace_all(label, "(", "("); + util::replace_all(label, ")", ")"); + util::replace_all(label, "##", "::"); + util::replace_all(label, "{", "{"); + util::replace_all(label, "}", "}"); + + if (label.empty()) + return ContainsMatcher( + CasedString(fmt::format("{} ..> {}", from, to), caseSensitivity)); + else + return ContainsMatcher(CasedString( + fmt::format("{} ..> {} : {}", from, to, label), caseSensitivity)); +} + +ContainsMatcher IsConceptRequirement(std::string const &cpt, + std::string requirement, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + util::replace_all(requirement, "<", "<"); + util::replace_all(requirement, ">", ">"); + util::replace_all(requirement, "(", "("); + util::replace_all(requirement, ")", ")"); + util::replace_all(requirement, "##", "::"); + util::replace_all(requirement, "{", "{"); + util::replace_all(requirement, "}", "}"); + + return ContainsMatcher(CasedString(requirement, caseSensitivity)); +} +} + ContainsMatcher IsLayoutHint(std::string const &from, std::string const &hint, std::string const &to, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) @@ -508,6 +821,15 @@ ContainsMatcher HasComment(std::string const &comment, CasedString(fmt::format("' {}", comment), caseSensitivity)); } +namespace mermaid { +ContainsMatcher HasComment(std::string const &comment, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return ContainsMatcher( + CasedString(fmt::format("%% {}", comment), caseSensitivity)); +} +} + ContainsMatcher HasNote(std::string const &cls, std::string const &position, std::string const ¬e = "", CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) @@ -516,6 +838,23 @@ ContainsMatcher HasNote(std::string const &cls, std::string const &position, fmt::format("note {} of {}", position, cls), caseSensitivity)); } +namespace mermaid { +ContainsMatcher HasNote(std::string const &cls, + std::string const &position = "", std::string const ¬e = "", + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return ContainsMatcher( + CasedString(fmt::format("note for {}", cls), caseSensitivity)); +} +ContainsMatcher HasPackageNote(std::string const &cls, + std::string const &position = "", std::string const ¬e = "", + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return ContainsMatcher( + CasedString(fmt::format("-.- {}", cls), caseSensitivity)); +} +} + ContainsMatcher HasMemberNote(std::string const &cls, std::string const &member, std::string const &position, std::string const ¬e = "", CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) @@ -533,6 +872,17 @@ ContainsMatcher HasLink(std::string const &alias, std::string const &link, fmt::format("{} [[{}{{{}}}]]", alias, link, tooltip), caseSensitivity)); } +namespace mermaid { +ContainsMatcher HasLink(std::string const &alias, std::string const &link, + std::string const &tooltip, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return ContainsMatcher(CasedString( + fmt::format("click {} href \"{}\" \"{}\"", alias, link, tooltip), + caseSensitivity)); +} +} + ContainsMatcher HasMemberLink(std::string const &method, std::string const &link, std::string const &tooltip, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) @@ -588,6 +938,61 @@ ContainsMatcher IsMethod(std::string const &name, return ContainsMatcher(CasedString(pattern, caseSensitivity)); } +namespace mermaid { +template +ContainsMatcher IsMethod(std::string const &name, std::string type = "void", + std::string const ¶ms = "", + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + std::string pattern; + + if constexpr (has_type()) + pattern = "+"; + else if constexpr (has_type()) + pattern = "#"; + else + pattern = "-"; + + pattern += name; + + pattern += "(" + params + ")"; + + std::vector method_mods; + if constexpr (has_type()) + method_mods.push_back("default"); + if constexpr (has_type()) + method_mods.push_back("const"); + if constexpr (has_type()) + method_mods.push_back("constexpr"); + if constexpr (has_type()) + method_mods.push_back("consteval"); + + pattern += " : "; + + if (!method_mods.empty()) { + pattern += fmt::format("[{}] ", fmt::join(method_mods, ",")); + } + + util::replace_all(type, "<", "<"); + util::replace_all(type, ">", ">"); + util::replace_all(type, "(", "("); + util::replace_all(type, ")", ")"); + util::replace_all(type, "##", "::"); + util::replace_all(type, "{", "{"); + util::replace_all(type, "}", "}"); + + pattern += type; + + if constexpr (has_type()) + pattern += "*"; + + if constexpr (has_type()) + pattern += "$"; + + return ContainsMatcher(CasedString(pattern, caseSensitivity)); +} +} + template ContainsMatcher IsField(std::string const &name, std::string const &type = "void", @@ -610,6 +1015,37 @@ ContainsMatcher IsField(std::string const &name, CasedString(pattern + " : " + type, caseSensitivity)); } +namespace mermaid { +template +ContainsMatcher IsField(std::string const &name, std::string type = "void", + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + std::string pattern; + if constexpr (has_type()) + pattern += "{static} "; + + if constexpr (has_type()) + pattern = "+"; + else if constexpr (has_type()) + pattern = "#"; + else + pattern = "-"; + + pattern += name; + + util::replace_all(type, "<", "<"); + util::replace_all(type, ">", ">"); + util::replace_all(type, "(", "("); + util::replace_all(type, ")", ")"); + util::replace_all(type, "##", "::"); + util::replace_all(type, "{", "{"); + util::replace_all(type, "}", "}"); + + return ContainsMatcher( + CasedString(pattern + " : " + type, caseSensitivity)); +} +} + template ContainsMatcher IsFriend(std::string const &from, std::string const &to, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) @@ -628,6 +1064,26 @@ ContainsMatcher IsFriend(std::string const &from, std::string const &to, caseSensitivity)); } +namespace mermaid { +template +ContainsMatcher IsFriend(std::string const &from, std::string const &to, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + std::string pattern; + + if constexpr (has_type()) + pattern = "+"; + else if constexpr (has_type()) + pattern = "#"; + else + pattern = "-"; + + return ContainsMatcher( + CasedString(fmt::format("{} <.. {} : {}[friend]", from, to, pattern), + caseSensitivity)); +} +} + ContainsMatcher IsPackage(std::string const &str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { @@ -635,6 +1091,14 @@ ContainsMatcher IsPackage(std::string const &str, CasedString("package [" + str + "]", caseSensitivity)); } +namespace mermaid { +ContainsMatcher IsPackage(std::string const &str, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return ContainsMatcher(CasedString("subgraph " + str, caseSensitivity)); +} +} + ContainsMatcher IsFolder(std::string const &str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { @@ -649,6 +1113,20 @@ ContainsMatcher IsFile(std::string const &str, CasedString("file \"" + str + "\"", caseSensitivity)); } +namespace mermaid { +ContainsMatcher IsFolder(std::string const &str, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return ContainsMatcher(CasedString("subgraph " + str, caseSensitivity)); +} + +ContainsMatcher IsFile(std::string const &str, + CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) +{ + return ContainsMatcher(CasedString(str + "[", caseSensitivity)); +} +} + ContainsMatcher IsDeprecated(std::string const &str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes) { diff --git a/uml/include/include.yml b/uml/include/include.yml index 22efca35..419a8691 100644 --- a/uml/include/include.yml +++ b/uml/include/include.yml @@ -1,6 +1,6 @@ type: include glob: - - src/**/*.cc + - src/config/*.cc relative_to: . include: paths: diff --git a/util/format_svg.py b/util/format_svg.py index 32904cea..9ef13f19 100755 --- a/util/format_svg.py +++ b/util/format_svg.py @@ -36,11 +36,16 @@ def main(argv): # Parse SVG XML tree = etree.fromstring(bytes(xml, encoding='utf8')) + if not tree.attrib['width'] or tree.attrib['width'].endswith('%'): + # Make sure the width is equal to the viewBox width + tree.attrib['width'] = tree.attrib['viewBox'].split(' ')[2] + # Add style color for links - defs = tree.xpath('//svg:defs', namespaces={'svg':'http://www.w3.org/2000/svg'})[0] - style = etree.SubElement(defs, 'style') - style.text = 'a:hover { text-decoration: underline; }' - style.set('type', 'text/css') + defs = tree.xpath('//svg:defs', namespaces={'svg':'http://www.w3.org/2000/svg'}) + if defs: + style = etree.SubElement(defs[0], 'style') + style.text = 'a:hover { text-decoration: underline; }' + style.set('type', 'text/css') # Remove comments from SVG, to minimize diff # when updating diagrams in Git diff --git a/util/generate_mermaid.py b/util/generate_mermaid.py new file mode 100644 index 00000000..b85cfc94 --- /dev/null +++ b/util/generate_mermaid.py @@ -0,0 +1,59 @@ +#!/usr/bin/python3 + +## +## util/validate_json.py +## +## Copyright (c) 2021-2023 Bartek Kryza +## +## 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. +## +import sys +import subprocess + +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path + +def print_usage(): + print(f'Usage: ./generate_mermaid.py file1.mmd file2.mmd ...') + + +def generate_mermaid_diagram(f): + try: + print(f'Generating Mermaid diagram from {f}') + f_svg = Path(f).with_suffix('.svg').name + target = Path(f).parent.absolute() + target = target.joinpath('mermaid') + target = target.joinpath(f_svg) + subprocess.check_call(['mmdc', '-i', f, '-o', target]) + except subprocess.CalledProcessError: + print(f'ERROR: Generating Mermaid diagram from {f} failed') + return False + + return True + + +files = sys.argv[1:] + + +if not files: + print_usage() + sys.exit(1) + +ok = 0 + + +with ThreadPoolExecutor(max_workers=16) as executor: + result = all(executor.map(generate_mermaid_diagram, files)) + + +sys.exit(ok) diff --git a/util/generate_test_cases_docs.py b/util/generate_test_cases_docs.py index ea6018d1..9504a0f9 100755 --- a/util/generate_test_cases_docs.py +++ b/util/generate_test_cases_docs.py @@ -69,16 +69,23 @@ with open(r'tests/test_cases.yaml') as f: # Copy and link the diagram image config_dict = yaml.full_load(config) - tc.write("## Generated UML diagrams\n") + tc.write("## Generated PlantUML diagrams\n") for diagram_name, _ in config_dict['diagrams'].items(): - copyfile(f'debug/tests/puml/{diagram_name}.svg', + copyfile(f'debug/tests/diagrams/plantuml/{diagram_name}.svg', f'docs/test_cases/{diagram_name}.svg') tc.write(f'![{diagram_name}](./{diagram_name}.svg "{test_case["title"]}")\n') + tc.write("## Generated Mermaid diagrams\n") + for diagram_name, _ in config_dict['diagrams'].items(): + copyfile(f'debug/tests/diagrams/mermaid/{diagram_name}.svg', + f'docs/test_cases/{diagram_name}_mermaid.svg') + tc.write(f'![{diagram_name}](./{diagram_name}_mermaid.svg "{test_case["title"]}")\n') + tc.write("## Generated JSON models\n") for diagram_name, _ in config_dict['diagrams'].items(): - if os.path.exists(f'debug/tests/puml/{diagram_name}.json'): - with open(f'debug/tests/puml/{diagram_name}.json') as f: + jd = f'debug/tests/diagrams/{diagram_name}.json' + if os.path.exists(jd): + with open(jd) as f: contents = f.read() tc.write("```json\n") tc.write(contents) diff --git a/util/templates/test_cases/.clang-uml b/util/templates/test_cases/.clang-uml index 63e89fab..8864bbd0 100644 --- a/util/templates/test_cases/.clang-uml +++ b/util/templates/test_cases/.clang-uml @@ -1,5 +1,5 @@ compilation_database_dir: .. -output_directory: puml +output_directory: diagrams diagrams: {{ name }}_{{ type }}: type: {{ type }} diff --git a/util/templates/test_cases/test_case.h b/util/templates/test_cases/test_case.h index 9289b364..5aba84d9 100644 --- a/util/templates/test_cases/test_case.h +++ b/util/templates/test_cases/test_case.h @@ -38,7 +38,7 @@ TEST_CASE("{{ name }}", "[test-case][{{ type }}]") {{ examples }} save_puml( - config.output_directory() + "/" + diagram->name + ".puml", puml); + config.output_directory(), diagram->name + ".puml", puml); } { @@ -46,7 +46,7 @@ TEST_CASE("{{ name }}", "[test-case][{{ type }}]") using namespace json; - save_json(config.output_directory() + "/" + diagram->name + ".json", j); + save_json(config.output_directory(), diagram->name + ".json", j); } } diff --git a/util/validate_json.py b/util/validate_json.py new file mode 100644 index 00000000..2ff691a6 --- /dev/null +++ b/util/validate_json.py @@ -0,0 +1,46 @@ +#!/usr/bin/python3 + +## +## util/validate_json.py +## +## Copyright (c) 2021-2023 Bartek Kryza +## +## 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. +## +import sys +import json + + +def print_usage(): + print(f'Usage: ./validate_json.py file1.json file2.json ...') + + +files = sys.argv[1:] + + +if not files: + print_usage() + sys.exit(1) + +ok = 0 + +for f in files: + with open(f, 'r') as file: + try: + json.load(file) + print(f'File {f} is valid') + except ValueError: + ok = 1 + print(f'File {f} is invalid') + +sys.exit(ok) \ No newline at end of file