Skip to content

Commit

Permalink
fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
timhendriks93 committed Jul 27, 2024
1 parent e50f830 commit 331f3a1
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 30 deletions.
3 changes: 2 additions & 1 deletion src/BlenderServoAnimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/BlenderServoAnimation.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#ifndef BlenderServoAnimation_H
#define BlenderServoAnimation_H

using BlenderServoAnimationLibrary::AnimationData;
using BlenderServoAnimationLibrary::Scene;
using BlenderServoAnimationLibrary::ServoManager;
using BlenderServoAnimationLibrary::AnimationData;

class BlenderServoAnimation {

Expand Down
2 changes: 1 addition & 1 deletion src/ServoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include "Servo.h"
#include <Arduino.h>

using BlenderServoAnimationLibrary::ServoManager;
using BlenderServoAnimationLibrary::Servo;
using BlenderServoAnimationLibrary::ServoManager;

ServoManager::~ServoManager() {
if (this->servos) {
Expand Down
12 changes: 8 additions & 4 deletions test/animation/test_live/test_live.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 8 additions & 4 deletions test/animation/test_loop/test_loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 8 additions & 4 deletions test/animation/test_play/test_play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
21 changes: 14 additions & 7 deletions test/animation/test_play_random/test_play_random.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
Expand All @@ -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));
Expand Down Expand Up @@ -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();
Expand All @@ -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) {
Expand Down
15 changes: 10 additions & 5 deletions test/animation/test_play_single/test_play_single.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand Down
6 changes: 4 additions & 2 deletions test/animation/test_stop/test_stop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/test_scene/test_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#include "Scene.h"
#include <unity.h>

using BlenderServoAnimationLibrary::ServoManager;
using BlenderServoAnimationLibrary::AnimationData;
using BlenderServoAnimationLibrary::Scene;
using BlenderServoAnimationLibrary::ServoManager;

void setUp(void) {
resetPositionLog();
Expand Down

0 comments on commit 331f3a1

Please sign in to comment.