# t40002 - Cyclic include graph diagram test case
## Config
```yaml
diagrams:
  t40002_include:
    type: include
    # Provide the files to parse in order to look
    # for #include directives
    glob:
      - src/t40002.cc
      - src/lib1/lib1.cc
      - src/lib2/lib2.cc
    include:
      # Include only files belonging to these paths relative to relative_to
      paths:
        - .
    exclude:
      paths:
        # Exclude single header relative to relative_to
        - include/lib2/lib2_detail.h
    plantuml:
      before:
        - "' t40002 test include diagram"
```
## Source code
File `tests/t40002/src/t40002.cc`
```cpp
#include "../include/lib1/lib1.h"
#include "../include/lib2/lib2.h"

namespace clanguml::t40002 {

int foo() { return lib1::foo() + lib2::foo(); }

}
```
File `tests/t40002/src/lib1/lib1.cc`
```cpp
#include "../../include/lib1/lib1.h"

#include <string>

namespace clanguml::t40002::lib1 {

int foo0() { return 0; }

int foo1() { return 1; }

int foo() { return foo1(); }

}
```
File `tests/t40002/src/lib2/lib2.cc`
```cpp
#include "../../include/lib2/lib2.h"
#include "../../include/lib2/lib2_detail.h"

namespace clanguml::t40002::lib2 {

int foo0() { return 0; }

int foo1() { return 1; }

int foo() { return foo1(); }

int foo22() { return 22; }

} // namespace clanguml::t40002::lib2
```
File `tests/t40002/include/lib1/lib1.h`
```cpp
#pragma once

#include "../lib2/lib2.h"

#include <string>

namespace clanguml::t40002::lib1 {

int foo0();

int foo1();

int foo();

}
```
File `tests/t40002/include/lib2/lib2_detail.h`
```cpp
#pragma once

namespace clanguml::t40002::lib2::detail {

int foo22();

}
```
File `tests/t40002/include/lib2/lib2.h`
```cpp
#pragma once

#include "lib2_detail.h"

namespace clanguml::t40002::lib2 {

int foo2();

int foo3();

int foo();

}
```
## 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
{
  "diagram_type": "include",
  "elements": [
    {
      "display_name": "src",
      "elements": [
        {
          "display_name": "src/t40002.cc",
          "file_kind": "implementation",
          "id": "11915602319277933652",
          "name": "t40002.cc",
          "type": "file"
        },
        {
          "display_name": "src/lib1",
          "elements": [
            {
              "display_name": "src/lib1/lib1.cc",
              "file_kind": "implementation",
              "id": "11951305658985723216",
              "name": "lib1.cc",
              "type": "file"
            }
          ],
          "id": "10277941644399287283",
          "name": "lib1",
          "type": "folder"
        },
        {
          "display_name": "src/lib2",
          "elements": [
            {
              "display_name": "src/lib2/lib2.cc",
              "file_kind": "implementation",
              "id": "14095000166128931568",
              "name": "lib2.cc",
              "type": "file"
            }
          ],
          "id": "11177797676640886425",
          "name": "lib2",
          "type": "folder"
        }
      ],
      "id": "11100957978370531577",
      "name": "src",
      "type": "folder"
    },
    {
      "display_name": "include",
      "elements": [
        {
          "display_name": "include/lib1",
          "elements": [
            {
              "display_name": "include/lib1/lib1.h",
              "file_kind": "header",
              "id": "17548393712337957522",
              "is_system": false,
              "name": "lib1.h",
              "type": "file"
            }
          ],
          "id": "13501402687592147456",
          "name": "lib1",
          "type": "folder"
        },
        {
          "display_name": "include/lib2",
          "elements": [
            {
              "display_name": "include/lib2/lib2.h",
              "file_kind": "header",
              "id": "15757398685574731504",
              "is_system": false,
              "name": "lib2.h",
              "type": "file"
            }
          ],
          "id": "9988244964011575444",
          "name": "lib2",
          "type": "folder"
        }
      ],
      "id": "7915299339925655008",
      "name": "include",
      "type": "folder"
    }
  ],
  "name": "t40002_include",
  "relationships": [
    {
      "destination": "17548393712337957522",
      "source": "11915602319277933652",
      "type": "association"
    },
    {
      "destination": "15757398685574731504",
      "source": "11915602319277933652",
      "type": "association"
    },
    {
      "destination": "17548393712337957522",
      "source": "11951305658985723216",
      "type": "association"
    },
    {
      "destination": "15757398685574731504",
      "source": "14095000166128931568",
      "type": "association"
    },
    {
      "destination": "15757398685574731504",
      "source": "17548393712337957522",
      "type": "association"
    }
  ]
}
```
