aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-05 14:50:49 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-05 14:50:49 +0200
commite54ebc7e74f3ca94de3467a03397c0aad2aed079 (patch)
tree87275746537881f8d21be33ae842374fd3750d49
parentc40332b990b025d2bd7b94e41184d7f0547da203 (diff)
`make format` + clang-tidy
-rw-r--r--makefile3
-rw-r--r--src/crepe/Sound.cpp1
-rw-r--r--src/crepe/api/AudioSource.h2
-rw-r--r--src/crepe/util/log.h3
-rw-r--r--src/example/audio_internal.cpp1
-rw-r--r--src/makefile6
-rw-r--r--src/test/audio.cpp23
-rw-r--r--src/test/dummy.cpp1
8 files changed, 13 insertions, 27 deletions
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 <memory>
-#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 <gtest/gtest.h>
-#include <memory>
-
-#include <crepe/api/AudioSource.h>
-#include <crepe/api/Asset.h>
-
-#include <chrono>
-#include <thread>
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<Asset>("../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 <gtest/gtest.h>
TEST(dummy, foo) { ASSERT_TRUE(1); }
-