...
1
2
3
4
5 package ssa
6
7 import (
8 "reflect"
9 "testing"
10 "unsafe"
11 )
12
13
14
15 func TestSizeof(t *testing.T) {
16 const _64bit = unsafe.Sizeof(uintptr(0)) == 8
17
18 var tests = []struct {
19 val interface{}
20 _32bit uintptr
21 _64bit uintptr
22 }{
23 {Value{}, 72, 112},
24 {Block{}, 164, 304},
25 {LocalSlot{}, 28, 40},
26 {valState{}, 28, 40},
27 }
28
29 for _, tt := range tests {
30 want := tt._32bit
31 if _64bit {
32 want = tt._64bit
33 }
34 got := reflect.TypeOf(tt.val).Size()
35 if want != got {
36 t.Errorf("unsafe.Sizeof(%T) = %d, want %d", tt.val, got, want)
37 }
38 }
39 }
40
View as plain text