feat: Add min and max and try to improve the performance
This commit is contained in:
@@ -23,11 +23,13 @@ func TestOperations(t *testing.T) {
|
||||
}{
|
||||
{"Sum", sum, []float64{300, 85.927, -30, 436}},
|
||||
{"Avg", avg, []float64{37.5, 6.609769230769231, -15, 72.666666666666666}},
|
||||
{"Min", min, []float64{10, 2.2, -20, 37}},
|
||||
{"Max", max, []float64{100, 12.287, -10, 129}},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
for k, exp := range tc.exp {
|
||||
name := fmt.Sprintf("%sData%d", tc.name, k)
|
||||
name := fmt.Sprintf("%s Data %d", tc.name, k)
|
||||
t.Run(name, func(t *testing.T) {
|
||||
res := tc.op(data[k])
|
||||
// comparing floats might not be the best solution
|
||||
|
||||
Reference in New Issue
Block a user