in reply to Re: compare two arrays if both are equal and have same elements irrespective of their position
in thread compare two arrays if both are equal and have same elements irrespective of their position

Do you know a way to create a bag using Test2::V0 as easy as in your example? I've been searching for something like that without luck.

Greetings,
-jo

$gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$
  • Comment on Re^2: compare two arrays if both are equal and have same elements irrespective of their position

Replies are listed 'Best First'.
Re^3: compare two arrays if both are equal and have same elements irrespective of their position
by choroba (Cardinal) on Jun 16, 2021 at 21:32 UTC
    You can write a simple helper sub yourself (or maybe write many of them and upload them to CPAN):
    use Test2::V0; sub mybag { my @ar = @_; bag { item $_ for @ar ; end } } is(\@array1, mybag(@array2));
    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]