7
use Test::More tests=>14;
9
use Net::OpenID::Common;
11
compare_comparisons('x', 'x', 'same, 1 char');
12
compare_comparisons('x', 'y', 'different, 1 char');
14
compare_comparisons('xx', 'xx', 'same, 2 chars');
15
compare_comparisons('xx', 'xy', 'different, 2 chars');
17
compare_comparisons('Frække frølår', 'Frække frølår', 'same, utf-8');
18
compare_comparisons('Frøkke frålær', 'Frække frølår', 'different, utf-8');
21
my $y='y' . 'x' x 999999;
22
compare_comparisons($x, $x, 'same, 1M chars');
23
compare_comparisons($x, $y, 'different, 1M chars');
26
compare_comparisons( $x, $z, 'different lengths, long');
27
compare_comparisons('a', 'aa', 'different lengths, short');
28
compare_comparisons( '', 'a', 'different lengths, shortest');
30
compare_comparisons( '', '', 'same length, shortest');
32
compare_comparisons(undef, '', 'undef, empty string');
33
compare_comparisons(undef, undef, 'both undef');
37
sub compare_comparisons {
38
my ($first, $second, $description)=@_;
40
# XXX may still want to test that the circumstances under
41
# which eq and timing_indep_eq produce warnings are the same
43
no warnings 'uninitialized';
44
is( ($first eq $second),
45
OpenID::util::timing_indep_eq($first, $second),