MCPcopy
hub / github.com/etcd-io/etcd / TestIntervalTreeStab

Function TestIntervalTreeStab

pkg/adt/interval_tree_test.go:290–307  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

288}
289
290func TestIntervalTreeStab(t *testing.T) {
291 ivt := NewIntervalTree()
292 ivt.Insert(NewStringInterval("0", "1"), 123)
293 ivt.Insert(NewStringInterval("0", "2"), 456)
294 ivt.Insert(NewStringInterval("5", "6"), 789)
295 ivt.Insert(NewStringInterval("6", "8"), 999)
296 ivt.Insert(NewStringInterval("0", "3"), 0)
297
298 tr := ivt.(*intervalTree)
299 require.Equalf(t, 0, tr.root.max.Compare(StringComparable("8")), "wrong root max got %v, expected 8", tr.root.max)
300 assert.Len(t, ivt.Stab(NewStringPoint("0")), 3)
301 assert.Len(t, ivt.Stab(NewStringPoint("1")), 2)
302 assert.Len(t, ivt.Stab(NewStringPoint("2")), 1)
303 assert.Empty(t, ivt.Stab(NewStringPoint("3")))
304 assert.Len(t, ivt.Stab(NewStringPoint("5")), 1)
305 assert.Len(t, ivt.Stab(NewStringPoint("55")), 1)
306 assert.Len(t, ivt.Stab(NewStringPoint("6")), 1)
307}
308
309type xy struct {
310 x int64

Callers

nothing calls this directly

Calls 9

InsertMethod · 0.95
StabMethod · 0.95
NewIntervalTreeFunction · 0.85
NewStringIntervalFunction · 0.85
StringComparableTypeAlias · 0.85
NewStringPointFunction · 0.85
CompareMethod · 0.65
LenMethod · 0.65
EmptyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…