Skip to content

Commit

Permalink
capture two flowing converts do backward flow right
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Dec 18, 2024
1 parent 49f4121 commit 9b4b73b
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions t/core.t
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,8 @@ isnt $y->trans_parent, undef, '$y has parent';
isnt PDL::Core::pdumphash($x), undef, 'pdumphash works';
isnt $y->trans_parent, undef, '$y still has parent after pdumphash';
$x += 3;
is "$x", "[3 4 5]", '$x right value';
is "$y", "[4 5 6]", '$y right value';
is_pdl $x, pdl("[3 4 5]"), '$x right value';
is_pdl $y, pdl("[4 5 6]"), '$y right value';
ok !$y->fflows, 'y not "flowing"';
$y->flowing;
ok $y->fflows, 'y "flowing" on';
Expand All @@ -800,13 +800,25 @@ ok !$y->fflows, 'y "flowing" off again';
eval {$y += 4};
isnt $@, '', 'error on assigning to ndarray with inward but no outward flow';
my $oneway_slice = $y->slice('0:1');
is "$oneway_slice", '[4 5]';
is_pdl $oneway_slice, pdl '[4 5]';
eval {$oneway_slice .= 11};
isnt $@, '', 'error on assigning into one-way slice';
my $c = $y->flowing->_convert_int(cdouble->enum);
ok $c->fflows, 'flowing -> converted has "flowing" on';
}

{
my $x = sequence 3;
my $c = $x->_convert_int(cdouble->enum);
isnt $c->trans_parent, undef, 'converted has trans_parent';
$c++;
is_pdl $x, pdl(1..3);
my $cf = $c->_convert_int(cfloat->enum);
isnt $cf->trans_parent, undef, 'converted2 has trans_parent';
$cf++;
is_pdl $x, pdl(2..4);
}

my $notouch = sequence(4);
$notouch->set_donttouchdata;
eval { $notouch->setdims([2,2]); $notouch->make_physical; };
Expand Down

0 comments on commit 9b4b73b

Please sign in to comment.