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
be5dd81a
Commit
be5dd81a
authored
6 years ago
by
Martine Lenders
Committed by
Martine Lenders
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
tests/unittests: adapt rpl_srh tests for API change
parent
0a5ef011
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-gnrc_rpl_srh/tests-gnrc_rpl_srh.c
+15
-7
15 additions, 7 deletions
tests/unittests/tests-gnrc_rpl_srh/tests-gnrc_rpl_srh.c
with
15 additions
and
7 deletions
tests/unittests/tests-gnrc_rpl_srh/tests-gnrc_rpl_srh.c
+
15
−
7
View file @
be5dd81a
...
@@ -74,6 +74,7 @@ static void test_rpl_srh_dst_multicast(void)
...
@@ -74,6 +74,7 @@ static void test_rpl_srh_dst_multicast(void)
static
const
ipv6_addr_t
mcast
=
IPV6_MCAST_ADDR
;
static
const
ipv6_addr_t
mcast
=
IPV6_MCAST_ADDR
;
gnrc_rpl_srh_t
*
srh
;
gnrc_rpl_srh_t
*
srh
;
uint8_t
*
vec
;
uint8_t
*
vec
;
void
*
err_ptr
;
int
res
;
int
res
;
_init_hdrs
(
&
srh
,
&
vec
,
&
mcast
);
_init_hdrs
(
&
srh
,
&
vec
,
&
mcast
);
...
@@ -82,8 +83,9 @@ static void test_rpl_srh_dst_multicast(void)
...
@@ -82,8 +83,9 @@ static void test_rpl_srh_dst_multicast(void)
memcpy
(
vec
,
&
a1
,
sizeof
(
a1
));
memcpy
(
vec
,
&
a1
,
sizeof
(
a1
));
memcpy
(
vec
+
sizeof
(
a1
),
&
a2
,
sizeof
(
a2
));
memcpy
(
vec
+
sizeof
(
a1
),
&
a2
,
sizeof
(
a2
));
res
=
gnrc_rpl_srh_process
(
&
hdr
,
srh
);
res
=
gnrc_rpl_srh_process
(
&
hdr
,
srh
,
&
err_ptr
);
TEST_ASSERT_EQUAL_INT
(
res
,
GNRC_IPV6_EXT_RH_ERROR
);
TEST_ASSERT_EQUAL_INT
(
res
,
GNRC_IPV6_EXT_RH_ERROR
);
TEST_ASSERT
((
&
hdr
.
dst
)
==
err_ptr
);
}
}
static
void
test_rpl_srh_route_multicast
(
void
)
static
void
test_rpl_srh_route_multicast
(
void
)
...
@@ -93,6 +95,7 @@ static void test_rpl_srh_route_multicast(void)
...
@@ -93,6 +95,7 @@ static void test_rpl_srh_route_multicast(void)
static
const
ipv6_addr_t
dst
=
IPV6_DST
;
static
const
ipv6_addr_t
dst
=
IPV6_DST
;
gnrc_rpl_srh_t
*
srh
;
gnrc_rpl_srh_t
*
srh
;
uint8_t
*
vec
;
uint8_t
*
vec
;
void
*
err_ptr
;
int
res
;
int
res
;
_init_hdrs
(
&
srh
,
&
vec
,
&
dst
);
_init_hdrs
(
&
srh
,
&
vec
,
&
dst
);
...
@@ -101,8 +104,9 @@ static void test_rpl_srh_route_multicast(void)
...
@@ -101,8 +104,9 @@ static void test_rpl_srh_route_multicast(void)
memcpy
(
vec
,
&
mcast
,
sizeof
(
mcast
));
memcpy
(
vec
,
&
mcast
,
sizeof
(
mcast
));
memcpy
(
vec
+
sizeof
(
mcast
),
&
a1
,
sizeof
(
a1
));
memcpy
(
vec
+
sizeof
(
mcast
),
&
a1
,
sizeof
(
a1
));
res
=
gnrc_rpl_srh_process
(
&
hdr
,
srh
);
res
=
gnrc_rpl_srh_process
(
&
hdr
,
srh
,
&
err_ptr
);
TEST_ASSERT_EQUAL_INT
(
res
,
GNRC_IPV6_EXT_RH_ERROR
);
TEST_ASSERT_EQUAL_INT
(
res
,
GNRC_IPV6_EXT_RH_ERROR
);
TEST_ASSERT
(
vec
==
err_ptr
);
}
}
static
void
test_rpl_srh_too_many_seg_left
(
void
)
static
void
test_rpl_srh_too_many_seg_left
(
void
)
...
@@ -111,6 +115,7 @@ static void test_rpl_srh_too_many_seg_left(void)
...
@@ -111,6 +115,7 @@ static void test_rpl_srh_too_many_seg_left(void)
static
const
ipv6_addr_t
dst
=
IPV6_DST
;
static
const
ipv6_addr_t
dst
=
IPV6_DST
;
gnrc_rpl_srh_t
*
srh
;
gnrc_rpl_srh_t
*
srh
;
uint8_t
*
vec
;
uint8_t
*
vec
;
void
*
err_ptr
;
int
res
;
int
res
;
_init_hdrs
(
&
srh
,
&
vec
,
&
dst
);
_init_hdrs
(
&
srh
,
&
vec
,
&
dst
);
...
@@ -118,8 +123,9 @@ static void test_rpl_srh_too_many_seg_left(void)
...
@@ -118,8 +123,9 @@ static void test_rpl_srh_too_many_seg_left(void)
srh
->
seg_left
=
SRH_SEG_LEFT
;
srh
->
seg_left
=
SRH_SEG_LEFT
;
memcpy
(
vec
,
&
a1
,
sizeof
(
a1
));
memcpy
(
vec
,
&
a1
,
sizeof
(
a1
));
res
=
gnrc_rpl_srh_process
(
&
hdr
,
srh
);
res
=
gnrc_rpl_srh_process
(
&
hdr
,
srh
,
&
err_ptr
);
TEST_ASSERT_EQUAL_INT
(
res
,
GNRC_IPV6_EXT_RH_ERROR
);
TEST_ASSERT_EQUAL_INT
(
res
,
GNRC_IPV6_EXT_RH_ERROR
);
TEST_ASSERT
((
&
srh
->
seg_left
)
==
err_ptr
);
}
}
static
void
test_rpl_srh_nexthop_no_prefix_elided
(
void
)
static
void
test_rpl_srh_nexthop_no_prefix_elided
(
void
)
...
@@ -128,6 +134,7 @@ static void test_rpl_srh_nexthop_no_prefix_elided(void)
...
@@ -128,6 +134,7 @@ static void test_rpl_srh_nexthop_no_prefix_elided(void)
static
const
ipv6_addr_t
expected1
=
IPV6_ADDR1
,
expected2
=
IPV6_ADDR2
;
static
const
ipv6_addr_t
expected1
=
IPV6_ADDR1
,
expected2
=
IPV6_ADDR2
;
gnrc_rpl_srh_t
*
srh
;
gnrc_rpl_srh_t
*
srh
;
uint8_t
*
vec
;
uint8_t
*
vec
;
void
*
err_ptr
;
int
res
;
int
res
;
_init_hdrs
(
&
srh
,
&
vec
,
&
dst
);
_init_hdrs
(
&
srh
,
&
vec
,
&
dst
);
...
@@ -137,13 +144,13 @@ static void test_rpl_srh_nexthop_no_prefix_elided(void)
...
@@ -137,13 +144,13 @@ static void test_rpl_srh_nexthop_no_prefix_elided(void)
memcpy
(
vec
+
sizeof
(
a1
),
&
a2
,
sizeof
(
a2
));
memcpy
(
vec
+
sizeof
(
a1
),
&
a2
,
sizeof
(
a2
));
/* first hop */
/* first hop */
res
=
gnrc_rpl_srh_process
(
&
hdr
,
srh
);
res
=
gnrc_rpl_srh_process
(
&
hdr
,
srh
,
&
err_ptr
);
TEST_ASSERT_EQUAL_INT
(
res
,
GNRC_IPV6_EXT_RH_FORWARDED
);
TEST_ASSERT_EQUAL_INT
(
res
,
GNRC_IPV6_EXT_RH_FORWARDED
);
TEST_ASSERT_EQUAL_INT
(
SRH_SEG_LEFT
-
1
,
srh
->
seg_left
);
TEST_ASSERT_EQUAL_INT
(
SRH_SEG_LEFT
-
1
,
srh
->
seg_left
);
TEST_ASSERT
(
ipv6_addr_equal
(
&
hdr
.
dst
,
&
expected1
));
TEST_ASSERT
(
ipv6_addr_equal
(
&
hdr
.
dst
,
&
expected1
));
/* second hop */
/* second hop */
res
=
gnrc_rpl_srh_process
(
&
hdr
,
srh
);
res
=
gnrc_rpl_srh_process
(
&
hdr
,
srh
,
&
err_ptr
);
TEST_ASSERT_EQUAL_INT
(
res
,
GNRC_IPV6_EXT_RH_FORWARDED
);
TEST_ASSERT_EQUAL_INT
(
res
,
GNRC_IPV6_EXT_RH_FORWARDED
);
TEST_ASSERT_EQUAL_INT
(
SRH_SEG_LEFT
-
2
,
srh
->
seg_left
);
TEST_ASSERT_EQUAL_INT
(
SRH_SEG_LEFT
-
2
,
srh
->
seg_left
);
TEST_ASSERT
(
ipv6_addr_equal
(
&
hdr
.
dst
,
&
expected2
));
TEST_ASSERT
(
ipv6_addr_equal
(
&
hdr
.
dst
,
&
expected2
));
...
@@ -155,6 +162,7 @@ static void test_rpl_srh_nexthop_prefix_elided(void)
...
@@ -155,6 +162,7 @@ static void test_rpl_srh_nexthop_prefix_elided(void)
static
const
ipv6_addr_t
expected1
=
IPV6_ADDR1
,
expected2
=
IPV6_ADDR2
;
static
const
ipv6_addr_t
expected1
=
IPV6_ADDR1
,
expected2
=
IPV6_ADDR2
;
gnrc_rpl_srh_t
*
srh
;
gnrc_rpl_srh_t
*
srh
;
uint8_t
*
vec
;
uint8_t
*
vec
;
void
*
err_ptr
;
int
res
;
int
res
;
static
const
uint8_t
a1
[
3
]
=
IPV6_ADDR1_ELIDED
;
static
const
uint8_t
a1
[
3
]
=
IPV6_ADDR1_ELIDED
;
static
const
uint8_t
a2
[
3
]
=
IPV6_ADDR2_ELIDED
;
static
const
uint8_t
a2
[
3
]
=
IPV6_ADDR2_ELIDED
;
...
@@ -168,13 +176,13 @@ static void test_rpl_srh_nexthop_prefix_elided(void)
...
@@ -168,13 +176,13 @@ static void test_rpl_srh_nexthop_prefix_elided(void)
memcpy
(
vec
+
sizeof
(
a1
),
&
a2
,
sizeof
(
a2
));
memcpy
(
vec
+
sizeof
(
a1
),
&
a2
,
sizeof
(
a2
));
/* first hop */
/* first hop */
res
=
gnrc_rpl_srh_process
(
&
hdr
,
srh
);
res
=
gnrc_rpl_srh_process
(
&
hdr
,
srh
,
&
err_ptr
);
TEST_ASSERT_EQUAL_INT
(
res
,
GNRC_IPV6_EXT_RH_FORWARDED
);
TEST_ASSERT_EQUAL_INT
(
res
,
GNRC_IPV6_EXT_RH_FORWARDED
);
TEST_ASSERT_EQUAL_INT
(
SRH_SEG_LEFT
-
1
,
srh
->
seg_left
);
TEST_ASSERT_EQUAL_INT
(
SRH_SEG_LEFT
-
1
,
srh
->
seg_left
);
TEST_ASSERT
(
ipv6_addr_equal
(
&
hdr
.
dst
,
&
expected1
));
TEST_ASSERT
(
ipv6_addr_equal
(
&
hdr
.
dst
,
&
expected1
));
/* second hop */
/* second hop */
res
=
gnrc_rpl_srh_process
(
&
hdr
,
srh
);
res
=
gnrc_rpl_srh_process
(
&
hdr
,
srh
,
&
err_ptr
);
TEST_ASSERT_EQUAL_INT
(
res
,
GNRC_IPV6_EXT_RH_FORWARDED
);
TEST_ASSERT_EQUAL_INT
(
res
,
GNRC_IPV6_EXT_RH_FORWARDED
);
TEST_ASSERT_EQUAL_INT
(
SRH_SEG_LEFT
-
2
,
srh
->
seg_left
);
TEST_ASSERT_EQUAL_INT
(
SRH_SEG_LEFT
-
2
,
srh
->
seg_left
);
TEST_ASSERT
(
ipv6_addr_equal
(
&
hdr
.
dst
,
&
expected2
));
TEST_ASSERT
(
ipv6_addr_equal
(
&
hdr
.
dst
,
&
expected2
));
...
...
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