Skip to content

Commit

Permalink
test dedupe
Browse files Browse the repository at this point in the history
  • Loading branch information
roelarents committed Jan 30, 2024
1 parent 206bf6c commit af2b5ce
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions snap/snap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,3 +633,38 @@ func TestSnap_ringContains(t *testing.T) {
})
}
}

func Test_kmpDeduplicate(t *testing.T) {
tests := []struct {
name string
ring [][2]float64
want [][2]float64
}{
{
name: "triangle should stay",
ring: [][2]float64{
{69951.68, 393649.6},
{69736.64, 393649.6},
{69736.64, 393434.56},
{69736.64, 393649.6},
{69521.6, 393649.6},
{69736.64, 393434.56},
{69736.64, 393649.6},
{69951.68, 393649.6},
},
want: [][2]float64{
{69951.68, 393649.6},
{69736.64, 393649.6},
{69521.6, 393649.6},
{69736.64, 393434.56},
{69736.64, 393649.6},
{69951.68, 393649.6},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
assert.Equalf(t, tt.want, kmpDeduplicate(tt.ring), "kmpDeduplicate(%v)", tt.ring)
})
}
}

0 comments on commit af2b5ce

Please sign in to comment.