Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
briandowns committed Sep 10, 2019
1 parent fbca0ce commit a45aadb
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions tests/tests.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
Expand All @@ -6,13 +7,13 @@
#include "unity/unity.h"

/**
* test_spinner_new verifies that the spinner_new
* test_spinner_new verifies that the spinner_new
* function returns a valid pointer.
*/
void
test_spinner_new(void)
{
spinner_t *s = spinner_new(0);
spinner_t* s = spinner_new(0);
TEST_ASSERT_NOT_NULL(s);
spinner_free(s);
}
Expand All @@ -24,7 +25,7 @@ test_spinner_new(void)
void
test_spinner_start(void)
{
spinner_t *s = spinner_new(0);
spinner_t* s = spinner_new(0);
spinner_start(s);
int current_state = s->active;
TEST_ASSERT_EQUAL_INT(s->active, current_state);
Expand All @@ -38,7 +39,7 @@ test_spinner_start(void)
void
test_spinner_stop(void)
{
spinner_t *s = spinner_new(0);
spinner_t* s = spinner_new(0);
spinner_start(s);
spinner_stop(s);
int current_state = s->active;
Expand All @@ -53,29 +54,31 @@ test_spinner_stop(void)
void
test_spinner_char_set_update(void)
{
spinner_t *s = spinner_new(0);
spinner_t* s = spinner_new(0);
spinner_char_set_update(s, 1);
TEST_ASSERT_EQUAL_UINT8(s->char_set_id, 1);
spinner_free(s);
}

/*
* test_spinner_update_speed verifies that the
* test_spinner_update_speed verifies that the
* speed of the spinner can be updates safely.
*/
void
test_spinner_update_speed(void)
{
spinner_t *s = spinner_new(0);
spinner_t* s = spinner_new(0);
s->delay = 100000;
uint64_t expected = 200000;
spinner_update_speed(s, expected);
TEST_ASSERT_EQUAL_UINT8(s->delay, expected);
spinner_free(s);
}

int main(void) {
UNITY_BEGIN();
int
main(void)
{
UNITY_BEGIN();

RUN_TEST(test_spinner_new);
RUN_TEST(test_spinner_start);
Expand Down

0 comments on commit a45aadb

Please sign in to comment.