diff paraspace/tests/dexfile_test.py @ 58:c2a4921ec83b

Fix issue misbehavior for dependency when update_offset() - If value of a depenend object is linked to its depend-on, it's size should be computed with value from depend-on. But, it was not. - It is fixed by awaring linking of depend objects in dex_deptracker.update_offset() and depend classes.
author Thinker K.F. Li <thinker@codemud.net>
date Sun, 26 Jun 2011 21:34:52 +0800
parents fa8fe7d714b9
children 08c220217076
line wrap: on
line diff
--- a/paraspace/tests/dexfile_test.py	Sat Jun 25 08:16:16 2011 +0800
+++ b/paraspace/tests/dexfile_test.py	Sun Jun 26 21:34:52 2011 +0800
@@ -59,6 +59,10 @@
     obj, parent = _resolve_name_path('_DEX_AnnotationMember_noname.value.' + 
                                      repr(key))
     assert isinstance(obj, dexfile.abs_value)
+
+    obj, parent = _resolve_name_path('_DEX_AnnotationSetItem.annotationOffs.'
+                                     'items.0')
+    assert isinstance(obj, dexfile.depend_off)
     pass
 
 
@@ -223,6 +227,9 @@
     
     code_item = dex.codeItems.items[0]
     assert code_item.debugInfoOff.__class__.__name__ == '_DEX_DebugInfoItem'
+
+    stringid = dex.stringIds.items[0]
+    assert isinstance(stringid.stringDataOff, dexfile._DEX_StringDataItem)
     pass
 
 
@@ -288,9 +295,10 @@
     offset1 = dex.typeLists.items[1].value.data_offset
     dex.typeLists.items[1].value.data_offset = 0
     
+    print 'update_offset()'
     update_offset(dex, all_dep_decls)
 
-    print dex.typeLists.items[0].value.data_offset
+    print dex.typeLists.items[0].value.data_offset, offset0
     assert dex.typeLists.items[0].value.data_offset == offset0
     assert dex.typeLists.items[1].value.data_offset == offset1
     pass