add a set of dyn(create / destroy) interface
1. tos_ring_q_create_dyn 2. tos_chr_fifo_create_dyn 3. tos_msg_q_create_dyn 4. tos_mail_q_create_dyn 5. tos_bin_heap_create_dyn 6. tos_prio_q_create_dyn 7. tos_prio_msg_q_create_dyn 8. tos_prio_mail_q_create_dyn
This commit is contained in:
@@ -86,6 +86,38 @@ TEST test_tos_fifo_char_push(void)
|
||||
PASS();
|
||||
}
|
||||
|
||||
TEST test_tos_fifo_char_push_dyn(void)
|
||||
{
|
||||
k_err_t err;
|
||||
int i = 0;
|
||||
uint8_t data;
|
||||
|
||||
err = tos_chr_fifo_create_dyn(&test_fifo_00, sizeof(fifo_buffer_00));
|
||||
ASSERT_EQ(err, K_ERR_NONE);
|
||||
|
||||
for (i = 0; i < FIFO_BUFFER_SIZE; ++i) {
|
||||
err = tos_chr_fifo_push(&test_fifo_00, 'a' + i);
|
||||
ASSERT_EQ(err, K_ERR_NONE);
|
||||
}
|
||||
|
||||
err = tos_chr_fifo_push(&test_fifo_00, 'z');
|
||||
ASSERT_EQ(err, K_ERR_RING_Q_FULL);
|
||||
|
||||
for (i = 0; i < FIFO_BUFFER_SIZE; ++i) {
|
||||
err = tos_chr_fifo_pop(&test_fifo_00, &data);
|
||||
ASSERT_EQ(err, K_ERR_NONE);
|
||||
ASSERT_EQ(data, 'a' + i);
|
||||
}
|
||||
|
||||
err = tos_chr_fifo_pop(&test_fifo_00, &data);
|
||||
ASSERT_EQ(err, K_ERR_RING_Q_EMPTY);
|
||||
|
||||
err = tos_chr_fifo_destroy_dyn(&test_fifo_00);
|
||||
ASSERT_EQ(err, K_ERR_NONE);
|
||||
|
||||
PASS();
|
||||
}
|
||||
|
||||
TEST test_tos_fifo_stream_push(void)
|
||||
{
|
||||
k_err_t err;
|
||||
@@ -119,6 +151,7 @@ SUITE(suit_char_fifo)
|
||||
RUN_TEST(test_tos_fifo_create);
|
||||
RUN_TEST(test_tos_fifo_destory);
|
||||
RUN_TEST(test_tos_fifo_char_push);
|
||||
RUN_TEST(test_tos_fifo_char_push_dyn);
|
||||
RUN_TEST(test_tos_fifo_stream_push);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user