github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/twinj/uuid/struct_test.go (about) 1 package uuid 2 3 /**************** 4 * Date: 15/02/14 5 * Time: 12:26 PM 6 ***************/ 7 8 import ( 9 "testing" 10 ) 11 12 var struct_bytes = []byte{ 13 0xAA, 0xCF, 0xEE, 0x12, 14 0xD4, 0x00, 15 0x27, 0x23, 16 0x00, 17 0xD3, 18 0x23, 0x12, 0x4A, 0x11, 0x89, 0xFF, 19 } 20 21 func TestUUID_Struct_UnmarshalBinary(t *testing.T) { 22 u := new(Struct) 23 u.size = length 24 err := u.UnmarshalBinary([]byte{1, 2, 3, 4, 5}) 25 if err == nil { 26 t.Errorf("Expected error due to invalid byte length") 27 } 28 err = u.UnmarshalBinary(struct_bytes) 29 if err != nil { 30 t.Errorf("Expected bytes") 31 } 32 }