github.com/pavlo67/common@v0.5.3/common/mathlib/plane/contour_test.go (about) 1 package plane 2 3 //func TestContour_Shorten(t *testing.T) { 4 // tests := []struct { 5 // name string 6 // cntr Contour 7 // distanceMax float64 8 // want Contour 9 // }{ 10 // { 11 // name: "", 12 // cntr: Contour{{0, 0}, {1, 1}, {2, 2}, {3, 3}}, 13 // distanceMax: 10, 14 // want: nil, 15 // }, 16 // } 17 // for _, tt := range tests { 18 // t.Run(tt.name, func(t *testing.T) { 19 // if got := tt.cntr.Shorten(tt.distanceMax); !reflect.DeepEqual(got, tt.want) { 20 // t.Errorf("Shorten() = %v, want %v", got, tt.want) 21 // } 22 // }) 23 // } 24 //} 25 26 //func TestContour_ConvexHull(t *testing.T) { 27 // tests := []struct { 28 // name string 29 // cntr Contour 30 // want []image.Point 31 // }{ 32 // { 33 // name: "", 34 // cntr: Contour{{0, 0}, {1, 0}, {1, 1}}, 35 // want: []image.Point{{0, 0}, {1, 0}, {1, 1}}, 36 // }, 37 // { 38 // name: "", 39 // cntr: Contour{{0, 0}, {1, 1}, {1, 0}}, 40 // want: []image.Point{{0, 0}, {1, 0}, {1, 1}}, 41 // }, 42 // { 43 // name: "", 44 // cntr: Contour{{0, 0}, {1, 1}, {0.75, 0.5}, {1, 0}}, 45 // want: []image.Point{{0, 0}, {1, 0}, {1, 1}}, 46 // }, 47 // } 48 // for _, tt := range tests { 49 // t.Run(tt.name, func(t *testing.T) { 50 // got := tt.cntr.ConvexHull() 51 // sort.Slice(got, func(i, j int) bool { return got[i].X < got[j].X || (got[i].X == got[j].X && got[i].Y < got[j].Y) }) 52 // 53 // if !reflect.DeepEqual(got, tt.want) { 54 // t.Errorf("ConvexHull() = %v, want %v", got, tt.want) 55 // } 56 // }) 57 // } 58 //}