<commit_before>use v6;
use Test;

=begin pod

Multi-Dimensional Arrays

=end pod

plan 31;

# multi-dimensional array
# L<S09/Multidimensional arrays/Perl 6 arrays are not restricted to being one-dimensional>

my $multi1 = [1, ['foo', 'bar', 'baz'], 5];<commit_msg>[gsoc_spectest] added some real multi-d array tests. (added 10 tests)<commit_after>use v6;
use Test;

=begin pod

Multi-Dimensional Arrays

=end pod

plan 41;

# multi-dimensional array
# L<S09/Multidimensional arrays/Perl 6 arrays are not restricted to being one-dimensional>

# real multi-dimensional arrays
{
    my @md[2;2];
    @md[0;0] = 0;
    @md[0;1] = 2;
    @md[1;0] = 4;
    @md[1;1] = 6;
    is(@md[0;0], 0, 'accessing an array as [0;0] works (1)');
    is(@md[0;1], 2, 'accessing an array as [0;0] works (2)');
    is(@md[1;0], 4, 'accessing an array as [0;0] works (3)');
    is(@md[1;1], 6, 'accessing an array as [0;0] works (4)');
    dies_ok({@md[1;2] = 5}, 'setting a multi-d array beyond boundaries fails');

    is(@md.elems, 4, '.elems works on multidimensional array');
}

{
    my @md[*;*;2];
    @md[0;0;0] = 'foo';
    @md[9;9;1] = 'bar';
    is(@md[0;0;0], 'foo', 'accessing a partially bounded array works (1)');
    is(@md[9;9;1], 'bar', 'accessing a partially bounded array works (2)');
    dies_ok({@md[0;0;2] = 9}, 'setting a partially bounded multi-d array beyond boundaries fails');

    is(@md.elems, 2, '.elems works on partially bounded multi-d array');
}

my $multi1 = [1, ['foo', 'bar', 'baz'], 5];
{'fraction_non_alphanumeric': 0.18695941450432468, 'fraction_numerical': 0.054557551563539586, 'mean_word_length': 3.915032679738562, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6338053', 'n_tokens_mistral': 619, 'n_tokens_neox': 584, 'n_words': 179}