Skip to content

Commit

Permalink
add/trim new lines
Browse files Browse the repository at this point in the history
  • Loading branch information
pjueon committed Jun 9, 2022
1 parent c60a153 commit e527a67
Show file tree
Hide file tree
Showing 28 changed files with 36 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ AccessModifierOffset: -4
ConstructorInitializerIndentWidth: 0
BreakConstructorInitializers: BeforeColon
ConstructorInitializerAllOnOneLineOrOnePerLine: true
NamespaceIndentation: All
NamespaceIndentation: All
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,8 @@
"stack": "cpp",
"random": "cpp"
},
"C_Cpp.clang_format_style": "file"
}
"C_Cpp.clang_format_style": "file",

"files.insertFinalNewline": true,
"files.trimFinalNewlines": true
}
1 change: 0 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,3 @@ COPY --from=builder /source/JetsonGPIO/build/install/ /usr/local/
# for debug
COPY --from=builder /source/JetsonGPIO/build/samples/ /samples
COPY --from=builder /source/JetsonGPIO/build/tests/ /tests

3 changes: 2 additions & 1 deletion include/private/DictionaryLike.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/

#pragma once
#ifndef DICTIONARY_LIKE_H
#define DICTIONARY_LIKE_H
Expand Down Expand Up @@ -49,4 +50,4 @@ namespace GPIO
};
} // namespace GPIO

#endif
#endif
2 changes: 1 addition & 1 deletion include/private/ExceptionHandling.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ namespace GPIO
std::runtime_error _error(const std::exception& e, const std::string& from);
} // namespace GPIO

#endif
#endif
1 change: 1 addition & 0 deletions include/private/MainModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/

#pragma once
#ifndef MAIN_MODULE_H
#define MAIN_MODULE_H
Expand Down
2 changes: 1 addition & 1 deletion include/private/Model.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ namespace GPIO
constexpr Model JETSON_ORIN = Model::JETSON_ORIN;
} // namespace GPIO

#endif
#endif
2 changes: 1 addition & 1 deletion include/private/ModelUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ namespace GPIO

} // namespace GPIO

#endif
#endif
2 changes: 1 addition & 1 deletion include/private/SysfsRoot.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ namespace GPIO
} // namespace GPIO

#undef _MACRO_SYSFS_ROOT
#endif
#endif
7 changes: 3 additions & 4 deletions include/private/TestUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@ DEALINGS IN THE SOFTWARE.
#define SIMPLE_UNIT_TEST_H

#include <functional>
#include <sstream>
#include <string>
#include <vector>
#include <sstream>

namespace assert
{
void is_true(bool b, std::string msg = "");
void expect_exception(const std::function<void(void)>& func, std::string msg = "");

template<class T1, class T2>
void are_equal(const T1& expected, const T2& actual, std::string msg = "")
template <class T1, class T2> void are_equal(const T1& expected, const T2& actual, std::string msg = "")
{
std::ostringstream s{};
s << msg << "(expected: " << expected << ", actual: " << actual << ")";
Expand Down Expand Up @@ -71,4 +70,4 @@ class TestSuit
std::vector<TestFunction> tests;
};

#endif
#endif
2 changes: 1 addition & 1 deletion samples/button_interrupt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ int main()
GPIO::cleanup();

return 0;
}
}
2 changes: 1 addition & 1 deletion samples/jetson_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ int main()
std::string model = GPIO::model;
std::cout << model << std::endl;
return 0;
}
}
2 changes: 1 addition & 1 deletion src/Callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ namespace GPIO
bool operator==(const Callback& A, const Callback& B) { return A.comparer(A.function, B.function); }

bool operator!=(const Callback& A, const Callback& B) { return !(A == B); }
} // namespace GPIO
} // namespace GPIO
2 changes: 1 addition & 1 deletion src/DictionaryLike.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ namespace GPIO
dictionary = std::move(_dictionary);
}

} // namespace GPIO
} // namespace GPIO
2 changes: 1 addition & 1 deletion src/ExceptionHandling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ namespace GPIO
{
return std::runtime_error(_error_message(e, from));
}
} // namespace GPIO
} // namespace GPIO
3 changes: 1 addition & 2 deletions src/GPIOEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ constexpr size_t MAX_EPOLL_EVENTS = 20;

