summaryrefslogtreecommitdiff
path: root/Examples/test-suite/constant_directive.i
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/constant_directive.i')
-rw-r--r--Examples/test-suite/constant_directive.i28
1 files changed, 28 insertions, 0 deletions
diff --git a/Examples/test-suite/constant_directive.i b/Examples/test-suite/constant_directive.i
new file mode 100644
index 000000000..8204720d6
--- /dev/null
+++ b/Examples/test-suite/constant_directive.i
@@ -0,0 +1,28 @@
+%module constant_directive
+
+// %constant and struct
+%{
+ struct Type1 {
+ Type1(int val = 0) : val(val) {}
+ int val;
+ };
+ static Type1 TYPE1_CONSTANT1(1);
+ static Type1 TYPE1_CONST2(2);
+ static Type1 TYPE1_CONST3(3);
+%}
+
+struct Type1 {
+ Type1(int val = 0) : val(val) {}
+ int val;
+};
+
+%inline %{
+Type1 getType1Instance() { return Type1(111); }
+%}
+
+%constant Type1 TYPE1_CONSTANT1;
+%constant Type1 TYPE1_CONSTANT2 = TYPE1_CONST2;
+%constant Type1 *TYPE1_CONSTANT3 = &TYPE1_CONST3;
+
+%constant int TYPE_INT = 0;
+