Attention is currently required from: tnt.
Hello tnt,

I'd like you to do a code review. Please visit

    https://gerrit.osmocom.org/c/osmo-e1d/+/27850

to review the following change.


Change subject: rifo_test: Use a helper function for the rifo init
......................................................................

rifo_test: Use a helper function for the rifo init

Because we poke at some of the internals we need to make
sure to maintain the internal state consistent.

Signed-off-by: Sylvain Munaut <[email protected]>
Change-Id: I5d9397be391c60f732c89f158d25660e1f32cfac
---
M tests/rifo/rifo_test.c
1 file changed, 12 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/50/27850/1

diff --git a/tests/rifo/rifo_test.c b/tests/rifo/rifo_test.c
index 06c882c..4e7ae45 100644
--- a/tests/rifo/rifo_test.c
+++ b/tests/rifo/rifo_test.c
@@ -11,6 +11,13 @@
 static void *g_e1d_ctx;
 static uint32_t init_next_out_fn;

+static void rifo_init(struct frame_rifo *rifo)
+{
+       frame_rifo_init(rifo);
+       rifo->next_out_fn = init_next_out_fn;
+       rifo->last_in_fn  = init_next_out_fn - 1;
+}
+
 static void rifo_in(struct frame_rifo *rifo, uint8_t *frame, uint32_t fn)
 {
        int rc = frame_rifo_in(rifo, frame, fn);
@@ -32,6 +39,7 @@
        struct frame_rifo rifo;
        frame_rifo_init(&rifo);
        rifo.next_out_fn = init_next_out_fn;
+       rifo.last_in_fn  = init_next_out_fn - 1;

        printf("\nTEST: %s, starting at FN: %u\n", __func__, init_next_out_fn);

@@ -54,8 +62,7 @@
 static void reordered_in(void)
 {
        struct frame_rifo rifo;
-       frame_rifo_init(&rifo);
-       rifo.next_out_fn = init_next_out_fn;
+       rifo_init(&rifo);

        printf("\nTEST: %s, starting at FN: %u\n", __func__, init_next_out_fn);

@@ -76,8 +83,7 @@
 static void correct_order(void)
 {
        struct frame_rifo rifo;
-       frame_rifo_init(&rifo);
-       rifo.next_out_fn = init_next_out_fn;
+       rifo_init(&rifo);

        printf("\nTEST: %s, starting at FN: %u\n", __func__, init_next_out_fn);

@@ -98,8 +104,7 @@
 static void too_old_frames(void)
 {
        struct frame_rifo rifo;
-       frame_rifo_init(&rifo);
-       rifo.next_out_fn = init_next_out_fn;
+       rifo_init(&rifo);

        printf("\nTEST: %s, starting at FN: %u\n", __func__, init_next_out_fn);

@@ -133,8 +138,7 @@
 {
        uint8_t frame[32];
        struct frame_rifo rifo;
-       frame_rifo_init(&rifo);
-       rifo.next_out_fn = init_next_out_fn;
+       rifo_init(&rifo);

        printf("\nTEST: %s, starting at FN: %u\n", __func__, init_next_out_fn);


--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/27850
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I5d9397be391c60f732c89f158d25660e1f32cfac
Gerrit-Change-Number: 27850
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <[email protected]>
Gerrit-Reviewer: tnt <[email protected]>
Gerrit-Attention: tnt <[email protected]>
Gerrit-MessageType: newchange

Reply via email to