namespace GPIO
{

// Error messages for all errors produced by this module
std::map<EventResultCode, const char*> event_error_code_to_message = {
{EventResultCode::SysFD_EdgeOpen, "Failure to open the /sys/class/gpio/gpio{$ch}/edge file"},
Expand Down Expand Up @@ -864,4 +863,4 @@ namespace GPIO

void _event_cleanup(int gpio, const std::string& gpio_name) { _remove_edge_detect(gpio); }

} // namespace GPIO
} // namespace GPIO
2 changes: 1 addition & 1 deletion src/GPIOPinData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ DEALINGS IN THE SOFTWARE.

#include "JetsonGPIO.h"
#include "private/ExceptionHandling.h"
#include "private/GPIOPinData.h"
#include "private/ModelUtility.h"
#include "private/PinDefinition.h"
#include "private/PythonFunctions.h"
#include "private/GPIOPinData.h"

using namespace std;
using namespace std::string_literals; // enables s-suffix for std::string literals
Expand Down
2 changes: 1 addition & 1 deletion src/JetsonGPIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,4 +401,4 @@ namespace GPIO
{
return wait_for_edge(std::to_string(channel), edge, bounce_time, timeout);
}
} // namespace GPIO
} // namespace GPIO
2 changes: 1 addition & 1 deletion src/LazyString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ namespace GPIO

is_cached = true;
}
} // namespace GPIO
} // namespace GPIO
2 changes: 1 addition & 1 deletion src/MainModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,4 +382,4 @@ namespace GPIO
}
}

} // namespace GPIO
} // namespace GPIO
4 changes: 2 additions & 2 deletions src/ModelUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/

#include "private/Model.h"
#include "private/ModelUtility.h"
#include "private/Model.h"
#include "private/PythonFunctions.h"
#include <stdexcept>

Expand Down Expand Up @@ -64,4 +64,4 @@ namespace GPIO

Model name_to_model(const std::string& name) { return index_to_model(model_name_index(name)); }

} // namespace GPIO
} // namespace GPIO
2 changes: 1 addition & 1 deletion src/PWM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,4 @@ namespace GPIO

void PWM::stop() { pImpl->stop(); }

} // namespace GPIO
} // namespace GPIO
2 changes: 1 addition & 1 deletion src/WaitResult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ namespace GPIO
{
WaitResult::WaitResult(const std::string& channel) : _channel(channel) {}
bool WaitResult::is_event_detected() const { return !is_None(channel()); }
} // namespace GPIO
} // namespace GPIO
3 changes: 2 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ set(_unit_test_targets
"test_model_name"
)


foreach (test ${_unit_test_targets})
add_executable(${test} unit-tests/${test}.cpp TestUtility.cpp)
add_test(NAME ${test} COMMAND $<TARGET_FILE:${test}>)
target_link_libraries(${test} PRIVATE JetsonGPIO)
endforeach ()
endforeach ()
2 changes: 1 addition & 1 deletion tests/TestUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ void TestSuit::run()

void TestSuit::reserve(size_t n) { tests.reserve(n); }

void TestSuit::add(const TestFunction& test) { tests.emplace_back(test); }
void TestSuit::add(const TestFunction& test) { tests.emplace_back(test); }
2 changes: 1 addition & 1 deletion tests/unit-tests/test_dictionary_like.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ int main()
}

return 0;
}
}
2 changes: 1 addition & 1 deletion tests/unit-tests/test_lazy_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,4 @@ int main()
}

return 0;
}
}
2 changes: 1 addition & 1 deletion tests/unit-tests/test_model_name.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ int main()
}

return 0;
}
}

0 comments on commit e527a67

Please sign in to comment.