mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-07 19:37:51 +00:00
add unit test
we can avoid regressions with a simple unit test that checks that timestamp ValCounts have the appropriate values in comparisons
This commit is contained in:
parent
8f85a9e88d
commit
0adfa75188
2 changed files with 15 additions and 1 deletions
|
|
@ -1157,7 +1157,6 @@ func (e *executor) executeMin(ctx context.Context, qcx *Qcx, index string, c *pq
|
|||
if other.Count == 0 {
|
||||
return ValCount{}, nil
|
||||
}
|
||||
|
||||
return other, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import (
|
|||
"reflect"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/molecula/featurebase/v2/pql"
|
||||
"github.com/molecula/featurebase/v2/testhook"
|
||||
|
|
@ -301,6 +302,20 @@ func TestValCountComparisons(t *testing.T) {
|
|||
expLarger: ValCount{FloatVal: 10.7, Count: 3},
|
||||
expSmaller: ValCount{FloatVal: 10.7, Count: 3},
|
||||
},
|
||||
{
|
||||
name: "timestampEquality",
|
||||
vc: ValCount{Val: -17782800, TimestampVal: time.Unix(0, -17782800*int64(time.Second)), Count: 1},
|
||||
other: ValCount{Val: -17782800, TimestampVal: time.Unix(0, -17782800*int64(time.Second)), Count: 1},
|
||||
expLarger: ValCount{Val: -17782800, TimestampVal: time.Unix(0, -17782800*int64(time.Second)), Count: 2},
|
||||
expSmaller: ValCount{Val: -17782800, TimestampVal: time.Unix(0, -17782800*int64(time.Second)), Count: 2},
|
||||
},
|
||||
{
|
||||
name: "timestamp",
|
||||
vc: ValCount{Val: -17782800, TimestampVal: time.Unix(0, -17782800*int64(time.Second)), Count: 1},
|
||||
other: ValCount{Val: 1587399600, TimestampVal: time.Unix(0, 1587399600*int64(time.Second)), Count: 1},
|
||||
expLarger: ValCount{Val: 1587399600, TimestampVal: time.Unix(0, 1587399600*int64(time.Second)), Count: 1},
|
||||
expSmaller: ValCount{Val: -17782800, TimestampVal: time.Unix(0, -17782800*int64(time.Second)), Count: 1},
|
||||
},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue