1 // Copyright 2018 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.
14 // Assert that the size of important structures do not change unexpectedly.
16 func TestSizeof(t *testing.T) {
17 const _64bit = unsafe.Sizeof(uintptr(0)) == 8
19 var tests = []struct {
20 val interface{} // type as a value
21 _32bit uintptr // size on 32bit platforms
22 _64bit uintptr // size on 64bit platforms
24 {runtime.G{}, 216, 376}, // g, but exported for testing
27 for _, tt := range tests {
32 got := reflect.TypeOf(tt.val).Size()
34 t.Errorf("unsafe.Sizeof(%T) = %d, want %d", tt.val, got, want)