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
a0067b92
Commit
a0067b92
authored
6 years ago
by
Martine Lenders
Browse files
Options
Downloads
Patches
Plain Diff
tests/unittests: provide tests for gnrc_pkt_len_upto()
parent
21202e7e
No related branches found
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-pkt/tests-pkt.c
+29
-0
29 additions, 0 deletions
tests/unittests/tests-pkt/tests-pkt.c
with
29 additions
and
0 deletions
tests/unittests/tests-pkt/tests-pkt.c
+
29
−
0
View file @
a0067b92
...
@@ -92,6 +92,32 @@ static void test_pkt_len__3_elem(void)
...
@@ -92,6 +92,32 @@ static void test_pkt_len__3_elem(void)
TEST_ASSERT_EQUAL_INT
(
sizeof
(
TEST_STRING8
)
+
sizeof
(
TEST_STRING12
),
gnrc_pkt_len
(
&
snip2
));
TEST_ASSERT_EQUAL_INT
(
sizeof
(
TEST_STRING8
)
+
sizeof
(
TEST_STRING12
),
gnrc_pkt_len
(
&
snip2
));
TEST_ASSERT_EQUAL_INT
(
sizeof
(
TEST_STRING8
),
gnrc_pkt_len
(
&
snip1
));
TEST_ASSERT_EQUAL_INT
(
sizeof
(
TEST_STRING8
),
gnrc_pkt_len
(
&
snip1
));
}
}
static
void
test_pkt_len_upto__NULL
(
void
)
{
TEST_ASSERT_EQUAL_INT
(
0
,
gnrc_pkt_len_upto
(
NULL
,
GNRC_NETTYPE_TEST
));
}
static
void
test_pkt_len_upto__not_in_list
(
void
)
{
gnrc_pktsnip_t
snip1
=
_INIT_ELEM_STATIC_DATA
(
TEST_STRING8
,
NULL
);
gnrc_pktsnip_t
snip2
=
_INIT_ELEM_STATIC_DATA
(
TEST_STRING12
,
&
snip1
);
gnrc_pktsnip_t
snip3
=
_INIT_ELEM
(
sizeof
(
"a"
),
"a"
,
&
snip2
);
TEST_ASSERT_EQUAL_INT
(
sizeof
(
TEST_STRING8
)
+
sizeof
(
TEST_STRING12
)
+
sizeof
(
"a"
),
gnrc_pkt_len_upto
(
&
snip3
,
GNRC_NETTYPE_TEST
));
}
static
void
test_pkt_len_upto__in_list
(
void
)
{
gnrc_pktsnip_t
snip1
=
_INIT_ELEM_STATIC_DATA
(
TEST_STRING8
,
NULL
);
gnrc_pktsnip_t
snip2
=
_INIT_ELEM_STATIC_TYPE
(
GNRC_NETTYPE_TEST
,
&
snip1
);
gnrc_pktsnip_t
snip3
=
_INIT_ELEM
(
sizeof
(
"a"
),
"a"
,
&
snip2
);
TEST_ASSERT_EQUAL_INT
(
sizeof
(
"a"
),
gnrc_pkt_len_upto
(
&
snip3
,
GNRC_NETTYPE_TEST
));
}
static
void
test_pkt_count__1_elem
(
void
)
static
void
test_pkt_count__1_elem
(
void
)
{
{
gnrc_pktsnip_t
snip1
=
_INIT_ELEM_STATIC_DATA
(
TEST_STRING8
,
NULL
);
gnrc_pktsnip_t
snip1
=
_INIT_ELEM_STATIC_DATA
(
TEST_STRING8
,
NULL
);
...
@@ -179,6 +205,9 @@ Test *tests_pkt_tests(void)
...
@@ -179,6 +205,9 @@ Test *tests_pkt_tests(void)
new_TestFixture
(
test_pkt_len__2_elem
),
new_TestFixture
(
test_pkt_len__2_elem
),
new_TestFixture
(
test_pkt_len__2_elem__overflow
),
new_TestFixture
(
test_pkt_len__2_elem__overflow
),
new_TestFixture
(
test_pkt_len__3_elem
),
new_TestFixture
(
test_pkt_len__3_elem
),
new_TestFixture
(
test_pkt_len_upto__NULL
),
new_TestFixture
(
test_pkt_len_upto__not_in_list
),
new_TestFixture
(
test_pkt_len_upto__in_list
),
new_TestFixture
(
test_pkt_count__1_elem
),
new_TestFixture
(
test_pkt_count__1_elem
),
new_TestFixture
(
test_pkt_count__5_elem
),
new_TestFixture
(
test_pkt_count__5_elem
),
new_TestFixture
(
test_pkt_count__null
),
new_TestFixture
(
test_pkt_count__null
),
...
...
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