fix stuff, add class annotation
This commit is contained in:
parent
b8b4e28f2d
commit
cf55766653
10 changed files with 164 additions and 117 deletions
|
|
@ -87,6 +87,7 @@ mod test {
|
|||
0xbe, 0x37, 0x01, 0xa8, 0x9f, 0x03, 0x1d, 0xf6, 0x33, 0x01, 0xd3, 0xe8, 0x02, 0x3f,
|
||||
];
|
||||
const ENCODED_ANNOTATION_RAW_2: &[u8] = &[0xf6, 0x33, 0x01, 0xd3, 0xe8, 0x02, 0x3f];
|
||||
const ENCODED_ANNOTATION_RAW_3: &[u8] = &[0xbf, 0x37, 0x01, 0xa8, 0x9f, 0x03, 0x38, 0x38, 0x02];
|
||||
const ANNOTATION_ELEMENT_RAW: &[u8] = &[
|
||||
0xa8, 0x9f, 0x03, 0x1d, 0xf6, 0x33, 0x01, 0xd3, 0xe8, 0x02, 0x3f,
|
||||
];
|
||||
|
|
@ -94,6 +95,16 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn deserialize_encoded_annotation() {
|
||||
assert_eq!(
|
||||
EncodedAnnotation::deserialize_from_slice(ENCODED_ANNOTATION_RAW_3).unwrap(),
|
||||
EncodedAnnotation {
|
||||
type_idx: Uleb128(7103),
|
||||
elements: vec![AnnotationElement {
|
||||
name_idx: Uleb128(53160),
|
||||
value: EncodedValue::Type(0x0238)
|
||||
}],
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
EncodedAnnotation::deserialize_from_slice(ENCODED_ANNOTATION_RAW_2).unwrap(),
|
||||
EncodedAnnotation {
|
||||
|
|
|
|||
|
|
@ -241,6 +241,7 @@ mod test {
|
|||
const ANNOTATION_ITEM: &[u8] = &[
|
||||
0x02, 0xbe, 0x37, 0x01, 0xa8, 0x9f, 0x03, 0x1d, 0xf6, 0x33, 0x01, 0xd3, 0xe8, 0x02, 0x3f,
|
||||
];
|
||||
const ANNOTATION_ITEM_2: &[u8] = &[0x02, 0xbf, 0x37, 0x01, 0xa8, 0x9f, 0x03, 0x38, 0x38, 0x02];
|
||||
|
||||
#[test]
|
||||
fn deserialize_annotation_item() {
|
||||
|
|
@ -252,6 +253,14 @@ mod test {
|
|||
.unwrap(),
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
AnnotationItem::deserialize_from_slice(ANNOTATION_ITEM_2).unwrap(),
|
||||
AnnotationItem {
|
||||
visibility: AnnotationVisibility::System,
|
||||
annotation: EncodedAnnotation::deserialize_from_slice(&ANNOTATION_ITEM_2[1..])
|
||||
.unwrap(),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -267,5 +276,16 @@ mod test {
|
|||
.unwrap()
|
||||
.as_slice()
|
||||
);
|
||||
assert_eq!(
|
||||
ANNOTATION_ITEM_2,
|
||||
AnnotationItem {
|
||||
visibility: AnnotationVisibility::System,
|
||||
annotation: EncodedAnnotation::deserialize_from_slice(&ANNOTATION_ITEM_2[1..])
|
||||
.unwrap(),
|
||||
}
|
||||
.serialize_to_vec()
|
||||
.unwrap()
|
||||
.as_slice()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue