This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to Scalar-List-Utils 1.45 from CPAN
[perl5.git] / cpan / Scalar-List-Utils / t / any-all.t
CommitLineData
e99e4210
SH
1#!./perl
2
b823713c
CBW
3use strict;
4use warnings;
e99e4210
SH
5
6use List::Util qw(any all notall none);
7use Test::More tests => 12;
8
9ok( (any { $_ == 1 } 1, 2, 3), 'any true' );
10ok( !(any { $_ == 1 } 2, 3, 4), 'any false' );
11ok( !(any { 1 }), 'any empty list' );
12
13ok( (all { $_ == 1 } 1, 1, 1), 'all true' );
14ok( !(all { $_ == 1 } 1, 2, 3), 'all false' );
15ok( (all { 1 }), 'all empty list' );
16
17ok( (notall { $_ == 1 } 1, 2, 3), 'notall true' );
18ok( !(notall { $_ == 1 } 1, 1, 1), 'notall false' );
19ok( !(notall { 1 }), 'notall empty list' );
20
21ok( (none { $_ == 1 } 2, 3, 4), 'none true' );
22ok( !(none { $_ == 1 } 1, 2, 3), 'none false' );
23ok( (none { 1 }), 'none empty list' );