Author: Wim Lavrijsen <[email protected]>
Branch: reflex-support
Changeset: r62587:582b2ae42222
Date: 2013-03-20 14:48 -0700
http://bitbucket.org/pypy/pypy/changeset/582b2ae42222/
Log: tests for global enums
diff --git a/pypy/module/cppyy/test/datatypes.h
b/pypy/module/cppyy/test/datatypes.h
--- a/pypy/module/cppyy/test/datatypes.h
+++ b/pypy/module/cppyy/test/datatypes.h
@@ -9,6 +9,9 @@
//===========================================================================
+enum fruit { kApple=78, kBanana=29, kCitrus=34 };
+
+//===========================================================================
class cppyy_test_data {
public:
cppyy_test_data();
diff --git a/pypy/module/cppyy/test/datatypes.xml
b/pypy/module/cppyy/test/datatypes.xml
--- a/pypy/module/cppyy/test/datatypes.xml
+++ b/pypy/module/cppyy/test/datatypes.xml
@@ -2,6 +2,8 @@
<class pattern="cppyy_test_*" />
+ <enum name="fruit" />
+
<function pattern="get_*" />
<function pattern="set_*" />
<function pattern="is_*" />
diff --git a/pypy/module/cppyy/test/datatypes_LinkDef.h
b/pypy/module/cppyy/test/datatypes_LinkDef.h
--- a/pypy/module/cppyy/test/datatypes_LinkDef.h
+++ b/pypy/module/cppyy/test/datatypes_LinkDef.h
@@ -7,6 +7,8 @@
#pragma link C++ struct cppyy_test_pod;
#pragma link C++ class cppyy_test_data;
+#pragma link C++ enum fruit;
+
#pragma link C++ function get_pod_address(cppyy_test_data&);
#pragma link C++ function get_int_address(cppyy_test_data&);
#pragma link C++ function get_double_address(cppyy_test_data&);
diff --git a/pypy/module/cppyy/test/test_datatypes.py
b/pypy/module/cppyy/test/test_datatypes.py
--- a/pypy/module/cppyy/test/test_datatypes.py
+++ b/pypy/module/cppyy/test/test_datatypes.py
@@ -454,6 +454,11 @@
assert c.s_enum == cppyy_test_data.kSomething
assert cppyy_test_data.s_enum == cppyy_test_data.kSomething
+ # global enums
+ assert gbl.kApple == 78
+ assert gbl.kBanana == 29
+ assert gbl.kCitrus == 34
+
def test12_object_returns(self):
"""Test access to and return of PODs"""
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit