Update encoding test to work with new interface.
parent
318bc7281d
commit
95f9e1619e
|
@ -2,31 +2,30 @@ package pd1_test
|
|||
|
||||
import (
|
||||
// "math/rand"
|
||||
// "reflect"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
// "github.com/influxdb/influxdb/tsdb/engine/pd1"
|
||||
"github.com/influxdb/influxdb/tsdb/engine/pd1"
|
||||
)
|
||||
|
||||
func TestEncoding_FloatBlock(t *testing.T) {
|
||||
// valueCount := 100
|
||||
// times := getTimes(valueCount, 60, time.Second)
|
||||
// values := make([]Value, len(times))
|
||||
// for i, t := range times {
|
||||
// values[i] = pd1.NewValue(t, rand.Float64())
|
||||
// }
|
||||
valueCount := 1000
|
||||
times := getTimes(valueCount, 60, time.Second)
|
||||
values := make(pd1.Values, len(times))
|
||||
for i, t := range times {
|
||||
values[i] = pd1.NewValue(t, float64(i))
|
||||
}
|
||||
|
||||
// b := pd1.EncodeFloatBlock(nil, values)
|
||||
b := values.Encode(nil)
|
||||
fmt.Println("**** ", len(b))
|
||||
|
||||
// decodedValues, err := pd1.DecodeFloatBlock(b)
|
||||
// if err != nil {
|
||||
// t.Fatalf("error decoding: %s", err.Error)
|
||||
// }
|
||||
decodedValues := values.DecodeSameTypeBlock(b)
|
||||
|
||||
// if !reflect.DeepEqual(decodedValues, values) {
|
||||
// t.Fatalf("unexpected results:\n\tgot: %v\n\texp: %v\n", decodedValues, values)
|
||||
// }
|
||||
if !reflect.DeepEqual(decodedValues, values) {
|
||||
t.Fatalf("unexpected results:\n\tgot: %v\n\texp: %v\n", decodedValues, values)
|
||||
}
|
||||
}
|
||||
|
||||
func getTimes(n, step int, precision time.Duration) []time.Time {
|
||||
|
|
Loading…
Reference in New Issue