Skip to content

Commit

Permalink
refactor(assertion-tools): ♻️ Resolve linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
DRovara committed Nov 20, 2024
1 parent 9b11a3c commit f1286bf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/backend/dd/DDSimDiagnostics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <map>
#include <memory>
#include <set>
#include <utility>
#include <vector>

/**
Expand Down
3 changes: 2 additions & 1 deletion include/common/parsing/AssertionTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "CodePreprocessing.hpp"

#include <memory>
#include <string>

Check warning on line 7 in include/common/parsing/AssertionTools.hpp

View workflow job for this annotation

GitHub Actions / 🇨‌ Lint / 🚨 Lint

include/common/parsing/AssertionTools.hpp:7:1 [misc-include-cleaner]

included header string is not used directly

/**
* @brief Define a general commutation rule.
Expand Down Expand Up @@ -54,7 +55,7 @@
*
* Can be either `Commutes`, `DoesNotCommute`, or `Unknown`.
*/
enum class CommutationResult {
enum class CommutationResult : uint8_t {

Check warning on line 58 in include/common/parsing/AssertionTools.hpp

View workflow job for this annotation

GitHub Actions / 🇨‌ Lint / 🚨 Lint

include/common/parsing/AssertionTools.hpp:58:32 [misc-include-cleaner]

no header providing "uint8_t" is directly included
/**
* @brief Indicates that the instructions commute with certainty.
*/
Expand Down
15 changes: 14 additions & 1 deletion src/backend/dd/DDSimDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "common/parsing/CodePreprocessing.hpp"

#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstring>
Expand All @@ -24,6 +25,7 @@
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

Expand Down Expand Up @@ -606,6 +608,18 @@ size_t dddiagnosticsSuggestAssertionMovements(Diagnostics* self,
return max;
}

/**
* @brief Finds a unique path between two qubits in the given graph, if it
* exists.
*
* If no such path exists, returns an empty vector.
*
* @param graph The graph to search in as a set of triples (start, end,
* instruction).
* @param start The starting vertex.
* @param end The ending vertex.
* @return The unique path between the two vertices, if it exists.
*/
std::vector<std::tuple<size_t, size_t, size_t>>
findUniquePath(const std::set<std::tuple<size_t, size_t, size_t>>& graph,
size_t start, size_t end) {
Expand Down Expand Up @@ -885,7 +899,6 @@ size_t dddiagnosticsSuggestNewAssertions(Diagnostics* self,
const auto string =
assertionString.str().substr(0, assertionString.str().size() - 2) +
";\n";
std::cout << string;
strncpy(assertions[index], string.c_str(), string.length());
index++;
if (index == count) {
Expand Down

0 comments on commit f1286bf

Please sign in to comment.