Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
f738cd27
Unverified
Commit
f738cd27
authored
7 years ago
by
Martine Lenders
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #8259 from smlng/fix/unittests/priority_pktqueue
unittests: fix failed assertion caused by priority_pktqueue
parents
d50969ef
2149411d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/unittests/tests-priority_pktqueue/tests-priority_pktqueue.c
+27
-13
27 additions, 13 deletions
...ittests/tests-priority_pktqueue/tests-priority_pktqueue.c
with
27 additions
and
13 deletions
tests/unittests/tests-priority_pktqueue/tests-priority_pktqueue.c
+
27
−
13
View file @
f738cd27
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include
"embUnit.h"
#include
"embUnit.h"
#include
"net/gnrc/pkt.h"
#include
"net/gnrc/pkt.h"
#include
"net/gnrc/pktbuf.h"
#include
"net/gnrc/priority_pktqueue.h"
#include
"net/gnrc/priority_pktqueue.h"
#include
"unittests-constants.h"
#include
"unittests-constants.h"
...
@@ -31,6 +32,7 @@ static gnrc_priority_pktqueue_t pkt_queue;
...
@@ -31,6 +32,7 @@ static gnrc_priority_pktqueue_t pkt_queue;
static
void
set_up
(
void
)
static
void
set_up
(
void
)
{
{
pkt_queue
.
first
=
NULL
;
pkt_queue
.
first
=
NULL
;
gnrc_pktbuf_init
();
}
}
static
void
test_gnrc_priority_pktqueue_init
(
void
)
static
void
test_gnrc_priority_pktqueue_init
(
void
)
...
@@ -118,10 +120,15 @@ static void test_gnrc_priority_pktqueue_length(void)
...
@@ -118,10 +120,15 @@ static void test_gnrc_priority_pktqueue_length(void)
static
void
test_gnrc_priority_pktqueue_flush
(
void
)
static
void
test_gnrc_priority_pktqueue_flush
(
void
)
{
{
gnrc_pktsnip_t
pkt1
=
PKT_INIT_ELEM_STATIC_DATA
(
TEST_STRING8
,
NULL
);
gnrc_pktsnip_t
*
pkt1
=
gnrc_pktbuf_add
(
NULL
,
TEST_STRING8
,
sizeof
(
TEST_STRING8
),
gnrc_pktsnip_t
pkt2
=
PKT_INIT_ELEM_STATIC_DATA
(
TEST_STRING16
,
NULL
);
GNRC_NETTYPE_TEST
);
gnrc_priority_pktqueue_node_t
elem1
=
PRIORITY_PKTQUEUE_NODE_INIT
(
1
,
&
pkt1
);
gnrc_pktsnip_t
*
pkt2
=
gnrc_pktbuf_add
(
NULL
,
TEST_STRING16
,
sizeof
(
TEST_STRING16
),
gnrc_priority_pktqueue_node_t
elem2
=
PRIORITY_PKTQUEUE_NODE_INIT
(
0
,
&
pkt2
);
GNRC_NETTYPE_TEST
);
TEST_ASSERT_NOT_NULL
(
pkt1
);
TEST_ASSERT_NOT_NULL
(
pkt2
);
gnrc_priority_pktqueue_node_t
elem1
=
PRIORITY_PKTQUEUE_NODE_INIT
(
1
,
pkt1
);
gnrc_priority_pktqueue_node_t
elem2
=
PRIORITY_PKTQUEUE_NODE_INIT
(
0
,
pkt2
);
gnrc_priority_pktqueue_push
(
&
pkt_queue
,
&
elem1
);
gnrc_priority_pktqueue_push
(
&
pkt_queue
,
&
elem1
);
gnrc_priority_pktqueue_push
(
&
pkt_queue
,
&
elem2
);
gnrc_priority_pktqueue_push
(
&
pkt_queue
,
&
elem2
);
...
@@ -134,29 +141,36 @@ static void test_gnrc_priority_pktqueue_flush(void)
...
@@ -134,29 +141,36 @@ static void test_gnrc_priority_pktqueue_flush(void)
static
void
test_gnrc_priority_pktqueue_head
(
void
)
static
void
test_gnrc_priority_pktqueue_head
(
void
)
{
{
gnrc_pktsnip_t
pkt1
=
PKT_INIT_ELEM_STATIC_DATA
(
TEST_STRING8
,
NULL
);
gnrc_pktsnip_t
*
pkt1
=
gnrc_pktbuf_add
(
NULL
,
TEST_STRING8
,
sizeof
(
TEST_STRING8
),
gnrc_pktsnip_t
pkt2
=
PKT_INIT_ELEM_STATIC_DATA
(
TEST_STRING12
,
NULL
);
GNRC_NETTYPE_TEST
);
gnrc_pktsnip_t
pkt3
=
PKT_INIT_ELEM_STATIC_DATA
(
TEST_STRING16
,
NULL
);
gnrc_pktsnip_t
*
pkt2
=
gnrc_pktbuf_add
(
NULL
,
TEST_STRING12
,
sizeof
(
TEST_STRING12
),
gnrc_priority_pktqueue_node_t
elem1
=
PRIORITY_PKTQUEUE_NODE_INIT
(
1
,
&
pkt1
);
GNRC_NETTYPE_TEST
);
gnrc_priority_pktqueue_node_t
elem2
=
PRIORITY_PKTQUEUE_NODE_INIT
(
1
,
&
pkt2
);
gnrc_pktsnip_t
*
pkt3
=
gnrc_pktbuf_add
(
NULL
,
TEST_STRING16
,
sizeof
(
TEST_STRING16
),
gnrc_priority_pktqueue_node_t
elem3
=
PRIORITY_PKTQUEUE_NODE_INIT
(
0
,
&
pkt3
);
GNRC_NETTYPE_TEST
);
TEST_ASSERT_NOT_NULL
(
pkt1
);
TEST_ASSERT_NOT_NULL
(
pkt2
);
TEST_ASSERT_NOT_NULL
(
pkt3
);
gnrc_priority_pktqueue_node_t
elem1
=
PRIORITY_PKTQUEUE_NODE_INIT
(
1
,
pkt1
);
gnrc_priority_pktqueue_node_t
elem2
=
PRIORITY_PKTQUEUE_NODE_INIT
(
1
,
pkt2
);
gnrc_priority_pktqueue_node_t
elem3
=
PRIORITY_PKTQUEUE_NODE_INIT
(
0
,
pkt3
);
gnrc_pktsnip_t
*
head
=
gnrc_priority_pktqueue_head
(
&
pkt_queue
);
gnrc_pktsnip_t
*
head
=
gnrc_priority_pktqueue_head
(
&
pkt_queue
);
TEST_ASSERT_NULL
(
head
);
TEST_ASSERT_NULL
(
head
);
gnrc_priority_pktqueue_push
(
&
pkt_queue
,
&
elem1
);
gnrc_priority_pktqueue_push
(
&
pkt_queue
,
&
elem1
);
head
=
gnrc_priority_pktqueue_head
(
&
pkt_queue
);
head
=
gnrc_priority_pktqueue_head
(
&
pkt_queue
);
TEST_ASSERT
(
head
==
&
pkt1
);
TEST_ASSERT
(
head
==
pkt1
);
gnrc_priority_pktqueue_push
(
&
pkt_queue
,
&
elem2
);
gnrc_priority_pktqueue_push
(
&
pkt_queue
,
&
elem2
);
head
=
gnrc_priority_pktqueue_head
(
&
pkt_queue
);
head
=
gnrc_priority_pktqueue_head
(
&
pkt_queue
);
TEST_ASSERT
(
head
==
&
pkt1
);
TEST_ASSERT
(
head
==
pkt1
);
gnrc_priority_pktqueue_push
(
&
pkt_queue
,
&
elem3
);
gnrc_priority_pktqueue_push
(
&
pkt_queue
,
&
elem3
);
head
=
gnrc_priority_pktqueue_head
(
&
pkt_queue
);
head
=
gnrc_priority_pktqueue_head
(
&
pkt_queue
);
TEST_ASSERT
(
head
==
&
pkt3
);
TEST_ASSERT
(
head
==
pkt3
);
gnrc_priority_pktqueue_flush
(
&
pkt_queue
);
gnrc_priority_pktqueue_flush
(
&
pkt_queue
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment