Unit testing for def/ module.

Added unit tests to test code in def/ module.
This commit is contained in:
Pradyumna Kaushik 2019-10-12 06:48:45 +00:00
parent e24b8a08c9
commit bac60e872a
396 changed files with 83991 additions and 13209 deletions

View file

@ -1,12 +1,14 @@
package stats
import "math"
import (
"math"
)
// Percentile finds the relative standing in a slice of floats
func Percentile(input Float64Data, percent float64) (percentile float64, err error) {
if input.Len() == 0 {
return math.NaN(), EmptyInput
return math.NaN(), EmptyInputErr
}
if percent <= 0 || percent > 100 {
@ -52,7 +54,7 @@ func PercentileNearestRank(input Float64Data, percent float64) (percentile float
// Return an error for empty slices
if il == 0 {
return math.NaN(), EmptyInput
return math.NaN(), EmptyInputErr
}
// Return error for less than 0 or greater than 100 percentages