1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
/*
* SPDX-FileCopyrightText: © Hypermode Inc. <hello@hypermode.com>
* SPDX-License-Identifier: Apache-2.0
*/
package badger
import (
"math"
"reflect"
"testing"
"github.com/stretchr/testify/require"
)
// Regression test for github.com/hypermodeinc/badger/pull/1800
func TestLargeEncode(t *testing.T) {
var headerEnc [maxHeaderSize]byte
h := header{math.MaxUint32, math.MaxUint32, math.MaxUint64, math.MaxUint8, math.MaxUint8}
require.NotPanics(t, func() { _ = h.Encode(headerEnc[:]) })
}
func TestNumFieldsHeader(t *testing.T) {
// maxHeaderSize must correspond with any changes made to header
require.Equal(t, 5, reflect.TypeOf(header{}).NumField())
}
|