This commit is contained in:
2026-06-05 19:43:01 +00:00
parent db5ecd3dfd
commit 05eea3b279
16 changed files with 1187 additions and 724 deletions

View File

@@ -3,14 +3,12 @@ package chunkenc
import (
"fmt"
"testing"
"gordenko.dev/dima/qb/conbuf"
)
func TestCumdelta(t *testing.T) {
var (
fracDigits byte = 0
buf = conbuf.New(nil)
buf = make([]byte, minBufferSize)
value float64
done bool
)
@@ -41,7 +39,7 @@ func TestCumdelta(t *testing.T) {
func TestInsdelta(t *testing.T) {
var (
fracDigits byte = 2
buf = conbuf.New(nil)
buf = make([]byte, minBufferSize)
value float64
done bool
)
@@ -70,7 +68,7 @@ func TestInsdelta(t *testing.T) {
func TestTimeDelta(t *testing.T) {
var (
buf = conbuf.New(nil)
buf = make([]byte, minBufferSize)
value uint32
done bool
)
@@ -120,7 +118,7 @@ func TestTimeDelta(t *testing.T) {
func TestCumdeltaBound(t *testing.T) {
var (
fracDigits byte = 0
buf = conbuf.New(nil)
buf = make([]byte, minBufferSize)
value float64
done bool
)
@@ -181,7 +179,7 @@ func TestCumdeltaBound(t *testing.T) {
func TestInsdeltaBound(t *testing.T) {
var (
fracDigits byte = 0
buf = conbuf.New(nil)
buf = make([]byte, minBufferSize)
value float64
done bool
)
@@ -241,7 +239,7 @@ func TestInsdeltaBound(t *testing.T) {
func TestInsdeltaBound2(t *testing.T) {
var (
fracDigits byte = 0
buf = conbuf.New(nil)
buf = make([]byte, minBufferSize)
value float64
done bool
)
@@ -297,3 +295,27 @@ func TestInsdeltaBound2(t *testing.T) {
fmt.Println(value, done)
}
}
func TestCap(t *testing.T) {
a := make([]byte, 0, 10)
fmt.Println("len:", len(a))
fmt.Println("cap:", cap(a))
a = append(a, 1)
fmt.Println("after append:")
fmt.Println("len:", len(a))
fmt.Println("cap:", cap(a))
fmt.Println("a:", a)
a[1] = 55
fmt.Println("after []:")
fmt.Println("len:", len(a))
fmt.Println("cap:", cap(a))
fmt.Println("a:", a)
a = append(a, 2)
fmt.Println("after 2nd append:")
fmt.Println("len:", len(a))
fmt.Println("cap:", cap(a))
fmt.Println("a:", a)
}