fix: continued moving everything to orderedmaps plus cleaned up most the tests

This commit is contained in:
Tristan Cartledge
2023-12-01 17:37:07 +00:00
parent 0f3d0cb28f
commit a4ad09aab3
169 changed files with 3435 additions and 3764 deletions

View File

@@ -205,7 +205,7 @@ func TestTranslateMapParallel(t *testing.T) {
})
t.Run("nil", func(t *testing.T) {
var m orderedmap.Map[string, int]
var m *orderedmap.Map[string, int]
var translateCounter int64
translateFunc := func(pair orderedmap.Pair[string, int]) (string, error) {
atomic.AddInt64(&translateCounter, 1)
@@ -297,26 +297,6 @@ func TestTranslateMapParallel(t *testing.T) {
require.NoError(t, err)
assert.Less(t, resultCounter, mapSize)
})
t.Run("Continue in translate", func(t *testing.T) {
m := orderedmap.New[string, int]()
for i := 0; i < mapSize; i++ {
m.Set(fmt.Sprintf("key%d", i), i+1000)
}
var translateCounter int64
translateFunc := func(_ orderedmap.Pair[string, int]) (string, error) {
atomic.AddInt64(&translateCounter, 1)
return "", datamodel.Continue
}
resultFunc := func(_ string) error {
t.Fatal("Expected no call to resultFunc()")
return nil
}
err := datamodel.TranslateMapParallel[string, int, string](m, translateFunc, resultFunc)
require.NoError(t, err)
assert.Equal(t, int64(mapSize), translateCounter)
})
}
func TestTranslatePipeline(t *testing.T) {