add eq test

This commit is contained in:
Jean-Marie Mineau 2024-02-14 09:43:25 +01:00
parent c41b5f0b0c
commit 6e207ddc63
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2
2 changed files with 13 additions and 1 deletions

View file

@ -28,3 +28,16 @@ fn test_generated_data_size() {
// TODO: check for all pool concerned if the pool span outside the data section?
//for item in dex.get_map_list().list() {}
}
#[test]
fn test_generated_apk_equivalence() {
let mut apk = Apk::new();
let dex_data = get_dex("classes_hello_world.dex");
apk.add_dex_file(&dex_data).unwrap();
let new_dex = apk.gen_raw_dex().unwrap();
assert_eq!(new_dex.len(), 1);
let new_dex = new_dex.first().unwrap();
let mut new_apk = Apk::new();
new_apk.add_dex_file(&new_dex).unwrap();
assert_eq!(apk, new_apk);
}

View file

@ -2,7 +2,6 @@
use crate as androscalpel_serializer;
use crate::core::Serializable;
pub use androscalpel_serializer_derive::*;
/// [dex-file-magic](https://source.android.com/docs/core/runtime/dex-format#dex-file-magic)
/// `version` is the Dex version of this file (encoded decimal digit).