fix sleb serializer

This commit is contained in:
Jean-Marie 'Histausse' Mineau 2024-02-06 19:37:12 +01:00
parent e4532f9e3c
commit fcfe2dc6e9
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2
5 changed files with 70 additions and 21 deletions

35
test.py
View file

@ -106,12 +106,19 @@ def cmp(a, b, req=0):
cmp_other(a, b, req)
def nice_bool(b) -> str:
if b:
return "\033[32mTrue\033[0m"
else:
return "\033[31mFalse\033[0m"
def cmp_other(a, b, req=0):
ident = " " * req
for f in dir(a):
if getattr(getattr(a, f), "__call__", None) is None:
eq = getattr(a, f) == getattr(b, f)
print(f"{f'{ident}{f}: ':<150}{eq}")
print(f"{f'{ident}{f}: ':<150}{nice_bool(eq)}")
if not eq:
cmp(getattr(a, f), getattr(b, f), req + 1)
@ -124,7 +131,7 @@ def cmp_dict(a, b, req=0):
print(f"{ident}a.keys() != b.keys()")
for key in keys_a & keys_b:
eq = a[key] == b[key]
print(f"{f'{ident}{str(key)}: ':<150}{eq}")
print(f"{f'{ident}{str(key)}: ':<150}{nice_bool(eq)}")
if not eq:
cmp(a[key], b[key], req + 1)
@ -137,7 +144,7 @@ def cmp_list(a, b, req=0):
print(f"{ident}len(a) != len(b)")
for i in range(min(la, lb)):
eq = a[i] == b[i]
print(f"{f'{ident}{str(i)}: ':<150}{eq}")
print(f"{f'{ident}{str(i)}: ':<150}{nice_bool(eq)}")
if not eq:
cmp(a[i], b[i], req + 1)
@ -147,13 +154,15 @@ print(f"apk are equals: {apk_eq}")
if not apk_eq:
cmp(new_apk, apk)
mid = IdMethod(
"setAction",
IdMethodType(
IdType("Landroidx/navigation/NavDeepLink$Builder;"),
[IdType("Ljava/lang/String;")],
),
IdType("Landroidx/navigation/NavDeepLink$Builder;"),
)
m = apk.classes[mid.class_].virtual_methods[mid]
nm = new_apk.classes[mid.class_].virtual_methods[mid]
# Landroidx/constraintlayout/core/widgets/ConstraintWidget$1;.<clinit>()V
# mid = IdMethod(
# "<clinit>",
# IdMethodType(
# IdType.void(),
# [],
# ),
# IdType("Landroidx/constraintlayout/core/widgets/ConstraintWidget$1;"),
# )
# m = apk.classes[mid.class_].direct_methods[mid]
# nm = new_apk.classes[mid.class_].direct_methods[mid]
#