github.com/jshiv/can-go@v0.2.1-0.20210224011015-069e90e90bdf/frame_test.go (about) 1 package can 2 3 import ( 4 "fmt" 5 "testing" 6 "unsafe" 7 8 "gotest.tools/v3/assert" 9 ) 10 11 // If this mocks ever starts failing, the documentation needs to be updated 12 // to prefer pass-by-pointer over pass-by-value. 13 func TestFrame_Size(t *testing.T) { 14 assert.Assert(t, unsafe.Sizeof(Frame{}) <= 16, "Frame size is <= 16 bytes") 15 } 16 17 func TestFrame_Validate_Error(t *testing.T) { 18 for _, tt := range []Frame{ 19 {ID: MaxID + 1}, 20 {ID: MaxExtendedID + 1, IsExtended: true}, 21 } { 22 tt := tt 23 t.Run(fmt.Sprintf("%v", tt), func(t *testing.T) { 24 assert.Check(t, tt.Validate() != nil, "should return validation error") 25 }) 26 } 27 }