From 72c68c375cf20ec7839fd8247579cc0e52513304 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sun, 28 Dec 2003 21:08:18 +0000 Subject: [PATCH] Added a reference polymorphic return type case test git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5599 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- .../test-suite/csharp/virtual_poly_runme.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/SWIG/Examples/test-suite/csharp/virtual_poly_runme.cs b/SWIG/Examples/test-suite/csharp/virtual_poly_runme.cs index fff147a06..e8bccd223 100644 --- a/SWIG/Examples/test-suite/csharp/virtual_poly_runme.cs +++ b/SWIG/Examples/test-suite/csharp/virtual_poly_runme.cs @@ -25,5 +25,25 @@ public class runme { virtual_poly.incr(ic); if ( (i.get() + 1) != ic.get() ) throw new Exception("incr test failed"); + + // + // Checking a pure user downcast + // + NNumber n1 = d.copy(); + NNumber n2 = d.nnumber(); + NDouble dn1 = NDouble.narrow(n1); + NDouble dn2 = NDouble.narrow(n2); + + if ( (dn1.get()) != dn2.get() ) + throw new Exception("copy/narrow test failed"); + + // + // Checking the ref polymorphic case + // + NNumber nr = d.ref_this(); + NDouble dr1 = NDouble.narrow(nr); + NDouble dr2 = (NDouble)d.ref_this(); + if ( dr1.get() != dr2.get() ) + throw new Exception("copy/narrow test failed"); } }