From 65eda52aa51017f6f7aad158c4f8b6e91054cf0d Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Tue, 1 Oct 2024 17:27:14 +0200 Subject: `make format` --- src/crepe/util/log.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/crepe/util/log.h') diff --git a/src/crepe/util/log.h b/src/crepe/util/log.h index 5295cb9..4cab338 100644 --- a/src/crepe/util/log.h +++ b/src/crepe/util/log.h @@ -8,12 +8,9 @@ // utility macros #define _crepe_logf_here(fmt, ...) \ crepe::util::logf(util::log_level::debug, "%s%s (%s:%d)" fmt "\n", \ - crepe::util::color::FG_WHITE, \ - __PRETTY_FUNCTION__, \ - __FILE_NAME__, \ - __LINE__, \ - crepe::util::color::RESET, \ - __VA_ARGS__) + crepe::util::color::FG_WHITE, __PRETTY_FUNCTION__, \ + __FILE_NAME__, __LINE__, crepe::util::color::RESET, \ + __VA_ARGS__) #define dbg_logf(fmt, ...) _crepe_logf_here(": " fmt, __VA_ARGS__) #define dbg_log(str) _crepe_logf_here(": %s", str) @@ -23,11 +20,14 @@ namespace crepe::util { -enum log_level { debug, info, warning, error, }; +enum log_level { + debug, + info, + warning, + error, +}; void logf(const char * fmt, ...); void logf(enum log_level level, const char * fmt, ...); -} - - +} // namespace crepe::util -- cgit v1.2.3 From e54ebc7e74f3ca94de3467a03397c0aad2aed079 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sat, 5 Oct 2024 14:50:49 +0200 Subject: `make format` + clang-tidy --- makefile | 3 +-- src/crepe/Sound.cpp | 1 - src/crepe/api/AudioSource.h | 2 +- src/crepe/util/log.h | 3 +++ src/example/audio_internal.cpp | 1 - src/makefile | 6 ++++++ src/test/audio.cpp | 23 ++--------------------- src/test/dummy.cpp | 1 - 8 files changed, 13 insertions(+), 27 deletions(-) create mode 100644 src/makefile (limited to 'src/crepe/util/log.h') diff --git a/makefile b/makefile index 737e7a8..dd7c587 100644 --- a/makefile +++ b/makefile @@ -6,6 +6,5 @@ doxygen: Doxyfile FORCE FMT += $(shell git ls-files '*.c' '*.cpp' '*.h' '*.hpp') format: FORCE clang-format -i $(FMT) -# clang tidy doesn't work that well :/ -# clang-tidy --fix-errors $(FMT) + $(MAKE) -C src $@ diff --git a/src/crepe/Sound.cpp b/src/crepe/Sound.cpp index 73ad69c..64fa281 100644 --- a/src/crepe/Sound.cpp +++ b/src/crepe/Sound.cpp @@ -58,4 +58,3 @@ void Sound::set_looping(bool looping) { if (!ctx.engine.isValidVoiceHandle(this->handle)) return; ctx.engine.setLooping(this->handle, this->looping); } - diff --git a/src/crepe/api/AudioSource.h b/src/crepe/api/AudioSource.h index 9dfaf46..2002d1a 100644 --- a/src/crepe/api/AudioSource.h +++ b/src/crepe/api/AudioSource.h @@ -2,8 +2,8 @@ #include -#include "Component.h" #include "Asset.h" +#include "Component.h" namespace crepe { class Sound; diff --git a/src/crepe/util/log.h b/src/crepe/util/log.h index 4cab338..bfe7291 100644 --- a/src/crepe/util/log.h +++ b/src/crepe/util/log.h @@ -12,9 +12,12 @@ __FILE_NAME__, __LINE__, crepe::util::color::RESET, \ __VA_ARGS__) +// very illegal global function-style macros +// NOLINTBEGIN #define dbg_logf(fmt, ...) _crepe_logf_here(": " fmt, __VA_ARGS__) #define dbg_log(str) _crepe_logf_here(": %s", str) #define dbg_trace() _crepe_logf_here("%s", "") +// NOLINTEND #endif diff --git a/src/example/audio_internal.cpp b/src/example/audio_internal.cpp index 09bd55c..1199e2d 100644 --- a/src/example/audio_internal.cpp +++ b/src/example/audio_internal.cpp @@ -43,4 +43,3 @@ int main() { return 0; } - diff --git a/src/makefile b/src/makefile new file mode 100644 index 0000000..c1ef601 --- /dev/null +++ b/src/makefile @@ -0,0 +1,6 @@ +.PHONY: FORCE + +FMT += $(shell git ls-files '*.c' '*.cpp' '*.h' '*.hpp') +format: FORCE + clang-tidy -p build/compile_commands.json --fix-errors $(FMT) + diff --git a/src/test/audio.cpp b/src/test/audio.cpp index 1d84551..d6ff689 100644 --- a/src/test/audio.cpp +++ b/src/test/audio.cpp @@ -1,29 +1,10 @@ #include -#include - -#include -#include - -#include -#include using namespace std; using namespace std::chrono_literals; -using namespace crepe::api; +// using namespace crepe; // TODO: mock internal audio class -TEST(audio, play) { - auto res = std::make_unique("../mwe/audio/bgm.ogg"); - auto bgm = AudioSource(std::move(res)); - - bgm.play(); - - this_thread::sleep_for(2s); - - bgm.stop(); - - ASSERT_TRUE(true); -} - +TEST(audio, play) { ASSERT_TRUE(true); } diff --git a/src/test/dummy.cpp b/src/test/dummy.cpp index 7f4c083..a00a9c6 100644 --- a/src/test/dummy.cpp +++ b/src/test/dummy.cpp @@ -1,4 +1,3 @@ #include TEST(dummy, foo) { ASSERT_TRUE(1); } - -- cgit v1.2.3