@@ -31,7 +31,7 @@ func mkHash(i int) common.Hash {
3131}
3232
3333func TestBlobLru (t * testing.T ) {
34- lru := NewBlobLRU (100 )
34+ lru := NewBlobLRU [common. Hash , [] byte ] (100 )
3535 var want uint64
3636 // Add 11 items of 10 byte each. First item should be swapped out
3737 for i := 0 ; i < 11 ; i ++ {
@@ -49,16 +49,16 @@ func TestBlobLru(t *testing.T) {
4949 // Zero:th should be evicted
5050 {
5151 k := mkHash (0 )
52- if val := lru .Get (k ); val != nil {
52+ if _ , ok := lru .Get (k ); ok {
5353 t .Fatalf ("should be evicted: %v" , k )
5454 }
5555 }
5656 // Elems 1-11 should be present
5757 for i := 1 ; i < 11 ; i ++ {
5858 k := mkHash (i )
5959 want := fmt .Sprintf ("value-%04d" , i )
60- have := lru .Get (k )
61- if have == nil {
60+ have , ok := lru .Get (k )
61+ if ! ok {
6262 t .Fatalf ("missing key %v" , k )
6363 }
6464 if string (have ) != want {
@@ -70,7 +70,7 @@ func TestBlobLru(t *testing.T) {
7070// TestBlobLruOverflow tests what happens when inserting an element exceeding
7171// the max size
7272func TestBlobLruOverflow (t * testing.T ) {
73- lru := NewBlobLRU (100 )
73+ lru := NewBlobLRU [common. Hash , [] byte ] (100 )
7474 // Add 10 items of 10 byte each, filling the cache
7575 for i := 0 ; i < 10 ; i ++ {
7676 k := mkHash (i )
@@ -86,7 +86,7 @@ func TestBlobLruOverflow(t *testing.T) {
8686 // Elems 0-9 should be missing
8787 for i := 1 ; i < 10 ; i ++ {
8888 k := mkHash (i )
89- if val := lru .Get (k ); val != nil {
89+ if _ , ok := lru .Get (k ); ok {
9090 t .Fatalf ("should be evicted: %v" , k )
9191 }
9292 }
@@ -108,7 +108,7 @@ func TestBlobLruOverflow(t *testing.T) {
108108
109109// TestBlobLruSameItem tests what happens when inserting the same k/v multiple times.
110110func TestBlobLruSameItem (t * testing.T ) {
111- lru := NewBlobLRU (100 )
111+ lru := NewBlobLRU [common. Hash , [] byte ] (100 )
112112 // Add one 10 byte-item 10 times
113113 k := mkHash (0 )
114114 v := fmt .Sprintf ("value-%04d" , 0 )
0 commit comments