Skip to content

Commit a805351

Browse files
1 parent 465fb20 commit a805351

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/test_templates.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,32 @@ def test35_templated_callbacks(self):
11891189
assert cppyy.gbl.dataframe_define_mock(cppyy.gbl.bar, 42, 11.11) == "bar(42, 11.110000)"
11901190
assert cppyy.gbl.dataframe_define_mock(cppyy.gbl.baz["int", "double"], 33, 101.101, "hello") == "baz(33, 101.101000, \"hello\")"
11911191

1192+
def test37_enum_template_argument_function(self):
1193+
import cppyy
1194+
from cppyy import gbl
1195+
1196+
cppyy.cppdef(
1197+
r"""
1198+
enum What { NO, YES };
1199+
1200+
template <What E>
1201+
struct EE {
1202+
What w = E;
1203+
};
1204+
1205+
template <What E>
1206+
What get() {
1207+
return E;
1208+
}
1209+
"""
1210+
)
1211+
1212+
assert gbl.EE[gbl.What.NO]().w == 0
1213+
assert gbl.EE[gbl.What.YES]().w == 1
1214+
1215+
assert gbl.get[gbl.What.NO]() == 0
1216+
assert gbl.get[gbl.What.YES]() == 1
1217+
11921218

11931219
@mark.skipif((IS_MAC and IS_CLING), reason="setup class fails with OS X cling")
11941220
class TestTEMPLATED_TYPEDEFS:

0 commit comments

Comments
 (0)