1
from __future__ import division
4
from pypy.objspace.flow.model import Constant, Variable
5
from pypy.translator.llvm.test import llvmsnippet
7
from pypy.translator.llvm.test.runtest import *
9
class TestClass(object):
10
def test_classsimple(self):
11
f = compile_function(llvmsnippet.class_simple, [])
14
def test_classsimple1(self):
15
f = compile_function(llvmsnippet.class_simple1, [int])
18
def test_id_int(self):
19
f = compile_function(llvmsnippet.id_int, [int])
20
for i in range(1, 20):
23
def test_classsimple2(self):
24
f = compile_function(llvmsnippet.class_simple2, [int])
27
def test_inherit1(self):
28
f = compile_function(llvmsnippet.class_inherit1, [])
31
def test_inherit2(self):
32
f = compile_function(llvmsnippet.class_inherit2, [])
35
def test_method_of_base_class(self):
36
f = compile_function(llvmsnippet.method_of_base_class, [])
39
def test_attribute_from_base_class(self):
40
f = compile_function(llvmsnippet.attribute_from_base_class, [])
43
def test_direct_call_of_virtual_method(self):
44
f = compile_function(llvmsnippet.direct_call_of_virtual_method, [])
47
def test_flow_type(self):
48
f = compile_function(llvmsnippet.flow_type, [])
51
def test_merge_class(self):
52
f = compile_function(llvmsnippet.merge_classes, [bool])
56
def test_attribute_instance(self):
57
f = compile_function(llvmsnippet.attribute_instance, [bool])
61
def test_global_instance(self):
62
f = compile_function(llvmsnippet.global_instance, [int])
63
assert f(-1) == llvmsnippet.global_instance(-1)
66
y = llvmsnippet.global_instance(i)
69
def test_getset(self):
70
f = compile_function(llvmsnippet.testgetset, [int])
73
def test_call_degrading_func(self):
74
f = compile_function(llvmsnippet.call_degrading_func, [bool])
75
assert f(True) == llvmsnippet.call_degrading_func(True)
76
assert f(False) == llvmsnippet.call_degrading_func(False)
78
def test_circular_classdef(self):
79
f = compile_function(llvmsnippet.circular_classdef, [])