add new test to account for int64 nth values

This commit is contained in:
Maxton Huff 2021-03-26 13:01:31 -05:00
parent 8746444cdb
commit 87412068f1

View file

@ -7127,9 +7127,9 @@ func variousQueriesOnPercentiles(t *testing.T, c *test.Cluster) {
}
// generate test cases per each nth argument
nths := []float64{0.0, 10, 25, 50, 75, 90, 99}
nthsFloat := []float64{0, 10, 25, 50, 75, 90, 99}
var tests []testCase
for _, nth := range nths {
for _, nth := range nthsFloat {
query := fmt.Sprintf(`Percentile(field="net_worth", filter=Row(val="foo"), nth=%f)`, nth)
expectedPercentile := getExpectedPercentile(nums, nth)
tests = append(tests, testCase{
@ -7137,6 +7137,15 @@ func variousQueriesOnPercentiles(t *testing.T, c *test.Cluster) {
csvVerifier: fmt.Sprintf("%d,1\n", expectedPercentile),
})
}
nthsInt := []int64{0, 10, 25, 50, 75, 90, 99}
for _, nth := range nthsInt {
query := fmt.Sprintf(`Percentile(field="net_worth", filter=Row(val="foo"), nth=%d)`, nth)
expectedPercentile := getExpectedPercentile(nums, float64(nth))
tests = append(tests, testCase{
query: query,
csvVerifier: fmt.Sprintf("%d,1\n", expectedPercentile),
})
}
for i, tst := range tests {
t.Run(fmt.Sprintf("%d-%s", i, tst.query), func(t *testing.T) {