"strings"
"testing"
"time"
+ "unsafe"
)
var doFuzzTests = flag.Bool("gob.fuzz", false, "run the fuzz tests, which are large and very slow")
func TestLargeSlice(t *testing.T) {
t.Run("byte", func(t *testing.T) {
- t.Parallel()
+ if unsafe.Sizeof(uintptr(0)) > 4 {
+ t.Parallel() // Only run in parallel in a large address space
+ }
s := make([]byte, 10<<21)
for i := range s {
s[i] = byte(i)
testEncodeDecode(t, st, rt)
})
t.Run("int8", func(t *testing.T) {
- t.Parallel()
+ if unsafe.Sizeof(uintptr(0)) > 4 {
+ t.Parallel()
+ }
s := make([]int8, 10<<21)
for i := range s {
s[i] = int8(i)
testEncodeDecode(t, st, rt)
})
t.Run("struct", func(t *testing.T) {
- t.Parallel()
+ if unsafe.Sizeof(uintptr(0)) > 4 {
+ t.Parallel()
+ }
s := make([]StringPair, 1<<21)
for i := range s {
s[i].A = string(rune(i))
testEncodeDecode(t, st, rt)
})
t.Run("string", func(t *testing.T) {
- t.Parallel()
+ if unsafe.Sizeof(uintptr(0)) > 4 {
+ t.Parallel()
+ }
s := make([]string, 1<<21)
for i := range s {
s[i] = string(rune(i))