// RUN: rm -rf %t && mkdir -p %t/docs %t/build
// RUN: sed 's|$test_dir|%/S|g' %S/Inputs/basic-project/database_template.json > %t/build/compile_commands.json
// RUN: clang-doc --format=html --output=%t/docs --executor=all-TUs %t/build/compile_commands.json
// RUN: FileCheck %s -input-file=%t/docs/index_json.js -check-prefix=JSON-INDEX
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Shape.html -check-prefix=HTML-SHAPE
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Calculator.html -check-prefix=HTML-CALC
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Rectangle.html -check-prefix=HTML-RECTANGLE
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Circle.html -check-prefix=HTML-CIRCLE
// JSON-INDEX: async function LoadIndex() {
// JSON-INDEX-NEXT: return{
// JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
// JSON-INDEX-NEXT: "Name": "",
// JSON-INDEX-NEXT: "RefType": "default",
// JSON-INDEX-NEXT: "Path": "",
// JSON-INDEX-NEXT: "Children": [
// JSON-INDEX-NEXT: {
// JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
// JSON-INDEX-NEXT: "Name": "GlobalNamespace",
// JSON-INDEX-NEXT: "RefType": "namespace",
// JSON-INDEX-NEXT: "Path": "GlobalNamespace",
// JSON-INDEX-NEXT: "Children": [
// JSON-INDEX-NEXT: {
// JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
// JSON-INDEX-NEXT: "Name": "Calculator",
// JSON-INDEX-NEXT: "RefType": "record",
// JSON-INDEX-NEXT: "Path": "GlobalNamespace",
// JSON-INDEX-NEXT: "Children": []
// JSON-INDEX-NEXT: },
// JSON-INDEX-NEXT: {
// JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
// JSON-INDEX-NEXT: "Name": "Circle",
// JSON-INDEX-NEXT: "RefType": "record",
// JSON-INDEX-NEXT: "Path": "GlobalNamespace",
// JSON-INDEX-NEXT: "Children": []
// JSON-INDEX-NEXT: },
// JSON-INDEX-NEXT: {
// JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
// JSON-INDEX-NEXT: "Name": "Rectangle",
// JSON-INDEX-NEXT: "RefType": "record",
// JSON-INDEX-NEXT: "Path": "GlobalNamespace",
// JSON-INDEX-NEXT: "Children": []
// JSON-INDEX-NEXT: },
// JSON-INDEX-NEXT: {
// JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}",
// JSON-INDEX-NEXT: "Name": "Shape",
// JSON-INDEX-NEXT: "RefType": "record",
// JSON-INDEX-NEXT: "Path": "GlobalNamespace",
// JSON-INDEX-NEXT: "Children": []
// JSON-INDEX-NEXT: }
// JSON-INDEX-NEXT: ]
// JSON-INDEX-NEXT: }
// JSON-INDEX-NEXT: ]
// JSON-INDEX-NEXT: };
// JSON-INDEX-NEXT: }
// HTML-SHAPE: <h1>class Shape</h1>
// HTML-SHAPE: <p>Defined at line 8 of file {{.*}}Shape.h</p>
// HTML-SHAPE: <div>brief</div>
// HTML-SHAPE: <p> Abstract base class for shapes.</p>
// HTML-SHAPE: <p> Provides a common interface for different types of shapes.</p>
// HTML-SHAPE: <h2 id="Functions">Functions</h2>
// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
// HTML-SHAPE: <p>public double area()</p>
// HTML-SHAPE: <div>brief</div>
// HTML-SHAPE: <p> Calculates the area of the shape.</p>
// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
// HTML-SHAPE: <p>public double perimeter()</p>
// HTML-SHAPE: <div>brief</div>
// HTML-SHAPE: <p> Calculates the perimeter of the shape.</p>
// HTML-SHAPE: <div>return</div>
// HTML-SHAPE: <p> double The perimeter of the shape.</p>
// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">~Shape</h3>
// HTML-SHAPE: <p>public void ~Shape()</p>
// HTML-SHAPE: <p>Defined at line 13 of file {{.*}}Shape.h</p>
// HTML-SHAPE: <div>brief</div>
// HTML-SHAPE: <p> Virtual destructor.</p>
// HTML-CALC: <h1>class Calculator</h1>
// HTML-CALC: <p>Defined at line 8 of file {{.*}}Calculator.h</p>
// HTML-CALC: <div>brief</div>
// HTML-CALC: <p> A simple calculator class.</p>
// HTML-CALC: <p> Provides basic arithmetic operations.</p>
// HTML-CALC: <h2 id="Functions">Functions</h2>
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">add</h3>
// HTML-CALC: <p>public int add(int a, int b)</p>
// HTML-CALC: <p>Defined at line 3 of file {{.*}}Calculator.cpp</p>
// HTML-CALC: <div>brief</div>
// HTML-CALC: <p> Adds two integers.</p>
// HTML-CALC: <div>return</div>
// HTML-CALC: <p> int The sum of a and b.</p>
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">subtract</h3>
// HTML-CALC: <p>public int subtract(int a, int b)</p>
// HTML-CALC: <p>Defined at line 7 of file {{.*}}Calculator.cpp</p>
// HTML-CALC: <div>brief</div>
// HTML-CALC: <p> Subtracts the second integer from the first.</p>
// HTML-CALC: <div>return</div>
// HTML-CALC: <p> int The result of a - b.</p>
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">multiply</h3>
// HTML-CALC: <p>public int multiply(int a, int b)</p>
// HTML-CALC: <p>Defined at line 11 of file {{.*}}Calculator.cpp</p>
// HTML-CALC: <div>brief</div>
// HTML-CALC: <p> Multiplies two integers.</p>
// HTML-CALC: <div>return</div>
// HTML-CALC: <p> int The product of a and b.</p>
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">divide</h3>
// HTML-CALC: <p>public double divide(int a, int b)</p>
// HTML-CALC: <p>Defined at line 15 of file {{.*}}Calculator.cpp</p>
// HTML-CALC: <div>brief</div>
// HTML-CALC: <p> Divides the first integer by the second.</p>
// HTML-CALC: <div>return</div>
// HTML-CALC: <p> double The result of a / b.</p>
// HTML-CALC: <div>throw</div>
// HTML-CALC: <p>if b is zero.</p>
// HTML-RECTANGLE: <h1>class Rectangle</h1>
// HTML-RECTANGLE: <p>Defined at line 10 of file {{.*}}Rectangle.h</p>
// HTML-RECTANGLE: <p> Represents a rectangle with a given width and height.</p
// HTML-RECTANGLE: <p>
// HTML-RECTANGLE: Inherits from
// HTML-RECTANGLE: <a href="Shape.html">Shape</a>
// HTML-RECTANGLE: </p>
// HTML-RECTANGLE: <h2 id="Members">Members</h2>
// HTML-RECTANGLE: <p> Width of the rectangle.</p>
// HTML-RECTANGLE: <div>private double width_</div>
// HTML-RECTANGLE: <p> Height of the rectangle.</p>
// HTML-RECTANGLE: <div>private double height_</div>
// HTML-RECTANGLE: <h2 id="Functions">Functions</h2>
// HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">Rectangle</h3>
// HTML-RECTANGLE: <p>public void Rectangle(double width, double height)</p>
// HTML-RECTANGLE: <p>Defined at line 3 of file {{.*}}Rectangle.cpp</p>
// HTML-RECTANGLE: <div>brief</div>
// HTML-RECTANGLE: <p> Constructs a new Rectangle object.</p>
// HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
// HTML-RECTANGLE: <p>public double area()</p>
// HTML-RECTANGLE: <p>Defined at line 6 of file {{.*}}Rectangle.cpp</p>
// HTML-RECTANGLE: <div>brief</div>
// HTML-RECTANGLE: <p> Calculates the area of the rectangle.</p>
// HTML-RECTANGLE: <div>return</div>
// HTML-RECTANGLE: <p> double The area of the rectangle.</p>
// HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
// HTML-RECTANGLE: <p>public double perimeter()</p>
// HTML-RECTANGLE: <p>Defined at line 10 of file {{.*}}Rectangle.cpp</p>
// HTML-RECTANGLE: <div>brief</div>
// HTML-RECTANGLE: <p> Calculates the perimeter of the rectangle.</p>
// HTML-RECTANGLE: <div>return</div>
// HTML-RECTANGLE: <p> double The perimeter of the rectangle.</p>
// HTML-CIRCLE: <h1>class Circle</h1>
// HTML-CIRCLE: <p>Defined at line 10 of file {{.*}}Circle.h</p>
// HTML-CIRCLE: <div>brief</div>
// HTML-CIRCLE: <p> Circle class derived from Shape.</p>
// HTML-CIRCLE: <p> Represents a circle with a given radius.</p>
// HTML-CIRCLE: <p>
// HTML-CIRCLE: Inherits from
// HTML-CIRCLE: <a href="Shape.html">Shape</a>
// HTML-CIRCLE: </p>
// HTML-CIRCLE: <h2 id="Members">Members</h2>
// HTML-CIRCLE: <p> Radius of the circle.</p>
// HTML-CIRCLE: <div>private double radius_</div>
// HTML-CIRCLE: <h2 id="Functions">Functions</h2>
// HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">Circle</h3>
// HTML-CIRCLE: <p>public void Circle(double radius)</p>
// HTML-CIRCLE: <p>Defined at line 3 of file {{.*}}Circle.cpp</p>
// HTML-CIRCLE: <div>brief</div>
// HTML-CIRCLE: <p> Constructs a new Circle object.</p>
// HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
// HTML-CIRCLE: <p>public double area()</p>
// HTML-CIRCLE: <p>Defined at line 5 of file {{.*}}Circle.cpp</p>
// HTML-CIRCLE: <div>brief</div>
// HTML-CIRCLE: <p> Calculates the area of the circle.</p>
// HTML-CIRCLE: <div>return</div>
// HTML-CIRCLE: <p> double The area of the circle.</p>
// HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
// HTML-CIRCLE: <p>public double perimeter()</p>
// HTML-CIRCLE: <p>Defined at line 9 of file {{.*}}Circle.cpp</p>
// HTML-CIRCLE: <div>brief</div>
// HTML-CIRCLE: <p> Calculates the perimeter of the circle.</p>
// HTML-CIRCLE: <div>return</div>
// HTML-CIRCLE: <p> double The perimeter of the circle.</p>
// MD-CALC: # class Calculator
// MD-CALC: *Defined at .{{[\/]}}include{{[\/]}}Calculator.h#8*
// MD-CALC: **brief** A simple calculator class.
// MD-CALC: Provides basic arithmetic operations.
// MD-CALC: ## Functions
// MD-CALC: ### add
// MD-CALC: *public int add(int a, int b)*
// MD-CALC: *Defined at .{{[\/]}}src{{[\/]}}Calculator.cpp#3*
// MD-CALC: **brief** Adds two integers.
// MD-CALC: **a** First integer.
// MD-CALC: **b** Second integer.
// MD-CALC: **return** int The sum of a and b.
// MD-CALC: ### subtract
// MD-CALC: *public int subtract(int a, int b)*
// MD-CALC: *Defined at .{{[\/]}}src{{[\/]}}Calculator.cpp#7*
// MD-CALC: **brief** Subtracts the second integer from the first.
// MD-CALC: **a** First integer.
// MD-CALC: **b** Second integer.
// MD-CALC: **return** int The result of a - b.
// MD-CALC: ### multiply
// MD-CALC: *public int multiply(int a, int b)*
// MD-CALC: *Defined at .{{[\/]}}src{{[\/]}}Calculator.cpp#11*
// MD-CALC: **brief** Multiplies two integers.
// MD-CALC: **a** First integer.
// MD-CALC: **b** Second integer.
// MD-CALC: **return** int The product of a and b.
// MD-CALC: ### divide
// MD-CALC: *public double divide(int a, int b)*
// MD-CALC: *Defined at .{{[\/]}}src{{[\/]}}Calculator.cpp#15*
// MD-CALC: **brief** Divides the first integer by the second.
// MD-CALC: **a** First integer.
// MD-CALC: **b** Second integer.
// MD-CALC: **return** double The result of a / b.
// MD-CALC: **throw**if b is zero.
// MD-CIRCLE: # class Circle
// MD-CIRCLE: *Defined at .{{[\/]}}include{{[\/]}}Circle.h#10*
// MD-CIRCLE: **brief** Circle class derived from Shape.
// MD-CIRCLE: Represents a circle with a given radius.
// MD-CIRCLE: Inherits from Shape
// MD-CIRCLE: ## Members
// MD-CIRCLE: private double radius_
// MD-CIRCLE: ## Functions
// MD-CIRCLE: ### Circle
// MD-CIRCLE: *public void Circle(double radius)*
// MD-CIRCLE: *Defined at .{{[\/]}}src{{[\/]}}Circle.cpp#3*
// MD-CIRCLE: **brief** Constructs a new Circle object.
// MD-CIRCLE: **radius** Radius of the circle.
// MD-CIRCLE: ### area
// MD-CIRCLE: *public double area()*
// MD-CIRCLE: *Defined at .{{[\/]}}src{{[\/]}}Circle.cpp#5*
// MD-CIRCLE: **brief** Calculates the area of the circle.
// MD-CIRCLE: **return** double The area of the circle.
// MD-CIRCLE: ### perimeter
// MD-CIRCLE: *public double perimeter()*
// MD-CIRCLE: *Defined at .{{[\/]}}src{{[\/]}}Circle.cpp#9*
// MD-CIRCLE: **brief** Calculates the perimeter of the circle.
// MD-CIRCLE: **return** double The perimeter of the circle.
// MD-RECTANGLE: # class Rectangle
// MD-RECTANGLE: *Defined at .{{[\/]}}include{{[\/]}}Rectangle.h#10*
// MD-RECTANGLE: **brief** Rectangle class derived from Shape.
// MD-RECTANGLE: Represents a rectangle with a given width and height.
// MD-RECTANGLE: Inherits from Shape
// MD-RECTANGLE: ## Members
// MD-RECTANGLE: private double width_
// MD-RECTANGLE: private double height_
// MD-RECTANGLE: ## Functions
// MD-RECTANGLE: ### Rectangle
// MD-RECTANGLE: *public void Rectangle(double width, double height)*
// MD-RECTANGLE: *Defined at .{{[\/]}}src{{[\/]}}Rectangle.cpp#3*
// MD-RECTANGLE: **brief** Constructs a new Rectangle object.
// MD-RECTANGLE: **width** Width of the rectangle.
// MD-RECTANGLE: **height** Height of the rectangle.
// MD-RECTANGLE: ### area
// MD-RECTANGLE: *public double area()*
// MD-RECTANGLE: *Defined at .{{[\/]}}src{{[\/]}}Rectangle.cpp#6*
// MD-RECTANGLE: **brief** Calculates the area of the rectangle.
// MD-RECTANGLE: **return** double The area of the rectangle.
// MD-RECTANGLE: ### perimeter
// MD-RECTANGLE: *public double perimeter()*
// MD-RECTANGLE: *Defined at .{{[\/]}}src{{[\/]}}Rectangle.cpp#10*
// MD-RECTANGLE: **brief** Calculates the perimeter of the rectangle.
// MD-RECTANGLE: **return** double The perimeter of the rectangle.
// MD-SHAPE: # class Shape
// MD-SHAPE: *Defined at .{{[\/]}}include{{[\/]}}Shape.h#8*
// MD-SHAPE: **brief** Abstract base class for shapes.
// MD-SHAPE: Provides a common interface for different types of shapes.
// MD-SHAPE: ## Functions
// MD-SHAPE: ### ~Shape
// MD-SHAPE: *public void ~Shape()*
// MD-SHAPE: *Defined at .{{[\/]}}include{{[\/]}}Shape.h#13*
// MD-SHAPE: **brief** Virtual destructor.
// MD-SHAPE: ### area
// MD-SHAPE: *public double area()*
// MD-SHAPE: **brief** Calculates the area of the shape.
// MD-SHAPE: **return** double The area of the shape.
// MD-SHAPE: ### perimeter
// MD-SHAPE: *public double perimeter()*
// MD-SHAPE: **brief** Calculates the perimeter of the shape.
// MD-SHAPE: **return** double The perimeter of the shape.
// MD-ALL-FILES: # All Files
// MD-ALL-FILES: ## [GlobalNamespace](GlobalNamespace{{[\/]}}index.md)
// MD-INDEX: # C/C++ Reference
// MD-INDEX: * Namespace: [GlobalNamespace](GlobalNamespace)