summaryrefslogtreecommitdiff
path: root/rt/t/api/versions_sorter.t
blob: fb628f194e25da26016837b8499d0bc11626346a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

use RT::Test nodata => 1, tests => 3;

use strict;
use warnings;

sub is_right_sorting {
    my @order = @_;
    my @tmp = sort { int(rand(3)) - 1 } @order;

    is_deeply(
        [ sort RT::Handle::cmp_version @tmp ],
        \@order,
        'test sorting of ('. join(' ', @tmp) .')'
    );
}

is_right_sorting(qw(1 2 3));
is_right_sorting(qw(1.1 1.2 1.3 2.0 2.1));
is_right_sorting(qw(4.0.0a1 4.0.0alpha2 4.0.0b1 4.0.0beta2 4.0.0pre1 4.0.0pre2 4.0.0rc1 4.0.0rc2 4.0.0));