From b9d12afa7cd4696fcaf6be562ddebe6058a0a297 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Sat, 29 Jan 2011 21:32:11 +0000 Subject: =?UTF-8?q?[D]=20Test=20C++=20references=20in=20=C2=BBd=5Fnativepo?= =?UTF-8?q?inters=C2=AB;=20normalized=20indentation.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12407 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/d/d_nativepointers_runme.1.d | 33 +++++++++++++++++------- Examples/test-suite/d/d_nativepointers_runme.2.d | 33 +++++++++++++++++------- 2 files changed, 46 insertions(+), 20 deletions(-) (limited to 'Examples/test-suite/d') 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); } -- cgit v1.2.1