MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestNewPartialRanges_Nearest

Function TestNewPartialRanges_Nearest

internal/caches/partial_ranges_test.go:102–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

100}
101
102func TestNewPartialRanges_Nearest(t *testing.T) {
103 {
104 // nearby
105 var r = caches.NewPartialRanges(0)
106 r.Add(301, 400)
107 r.Add(401, 500)
108 r.Add(501, 600)
109
110 t.Log(r.Nearest(100, 200))
111 t.Log(r.Nearest(300, 350))
112 t.Log(r.Nearest(302, 350))
113 }
114
115 {
116 // nearby
117 var r = caches.NewPartialRanges(0)
118 r.Add(301, 400)
119 r.Add(450, 500)
120 r.Add(550, 600)
121
122 t.Log(r.Nearest(100, 200))
123 t.Log(r.Nearest(300, 350))
124 t.Log(r.Nearest(302, 350))
125 t.Log(r.Nearest(302, 440))
126 t.Log(r.Nearest(302, 1000))
127 }
128}
129
130func TestNewPartialRanges_Large_Range(t *testing.T) {
131 var a = assert.NewAssertion(t)

Callers

nothing calls this directly

Calls 4

NewPartialRangesFunction · 0.92
LogMethod · 0.80
NearestMethod · 0.80
AddMethod · 0.65

Tested by

no test coverage detected