- any
- List::MoreUtils
Multiple expected values revised
We are going to use the "any" function of List::MoreUtils.
examples/test-perl/t/dice_any.t
use strict; use warnings; use MyTools; use List::MoreUtils qw(any); use Test::More tests => 4; for (1..4) { my $value = dice(); ok( (any {$_ eq $value} (1, 2, 3, 4, 5, 6)), 'correct number'); }
Output:
1..4 not ok 1 - correct number # Failed test 'correct number' # at t/dice_any.t line 14. ok 2 - correct number not ok 3 - correct number # Failed test 'correct number' # at t/dice_any.t line 14. ok 4 - correct number # Looks like you failed 2 tests of 4.
This shows that there is some problem but we still don't know what exactly is the problem.
Especially think if this is part of a larger test suit when one of the tests fail.
We would like to see the actual value and maybe even the expected values.