diff --git a/pkg/digest/compare.go b/pkg/digest/compare.go index 390b446..1c466e3 100644 --- a/pkg/digest/compare.go +++ b/pkg/digest/compare.go @@ -7,31 +7,6 @@ import ( "sync" ) -// Compare compares two Digest maps and returns the additions and modification -// keys as arrays. -func Compare(baseDigest, newDigest map[uint64]uint64) (additions []uint64, modifications []uint64) { - maxSize := len(newDigest) - additions = make([]uint64, maxSize) - modifications = make([]uint64, maxSize) - - additionCounter := 0 - modificationCounter := 0 - for k, newVal := range newDigest { - if oldVal, present := baseDigest[k]; present { - if newVal != oldVal { - //Modifications - modifications[modificationCounter] = k - modificationCounter++ - } - } else { - //Additions - additions[additionCounter] = k - additionCounter++ - } - } - return additions[:additionCounter], modifications[:modificationCounter] -} - // Difference represents the additions and modifications // between the two Configs type Difference struct { diff --git a/pkg/digest/compare_test.go b/pkg/digest/compare_test.go index 45fff8e..3f94e29 100644 --- a/pkg/digest/compare_test.go +++ b/pkg/digest/compare_test.go @@ -8,29 +8,6 @@ import ( "github.com/stretchr/testify/assert" ) -func TestCompare(t *testing.T) { - baseDigest := map[uint64]uint64{ - 10000106069522789940: 11608188164212916000, - 10000305084889337335: 11796412213504516000, - 10024909476616779194: 14500526491611670000, - 1004896778135186857: 15778011848259830000, - } - - newDigest := map[uint64]uint64{ - 10000106069522789940: 11608188164212916000, - 10000305084889337335: 11796412213504516001, - 10049141081086325814: 12259600610026582000, - } - - additions, modifications := digest.Compare(baseDigest, newDigest) - - expectedAdditions := []uint64{10049141081086325814} - expectedModifications := []uint64{10000305084889337335} - - assert.Equal(t, expectedAdditions, additions) - assert.Equal(t, expectedModifications, modifications) -} - func TestDiff(t *testing.T) { base := `1,col-1,col-2,col-3,one-value 2,col-1,col-2,col-3,two-value