diff options
Diffstat (limited to 'testsuites')
-rw-r--r-- | testsuites/libtests/record01/init.c | 73 |
1 files changed, 35 insertions, 38 deletions
diff --git a/testsuites/libtests/record01/init.c b/testsuites/libtests/record01/init.c index 8b71ed3c61..d5390dff49 100644 --- a/testsuites/libtests/record01/init.c +++ b/testsuites/libtests/record01/init.c @@ -75,40 +75,43 @@ static const rtems_record_item expected_items_1[ITEM_COUNT] = { static const rtems_record_item expected_items_2[ITEM_COUNT] = { { .event = TE(2, UE(1)), .data = 3 }, { .event = TE(6, UE(5)), .data = 7 }, - { .event = TE(10, RTEMS_RECORD_EVENT_OVERFLOW), .data = 11 } + { .event = TE(10, UE(9)), .data = 11 } }; static const rtems_record_item expected_items_3[ITEM_COUNT] = { { .event = TE(2, UE(1)), .data = 3 }, { .event = TE(6, UE(5)), .data = 7 }, - { .event = TE(10, RTEMS_RECORD_EVENT_OVERFLOW), .data = 11 }, - { .event = TE(14, RTEMS_RECORD_EVENT_OVERFLOW), .data = 15 } + { .event = TE(10, UE(9)), .data = 11 }, + { .event = TE(14, UE(13)), .data = 15 } }; static const rtems_record_item expected_items_4[ITEM_COUNT] = { - { .event = TE(2, UE(1)), .data = 3 }, + { .event = TE(18, UE(17)), .data = 19 }, { .event = TE(6, UE(5)), .data = 7 }, - { .event = TE(10, RTEMS_RECORD_EVENT_OVERFLOW), .data = 11 }, - { .event = TE(18, RTEMS_RECORD_EVENT_OVERFLOW), .data = 19 } + { .event = TE(10, UE(9)), .data = 11 }, + { .event = TE(14, UE(13)), .data = 15 } }; static const rtems_record_item expected_items_5[ITEM_COUNT] = { - { .event = TE(2, RTEMS_RECORD_EVENT_OVERFLOW), .data = 3 } + { .event = TE(2, UE(1)), .data = 3 } }; static const rtems_record_item expected_items_6[ITEM_COUNT] = { - { .event = TE(6, RTEMS_RECORD_EVENT_OVERFLOW), .data = 7 } + { .event = TE(2, UE(1)), .data = 3 }, + { .event = TE(6, UE(5)), .data = 7 } }; static const rtems_record_item expected_items_7[ITEM_COUNT] = { - { .event = TE(10, RTEMS_RECORD_EVENT_OVERFLOW), .data = 11 } + { .event = TE(2, UE(1)), .data = 3 }, + { .event = TE(6, UE(5)), .data = 7 }, + { .event = TE(10, UE(9)), .data = 11 } }; static const rtems_record_item expected_items_8[] = { { .event = TE(0, RTEMS_RECORD_EVENT_PROCESSOR), .data = 0 }, { .event = TE(2, UE(1)), .data = 3 }, { .event = TE(5, UE(4)), .data = 6 }, - { .event = TE(8, RTEMS_RECORD_EVENT_OVERFLOW), .data = 9 } + { .event = TE(8, UE(7)), .data = 9 } }; static const rtems_record_item expected_items_9[] = { @@ -121,7 +124,7 @@ static const rtems_record_item expected_items_10[] = { { .event = TE(0, RTEMS_RECORD_EVENT_PROCESSOR), .data = 0 }, { .event = TE(17, UE(16)), .data = 18 }, { .event = TE(20, UE(19)), .data = 21 }, - { .event = TE(23, RTEMS_RECORD_EVENT_OVERFLOW), .data = 24 } + { .event = TE(23, UE(22)), .data = 24 } }; static const rtems_record_item expected_items_11[] = { @@ -164,24 +167,24 @@ static void test_capacity(const Record_Control *control) rtems_test_assert(capacity == 0); } -static void test_increment(const Record_Control *control) +static void test_index(const Record_Control *control) { - unsigned int next; + unsigned int index; - next = _Record_Increment(control, 0, 1); - rtems_test_assert(next == 1); + index = _Record_Index(control, 0); + rtems_test_assert(index == 0); - next = _Record_Increment(control, 1, 1); - rtems_test_assert(next == 2); + index = _Record_Index(control, 1); + rtems_test_assert(index == 1); - next = _Record_Increment(control, 2, 1); - rtems_test_assert(next == 3); + index = _Record_Index(control, 2); + rtems_test_assert(index == 2); - next = _Record_Increment(control, 3, 1); - rtems_test_assert(next == 0); + index = _Record_Index(control, 3); + rtems_test_assert(index == 3); - next = _Record_Increment(control, 3, 0); - rtems_test_assert(next == 3); + index = _Record_Index(control, 4); + rtems_test_assert(index == 0); } static void test_prepare_2(test_context *ctx, Record_Control *control) @@ -190,12 +193,9 @@ static void test_prepare_2(test_context *ctx, Record_Control *control) init_context(ctx); - rtems_record_prepare(&rc, 2); - rtems_test_assert(!rtems_record_is_overflow(&rc)); + rtems_record_prepare(&rc); rtems_test_assert(rc.control == control); rtems_test_assert(rc.head == 0); - rtems_test_assert(rc.increment == 1); - rtems_test_assert(rc.final_head == 2); rtems_test_assert(_Record_Head(control) == 0); rtems_test_assert(_Record_Tail(control) == 0); @@ -220,34 +220,31 @@ static void test_prepare_3(test_context *ctx, Record_Control *control) init_context(ctx); - rtems_record_prepare(&rc, 3); - rtems_test_assert(rtems_record_is_overflow(&rc)); + rtems_record_prepare(&rc); rtems_test_assert(rc.control == control); rtems_test_assert(rc.head == 0); - rtems_test_assert(rc.increment == 0); - rtems_test_assert(rc.final_head == 1); rtems_test_assert(_Record_Head(control) == 0); rtems_test_assert(_Record_Tail(control) == 0); rc.now = 2; rtems_record_add(&rc, UE(1), 3); - rtems_test_assert(rc.head == 0); + rtems_test_assert(rc.head == 1); rtems_test_assert(memcmp(control->Items, expected_items_5, ITEM_SIZE) == 0); rtems_test_assert(_Record_Head(control) == 0); rtems_test_assert(_Record_Tail(control) == 0); rc.now = 6; rtems_record_add(&rc, UE(5), 7); - rtems_test_assert(rc.head == 0); + rtems_test_assert(rc.head == 2); rtems_test_assert(memcmp(control->Items, expected_items_6, ITEM_SIZE) == 0); rtems_test_assert(_Record_Head(control) == 0); rtems_test_assert(_Record_Tail(control) == 0); rc.now = 10; rtems_record_commit(&rc, UE(9), 11); - rtems_test_assert(rc.head == 0); + rtems_test_assert(rc.head == 3); rtems_test_assert(memcmp(control->Items, expected_items_7, ITEM_SIZE) == 0); - rtems_test_assert(_Record_Head(control) == 1); + rtems_test_assert(_Record_Head(control) == 3); rtems_test_assert(_Record_Tail(control) == 0); } @@ -286,13 +283,13 @@ static void test_produce(test_context *ctx, Record_Control *control) rtems_record_produce(UE(13), 15); set_time(&control->Items[3], 14); rtems_test_assert(memcmp(control->Items, expected_items_3, ITEM_SIZE) == 0); - rtems_test_assert(_Record_Head(control) == 3); + rtems_test_assert(_Record_Head(control) == 4); rtems_test_assert(_Record_Tail(control) == 0); rtems_record_produce(UE(17), 19); set_time(&control->Items[3], 18); rtems_test_assert(memcmp(control->Items, expected_items_4, ITEM_SIZE) == 0); - rtems_test_assert(_Record_Head(control) == 3); + rtems_test_assert(_Record_Head(control) == 5); rtems_test_assert(_Record_Tail(control) == 0); } @@ -540,7 +537,7 @@ static void Init(rtems_task_argument arg) init_context(ctx); test_capacity(&ctx->control); - test_increment(&ctx->control); + test_index(&ctx->control); test_prepare_2(ctx, &ctx->control); test_prepare_3(ctx, &ctx->control); test_produce(ctx, &ctx->control); |