line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
1099
|
use Test::Most; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use lib 'lib'; |
4
|
|
|
|
|
|
|
use Unknown::Values; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
ok !( 1 == unknown ), 'Direct comparisons to unknown should fail (==)'; |
7
|
|
|
|
|
|
|
ok !( unknown == unknown ), '... and unknown should not be == to itself'; |
8
|
|
|
|
|
|
|
ok !( unknown eq unknown ), '... and unknown should not be eq to itself'; |
9
|
|
|
|
|
|
|
ok !( 2 <= unknown ), 'Direct comparisons to unknown should fail (<=)'; |
10
|
|
|
|
|
|
|
ok !( 3 >= unknown ), 'Direct comparisons to unknown should fail (>=)'; |
11
|
|
|
|
|
|
|
ok !( 4 > unknown ), 'Direct comparisons to unknown should fail (>)'; |
12
|
|
|
|
|
|
|
ok !( 5 < unknown ), 'Direct comparisons to unknown should fail (<)'; |
13
|
|
|
|
|
|
|
ok !( 6 != unknown ), |
14
|
|
|
|
|
|
|
'Direct negative comparisons to unknown should fail (!=)'; |
15
|
|
|
|
|
|
|
ok !( 6 ne unknown ), |
16
|
|
|
|
|
|
|
'Direct negative comparisons to unknown should fail (ne)'; |
17
|
|
|
|
|
|
|
ok !( unknown ne unknown ), |
18
|
|
|
|
|
|
|
'Negative comparisons of unknown to unknown should fail (ne)'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $value = unknown; |
21
|
|
|
|
|
|
|
my @array = ( 1, 2, 3, $value, 4, 5 ); |
22
|
|
|
|
|
|
|
my @less = grep { $_ < 4 } @array; |
23
|
|
|
|
|
|
|
my @greater = grep { $_ > 3 } @array; |
24
|
|
|
|
|
|
|
eq_or_diff \@less, [ 1, 2, 3 ], 'unknown values are not returned with <'; |
25
|
|
|
|
|
|
|
eq_or_diff \@greater, [ 4, 5 ], 'unknown values are not returned with >'; |
26
|
|
|
|
|
|
|
eq_or_diff [ grep { is_unknown $_ } @array ], [unknown], |
27
|
|
|
|
|
|
|
'... but you can look for unknown values'; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my @sorted = sort { $a <=> $b } ( 4, 1, unknown, 5, unknown, unknown, 7 ); |
30
|
|
|
|
|
|
|
eq_or_diff \@sorted, [ 1, 4, unknown, 5, unknown, unknown, 7 ], |
31
|
|
|
|
|
|
|
'Sorting unknown values should leave their position in the list unchanged'; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
done_testing; |