Mercurial > paraspace
changeset 20:265f39947b36
Unit test for dependencies of dexfile.py
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Wed, 01 Jun 2011 21:31:07 +0800 |
parents | 6008b9a9d33e |
children | f031b9d02ce8 |
files | paraspace/tests/dexfile_test.py |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/paraspace/tests/dexfile_test.py Wed Jun 01 20:48:35 2011 +0800 +++ b/paraspace/tests/dexfile_test.py Wed Jun 01 21:31:07 2011 +0800 @@ -24,3 +24,20 @@ pass +def dependencies_test(): + srcdir = os.path.dirname(__file__) + srcroot = os.path.join(srcdir, '..', '..') + testdatapath = os.path.join(srcroot, 'data', 'testdata1.dex') + dex = dexfile.DEXFile.open(testdatapath) + + deps = dexfile.collect_dependencies() + assert deps['_DEX_AnnotationItem.typeIdx'][0] == dexfile.depend_idx + assert deps['_DEX_AnnotationItem.typeIdx'][1] == 'DEXFile.typeIds' + assert deps['_DEX_FieldId.typeIdx'][0] == dexfile.depend_idx + assert deps['_DEX_FieldId.typeIdx'][1] == 'DEXFile.typeIds' + assert deps['_DEX_ClassDef.staticValuesOff'][0] == dexfile.depend_off + assert deps['_DEX_ClassDef.staticValuesOff'][1] == '_DEX_EncodedArrayItem' + assert deps['_DEX_Try.handlerOff'][0] == dexfile.depend_off_rel + assert deps['_DEX_Try.handlerOff'][1] == '_DEX_Catch' + assert deps['_DEX_Try.handlerOff'][2] == None + pass