Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,25 @@ class Calculator {
* @throw std::invalid_argument if b is zero.
*/
double divide(int a, int b);
};

/**
* @brief Performs the mod operation on integers.
*
* @param a First integer.
* @param b Second integer.
* @return The result of a % b.
*/
static int mod(int a, int b) {
return a % b;
}

/**
* @brief A static value.
*/
static constexpr int static_val = 10;

/**
* @brief Holds a public value.
*/
int public_val = -1;
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ int Calculator::multiply(int a, int b) {
double Calculator::divide(int a, int b) {
return static_cast<double>(a) / b;
}

27 changes: 27 additions & 0 deletions clang-tools-extra/test/clang-doc/basic-project.test
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@
// 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="Members">Members</h2>
// HTML-CALC: <div>brief</div>
// HTML-CALC: <p> Holds a public value.</p>
// HTML-CALC: <div>public int public_val</div>

// 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>
Expand Down Expand Up @@ -185,6 +191,18 @@
// HTML-CALC: <div>throw</div>
// HTML-CALC: <p>if b is zero.</p>

// HTML-CALC: <p>public int mod(int a, int b)</p>
// CALC-NO-REPOSITORY: Defined at line 54 of file .{{.}}include{{.}}Calculator.h
// CALC-REPOSITORY: Defined at line
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./include/Calculator.h#54">54</a>
// CALC-LINE-PREFIX: <a href="https://repository.com/./include/Calculator.h#L54">54</a>
// CALC-REPOSITORY-NEXT: of file
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./include/Calculator.h">Calculator.h</a>
// HTML-CALC: <div>brief</div>
// HTML-CALC: <p> Performs the mod operation on integers.</p>
// HTML-CALC: <div>return</div>
// HTML-CALC: <p> The result of a % b.</p>

// HTML-RECTANGLE: <h1>class Rectangle</h1>
// RECTANGLE-NO-REPOSITORY: <p>Defined at line 10 of file .{{.}}include{{.}}Rectangle.h</p>
// RECTANGLE-REPOSITORY: <p>
Expand Down Expand Up @@ -306,6 +324,8 @@
// MD-CALC: *Defined at .{{[\/]}}include{{[\/]}}Calculator.h#8*
// MD-CALC: **brief** A simple calculator class.
// MD-CALC: Provides basic arithmetic operations.
// MD-CALC: ## Members
// MD-CALC: public int public_val
// MD-CALC: ## Functions
// MD-CALC: ### add
// MD-CALC: *public int add(int a, int b)*
Expand Down Expand Up @@ -336,6 +356,13 @@
// MD-CALC: **b** Second integer.
// MD-CALC: **return** double The result of a / b.
// MD-CALC: **throw**if b is zero.
// MD-CALC: ### mod
// MD-CALC: *public int mod(int a, int b)*
// MD-CALC: *Defined at ./include{{[\/]}}Calculator.h#54*
// MD-CALC: **brief** Performs the mod operation on integers.
// MD-CALC: **a** First integer.
// MD-CALC: **b** Second integer.
// MD-CALC: **return** The result of a % b.

// MD-CIRCLE: # class Circle
// MD-CIRCLE: *Defined at .{{[\/]}}include{{[\/]}}Circle.h#10*
Expand Down
Loading