size_test.go
raw| 1 | package json |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | "unsafe" |
| 6 | |
| 7 | "github.com/goccy/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 != 128 { |
| 15 | t.Fatalf("unexpected opcode size: expected 128bytes but got %dbytes", size) |
| 16 | } |
| 17 | } |
| 18 | } |