github.com/grbit/go-json@v0.11.0/size_test.go (about)

     1  package json
     2  
     3  import (
     4  	"testing"
     5  	"unsafe"
     6  
     7  	"github.com/grbit/go-json/internal/encoder"
     8  )
     9  
    10  func TestOpcodeSize(t *testing.T) {
    11  	const uintptrSize = 4 << (^uintptr(0) >> 63)
    12  	if uintptrSize == 8 {
    13  		size := unsafe.Sizeof(encoder.Opcode{})
    14  		if size != 120 {
    15  			t.Fatalf("unexpected opcode size: expected 112bytes but got %dbytes", size)
    16  		}
    17  	}
    18  }