diff --git a/utils/coverage.html b/utils/coverage.html deleted file mode 100644 index 13e5b1725..000000000 --- a/utils/coverage.html +++ /dev/null @@ -1,10990 +0,0 @@ - - - - - - utils: Go Coverage Report - - - -
- -
- not tracked - - not covered - covered - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - diff --git a/utils/slice_test.go b/utils/slice_test.go index cf46c8800..d28525646 100644 --- a/utils/slice_test.go +++ b/utils/slice_test.go @@ -91,6 +91,57 @@ func TestAvg(t *testing.T) { } } +func TestAvgNegative(t *testing.T) { + tests := []struct { + name string + args []float64 + want float64 + }{ + { + name: "no data", + args: []float64{}, + want: -1, + }, + { + name: "testing AvgNegative", + args: []float64{-1,0,4}, + want: 1, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := AvgNegative(tt.args); got != tt.want { + t.Errorf("AvgNegative() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestPrefixSliceItems(t *testing.T) { + type args struct { + slc []string + prfx string + } + tests := []struct { + name string + args args + wantOut []string + }{ + { + name: "testing PrefixSliceItems", + args: args{[]string{"test1", "test2"}, "!"}, + wantOut: []string{"!test1", "!test2"}, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if gotOut := PrefixSliceItems(tt.args.slc, tt.args.prfx); !reflect.DeepEqual(gotOut, tt.wantOut) { + t.Errorf("PrefixSliceItems() = %v, want %v", gotOut, tt.wantOut) + } + }) + } +} + func TestAvgEmpty(t *testing.T) { values := []float64{} result := Avg(values)