Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
90059129
Unverified
Commit
90059129
authored
1 year ago
by
Sanghee Choi
Committed by
GitHub
1 year ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common/lru: add test case for BasicLRU.Peek (#27559)
parent
d7ea278f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
basiclru_test.go
common/lru/basiclru_test.go
+14
-0
No files found.
common/lru/basiclru_test.go
View file @
90059129
...
...
@@ -170,6 +170,20 @@ func TestBasicLRUContains(t *testing.T) {
}
}
// Test that Peek doesn't update recent-ness
func
TestBasicLRUPeek
(
t
*
testing
.
T
)
{
cache
:=
NewBasicLRU
[
int
,
int
](
2
)
cache
.
Add
(
1
,
1
)
cache
.
Add
(
2
,
2
)
if
v
,
ok
:=
cache
.
Peek
(
1
);
!
ok
||
v
!=
1
{
t
.
Errorf
(
"1 should be set to 1"
)
}
cache
.
Add
(
3
,
3
)
if
cache
.
Contains
(
1
)
{
t
.
Errorf
(
"should not have updated recent-ness of 1"
)
}
}
func
BenchmarkLRU
(
b
*
testing
.
B
)
{
var
(
capacity
=
1000
...
...
This diff is collapsed.
Click to expand it.
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