1 // Copyright 2021 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
12 // Signal size changes of important structures.
13 func TestSizeof(t *testing.T) {
14 const _64bit = ^uint(0)>>32 != 0
16 var tests = []struct {
17 val any // type as a value
18 _32bit uintptr // size on 32bit platforms
19 _64bit uintptr // size on 64bit platforms
28 {Signature{}, 28, 56},
30 {Interface{}, 40, 80},
34 {TypeParam{}, 28, 48},
52 for _, test := range tests {
53 got := reflect.TypeOf(test.val).Size()
59 t.Errorf("unsafe.Sizeof(%T) = %d, want %d", test.val, got, want)