aboutsummaryrefslogtreecommitdiff
path: root/device/peer_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'device/peer_test.go')
-rw-r--r--device/peer_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/device/peer_test.go b/device/peer_test.go
index de87ab6..b389f1e 100644
--- a/device/peer_test.go
+++ b/device/peer_test.go
@@ -6,6 +6,7 @@
package device
import (
+ "reflect"
"testing"
"unsafe"
)
@@ -24,6 +25,19 @@ func checkAlignment(t *testing.T, name string, offset uintptr) {
// hard segfault at runtime.
func TestPeerAlignment(t *testing.T) {
var p Peer
+
+ typ := reflect.TypeOf(p)
+ t.Logf("Peer type size: %d, with fields:", typ.Size())
+ for i := 0; i < typ.NumField(); i++ {
+ field := typ.Field(i)
+ t.Logf("\t%30s\toffset=%3v\t(type size=%3d, align=%d)",
+ field.Name,
+ field.Offset,
+ field.Type.Size(),
+ field.Type.Align(),
+ )
+ }
+
checkAlignment(t, "Peer.stats", unsafe.Offsetof(p.stats))
checkAlignment(t, "Peer.isRunning", unsafe.Offsetof(p.isRunning))
}