diff --git a/Examples/test-suite/csharp/cpp11_std_unique_ptr_runme.cs b/Examples/test-suite/csharp/cpp11_std_unique_ptr_runme.cs index 09c6ec0af..9382cb83a 100644 --- a/Examples/test-suite/csharp/cpp11_std_unique_ptr_runme.cs +++ b/Examples/test-suite/csharp/cpp11_std_unique_ptr_runme.cs @@ -53,8 +53,8 @@ public class cpp11_std_unique_ptr_runme { using (Klass kin = new Klass("KlassInput")) { bool exception_thrown = false; + Klass notowned = cpp11_std_unique_ptr.get_not_owned_ptr(kin); try { - Klass notowned = cpp11_std_unique_ptr.get_not_owned_ptr(kin); cpp11_std_unique_ptr.takeKlassUniquePtr(notowned); } catch (ApplicationException e) { if (!e.Message.Contains("Cannot release ownership as memory is not owned")) @@ -63,6 +63,7 @@ public class cpp11_std_unique_ptr_runme { } if (!exception_thrown) throw new ApplicationException("Should have thrown 'Cannot release ownership as memory is not owned' error"); + checkCount(1); } checkCount(0); diff --git a/Examples/test-suite/csharp/li_std_auto_ptr_runme.cs b/Examples/test-suite/csharp/li_std_auto_ptr_runme.cs index b5ff1fd29..491fa3652 100644 --- a/Examples/test-suite/csharp/li_std_auto_ptr_runme.cs +++ b/Examples/test-suite/csharp/li_std_auto_ptr_runme.cs @@ -53,8 +53,8 @@ public class li_std_auto_ptr_runme { using (Klass kin = new Klass("KlassInput")) { bool exception_thrown = false; + Klass notowned = li_std_auto_ptr.get_not_owned_ptr(kin); try { - Klass notowned = li_std_auto_ptr.get_not_owned_ptr(kin); li_std_auto_ptr.takeKlassAutoPtr(notowned); } catch (ApplicationException e) { if (!e.Message.Contains("Cannot release ownership as memory is not owned")) @@ -63,6 +63,7 @@ public class li_std_auto_ptr_runme { } if (!exception_thrown) throw new ApplicationException("Should have thrown 'Cannot release ownership as memory is not owned' error"); + checkCount(1); } checkCount(0); diff --git a/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java b/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java index 36a9c03fc..7d6e708ad 100644 --- a/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java +++ b/Examples/test-suite/java/cpp11_std_unique_ptr_runme.java @@ -68,8 +68,8 @@ public class cpp11_std_unique_ptr_runme { { Klass kin = new Klass("KlassInput"); boolean exception_thrown = false; + Klass notowned = cpp11_std_unique_ptr.get_not_owned_ptr(kin); try { - Klass notowned = cpp11_std_unique_ptr.get_not_owned_ptr(kin); cpp11_std_unique_ptr.takeKlassUniquePtr(notowned); } catch (RuntimeException e) { if (!e.getMessage().contains("Cannot release ownership as memory is not owned")) @@ -78,6 +78,7 @@ public class cpp11_std_unique_ptr_runme { } if (!exception_thrown) throw new RuntimeException("Should have thrown 'Cannot release ownership as memory is not owned' error"); + checkCount(1); kin.delete(); checkCount(0); } diff --git a/Examples/test-suite/java/li_std_auto_ptr_runme.java b/Examples/test-suite/java/li_std_auto_ptr_runme.java index daec84dc0..58f1ea9c3 100644 --- a/Examples/test-suite/java/li_std_auto_ptr_runme.java +++ b/Examples/test-suite/java/li_std_auto_ptr_runme.java @@ -68,8 +68,8 @@ public class li_std_auto_ptr_runme { { Klass kin = new Klass("KlassInput"); boolean exception_thrown = false; + Klass notowned = li_std_auto_ptr.get_not_owned_ptr(kin); try { - Klass notowned = li_std_auto_ptr.get_not_owned_ptr(kin); li_std_auto_ptr.takeKlassAutoPtr(notowned); } catch (RuntimeException e) { if (!e.getMessage().contains("Cannot release ownership as memory is not owned")) @@ -78,6 +78,7 @@ public class li_std_auto_ptr_runme { } if (!exception_thrown) throw new RuntimeException("Should have thrown 'Cannot release ownership as memory is not owned' error"); + checkCount(1); kin.delete(); checkCount(0); } diff --git a/Examples/test-suite/octave/cpp11_std_unique_ptr_runme.m b/Examples/test-suite/octave/cpp11_std_unique_ptr_runme.m index 3da93e338..82c93836b 100644 --- a/Examples/test-suite/octave/cpp11_std_unique_ptr_runme.m +++ b/Examples/test-suite/octave/cpp11_std_unique_ptr_runme.m @@ -54,8 +54,8 @@ checkCount(0); kin = Klass("KlassInput"); exception_thrown = false; +notowned = get_not_owned_ptr(kin); try - notowned = get_not_owned_ptr(kin); takeKlassUniquePtr(notowned); catch e if (isempty(strfind(e.message, "cannot release ownership as memory is not owned"))) @@ -66,6 +66,7 @@ end_try_catch if (!exception_thrown) error("Should have thrown 'Cannot release ownership as memory is not owned' error"); endif +checkCount(1); clear kin; checkCount(0); diff --git a/Examples/test-suite/octave/li_std_auto_ptr_runme.m b/Examples/test-suite/octave/li_std_auto_ptr_runme.m index c1e655db5..51898e0bd 100644 --- a/Examples/test-suite/octave/li_std_auto_ptr_runme.m +++ b/Examples/test-suite/octave/li_std_auto_ptr_runme.m @@ -53,8 +53,8 @@ checkCount(0); kin = Klass("KlassInput"); exception_thrown = false; +notowned = get_not_owned_ptr(kin); try - notowned = get_not_owned_ptr(kin); takeKlassAutoPtr(notowned); catch e if (isempty(strfind(e.message, "cannot release ownership as memory is not owned"))) @@ -65,6 +65,7 @@ end_try_catch if (!exception_thrown) error("Should have thrown 'Cannot release ownership as memory is not owned' error"); endif +checkCount(1); clear kin; checkCount(0); diff --git a/Examples/test-suite/perl5/cpp11_std_unique_ptr_runme.pl b/Examples/test-suite/perl5/cpp11_std_unique_ptr_runme.pl index a42580aca..0202b0fda 100644 --- a/Examples/test-suite/perl5/cpp11_std_unique_ptr_runme.pl +++ b/Examples/test-suite/perl5/cpp11_std_unique_ptr_runme.pl @@ -1,6 +1,6 @@ use strict; use warnings; -use Test::More tests => 24; +use Test::More tests => 25; BEGIN { use_ok('cpp11_std_unique_ptr') } require_ok('cpp11_std_unique_ptr'); @@ -41,11 +41,12 @@ sub checkCount { { my $kin = new cpp11_std_unique_ptr::Klass("KlassInput"); + my $notowned = cpp11_std_unique_ptr::get_not_owned_ptr($kin); eval { - my $notowned = cpp11_std_unique_ptr::get_not_owned_ptr($kin); cpp11_std_unique_ptr::takeKlassUniquePtr($notowned); }; like($@, qr/\bcannot release ownership as memory is not owned\b/, "double usage of takeKlassUniquePtr should be an error"); + checkCount(1); undef $kin; checkCount(0); } diff --git a/Examples/test-suite/perl5/li_std_auto_ptr_runme.pl b/Examples/test-suite/perl5/li_std_auto_ptr_runme.pl index 8a33f4562..232ebf6d0 100644 --- a/Examples/test-suite/perl5/li_std_auto_ptr_runme.pl +++ b/Examples/test-suite/perl5/li_std_auto_ptr_runme.pl @@ -1,6 +1,6 @@ use strict; use warnings; -use Test::More tests => 24; +use Test::More tests => 25; BEGIN { use_ok('li_std_auto_ptr') } require_ok('li_std_auto_ptr'); @@ -41,11 +41,12 @@ sub checkCount { { my $kin = new li_std_auto_ptr::Klass("KlassInput"); + my $notowned = li_std_auto_ptr::get_not_owned_ptr($kin); eval { - my $notowned = li_std_auto_ptr::get_not_owned_ptr($kin); li_std_auto_ptr::takeKlassAutoPtr($notowned); }; like($@, qr/\bcannot release ownership as memory is not owned\b/, "double usage of takeKlassAutoPtr should be an error"); + checkCount(1); undef $kin; checkCount(0); } diff --git a/Examples/test-suite/python/cpp11_std_unique_ptr_runme.py b/Examples/test-suite/python/cpp11_std_unique_ptr_runme.py index d317754b4..ba2a486bc 100644 --- a/Examples/test-suite/python/cpp11_std_unique_ptr_runme.py +++ b/Examples/test-suite/python/cpp11_std_unique_ptr_runme.py @@ -43,13 +43,14 @@ checkCount(0) kin = Klass("KlassInput") exception_thrown = False +notowned = get_not_owned_ptr(kin) try: - notowned = get_not_owned_ptr(kin) takeKlassUniquePtr(notowned) except RuntimeError as e: exception_thrown = True if not exception_thrown: raise RuntimeError("Should have thrown 'Cannot release ownership as memory is not owned' error") +checkCount(1) del kin checkCount(0) diff --git a/Examples/test-suite/python/li_std_auto_ptr_runme.py b/Examples/test-suite/python/li_std_auto_ptr_runme.py index c1df7eb76..fe377b6c4 100644 --- a/Examples/test-suite/python/li_std_auto_ptr_runme.py +++ b/Examples/test-suite/python/li_std_auto_ptr_runme.py @@ -43,13 +43,14 @@ checkCount(0) kin = Klass("KlassInput") exception_thrown = False +notowned = get_not_owned_ptr(kin) try: - notowned = get_not_owned_ptr(kin) takeKlassAutoPtr(notowned) except RuntimeError as e: exception_thrown = True if not exception_thrown: raise RuntimeError("Should have thrown 'Cannot release ownership as memory is not owned' error") +checkCount(1) del kin checkCount(0) diff --git a/Examples/test-suite/ruby/cpp11_std_unique_ptr_runme.rb b/Examples/test-suite/ruby/cpp11_std_unique_ptr_runme.rb index 83bac5f1b..4f2ccb3d9 100644 --- a/Examples/test-suite/ruby/cpp11_std_unique_ptr_runme.rb +++ b/Examples/test-suite/ruby/cpp11_std_unique_ptr_runme.rb @@ -70,8 +70,8 @@ checkCount(0) kin = Cpp11_std_unique_ptr::Klass.new("KlassInput") exception_thrown = false +notowned = Cpp11_std_unique_ptr::get_not_owned_ptr(kin) begin - notowned = Cpp11_std_unique_ptr::get_not_owned_ptr(kin) Cpp11_std_unique_ptr::takeKlassUniquePtr(notowned) rescue RuntimeError => e if (!e.to_s.include? "cannot release ownership as memory is not owned") @@ -82,6 +82,7 @@ end if (!exception_thrown) raise RuntimeError, "Should have thrown 'Cannot release ownership as memory is not owned' error" end +checkCount(1) Cpp11_std_unique_ptr.takeKlassUniquePtr(kin) # Ensure object is deleted (can't rely on GC) checkCount(0) diff --git a/Examples/test-suite/ruby/li_std_auto_ptr_runme.rb b/Examples/test-suite/ruby/li_std_auto_ptr_runme.rb index 6562d8d84..ffd33ad34 100644 --- a/Examples/test-suite/ruby/li_std_auto_ptr_runme.rb +++ b/Examples/test-suite/ruby/li_std_auto_ptr_runme.rb @@ -70,8 +70,8 @@ checkCount(0) kin = Li_std_auto_ptr::Klass.new("KlassInput") exception_thrown = false +notowned = Li_std_auto_ptr::get_not_owned_ptr(kin) begin - notowned = Li_std_auto_ptr::get_not_owned_ptr(kin) Li_std_auto_ptr::takeKlassAutoPtr(notowned) rescue RuntimeError if (!e.to_s.include? "cannot release ownership as memory is not owned") @@ -82,6 +82,7 @@ end if (!exception_thrown) raise RuntimeError, "Should have thrown 'Cannot release ownership as memory is not owned' error" end +checkCount(1) Li_std_auto_ptr.takeKlassAutoPtr(kin) # Ensure object is deleted (can't rely on GC) checkCount(0) diff --git a/Examples/test-suite/tcl/cpp11_std_unique_ptr_runme.tcl b/Examples/test-suite/tcl/cpp11_std_unique_ptr_runme.tcl index d5864b874..636757d48 100644 --- a/Examples/test-suite/tcl/cpp11_std_unique_ptr_runme.tcl +++ b/Examples/test-suite/tcl/cpp11_std_unique_ptr_runme.tcl @@ -90,8 +90,8 @@ checkCount 0 Klass kin "KlassInput" set exception_thrown 0 +set notowned [get_not_owned_ptr kin] if [ catch { - set notowned [get_not_owned_ptr kin] takeKlassUniquePtr notowned } ] { set exception_thrown 1 @@ -99,6 +99,7 @@ if [ catch { if {!$exception_thrown} { error "Should have thrown 'Cannot release ownership as memory is not owned' error" } +checkCount 1 kin -delete checkCount 0 diff --git a/Examples/test-suite/tcl/li_std_auto_ptr_runme.tcl b/Examples/test-suite/tcl/li_std_auto_ptr_runme.tcl index f9ab30ad4..7c32187be 100644 --- a/Examples/test-suite/tcl/li_std_auto_ptr_runme.tcl +++ b/Examples/test-suite/tcl/li_std_auto_ptr_runme.tcl @@ -61,8 +61,8 @@ checkCount 0 Klass kin "KlassInput" set exception_thrown 0 +set notowned [get_not_owned_ptr kin] if [ catch { - set notowned [get_not_owned_ptr kin] takeKlassAutoPtr notowned } ] { set exception_thrown 1 @@ -70,6 +70,7 @@ if [ catch { if {!$exception_thrown} { error "Should have thrown 'Cannot release ownership as memory is not owned' error" } +checkCount 1 kin -delete checkCount 0