diff options
author | Matias Elo <matias.elo@nokia.com> | 2022-10-21 17:44:02 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2022-11-30 09:19:08 +0200 |
commit | 5af3dc798bf7f245f64ae3178a9324d600b0e249 (patch) | |
tree | c95c9700d25b196b830ef23a4fefecdf61ccb311 /test | |
parent | 19bcb9061ad1205eb63fd216411b8d8aac29dd77 (diff) |
validation: buffer: add tests for multi event conversion functions
Add validation tests for odp_buffer_from_event_multi() and
odp_buffer_to_event_multi() functions.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/validation/api/buffer/buffer.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/validation/api/buffer/buffer.c b/test/validation/api/buffer/buffer.c index c3484e14a..2d9632342 100644 --- a/test/validation/api/buffer/buffer.c +++ b/test/validation/api/buffer/buffer.c @@ -75,6 +75,8 @@ static void test_pool_alloc_free(const odp_pool_param_t *param) odp_pool_print(pool); for (i = 0; i < num; i++) { + odp_buffer_t buf; + buffer[i] = odp_buffer_alloc(pool); if (buffer[i] == ODP_BUFFER_INVALID) @@ -88,6 +90,10 @@ static void test_pool_alloc_free(const odp_pool_param_t *param) ev = odp_buffer_to_event(buffer[i]); CU_ASSERT(odp_buffer_from_event(ev) == buffer[i]); + odp_buffer_to_event_multi(&buffer[i], &ev, 1); + odp_buffer_from_event_multi(&buf, &ev, 1); + CU_ASSERT(buf == buffer[i]); + if (odp_event_type(ev) != ODP_EVENT_BUFFER) wrong_type = true; if (odp_event_subtype(ev) != ODP_EVENT_NO_SUBTYPE) @@ -147,12 +153,20 @@ static void test_pool_alloc_free_multi(const odp_pool_param_t *param) ret = 0; for (i = 0; i < num; i += ret) { + odp_buffer_t buf[BURST]; + odp_event_t event[BURST]; + ret = odp_buffer_alloc_multi(pool, &buffer[i], BURST); CU_ASSERT(ret >= 0); CU_ASSERT(ret <= BURST); if (ret <= 0) break; + + odp_buffer_to_event_multi(&buffer[i], event, ret); + odp_buffer_from_event_multi(buf, event, ret); + for (int j = 0; j < ret; j++) + CU_ASSERT(buf[j] == buffer[i + j]); } num_buf = i; |