Add std::auto_ptr support for Perl based on std::unique_ptr

This commit is contained in:
William S Fulton 2022-07-12 09:41:56 +01:00
commit 2bba78f757
4 changed files with 43 additions and 1 deletions

View file

@ -0,0 +1,17 @@
use strict;
use warnings;
use Test::More tests => 6;
BEGIN { use_ok('li_std_auto_ptr') }
require_ok('li_std_auto_ptr');
my $k1 = li_std_auto_ptr::makeKlassAutoPtr("first");
my $k2 = li_std_auto_ptr::makeKlassAutoPtr("second");
is(li_std_auto_ptr::Klass::getTotal_count, 2, "have 2 pointers");
undef $k1;
is(li_std_auto_ptr::Klass::getTotal_count, 1, "left 1 pointer");
is($k2->getLabel, "second", "proper label");
undef $k2;
is(li_std_auto_ptr::Klass::getTotal_count, 0, "remove all pointers");