Skip to content

Commit

Permalink
Added Example test matchin the diag
Browse files Browse the repository at this point in the history
  • Loading branch information
yogeshbdeshpande committed Dec 1, 2021
1 parent 360edfb commit 4c5ef96
Showing 1 changed file with 14 additions and 62 deletions.
76 changes: 14 additions & 62 deletions comid/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,69 +590,21 @@ func Example_decode_CBOR_4() {
}

func Example_decode_CBOR_5() {
// Taken from https://github.com/ietf-corim-cddl/blob/main/examples/comid-2.diag
// Taken from https://github.com/ietf-corim-cddl/blob/main/examples/comid-3.diag
in := []byte{
0xa5, 0x00, 0x65, 0x65, 0x6e, 0x2d, 0x47, 0x42, 0x01, 0xa1, 0x00, 0x78,
0x20, 0x6d, 0x79, 0x2d, 0x6e, 0x73, 0x3a, 0x61, 0x63, 0x6d, 0x65, 0x2d,
0x72, 0x6f, 0x61, 0x64, 0x72, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x2d, 0x73,
0x75, 0x70, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x02, 0x82, 0xa3,
0x00, 0x69, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x4c, 0x74, 0x64, 0x2e, 0x01,
0xd8, 0x20, 0x74, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x61,
0x63, 0x6d, 0x65, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x02,
0x82, 0x01, 0x00, 0xa2, 0x00, 0x69, 0x45, 0x4d, 0x43, 0x41, 0x20, 0x4c,
0x74, 0x64, 0x2e, 0x02, 0x81, 0x02, 0x03, 0x82, 0xa2, 0x00, 0x78, 0x1a,
0x6d, 0x79, 0x2d, 0x6e, 0x73, 0x3a, 0x61, 0x63, 0x6d, 0x65, 0x2d, 0x72,
0x6f, 0x61, 0x64, 0x72, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x2d, 0x62, 0x61,
0x73, 0x65, 0x01, 0x00, 0xa2, 0x00, 0x78, 0x19, 0x6d, 0x79, 0x2d, 0x6e,
0x73, 0x3a, 0x61, 0x63, 0x6d, 0x65, 0x2d, 0x72, 0x6f, 0x61, 0x64, 0x72,
0x75, 0x6e, 0x6e, 0x65, 0x72, 0x2d, 0x6f, 0x6c, 0x64, 0x01, 0x01, 0x04,
0xa4, 0x00, 0x81, 0x82, 0xa3, 0x00, 0xa5, 0x00, 0xd8, 0x6f, 0x44, 0x55,
0x02, 0xc0, 0x00, 0x01, 0x69, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x4c, 0x74,
0x64, 0x2e, 0x02, 0x6a, 0x52, 0x6f, 0x61, 0x64, 0x52, 0x75, 0x6e, 0x6e,
0x65, 0x72, 0x03, 0x00, 0x04, 0x01, 0x01, 0xd9, 0x02, 0x26, 0x47, 0x02,
0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0x02, 0xd8, 0x25, 0x50, 0x31, 0xfb,
0x5a, 0xbf, 0x02, 0x3e, 0x49, 0x92, 0xaa, 0x4e, 0x95, 0xf9, 0xc1, 0x50,
0x3b, 0xfa, 0x81, 0xa2, 0x00, 0x18, 0x2d, 0x01, 0xaa, 0x01, 0xd9, 0x02,
0x28, 0x02, 0x02, 0x82, 0x82, 0x06, 0x44, 0xab, 0xcd, 0xef, 0x00, 0x82,
0x06, 0x44, 0xff, 0xff, 0xff, 0xff, 0x03, 0x0a, 0x04, 0xd9, 0x02, 0x30,
0x44, 0x01, 0x02, 0x03, 0x04, 0x05, 0x44, 0xff, 0xff, 0xff, 0xff, 0x06,
0x48, 0x02, 0x00, 0x5e, 0x10, 0x00, 0x00, 0x00, 0x01, 0x07, 0x50, 0x20,
0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x68, 0x08, 0x6c, 0x43, 0x30, 0x32, 0x58, 0x37, 0x30, 0x56,
0x48, 0x4a, 0x48, 0x44, 0x35, 0x09, 0x47, 0x02, 0xde, 0xad, 0xbe, 0xef,
0xde, 0xad, 0x0a, 0x50, 0x31, 0xfb, 0x5a, 0xbf, 0x02, 0x3e, 0x49, 0x92,
0xaa, 0x4e, 0x95, 0xf9, 0xc1, 0x50, 0x3b, 0xfa, 0x01, 0x81, 0x82, 0xa3,
0x00, 0xa5, 0x00, 0xd8, 0x25, 0x50, 0x31, 0xfb, 0x5a, 0xbf, 0x02, 0x3e,
0x49, 0x92, 0xaa, 0x4e, 0x95, 0xf9, 0xc1, 0x50, 0x3b, 0xfa, 0x01, 0x69,
0x41, 0x43, 0x4d, 0x45, 0x20, 0x4c, 0x74, 0x64, 0x2e, 0x02, 0x6a, 0x52,
0x6f, 0x61, 0x64, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x03, 0x00, 0x04,
0x01, 0x01, 0xd9, 0x02, 0x26, 0x47, 0x02, 0xde, 0xad, 0xbe, 0xef, 0xde,
0xad, 0x02, 0xd8, 0x25, 0x50, 0x31, 0xfb, 0x5a, 0xbf, 0x02, 0x3e, 0x49,
0x92, 0xaa, 0x4e, 0x95, 0xf9, 0xc1, 0x50, 0x3b, 0xfa, 0x81, 0xa2, 0x00,
0x18, 0x2e, 0x01, 0xaa, 0x01, 0xd9, 0x02, 0x29, 0x02, 0x02, 0x82, 0x82,
0x06, 0x44, 0xab, 0xcd, 0xef, 0x00, 0x82, 0x06, 0x44, 0xff, 0xff, 0xff,
0xff, 0x03, 0x0b, 0x04, 0xd9, 0x02, 0x30, 0x44, 0x01, 0x02, 0x03, 0x04,
0x05, 0x44, 0xff, 0xff, 0xff, 0xff, 0x06, 0x48, 0x02, 0x00, 0x5e, 0x10,
0x00, 0x00, 0x00, 0x01, 0x07, 0x50, 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x08, 0x6c,
0x43, 0x30, 0x32, 0x58, 0x37, 0x30, 0x56, 0x48, 0x4a, 0x48, 0x44, 0x35,
0x09, 0x47, 0x02, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0x0a, 0x50, 0x31,
0xfb, 0x5a, 0xbf, 0x02, 0x3e, 0x49, 0x92, 0xaa, 0x4e, 0x95, 0xf9, 0xc1,
0x50, 0x3b, 0xfa, 0x02, 0x81, 0x82, 0xa1, 0x01, 0xd8, 0x25, 0x50, 0x31,
0xfb, 0x5a, 0xbf, 0x02, 0x3e, 0x49, 0x92, 0xaa, 0x4e, 0x95, 0xf9, 0xc1,
0x50, 0x3b, 0xfa, 0x81, 0xa2, 0x00, 0x75, 0x46, 0x47, 0x48, 0x49, 0x6a,
0x6b, 0x69, 0x73, 0x6c, 0x64, 0x6e, 0x41, 0x53, 0x44, 0x78, 0x76, 0x57,
0x59, 0x2e, 0x2e, 0x2e, 0x01, 0x82, 0x74, 0x4d, 0x45, 0x4e, 0x47, 0x73,
0x64, 0x68, 0x66, 0x75, 0x67, 0x6a, 0x51, 0x57, 0x45, 0x74, 0x79, 0x58,
0x2e, 0x2e, 0x2e, 0x74, 0x4d, 0x49, 0x49, 0x45, 0x6e, 0x6a, 0x43, 0x43,
0x41, 0x34, 0x61, 0x67, 0x41, 0x77, 0x49, 0x42, 0x41, 0x2e, 0x2e, 0x2e,
0x03, 0x81, 0x82, 0xa1, 0x01, 0xd9, 0x02, 0x26, 0x47, 0x02, 0xde, 0xad,
0xbe, 0xef, 0xde, 0xad, 0x81, 0xa2, 0x00, 0x74, 0x4d, 0x49, 0x47, 0x6b,
0x41, 0x67, 0x45, 0x42, 0x42, 0x44, 0x43, 0x6b, 0x35, 0x51, 0x62, 0x6f,
0x42, 0x2e, 0x2e, 0x2e, 0x01, 0x82, 0x74, 0x4d, 0x49, 0x49, 0x44, 0x6b,
0x6a, 0x43, 0x43, 0x41, 0x78, 0x69, 0x67, 0x41, 0x77, 0x49, 0x42, 0x41,
0x2e, 0x2e, 0x2e, 0x74, 0x4d, 0x49, 0x49, 0x45, 0x6e, 0x6a, 0x43, 0x43,
0x41, 0x34, 0x61, 0x67, 0x41, 0x77, 0x49, 0x42, 0x41, 0x2e, 0x2e, 0x2e,
0xa3, 0x01, 0xa1, 0x00, 0x78, 0x20, 0x6d, 0x79, 0x2d, 0x6e, 0x73, 0x3a,
0x61, 0x63, 0x6d, 0x65, 0x2d, 0x72, 0x6f, 0x61, 0x64, 0x72, 0x75, 0x6e,
0x6e, 0x65, 0x72, 0x2d, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x65, 0x6d, 0x65,
0x6e, 0x74, 0x02, 0x81, 0xa3, 0x00, 0x69, 0x41, 0x43, 0x4d, 0x45, 0x20,
0x49, 0x6e, 0x63, 0x2e, 0x01, 0xd8, 0x20, 0x74, 0x68, 0x74, 0x74, 0x70,
0x73, 0x3a, 0x2f, 0x2f, 0x61, 0x63, 0x6d, 0x65, 0x2e, 0x65, 0x78, 0x61,
0x6d, 0x70, 0x6c, 0x65, 0x02, 0x83, 0x01, 0x00, 0x02, 0x04, 0xa1, 0x00,
0x81, 0x82, 0xa1, 0x00, 0xa3, 0x00, 0xd8, 0x6f, 0x44, 0x55, 0x02, 0xc0,
0x00, 0x01, 0x69, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x49, 0x6e, 0x63, 0x2e,
0x02, 0x78, 0x18, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x52, 0x6f, 0x61, 0x64,
0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x20, 0x46, 0x69, 0x72, 0x6d, 0x77,
0x61, 0x72, 0x65, 0x81, 0xa2, 0x00, 0x19, 0x02, 0xbc, 0x01, 0xa1, 0x02,
0x81, 0x82, 0x06, 0x44, 0xab, 0xcd, 0xef, 0x00,
}
comid := Comid{}
err := comid.FromCBOR(in)
Expand Down

0 comments on commit 4c5ef96

Please sign in to comment.