Skip to content

Commit

Permalink
Format all C++ files. (#9)
Browse files Browse the repository at this point in the history
Co-authored-by: Marc-Antoine Maheux <[email protected]>
  • Loading branch information
doumdi and mamaheux authored Mar 16, 2022
1 parent fb74f2e commit 0c498f2
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 26 deletions.
91 changes: 91 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# LLVM 12
---
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: AcrossComments
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros: []
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: After
BreakBeforeBraces: Allman
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 120
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: false
UseCRLF: false
DerivePointerAlignment: false
EmptyLineBeforeAccessModifier: LogicalBlock
FixNamespaceComments: false
ForEachMacros: []
IncludeBlocks: Preserve
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: NoIndent
IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: false
Language: Cpp
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
PointerAlignment: Left
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: Never
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++14
StatementAttributeLikeMacros: [emit]
StatementMacros: [Q_UNUSED, Q_OBJECT]
TabWidth: 4
UseCRLF: false
UseTab: Never
19 changes: 10 additions & 9 deletions firmware/firmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@
*/

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
void setup()
{
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
void loop()
{
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

2 changes: 1 addition & 1 deletion library/cppcount/cppcount/src/characters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ unordered_map<char, size_t> countCharactersIgnoreCase(const string& str)
{
unordered_map<char, size_t> counts;

for (auto& pair: countCharacters(str))
for (auto& pair : countCharacters(str))
{
counts[toupper(pair.first)] += pair.second;
}
Expand Down
18 changes: 2 additions & 16 deletions library/cppcount/cppcount/tests/src/charactersTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,15 @@ TEST(charactersTests, countCharacters)
{
unordered_map<char, size_t> counts = countCharacters("Bonjour Bob");
unordered_map<char, size_t> expected_counts(
{{'B', 2},
{'o', 3},
{'n', 1},
{'j', 1},
{'u', 1},
{'r', 1},
{' ', 1},
{'b', 1}});
{{'B', 2}, {'o', 3}, {'n', 1}, {'j', 1}, {'u', 1}, {'r', 1}, {' ', 1}, {'b', 1}});

EXPECT_TRUE(counts == expected_counts);
}

TEST(charactersTests, countCharactersIgnoreCase)
{
unordered_map<char, size_t> counts = countCharactersIgnoreCase("BonjOur BOb");
unordered_map<char, size_t> expected_counts(
{{'B', 3},
{'O', 3},
{'N', 1},
{'J', 1},
{'U', 1},
{'R', 1},
{' ', 1}});
unordered_map<char, size_t> expected_counts({{'B', 3}, {'O', 3}, {'N', 1}, {'J', 1}, {'U', 1}, {'R', 1}, {' ', 1}});

EXPECT_TRUE(counts == expected_counts);
}

0 comments on commit 0c498f2

Please sign in to comment.