File: 99_leaktrace.t

package info (click to toggle)
liblist-utilsby-xs-perl 0.06-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 212 kB
  • sloc: perl: 198; makefile: 3; sh: 1
file content (64 lines) | stat: -rw-r--r-- 1,114 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!perl
use strict;
use warnings;

BEGIN {
    use Test::More;

    eval "use Test::LeakTrace";
    plan skip_all => "Test::LeakTrace required for memory leak testing" if $@;

    use List::UtilsBy::XS qw(:all);
};

no_leaks_ok {
    my @a = sort_by { $_ } 1 .. 10;
} 'sort_by';

no_leaks_ok {
    my @a = nsort_by { $_ } 1 .. 10;
} 'nsort_by';

no_leaks_ok {
    my @a = max_by { $_ } 1 .. 10;
} 'max_by';

no_leaks_ok {
    my @a = uniq_by { $_ } 1 .. 10;
} 'uniq_by';

no_leaks_ok {
    my %a = partition_by { $_ } 1 .. 10;
} 'partition_by';

no_leaks_ok {
    my %a = count_by { $_ } 1 .. 10;
} 'count_by';

no_leaks_ok {
    my @a = zip_by { $_ } [1..10], [1..10];
} 'zip_by';

no_leaks_ok {
    my @a = unzip_by { $_ } 1..10;
} 'unzip_by';

my @array = (1..10);
no_leaks_ok {
    my @a = extract_by { $_ } @array;
} 'extract_by';

my @array2 = (1..10);
no_leaks_ok {
    my $a = extract_by { $_ } @array2;
} 'extract_by with scalar context';

no_leaks_ok {
    my @a = weighted_shuffle_by { $_ } 1..10;
} 'weighted_shuffle_by';

no_leaks_ok {
    my @a = bundle_by { $_ } 1..10;
} 'bundle_by';

done_testing;