Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
41c71143
Commit
41c71143
authored
Jan 06, 2023
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more packetmap tests.
parent
774432bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
packetmap/packetmap_test.go
packetmap/packetmap_test.go
+53
-0
No files found.
packetmap/packetmap_test.go
View file @
41c71143
...
...
@@ -171,6 +171,59 @@ func TestWraparound(t *testing.T) {
uint16
(
i
-
2
),
1
,
ok
,
s
,
p
)
}
}
ok
,
s
,
p
=
m
.
Map
((
256000
&
0xFFFF
)
+
2
,
1
)
expect
:=
uint16
((
256000
)
&
0xFFFF
)
if
!
ok
||
s
!=
expect
||
p
!=
1
{
t
.
Errorf
(
"Expected %v, 1, got %v, %v, %v"
,
expect
,
ok
,
s
,
p
)
}
}
func
TestWraparoundDrop
(
t
*
testing
.
T
)
{
m
:=
Map
{}
ok
,
s
,
p
:=
m
.
Map
(
0
,
0
)
if
!
ok
||
s
!=
0
||
p
!=
0
{
t
.
Errorf
(
"Expected 0, 0, got %v, %v, %v"
,
ok
,
s
,
p
)
}
ok
,
s
,
p
=
m
.
Map
(
1
,
0
)
if
!
ok
||
s
!=
1
||
p
!=
0
{
t
.
Errorf
(
"Expected 1, 0, got %v, %v, %v"
,
ok
,
s
,
p
)
}
ok
=
m
.
Drop
(
2
,
1
)
if
!
ok
||
m
.
pidDelta
!=
1
{
t
.
Errorf
(
"Expected 1, got %v, %v"
,
ok
,
m
.
pidDelta
)
}
ok
=
m
.
Drop
(
3
,
1
)
if
!
ok
||
m
.
pidDelta
!=
1
{
t
.
Errorf
(
"Expected 1, got %v, %v"
,
ok
,
m
.
pidDelta
)
}
for
i
:=
4
;
i
<
256000
;
i
+=
3
{
ok
,
s
,
p
=
m
.
Map
(
uint16
(
i
),
uint16
((
i
/
2
)
&
0x7FFF
))
if
!
ok
||
s
!=
uint16
((
i
-
1
)
/
3
*
2
)
||
p
!=
1
{
t
.
Errorf
(
"Expected %v, %v, got %v, %v, %v"
,
uint16
((
i
-
1
)
/
3
*
2
),
1
,
ok
,
s
,
p
)
}
ok
,
s
,
p
=
m
.
Map
(
uint16
(
i
+
1
),
uint16
((
i
/
2
)
&
0x7FFF
))
if
!
ok
||
s
!=
uint16
((
i
-
1
)
/
3
*
2
+
1
)
||
p
!=
1
{
t
.
Errorf
(
"Expected %v, %v, got %v, %v, %v"
,
uint16
((
i
-
1
)
/
3
*
2
+
1
),
1
,
ok
,
s
,
p
)
}
ok
=
m
.
Drop
(
uint16
(
i
+
2
),
uint16
((
i
/
2
)
&
0x7FFF
))
if
!
ok
{
t
.
Errorf
(
"Expected ok"
)
}
}
ok
,
s
,
p
=
m
.
Map
((
256000
&
0xFFFF
)
+
4
,
0
)
expect
:=
uint16
(((
256000
-
1
)
/
3
*
2
+
4
)
&
0xFFFF
)
if
!
ok
||
s
!=
expect
||
p
!=
1
{
t
.
Errorf
(
"Expected %v, 1, got %v, %v, %v"
,
expect
,
ok
,
s
,
p
)
}
}
func
TestReset
(
t
*
testing
.
T
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment