Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bio-rd
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
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
danet
bio-rd
Commits
0e02198a
Commit
0e02198a
authored
6 years ago
by
Serge Bazanski
Browse files
Options
Downloads
Plain Diff
Merge branch 'feature/rs' of github.com:bio-routing/bio-rd into feature/rs
parents
11b291f6
11d02295
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
routingtable/adjRIBOut/path_id_manager_test.go
+0
-109
0 additions, 109 deletions
routingtable/adjRIBOut/path_id_manager_test.go
with
0 additions
and
109 deletions
routingtable/adjRIBOut/path_id_manager_test.go
deleted
100644 → 0
+
0
−
109
View file @
11b291f6
package
adjRIBOut
import
(
"testing"
"github.com/stretchr/testify/assert"
)
func
TestGetNewID
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
name
string
maxIDs
uint32
count
int
wantFail
bool
}{
{
name
:
"Out of path IDs"
,
maxIDs
:
10
,
count
:
11
,
wantFail
:
true
,
},
{
name
:
"Success"
,
maxIDs
:
10
,
count
:
10
,
wantFail
:
false
,
},
}
X
:
for
_
,
test
:=
range
tests
{
maxUint32
=
test
.
maxIDs
m
:=
newPathIDManager
()
for
i
:=
0
;
i
<
test
.
count
;
i
++
{
_
,
err
:=
m
.
getNewID
()
if
err
!=
nil
{
if
test
.
wantFail
{
continue
X
}
t
.
Errorf
(
"Unexpected failure for test %q: %v"
,
test
.
name
,
err
)
continue
X
}
}
if
test
.
wantFail
{
t
.
Errorf
(
"Unexpected success for test %q"
,
test
.
name
)
continue
}
}
}
func
TestReleaseID
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
name
string
pm
*
pathIDManager
release
uint32
expected
*
pathIDManager
}{
{
name
:
"Release existent"
,
pm
:
&
pathIDManager
{
ids
:
map
[
uint32
]
struct
{}{
0
:
struct
{}{},
1
:
struct
{}{},
2
:
struct
{}{},
},
last
:
2
,
used
:
3
,
},
release
:
1
,
expected
:
&
pathIDManager
{
ids
:
map
[
uint32
]
struct
{}{
0
:
struct
{}{},
2
:
struct
{}{},
},
last
:
2
,
used
:
2
,
},
},
{
name
:
"Release non-existent"
,
pm
:
&
pathIDManager
{
ids
:
map
[
uint32
]
struct
{}{
0
:
struct
{}{},
1
:
struct
{}{},
2
:
struct
{}{},
},
last
:
2
,
used
:
3
,
},
release
:
3
,
expected
:
&
pathIDManager
{
ids
:
map
[
uint32
]
struct
{}{
0
:
struct
{}{},
1
:
struct
{}{},
2
:
struct
{}{},
},
last
:
2
,
used
:
3
,
},
},
}
for
_
,
test
:=
range
tests
{
test
.
pm
.
releaseID
(
test
.
release
)
assert
.
Equalf
(
t
,
test
.
expected
,
test
.
pm
,
"%s"
,
test
.
name
)
}
}
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