-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |