changeset 16:712e76c3d791

unittest for dexfile.py
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 01 Jun 2011 10:10:05 +0800
parents c98be35b572b
children d0806672da04
files paraspace/__init__.py paraspace/tests/__init__.py paraspace/tests/dexfile_test.py
diffstat 3 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/paraspace/__init__.py	Wed Jun 01 10:10:05 2011 +0800
@@ -0,0 +1,1 @@
+# keep me
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/paraspace/tests/__init__.py	Wed Jun 01 10:10:05 2011 +0800
@@ -0,0 +1,1 @@
+# keep me
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/paraspace/tests/dexfile_test.py	Wed Jun 01 10:10:05 2011 +0800
@@ -0,0 +1,26 @@
+from paraspace import dexfile
+import os
+
+def block_sizes_test():
+    srcdir = os.path.dirname(__file__)
+    srcroot = os.path.join(srcdir, '..', '..')
+    testdatapath = os.path.join(srcroot, 'data', 'testdata1.dex')
+    dex = dexfile.DEXFile.open(testdatapath)
+    assert dex.stringIds.data_size == 5384
+    assert dex.typeIds.data_size == 704
+    assert dex.protoIds.data_size == 1776
+    assert dex.fieldIds.data_size == 1944
+    assert dex.methodIds.data_size == 3552
+    assert dex.classDefs.data_size == 1600
+    assert dex.classDatas.data_size == 2052
+    assert dex.typeLists.data_size == 838
+    assert dex.codeItems.data_size == 30688
+    assert dex.annotationSetItems.data_size == 412
+    assert dex.annotationsDirectoryItems.data_size == 792
+    assert dex.annotationItems.data_size == 642
+    assert dex.encodedArrayItems.data_size == 139
+    assert dex.debugInfoItems.data_size == 6353
+    assert dex.stringDataItems.data_size == 23492
+    pass
+
+