move issue 10 test case into common tests
This commit is contained in:
parent
6d60c4a469
commit
2b9ac16733
1 changed files with 23 additions and 1 deletions
|
|
@ -395,7 +395,8 @@ class TestMetaData(unittest.TestCase):
|
||||||
def test_metadata(self):
|
def test_metadata(self):
|
||||||
m = Module.new('a')
|
m = Module.new('a')
|
||||||
t = Type.int()
|
t = Type.int()
|
||||||
metadata = MetaData.get(m, [Constant.int(t, 100), MetaDataString.get(m, 'abcdef')])
|
metadata = MetaData.get(m, [Constant.int(t, 100),
|
||||||
|
MetaDataString.get(m, 'abcdef')])
|
||||||
MetaData.add_named_operand(m, 'foo', metadata)
|
MetaData.add_named_operand(m, 'foo', metadata)
|
||||||
self.assertEqual(MetaData.get_named_operands(m, 'foo'), [metadata])
|
self.assertEqual(MetaData.get_named_operands(m, 'foo'), [metadata])
|
||||||
self.assertEqual(MetaData.get_named_operands(m, 'bar'), [])
|
self.assertEqual(MetaData.get_named_operands(m, 'bar'), [])
|
||||||
|
|
@ -436,6 +437,27 @@ tests.append(TestInlining)
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class TestIssue10(unittest.TestCase):
|
||||||
|
def test_issue10(self):
|
||||||
|
m = Module.new('a')
|
||||||
|
ti = Type.int()
|
||||||
|
tf = Type.function(ti, [ti, ti])
|
||||||
|
|
||||||
|
f = m.add_function(tf, "func1")
|
||||||
|
|
||||||
|
bb = f.append_basic_block('entry')
|
||||||
|
|
||||||
|
b = Builder.new(bb)
|
||||||
|
|
||||||
|
# There are no instructions in bb. Positioning of the
|
||||||
|
# builder at beginning (or end) should succeed (trivially).
|
||||||
|
b.position_at_end(bb)
|
||||||
|
b.position_at_beginning(bb)
|
||||||
|
|
||||||
|
tests.append(TestIssue10)
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
def run(verbosity=1):
|
def run(verbosity=1):
|
||||||
print('llvmpy is installed in: ' + os.path.dirname(__file__))
|
print('llvmpy is installed in: ' + os.path.dirname(__file__))
|
||||||
print('llvmpy version: ' + __version__)
|
print('llvmpy version: ' + __version__)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue