<commit_before>use v6;
use lib 't/spec/packages';

use Test;
use Test::Tap;

plan 61;

#?rakudo.jvm todo 3 "D: doesn't work in signatures"
dies_ok { Supply.classify( {...}  ) }, 'can not be called as a class method';
dies_ok { Supply.classify( {a=>1} ) }, 'can not be called as a class method';
dies_ok { Supply.classify( [<a>]  ) }, 'can not be called as a class method';

for (ThreadPoolScheduler, CurrentThreadScheduler) {
    $*SCHEDULER = .new;
    isa_ok $*SCHEDULER, $_, "***** scheduling with {$_.gist}";

    my %mapper is default(Int) = ( a=>Str, b=>Str, c=>Str );
    my &mapper = {.WHAT};
    for &mapper, $%mapper -> \mapper {
        my $what = mapper.WHAT.perl;
        my $s = Supply.new;
        ok $s ~~ Supply, "we got a base Supply ($what)";
        my $c = $s.classify( mapper );
        ok $s ~~ Supply, "we got a classification Supply ($what)";

        my @keys;
        my @supplies;
        isa_ok $c.tap( -> $p {
            @keys.push: $p.key;
            @supplies.push: $p.value;
        } ), Tap, "we got a tap ($what)";

        $s.more($_) for 1,2,3,<a b c>;
        is_deeply @keys, [Int, Str], "did we get the right keys ($what)";
        tap_ok @supplies[0], [1,2,3],   "got the Int supply ($what)", :live;
        tap_ok @supplies[1], [<a b c>], "got the Str supply ($what)", :live;
    }
}<commit_msg>Also test Supply.classify( @mapper )<commit_after>use v6;
use lib 't/spec/packages';

use Test;
use Test::Tap;

plan 89;

#?rakudo.jvm todo 3 "D: doesn't work in signatures"
dies_ok { Supply.classify( {...}  ) }, 'can not be called as a class method';
dies_ok { Supply.classify( {a=>1} ) }, 'can not be called as a class method';
dies_ok { Supply.classify( [<a>]  ) }, 'can not be called as a class method';

for (ThreadPoolScheduler, CurrentThreadScheduler) {
    $*SCHEDULER = .new;
    isa_ok $*SCHEDULER, $_, "***** scheduling with {$_.gist}";

    my %mapper is default(0) = ( 11=>1, 12=>1, 13=>1 );
    my &mapper = { $_ div 10 };
    my @mapper = (0 xx 10, 1 xx 10);
    for &mapper, $%mapper, $@mapper -> \mapper {
        my $what = mapper.WHAT.perl;
        my $s = Supply.new;
        ok $s ~~ Supply, "we got a base Supply ($what)";
        my $c = $s.classify( mapper );
        ok $s ~~ Supply, "we got a classification Supply ($what)";

        my @keys;
        my @supplies;
        isa_ok $c.tap( -> $p {
            @keys.push: $p.key;
            @supplies.push: $p.value;
        } ), Tap, "we got a tap ($what)";

        $s.more($_) for 1,2,3,11,12,13;
        is_deeply @keys, [0,1], "did we get the right keys ($what)";
        tap_ok @supplies[0], [1,2,3],   "got the 0 supply ($what)", :live;
        tap_ok @supplies[1], [11,12,13], "got the 1 supply ($what)", :live;
    }
}
{'fraction_non_alphanumeric': 0.18271334792122537, 'fraction_numerical': 0.02188183807439825, 'mean_word_length': 2.5716145833333335, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7280427', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1014, 'n_words': 321}