<commit_before>use v6;
unit module Test::Iterator;

use Test;

# Test whether all iterator functions work as expected on an
# iterator.
# First parameter is Callable that generates a fresh iterator.
# Second parameter is a description for this group of tests.
# Rest is a slurpy with the expected result of pulling all
# values from the iterator.
sub iterator-ok(&iterator, $desc, *@expected) is export {
    subtest {
        plan 17;
        {
            my @a;
            my $iterator = iterator();
            until (my $pulled := $iterator.pull-one) =:= IterationEnd {
                @a.push($pulled)
            }
            is-deeply @a, @expected, "$desc: pull-one until exhausted";
        }

        {
            my $iterator = iterator();
            Nil until $iterator.push-exactly(my @a,3) =:= IterationEnd;
            is-deeply @a, @expected, "$desc: push-exactly until exhausted";
        }

        {
            my $iterator = iterator();
            Nil until $iterator.push-at-least(my @a,3) =:= IterationEnd;
            is-deeply @a, @expected, "$desc: push-at-least until exhausted";
        }

        {
            my $iterator = iterator();
            is $iterator.push-all(my @a), IterationEnd,
              "$desc: does push-all return IterationEnd";
            is-deeply @a, @expected, "$desc: push-all";
        }

        {
            my $iterator = iterator();
            is $iterator.push-until-lazy(my @a), IterationEnd,
              "$desc: does push-until-lazy return IterationEnd";
            is-deeply @a, @expected, "$desc: push-until-lazy";
        }

        {
            my $iterator = iterator();
            is $iterator.sink-all, IterationEnd,
              "$desc: does sink-all return IterationEnd";
        }

        {
            my $iterator = iterator();
            my $meen = 0;
            $meen++ while $iterator.skip-one;
            is $meen, +@expected, "$desc: skip-one until exhausted";
        }

        {
            my $iterator = iterator();
            ok $iterator.skip-at-least(@expected - 1),
              "$desc: skip-at-least except last";
            is $iterator.pull-one, @expected[* - 1],
              "$desc: skip-at-least check last value";
            is $iterator.pull-one, IterationEnd,
              "$desc: did skip-at-least after pull-one exhaust?";
        }

        {
            my $iterator = iterator();
            is $iterator.skip-at-least-pull-one(@expected-1), @expected[*-1],<commit_msg>[v6.d REVIEW] Fix apparent typo in var name<commit_after>use v6;
unit module Test::Iterator;

use Test;

# Test whether all iterator functions work as expected on an
# iterator.
# First parameter is Callable that generates a fresh iterator.
# Second parameter is a description for this group of tests.
# Rest is a slurpy with the expected result of pulling all
# values from the iterator.
sub iterator-ok(&iterator, $desc, *@expected) is export {
    subtest {
        plan 17;
        {
            my @a;
            my $iterator = iterator();
            until (my $pulled := $iterator.pull-one) =:= IterationEnd {
                @a.push($pulled)
            }
            is-deeply @a, @expected, "$desc: pull-one until exhausted";
        }

        {
            my $iterator = iterator();
            Nil until $iterator.push-exactly(my @a,3) =:= IterationEnd;
            is-deeply @a, @expected, "$desc: push-exactly until exhausted";
        }

        {
            my $iterator = iterator();
            Nil until $iterator.push-at-least(my @a,3) =:= IterationEnd;
            is-deeply @a, @expected, "$desc: push-at-least until exhausted";
        }

        {
            my $iterator = iterator();
            is $iterator.push-all(my @a), IterationEnd,
              "$desc: does push-all return IterationEnd";
            is-deeply @a, @expected, "$desc: push-all";
        }

        {
            my $iterator = iterator();
            is $iterator.push-until-lazy(my @a), IterationEnd,
              "$desc: does push-until-lazy return IterationEnd";
            is-deeply @a, @expected, "$desc: push-until-lazy";
        }

        {
            my $iterator = iterator();
            is $iterator.sink-all, IterationEnd,
              "$desc: does sink-all return IterationEnd";
        }

        {
            my $iterator = iterator();
            my $seen = 0;
            $seen++ while $iterator.skip-one;
            is $seen, +@expected, "$desc: skip-one until exhausted";
        }

        {
            my $iterator = iterator();
            ok $iterator.skip-at-least(@expected - 1),
              "$desc: skip-at-least except last";
            is $iterator.pull-one, @expected[* - 1],
              "$desc: skip-at-least check last value";
            is $iterator.pull-one, IterationEnd,
              "$desc: did skip-at-least after pull-one exhaust?";
        }

        {
            my $iterator = iterator();
            is $iterator.skip-at-least-pull-one(@expected-1), @expected[*-1],
{'fraction_non_alphanumeric': 0.12708830548926014, 'fraction_numerical': 0.004176610978520286, 'mean_word_length': 1.7376156777354381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '743429', 'n_tokens_mistral': 1458, 'n_tokens_neox': 1414, 'n_words': 414}