summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Nadlinger <code@klickverbot.at>2011-01-29 21:32:11 +0000
committerDavid Nadlinger <code@klickverbot.at>2011-01-29 21:32:11 +0000
commitb9d12afa7cd4696fcaf6be562ddebe6058a0a297 (patch)
tree28f31c1d8a078c6fa2a4c811f22f29c8562d6641
parent160ee9c937dc0a987f2783dd4a231db1349ae9b6 (diff)
downloadswig-b9d12afa7cd4696fcaf6be562ddebe6058a0a297.tar.gz
[D] Test C++ references in »d_nativepointers«; normalized indentation.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12407 626c5289-ae23-0410-ae9c-e8d60b6d4f22
-rw-r--r--Examples/test-suite/d/d_nativepointers_runme.1.d33
-rw-r--r--Examples/test-suite/d/d_nativepointers_runme.2.d33
-rw-r--r--Examples/test-suite/d_nativepointers.i3
3 files changed, 49 insertions, 20 deletions
diff --git a/Examples/test-suite/d/d_nativepointers_runme.1.d b/Examples/test-suite/d/d_nativepointers_runme.1.d
index 00407c1db..797c057d3 100644
--- a/Examples/test-suite/d/d_nativepointers_runme.1.d
+++ b/Examples/test-suite/d/d_nativepointers_runme.1.d
@@ -7,17 +7,30 @@ import d_nativepointers.SWIGTYPE_p_p_SomeClass;
import d_nativepointers.SWIGTYPE_p_p_f_p_p_int_p_SomeClass__void;
void main() {
- check!(a, int*);
- check!(b, float**);
- check!(c, char***);
- check!(d, SomeClass);
- check!(e, SWIGTYPE_p_p_SomeClass);
- check!(f, SWIGTYPE_p_OpaqueClass);
- check!(g, void function(int**, char***));
- check!(h, SWIGTYPE_p_p_f_p_p_int_p_SomeClass__void);
+ check!(a, int*);
+ check!(b, float**);
+ check!(c, char***);
+ check!(d, SomeClass);
+ check!(e, SWIGTYPE_p_p_SomeClass);
+ check!(f, SWIGTYPE_p_OpaqueClass);
+ check!(g, void function(int**, char***));
+ check!(h, SWIGTYPE_p_p_f_p_p_int_p_SomeClass__void);
+
+ {
+ static assert(is(int* function(int*) == typeof(&refA)));
+ int v = 2;
+ assert(*refA(&v) == 2);
+ }
+
+ {
+ static assert(is(float** function(float**) == typeof(&refB)));
+ float v = 1.0;
+ float* p = &v;
+ assert(**refB(&p) == 1.0);
+ }
}
void check(alias F, T)() {
- static assert(is(T function(T) == typeof(&F)));
- assert(F(null) is null);
+ static assert(is(T function(T) == typeof(&F)));
+ assert(F(null) is null);
}
diff --git a/Examples/test-suite/d/d_nativepointers_runme.2.d b/Examples/test-suite/d/d_nativepointers_runme.2.d
index 00407c1db..797c057d3 100644
--- a/Examples/test-suite/d/d_nativepointers_runme.2.d
+++ b/Examples/test-suite/d/d_nativepointers_runme.2.d
@@ -7,17 +7,30 @@ import d_nativepointers.SWIGTYPE_p_p_SomeClass;
import d_nativepointers.SWIGTYPE_p_p_f_p_p_int_p_SomeClass__void;
void main() {
- check!(a, int*);
- check!(b, float**);
- check!(c, char***);
- check!(d, SomeClass);
- check!(e, SWIGTYPE_p_p_SomeClass);
- check!(f, SWIGTYPE_p_OpaqueClass);
- check!(g, void function(int**, char***));
- check!(h, SWIGTYPE_p_p_f_p_p_int_p_SomeClass__void);
+ check!(a, int*);
+ check!(b, float**);
+ check!(c, char***);
+ check!(d, SomeClass);
+ check!(e, SWIGTYPE_p_p_SomeClass);
+ check!(f, SWIGTYPE_p_OpaqueClass);
+ check!(g, void function(int**, char***));
+ check!(h, SWIGTYPE_p_p_f_p_p_int_p_SomeClass__void);
+
+ {
+ static assert(is(int* function(int*) == typeof(&refA)));
+ int v = 2;
+ assert(*refA(&v) == 2);
+ }
+
+ {
+ static assert(is(float** function(float**) == typeof(&refB)));
+ float v = 1.0;
+ float* p = &v;
+ assert(**refB(&p) == 1.0);
+ }
}
void check(alias F, T)() {
- static assert(is(T function(T) == typeof(&F)));
- assert(F(null) is null);
+ static assert(is(T function(T) == typeof(&F)));
+ assert(F(null) is null);
}
diff --git a/Examples/test-suite/d_nativepointers.i b/Examples/test-suite/d_nativepointers.i
index b681844f5..fdf3f1669 100644
--- a/Examples/test-suite/d_nativepointers.i
+++ b/Examples/test-suite/d_nativepointers.i
@@ -15,4 +15,7 @@
OpaqueClass *f( OpaqueClass *value ){ return value; }
FuncA g( FuncA value ){ return value; }
FuncB* h( FuncB* value ){ return value; }
+
+ int &refA( int &value ){ return value; }
+ float *&refB( float *&value ){ return value; }
%}