From 331f3a13d10afcaba0b60b7639c2b5f40fe623e6 Mon Sep 17 00:00:00 2001 From: Tim Hendriks Date: Sat, 27 Jul 2024 13:24:13 +0200 Subject: [PATCH] fix linting errors --- src/BlenderServoAnimation.cpp | 3 ++- src/BlenderServoAnimation.h | 2 +- src/ServoManager.cpp | 2 +- test/animation/test_live/test_live.cpp | 12 +++++++---- test/animation/test_loop/test_loop.cpp | 12 +++++++---- test/animation/test_play/test_play.cpp | 12 +++++++---- .../test_play_random/test_play_random.cpp | 21 ++++++++++++------- .../test_play_single/test_play_single.cpp | 15 ++++++++----- test/animation/test_stop/test_stop.cpp | 6 ++++-- test/test_scene/test_scene.cpp | 2 +- 10 files changed, 57 insertions(+), 30 deletions(-) diff --git a/src/BlenderServoAnimation.cpp b/src/BlenderServoAnimation.cpp index 2b9cba3..eca659b 100644 --- a/src/BlenderServoAnimation.cpp +++ b/src/BlenderServoAnimation.cpp @@ -26,7 +26,8 @@ bool BlenderServoAnimation::hasScenes() { return this->addIndex > 0; } -void BlenderServoAnimation::addScene(const byte *data, int size, byte fps, int frames) { +void BlenderServoAnimation::addScene(const byte *data, int size, byte fps, + int frames) { AnimationData *animationData = new AnimationData(data, size); Scene *scene = new Scene(&this->servoManager, animationData, fps, frames); this->registerScene(scene); diff --git a/src/BlenderServoAnimation.h b/src/BlenderServoAnimation.h index dc2caf6..5524443 100644 --- a/src/BlenderServoAnimation.h +++ b/src/BlenderServoAnimation.h @@ -8,9 +8,9 @@ #ifndef BlenderServoAnimation_H #define BlenderServoAnimation_H +using BlenderServoAnimationLibrary::AnimationData; using BlenderServoAnimationLibrary::Scene; using BlenderServoAnimationLibrary::ServoManager; -using BlenderServoAnimationLibrary::AnimationData; class BlenderServoAnimation { diff --git a/src/ServoManager.cpp b/src/ServoManager.cpp index 7f66b46..d9eba8f 100644 --- a/src/ServoManager.cpp +++ b/src/ServoManager.cpp @@ -2,8 +2,8 @@ #include "Servo.h" #include -using BlenderServoAnimationLibrary::ServoManager; using BlenderServoAnimationLibrary::Servo; +using BlenderServoAnimationLibrary::ServoManager; ServoManager::~ServoManager() { if (this->servos) { diff --git a/test/animation/test_live/test_live.cpp b/test/animation/test_live/test_live.cpp index 6a827a4..1c211c8 100644 --- a/test/animation/test_live/test_live.cpp +++ b/test/animation/test_live/test_live.cpp @@ -26,14 +26,18 @@ void test_prevented(void) { TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY, animation.getMode()); animation.pause(); animation.playSingle(0); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, + animation.getMode()); animation.live(mock); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, + animation.getMode()); animation.pause(); animation.playRandom(); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, + animation.getMode()); animation.live(mock); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, + animation.getMode()); animation.pause(); TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PAUSE, animation.getMode()); animation.live(mock); diff --git a/test/animation/test_loop/test_loop.cpp b/test/animation/test_loop/test_loop.cpp index 46c5699..5d4e626 100644 --- a/test/animation/test_loop/test_loop.cpp +++ b/test/animation/test_loop/test_loop.cpp @@ -60,14 +60,18 @@ void test_prevented(void) { TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY, animation.getMode()); animation.pause(); animation.playSingle(0); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, + animation.getMode()); animation.loop(); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, + animation.getMode()); animation.pause(); animation.playRandom(); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, + animation.getMode()); animation.loop(); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, + animation.getMode()); animation.stop(); TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_STOP, animation.getMode()); animation.loop(); diff --git a/test/animation/test_play/test_play.cpp b/test/animation/test_play/test_play.cpp index d19bd5c..86a7315 100644 --- a/test/animation/test_play/test_play.cpp +++ b/test/animation/test_play/test_play.cpp @@ -57,14 +57,18 @@ void test_prevented(void) { TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_LOOP, animation.getMode()); animation.pause(); animation.playSingle(0); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, + animation.getMode()); animation.play(); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, + animation.getMode()); animation.pause(); animation.playRandom(); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, + animation.getMode()); animation.play(); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, + animation.getMode()); animation.stop(); TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_STOP, animation.getMode()); animation.play(); diff --git a/test/animation/test_play_random/test_play_random.cpp b/test/animation/test_play_random/test_play_random.cpp index 8cb61c6..cffa946 100644 --- a/test/animation/test_play_random/test_play_random.cpp +++ b/test/animation/test_play_random/test_play_random.cpp @@ -25,7 +25,8 @@ void test_play_random(void) { animation.playRandom(); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, + animation.getMode()); TEST_ASSERT_NOT_EQUAL(nullptr, animation.getCurrentScene()); TEST_ASSERT_EQUAL(1, animation.getPlayIndex()); TEST_ASSERT_FALSE(animation.scenePlayed(0)); @@ -36,7 +37,8 @@ void test_play_random(void) { animation.run(i); } - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, + animation.getMode()); TEST_ASSERT_EQUAL(0, animation.getPlayIndex()); TEST_ASSERT_TRUE(animation.scenePlayed(0)); TEST_ASSERT_TRUE(animation.scenePlayed(1)); @@ -46,7 +48,8 @@ void test_play_random(void) { animation.run(i); } - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, + animation.getMode()); TEST_ASSERT_EQUAL(2, animation.getPlayIndex()); TEST_ASSERT_EQUAL(20, logIndex); TEST_ASSERT_FALSE(animation.scenePlayed(0)); @@ -78,9 +81,11 @@ void test_prevented(void) { TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY, animation.getMode()); animation.pause(); animation.playSingle(0); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, + animation.getMode()); animation.playRandom(); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, + animation.getMode()); animation.stop(); TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_STOP, animation.getMode()); animation.playRandom(); @@ -99,11 +104,13 @@ void test_allowed(void) { TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_DEFAULT, animation.getMode()); animation.playRandom(); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, + animation.getMode()); animation.pause(); TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PAUSE, animation.getMode()); animation.playRandom(); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, + animation.getMode()); } int main(int argc, char **argv) { diff --git a/test/animation/test_play_single/test_play_single.cpp b/test/animation/test_play_single/test_play_single.cpp index ded193c..d61b678 100644 --- a/test/animation/test_play_single/test_play_single.cpp +++ b/test/animation/test_play_single/test_play_single.cpp @@ -20,7 +20,8 @@ void test_play_single(void) { animation.playSingle(2); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, + animation.getMode()); TEST_ASSERT_EQUAL(2, animation.getPlayIndex()); for (long i = 0; i < ANIMATION_MICROS; i += FRAME_MICROS) { @@ -57,9 +58,11 @@ void test_prevented(void) { TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY, animation.getMode()); animation.pause(); animation.playRandom(); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, + animation.getMode()); animation.playSingle(0); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, + animation.getMode()); animation.stop(); TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_STOP, animation.getMode()); animation.playSingle(0); @@ -78,11 +81,13 @@ void test_allowed(void) { TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_DEFAULT, animation.getMode()); animation.playSingle(0); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, + animation.getMode()); animation.pause(); TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PAUSE, animation.getMode()); animation.playSingle(0); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, + animation.getMode()); } void test_prevent_sudden_index_change(void) { diff --git a/test/animation/test_stop/test_stop.cpp b/test/animation/test_stop/test_stop.cpp index 2f276b9..72e2b3a 100644 --- a/test/animation/test_stop/test_stop.cpp +++ b/test/animation/test_stop/test_stop.cpp @@ -101,12 +101,14 @@ void test_allowed(void) { TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_STOP, animation.getMode()); animation.run(10000); animation.playSingle(0); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_SINGLE, + animation.getMode()); animation.stop(); TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_STOP, animation.getMode()); animation.run(10000); animation.playRandom(); - TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, animation.getMode()); + TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_PLAY_RANDOM, + animation.getMode()); animation.stop(); TEST_ASSERT_EQUAL(BlenderServoAnimation::MODE_STOP, animation.getMode()); animation.run(10000); diff --git a/test/test_scene/test_scene.cpp b/test/test_scene/test_scene.cpp index 3cb448f..3c17cb2 100644 --- a/test/test_scene/test_scene.cpp +++ b/test/test_scene/test_scene.cpp @@ -3,9 +3,9 @@ #include "Scene.h" #include -using BlenderServoAnimationLibrary::ServoManager; using BlenderServoAnimationLibrary::AnimationData; using BlenderServoAnimationLibrary::Scene; +using BlenderServoAnimationLibrary::ServoManager; void setUp(void) { resetPositionLog();