[riot-notifications] [RIOT-OS/RIOT] tests: provide unittests for gnrc_sixlowpan_frag/rbuf (#10851)

Martine Lenders notifications at github.com
Wed Jan 23 18:13:55 CET 2019


miri64 commented on this pull request.



>      rbuf_int_t *ptr;
     uint8_t *data = ((uint8_t *)pkt->data) + sizeof(sixlowpan_frag_t);
     size_t frag_size;
 
+    /* check if provided offset is the same as in fragment */
+    assert(((((frag->disp_size.u8[0] & SIXLOWPAN_FRAG_DISP_MASK) ==
+                SIXLOWPAN_FRAG_1_DISP)) && (offset == 0)) ||
+           ((((frag->disp_size.u8[0] & SIXLOWPAN_FRAG_DISP_MASK) ==
+                SIXLOWPAN_FRAG_N_DISP)) && (offset == (frag->offset * 8U))));

`gnrc_sixlowpan_frag` internally derives the offset value directly from the fragment header

https://github.com/RIOT-OS/RIOT/blob/1f7292c358ccda95090fb15ff29ac93d674f26e2/sys/net/gnrc/network_layer/sixlowpan/frag/gnrc_sixlowpan_frag.c#L306-L322

So for normal usage within GNRC this assertion is redundant, but to make the tests of `rbuf_add` 100% water-tide I added it in a separate commit (48d73191c5e6161ed1c2474004581b14d5a2062b when writing this comment).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10851#pullrequestreview-195641156
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190123/fa6e906e/attachment-0001.html>


More information about the notifications mailing list