-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19a691b
commit d9ca634
Showing
9 changed files
with
105 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#include "../test/helper.h" | ||
#include "internal/Animation.h" | ||
#include <unity.h> | ||
|
||
using namespace BlenderServoAnimation; | ||
using namespace fakeit; | ||
|
||
void setUp(void) { | ||
ArduinoFakeReset(); | ||
} | ||
|
||
void test_prevented(void) { | ||
Animation animation; | ||
Serial_ mock; | ||
animation.addScene(mock); | ||
|
||
When(OverloadedMethod(ArduinoFake(), random, long(long))).Return(0); | ||
|
||
animation.loop(); | ||
TEST_ASSERT_EQUAL(Animation::MODE_LOOP, animation.getMode()); | ||
animation.live(mock); | ||
TEST_ASSERT_EQUAL(Animation::MODE_LOOP, animation.getMode()); | ||
animation.pause(); | ||
animation.play(); | ||
TEST_ASSERT_EQUAL(Animation::MODE_PLAY, animation.getMode()); | ||
animation.live(mock); | ||
TEST_ASSERT_EQUAL(Animation::MODE_PLAY, animation.getMode()); | ||
animation.pause(); | ||
animation.playSingle(0); | ||
TEST_ASSERT_EQUAL(Animation::MODE_PLAY_SINGLE, animation.getMode()); | ||
animation.live(mock); | ||
TEST_ASSERT_EQUAL(Animation::MODE_PLAY_SINGLE, animation.getMode()); | ||
animation.pause(); | ||
animation.playRandom(); | ||
TEST_ASSERT_EQUAL(Animation::MODE_PLAY_RANDOM, animation.getMode()); | ||
animation.live(mock); | ||
TEST_ASSERT_EQUAL(Animation::MODE_PLAY_RANDOM, animation.getMode()); | ||
animation.pause(); | ||
TEST_ASSERT_EQUAL(Animation::MODE_PAUSE, animation.getMode()); | ||
animation.live(mock); | ||
TEST_ASSERT_EQUAL(Animation::MODE_PAUSE, animation.getMode()); | ||
animation.stop(); | ||
TEST_ASSERT_EQUAL(Animation::MODE_STOP, animation.getMode()); | ||
animation.live(mock); | ||
TEST_ASSERT_EQUAL(Animation::MODE_STOP, animation.getMode()); | ||
} | ||
|
||
void test_allowed(void) { | ||
Serial_ mock; | ||
Animation animation; | ||
animation.addScene(mock); | ||
|
||
TEST_ASSERT_EQUAL(Animation::MODE_DEFAULT, animation.getMode()); | ||
animation.live(mock); | ||
TEST_ASSERT_EQUAL(Animation::MODE_LIVE, animation.getMode()); | ||
} | ||
|
||
int main(int argc, char **argv) { | ||
UNITY_BEGIN(); | ||
RUN_TEST(test_prevented); | ||
RUN_TEST(test_allowed); | ||
UNITY_END(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters