From 6e207ddc63566fa85cd0bb79154273f990532405 Mon Sep 17 00:00:00 2001 From: Jean-Marie Mineau Date: Wed, 14 Feb 2024 09:43:25 +0100 Subject: [PATCH] add eq test --- androscalpel/src/tests/mod.rs | 13 +++++++++++++ androscalpel_serializer/src/consts.rs | 1 - 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/androscalpel/src/tests/mod.rs b/androscalpel/src/tests/mod.rs index 6f33c0a..2e7d73d 100644 --- a/androscalpel/src/tests/mod.rs +++ b/androscalpel/src/tests/mod.rs @@ -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); +} diff --git a/androscalpel_serializer/src/consts.rs b/androscalpel_serializer/src/consts.rs index 7a26840..32d9f4b 100644 --- a/androscalpel_serializer/src/consts.rs +++ b/androscalpel_serializer/src/consts.rs @@ -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).