[pypy-svn] r47840 - pypy/dist/pypy/lang/smalltalk/test
akuhn at codespeak.net
akuhn at codespeak.net
Wed Oct 24 17:51:12 CEST 2007
Author: akuhn
Date: Wed Oct 24 17:51:11 2007
New Revision: 47840
Added:
pypy/dist/pypy/lang/smalltalk/test/test_miniimage.py
Log:
stupid me forgot to add test/test_miniimage.py
Added: pypy/dist/pypy/lang/smalltalk/test/test_miniimage.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/lang/smalltalk/test/test_miniimage.py Wed Oct 24 17:51:11 2007
@@ -0,0 +1,66 @@
+# ----- mini.image productline -------------------------------
+# NOT relying on order of methods
+# one big method to rule them all
+import py
+from pypy.lang.smalltalk import squeakimage as sq
+
+
+mini_image = py.magic.autopath().dirpath().dirpath().join('mini.image')
+
+def test_miniimageexists():
+ assert mini_image.check(dir=False)
+
+def get_miniimage():
+ return sq.ImageReader(sq.Stream(mini_image.open()))
+
+def test_read_header():
+ example = get_miniimage()
+ example.read_header()
+ assert example.endofmemory == 0x93174
+ assert example.oldbaseaddress == 0x6649000
+ assert example.specialobjectspointer == 0x6668380
+
+def test_read_all_header():
+ example = get_miniimage()
+ example.read_header()
+ next = example.stream.peek()
+ assert next != 0 #expects object header, which must not be 0x00000000
+
+def test_readimage_productline():
+ example = get_miniimage()
+ example.read_header()
+ objects = example.read_body()
+ assert len(objects) > 0
+ assert 15000 < len(objects) < 16000
+
+ # at end of file
+ # py.test.raises(IndexError, lambda: example.stream.next())
+
+ # all pointers are valid
+ for each in example.chunks.itervalues():
+ if each.format < 5:
+ for pointer in each.data:
+ if (pointer & 1) != 1:
+ assert pointer in example.chunks
+
+ # there are 31 compact classes
+ example.init_compactclassesarray()
+ assert len(example.compactclasses) == 31
+
+ example.init_g_objects()
+
+ example.init_w_objects()
+
+ example.fillin_w_objects()
+
+ image = sq.SqueakImage()
+
+ image.from_reader(example)
+
+ for each in image.objects:
+ each.invariant()
+
+ w_float_class = image.special(sq.FLOAT_CLASS)
+
+ #assert w_float_class.size() == 10
+
More information about the pypy-svn
mailing list