mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-24 03:09:22 -06:00
fix prolly field tests
This commit is contained in:
@@ -16,6 +16,7 @@ package index
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/shopspring/decimal"
|
||||
"math"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -103,7 +104,7 @@ func TestRoundTripProllyFields(t *testing.T) {
|
||||
{
|
||||
name: "decimal",
|
||||
typ: val.Type{Enc: val.DecimalEnc},
|
||||
value: "0.263419374632932747932030573792",
|
||||
value: mustParseDecimal("0.263419374632932747932030573792"),
|
||||
},
|
||||
{
|
||||
name: "string",
|
||||
@@ -125,11 +126,11 @@ func TestRoundTripProllyFields(t *testing.T) {
|
||||
typ: val.Type{Enc: val.DateEnc},
|
||||
value: dateFromTime(time.Now().UTC()),
|
||||
},
|
||||
//{
|
||||
// name: "time",
|
||||
// typ: val.Type{Enc: val.DateEnc},
|
||||
// value: dateFromTime(time.Now().UTC()),
|
||||
//},
|
||||
{
|
||||
name: "time",
|
||||
typ: val.Type{Enc: val.TimeEnc},
|
||||
value: int64(123456),
|
||||
},
|
||||
{
|
||||
name: "datetime",
|
||||
typ: val.Type{Enc: val.DatetimeEnc},
|
||||
@@ -212,6 +213,14 @@ func mustParseJson(t *testing.T, s string) sql.JSONDocument {
|
||||
return sql.JSONDocument{Val: v}
|
||||
}
|
||||
|
||||
func mustParseDecimal(s string) decimal.Decimal {
|
||||
d, err := decimal.NewFromString(s)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
func dateFromTime(t time.Time) time.Time {
|
||||
y, m, d := t.Year(), t.Month(), t.Day()
|
||||
return time.Date(y, m, d, 0, 0, 0, 0, time.UTC)
|
||||
|
||||
Reference in New Issue
Block a user