[pypy-svn] r18421 - in pypy/branch/hl-backend/pypy/rpython/ootype: . test
bert at codespeak.net
bert at codespeak.net
Tue Oct 11 18:20:07 CEST 2005
Author: bert
Date: Tue Oct 11 18:20:07 2005
New Revision: 18421
Added:
pypy/branch/hl-backend/pypy/rpython/ootype/test/test_ooann.py
pypy/branch/hl-backend/pypy/rpython/ootype/test/test_ooclean.py
Modified:
pypy/branch/hl-backend/pypy/rpython/ootype/ootype.py
Log:
Some failing tests.
Modified: pypy/branch/hl-backend/pypy/rpython/ootype/ootype.py
==============================================================================
--- pypy/branch/hl-backend/pypy/rpython/ootype/ootype.py (original)
+++ pypy/branch/hl-backend/pypy/rpython/ootype/ootype.py Tue Oct 11 18:20:07 2005
@@ -5,7 +5,7 @@
from pypy.tool.tls import tlsobject
from types import NoneType
from pypy.rpython.lltype import LowLevelType, Signed, Unsigned, Float, Char
-from pypy.rpython.lltype import Bool, Void, UniChar, typeOf
+from pypy.rpython.lltype import Bool, Void, UniChar, typeOf, Primitive
class OOType(LowLevelType):
pass
Added: pypy/branch/hl-backend/pypy/rpython/ootype/test/test_ooann.py
==============================================================================
--- (empty file)
+++ pypy/branch/hl-backend/pypy/rpython/ootype/test/test_ooann.py Tue Oct 11 18:20:07 2005
@@ -0,0 +1,17 @@
+from pypy.rpython.ootype.ootype import *
+from pypy.annotation import model as annmodel
+from pypy.objspace.flow import FlowObjSpace
+from pypy.translator.annrpython import RPythonAnnotator
+
+
+def test_simple():
+ C = Class("test", None, {'a': Signed})
+
+ def oof():
+ c = new(C)
+ return c.a
+
+ a = RPythonAnnotator()
+ s = a.build_types(oof, [])
+ assert s.knowntype == int
+
Added: pypy/branch/hl-backend/pypy/rpython/ootype/test/test_ooclean.py
==============================================================================
--- (empty file)
+++ pypy/branch/hl-backend/pypy/rpython/ootype/test/test_ooclean.py Tue Oct 11 18:20:07 2005
@@ -0,0 +1,38 @@
+from pypy.translator.translator import Translator
+from pypy.rpython import lltype
+from pypy.rpython.ootype import ootype
+
+def check_only_ootype(graph):
+ def check_ootype(v):
+ t = v.concretetype
+ assert isinstance(t, ootype.Primitive) or isinstance(t, ootype.OOType)
+
+ for block in graph.iterblocks():
+ for var in block.getvariables():
+ check_ootype(var)
+ for const in block.getconstants():
+ check_ootype(const)
+
+def test_simple():
+ def f(a, b):
+ return a + b
+ t = Translator(f)
+ t.annotate([int, int])
+ t.specialize()
+
+ graph = t.flowgraphs[f]
+ check_only_ootype(graph)
+
+def test_simple_call():
+ def f(a, b):
+ return a + b
+
+ def g():
+ return f(5, 3)
+
+ t = Translator(g)
+ t.annotate([])
+ t.specialize()
+
+ graph = t.flowgraphs[g]
+ check_only_ootype(graph)
More information about the Pypy-commit
mailing list