From 9b4b73b59351ab6da7d34fa0a7890cfbb2cda42c Mon Sep 17 00:00:00 2001 From: Ed J Date: Wed, 18 Dec 2024 12:51:57 +0000 Subject: [PATCH] capture two flowing converts do backward flow right --- t/core.t | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/t/core.t b/t/core.t index b78772745..8aa22c950 100644 --- a/t/core.t +++ b/t/core.t @@ -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'; @@ -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; };