mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-31 15:06:26 +00:00
wip
This commit is contained in:
parent
164705cf20
commit
3010034c7a
1 changed files with 10 additions and 4 deletions
|
@ -11,8 +11,8 @@ func TestArena(t *testing.T) {
|
||||||
|
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
a := getArena()
|
a := getArena()
|
||||||
if n := a.sizeBytes(); n != 0 {
|
if n := len(a.b); n != 0 {
|
||||||
t.Fatalf("unexpected non-zero size of empty arena: %d", n)
|
t.Fatalf("unexpected non-zero length of empty arena: %d", n)
|
||||||
}
|
}
|
||||||
|
|
||||||
// add values to arena
|
// add values to arena
|
||||||
|
@ -35,9 +35,12 @@ func TestArena(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if n := a.sizeBytes(); n < valuesLen {
|
if n := len(a.b); n != valuesLen {
|
||||||
t.Fatalf("unexpected arena size; got %d; want %d", n, valuesLen)
|
t.Fatalf("unexpected arena size; got %d; want %d", n, valuesLen)
|
||||||
}
|
}
|
||||||
|
if n := a.sizeBytes(); n < valuesLen {
|
||||||
|
t.Fatalf("unexpected arena capacity; got %d; want at least %d", n, valuesLen)
|
||||||
|
}
|
||||||
|
|
||||||
// Try allocating slices with different lengths
|
// Try allocating slices with different lengths
|
||||||
bs := make([]string, 100)
|
bs := make([]string, 100)
|
||||||
|
@ -47,9 +50,12 @@ func TestArena(t *testing.T) {
|
||||||
t.Fatalf("unexpected len(b); got %d; want %d", len(b), j)
|
t.Fatalf("unexpected len(b); got %d; want %d", len(b), j)
|
||||||
}
|
}
|
||||||
valuesLen += j
|
valuesLen += j
|
||||||
if n := a.sizeBytes(); n < valuesLen {
|
if n := len(a.b); n != valuesLen {
|
||||||
t.Fatalf("unexpected arena size; got %d; want %d", n, valuesLen)
|
t.Fatalf("unexpected arena size; got %d; want %d", n, valuesLen)
|
||||||
}
|
}
|
||||||
|
if n := a.sizeBytes(); n < valuesLen {
|
||||||
|
t.Fatalf("unexpected arena capacity; got %d; want at least %d", n, valuesLen)
|
||||||
|
}
|
||||||
for k := range b {
|
for k := range b {
|
||||||
b[k] = byte(k)
|
b[k] = byte(k)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue