Skip to content

Commit 56a3456

Browse files
committed
formatting
1 parent 93b68c3 commit 56a3456

File tree

3 files changed

+16
-22
lines changed

3 files changed

+16
-22
lines changed

include/maxplus/base/fsm/fsm.h

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,7 @@ class State : public WithUniqueID {
152152
}
153153

154154
// as a reference
155-
[[nodiscard]] virtual const StateRef getReference() const {
156-
return this;
157-
}
155+
[[nodiscard]] virtual const StateRef getReference() const { return this; }
158156

159157
void insertOutgoingEdge(Edge &e) { this->outgoingEdges.insert(&e); }
160158

@@ -215,7 +213,6 @@ class FiniteStateMachine {
215213
[[nodiscard]] virtual const SetOfStates &getStates() const = 0;
216214
};
217215

218-
219216
//
220217
// A generic DFS strategy on the target FSM
221218
// overwrite the methods onEnterState, onLeaveState, onTransition and onSimpleCycle with
@@ -339,9 +336,7 @@ class DetectCycle : public DepthFirstSearch {
339336
DetectCycle(DetectCycle &&) = delete;
340337
DetectCycle &operator=(DetectCycle &&) = delete;
341338

342-
bool checkForCycles() {
343-
return this->checkForCycles(nullptr);
344-
}
339+
bool checkForCycles() { return this->checkForCycles(nullptr); }
345340

346341
bool checkForCycles(ListOfStateRefs *cycle) {
347342
this->visitedStates.clear();
@@ -353,7 +348,9 @@ class DetectCycle : public DepthFirstSearch {
353348
if (this->hasCycle) {
354349
return true;
355350
}
356-
while (nextStartingState != states.end() && this->visitedStates.includesState((*nextStartingState).second->getReference())) {
351+
while (nextStartingState != states.end()
352+
&& this->visitedStates.includesState(
353+
(*nextStartingState).second->getReference())) {
357354
nextStartingState++;
358355
}
359356
}
@@ -364,9 +361,7 @@ class DetectCycle : public DepthFirstSearch {
364361
SetOfStateRefs visitedStates;
365362
ListOfStateRefs *cycle = nullptr;
366363

367-
void onEnterState(StateRef s) override {
368-
this->visitedStates.insert(s);
369-
}
364+
void onEnterState(StateRef s) override { this->visitedStates.insert(s); }
370365

371366
void onSimpleCycle(DfsStack &stack) override {
372367
if (!this->hasCycle) {

src/testbench/graph/mpautomatontest.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,8 @@ void MPAutomatonTest::testMinimizeFSM() {
118118

119119
fsa.setInitialState(*s0);
120120

121-
const auto fsaMin =
122-
std::dynamic_pointer_cast<FSM::Labeled::FiniteStateMachine<int, int>>(
123-
fsa.minimizeEdgeLabels());
121+
const auto fsaMin = std::dynamic_pointer_cast<FSM::Labeled::FiniteStateMachine<int, int>>(
122+
fsa.minimizeEdgeLabels());
124123

125124
std::cout << "Nr states: " << fsaMin->getStates().size() << std::endl;
126125
std::cout << "Nr edges: " << fsaMin->getEdges().size() << std::endl;
@@ -150,7 +149,7 @@ void MPAutomatonTest::testDetectCycleFSM() {
150149
FSM::Abstract::DetectCycle DC(fsa);
151150
bool hasCycle = DC.checkForCycles();
152151

153-
ASSERT(! hasCycle);
152+
ASSERT(!hasCycle);
154153
}
155154

156155
{

src/testbench/graph/testing.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ namespace testing {
1212
} \
1313
}
1414

15-
#define ASSERT(x) \
15+
#define ASSERT(x) \
1616
{ \
17-
if (!(x)) { \
18-
throw std::runtime_error( \
19-
std::string("Assert condition violated.") + std::string("\nIn:") \
20-
+ std::string(__FILE__) + std::string(":") + std::to_string(__LINE__) \
21-
+ std::string(" in ") + std::string(__FUNCTION__) + std::string(": ") \
22-
+ std::to_string((x))); \
17+
if (!(x)) { \
18+
throw std::runtime_error(std::string("Assert condition violated.") \
19+
+ std::string("\nIn:") + std::string(__FILE__) \
20+
+ std::string(":") + std::to_string(__LINE__) \
21+
+ std::string(" in ") + std::string(__FUNCTION__) \
22+
+ std::string(": ") + std::to_string((x))); \
2323
} \
2424
}
2525

0 commit comments

Comments
 (0)