Skip to content

Commit

Permalink
template tests pytest input
Browse files Browse the repository at this point in the history
  • Loading branch information
wlav committed Jul 31, 2017
1 parent b9abe16 commit 4b424ef
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/test_templates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import py, os, sys
from pytest import raises
from .support import setup_make

currpath = py.path.local(__file__).dirpath()
test_dct = str(currpath.join("templatesDict.so"))

def setup_module(mod):
setup_make("templatesDict.so")


class TestTEMPLATES:
def setup_class(cls):
cls.test_dct = test_dct
import cppyy
cls.advanced = cppyy.load_reflection_info(cls.test_dct)

def test01_template_member_functions(self):
"""Template member functions lookup and calls"""

import cppyy

m = cppyy.gbl.MyTemplatedMethodClass()

# pre-instantiated
assert m.get_size['char']() == m.get_char_size()
assert m.get_size[int]() == m.get_int_size()

# specialized
assert m.get_size[long]() == m.get_long_size()

# auto-instantiation
assert m.get_size[float]() == m.get_float_size()
assert m.get_size['double']() == m.get_double_size()
assert m.get_size['MyTemplatedMethodClass']() == m.get_self_size()

# auto through typedef
assert m.get_size['MyTMCTypedef_t']() == m.get_self_size()

0 comments on commit 4b424ef

Please sign in to comment.