github.com/igoogolx/clash@v1.19.8/component/process/process_freebsd_test.go (about) 1 //go:build freebsd 2 3 package process 4 5 import ( 6 "testing" 7 "unsafe" 8 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestEnforceStructValid12(t *testing.T) { 13 if majorVersion != 12 && majorVersion != 13 { 14 t.Skipf("Unsupported freebsd version: %d", majorVersion) 15 16 return 17 } 18 19 assert.Equal(t, 0, int(unsafe.Offsetof(XTcpcb12{}.Len))) 20 assert.Equal(t, 24, int(unsafe.Offsetof(XTcpcb12{}.SocketAddr))) 21 assert.Equal(t, 116, int(unsafe.Offsetof(XTcpcb12{}.Family))) 22 assert.Equal(t, 260, int(unsafe.Offsetof(XTcpcb12{}.InEndpoints))) 23 assert.Equal(t, 0, int(unsafe.Offsetof(XInpcb12{}.Len))) 24 assert.Equal(t, 16, int(unsafe.Offsetof(XInpcb12{}.SocketAddr))) 25 assert.Equal(t, 108, int(unsafe.Offsetof(XInpcb12{}.Family))) 26 assert.Equal(t, 252, int(unsafe.Offsetof(XInpcb12{}.InEndpoints))) 27 assert.Equal(t, 0, int(unsafe.Offsetof(XFile12{}.Size))) 28 assert.Equal(t, 8, int(unsafe.Offsetof(XFile12{}.Pid))) 29 assert.Equal(t, 56, int(unsafe.Offsetof(XFile12{}.DataAddr))) 30 assert.Equal(t, 64, int(unsafe.Sizeof(Xinpgen12{}))) 31 assert.Equal(t, 744, int(unsafe.Sizeof(XTcpcb12{}))) 32 assert.Equal(t, 400, int(unsafe.Sizeof(XInpcb12{}))) 33 assert.Equal(t, 40, int(unsafe.Sizeof(InEndpoints12{}))) 34 assert.Equal(t, 128, int(unsafe.Sizeof(XFile12{}))) 35 }