MCPcopy Create free account
hub / github.com/elliotchance/orderedmap / TestIterations

Function TestIterations

v2/orderedmap_test.go:332–352  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

330}
331
332func TestIterations(t *testing.T) {
333 type Element struct {
334 Key int
335 Value bool
336 }
337 t.Run("FourBoolElements", func(t *testing.T) {
338 m := orderedmap.NewOrderedMap[int, bool]()
339 expected := []Element{{5, true}, {3, false}, {1, false}, {4, true}}
340 for _, v := range expected {
341 m.Set(v.Key, v.Value)
342 }
343 element := m.Front()
344 for i := 0; i < len(expected); i++ {
345 assert.NotNil(t, element)
346 assert.Equal(t, expected[i].Key, element.Key)
347 assert.Equal(t, expected[i].Value, element.Value)
348 element = element.Next()
349 }
350 assert.Nil(t, element)
351 })
352}
353
354func TestOrderedMap_Has(t *testing.T) {
355 t.Run("ReturnsFalseIfKeyDoesNotExist", func(t *testing.T) {

Callers

nothing calls this directly

Calls 3

SetMethod · 0.95
FrontMethod · 0.95
NextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…