Skip to content

Commit

Permalink
queue test: add counter overflow protect
Browse files Browse the repository at this point in the history
without this fix test_equeue_break_no_windup was failing on IAR
  • Loading branch information
maciejbocianski committed Aug 30, 2019
1 parent 6440aea commit b45d6d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion TESTS/events/equeue/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ static void pass_func(void *eh)

static void simple_func(void *p)
{
(*(reinterpret_cast<uint8_t *>(p)))++;
uint8_t *d = reinterpret_cast<uint8_t *>(p);
if (*d < 255) {
(*d)++;
}
}

static void sloth_func(void *p)
Expand Down
5 changes: 4 additions & 1 deletion UNITTESTS/events/equeue/test_equeue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ static void pass_func(void *eh)

static void simple_func(void *p)
{
(*(reinterpret_cast<uint8_t *>(p)))++;
uint8_t *d = reinterpret_cast<uint8_t *>(p);
if (*d < 255) {
(*d)++;
}
}

static void sloth_func(void *p)
Expand Down

0 comments on commit b45d6d6

Please sign in to comment.