<commit_before>use v6;

use Test;

plan *;
# L<S12/Enumerations>
{
    my %hash; eval '%hash = enum «:Mon(1) Tue Wed Thu Fri Sat Sun»';

    #is((%hash<Mon Tue Wed Thu Fri Sat Sun>) »eq« (1 .. 7)), "enum generated correct sequence");
    #?pugs 3 todo
    is(%hash<Mon>, 1, "first value ok");
    is(%hash<Thu>, 4, "fourth value ok");
    is(%hash<Sun>, 7, "last value ok");
};

{
    my %hash; eval '%hash = enum «:Two(2) Three Four»';

    #is((%hash<Two Three Four>) »eq« (2 .. 4)), "enum generated correct sequence");
    #?pugs 3 todo
    is(%hash<Two>, 2, "first value ok");
    is(%hash<Three>, 3, "second value ok");
    is(%hash<Four>, 4, "last value ok");
};

my %hash;

#?rakudo skip 'Parse error: Statement not terminated properly'
#?pugs 3 todo 'feature'
lives_ok { %hash = enum <<:Sun(1) :Mon(2) :Tue(3) :Wed(4) :Thu(5) :Fri(6) :Sat(7)>>; }, 'specifying keys and values works...';

is %hash.keys, <Sun Mon Tue Wed Thu Fri Sat>, '...and the right keys are assigned';

is %hash.values, 1..7, '...and the right values are assigned';

%hash = ();

#?rakudo skip 'Parse error: Statement not terminated properly'
#?pugs 3 todo 'feature'
lives_ok { %hash = enum <<:Sun(1) Mon Tue Wed Thu Fri Sat>>; }, 'specifying a value for only the first key works...';

is %hash.keys, <Sun Mon Tue Wed Thu Fri Sat>, '...and the right keys are assigned';

is %hash.values, 1..7, '...and the right values are assigned';

%hash = ();

#?rakudo skip 'Parse error: Statement not terminated properly'
#?pugs 3 todo 'feature'
lives_ok { %hash = enum «:Sun(1) Mon Tue Wed Thu Fri Sat»; }, 'french quotes work...';

is %hash.keys, <Sun Mon Tue Wed Thu Fri Sat>, '...and the right keys are assigned';

is %hash.values, 1..7, '...and the right values are assigned';

%hash = ();

#?rakudo skip 'Parse error: Statement not terminated properly'
#?pugs 3 todo 'feature'
lives_ok { %hash = enum <<:Sun(1) Mon Tue :Wed(4) Thu Fri Sat>>; }, 'specifying continuous values in the middle works...';

is %hash.keys, <Sun Mon Tue Wed Thu Fri Sat>, '...and the right keys are assigned';

is %hash.values, 1..7, '...and the right values are assigned';

%hash = ();

#?rakudo skip 'Parse error: Statement not terminated properly'
#?pugs 3 todo 'feature'
lives_ok { %hash = enum <<:Sun(1) Mon Tue :Wed(5) Thu Fri Sat>>; }, 'specifying different values in the middle works...';

is %hash.keys, <Sun Mon Tue Wed Thu Fri Sat>, '...and the right keys are assigned';

is %hash.values, (1, 2, 3, 5, 6, 7, 8), '...and the right values are assigned';

%hash = ();

#?rakudo skip 'Parse error: Statement not terminated properly'
#?pugs 3 todo 'feature'
lives_ok { %hash = enum «:Alpha<A> Bravo Charlie Delta Echo»; }, 'specifying a string up front works';

is %hash.keys, <Alpha Bravo Charlie Delta Echo>, '...and the right keys are assigned';

is %hash.values, <A B C D E>, '...and the right values are assigned';

%hash = ();

eval q[
lives_ok { %hash = enum <<:Alpha<A> Bravo Charlie Delta Echo>>; }, 'specifying a string up front works (Texas quotes)', :todo<feature>;
];

#?pugs todo 'feature'
is %hash.keys, <Alpha Bravo Charlie Delta Echo>, '...and the right keys are assigned';

#?pugs todo 'feature'<commit_msg>[t/spec] correct some enum tests that relied on hash key order<commit_after>use v6;

use Test;

plan *;
# L<S12/Enumerations>
{
    my %hash; eval '%hash = enum «:Mon(1) Tue Wed Thu Fri Sat Sun»';

    #is((%hash<Mon Tue Wed Thu Fri Sat Sun>) »eq« (1 .. 7)), "enum generated correct sequence");
    #?pugs 3 todo
    is(%hash<Mon>, 1, "first value ok");
    is(%hash<Thu>, 4, "fourth value ok");
    is(%hash<Sun>, 7, "last value ok");
};

{
    my %hash; eval '%hash = enum «:Two(2) Three Four»';

    #is((%hash<Two Three Four>) »eq« (2 .. 4)), "enum generated correct sequence");
    #?pugs 3 todo
    is(%hash<Two>, 2, "first value ok");
    is(%hash<Three>, 3, "second value ok");
    is(%hash<Four>, 4, "last value ok");
};

my %hash;

#?pugs 3 todo 'feature'
lives_ok { %hash = enum <<:Sun(1) :Mon(2) :Tue(3) :Wed(4) :Thu(5) :Fri(6) :Sat(7)>>; }, 'specifying keys and values works...';

#?rakudo 2 todo '<<:pair(3)>> magic' 
is %hash.keys.sort, <Sun Mon Tue Wed Thu Fri Sat>.sort, '...and the right keys are assigned';
is %hash.values.sort, 1..7, '...and the right values are assigned';

%hash = ();

#?pugs 3 todo 'feature'
lives_ok { %hash = enum <<:Sun(1) Mon Tue Wed Thu Fri Sat>>; }, 'specifying a value for only the first key works...';

#?rakudo 2 todo '<<:pair(3)>> magic' 
is %hash.keys.sort, <Sun Mon Tue Wed Thu Fri Sat>.sort, '...and the right keys are assigned';

is %hash.values.sort, 1..7, '...and the right values are assigned';

%hash = ();

#?pugs 3 todo 'feature'
lives_ok { %hash = enum «:Sun(1) Mon Tue Wed Thu Fri Sat»; }, 'french quotes work...';

#?rakudo 2 todo '<<:pair(3)>> magic' 
is %hash.keys.sort , <Sun Mon Tue Wed Thu Fri Sat>.sort , '...and the right keys are assigned';

is %hash.values, 1..7, '...and the right values are assigned';

%hash = ();

#?pugs 3 todo 'feature'
lives_ok { %hash = enum <<:Sun(1) Mon Tue :Wed(4) Thu Fri Sat>>; }, 'specifying continuous values in the middle works...';

#?rakudo 2 todo '<<:pair(3)>> magic' 
is %hash.keys.sort, <Sun Mon Tue Wed Thu Fri Sat>.sort, '...and the right keys are assigned';
is %hash.values.sort, 1..7, '...and the right values are assigned';

%hash = ();

#?pugs 3 todo 'feature'
lives_ok { %hash = enum <<:Sun(1) Mon Tue :Wed(5) Thu Fri Sat>>; }, 'specifying different values in the middle works...';

#?rakudo 2 todo '<<:pair(3)>> magic' 
is %hash.keys.sort, <Sun Mon Tue Wed Thu Fri Sat>.sort, '...and the right keys are assigned';

is %hash.values.sort, (1, 2, 3, 5, 6, 7, 8), '...and the right values are assigned';

%hash = ();

#?pugs 3 todo 'feature'
lives_ok { %hash = enum «:Alpha<A> Bravo Charlie Delta Echo»; }, 'specifying a string up front works';

#?rakudo 2 todo '<<:pair(3)>> magic' 
is %hash.keys.sort, <Alpha Bravo Charlie Delta Echo>, '...and the right keys are assigned';
is %hash.values.sort, <A B C D E>, '...and the right values are assigned';

%hash = ();

lives_ok { %hash = enum <<:Alpha<A> Bravo Charlie Delta Echo>>; }, 'specifying a string up front works (Texas quotes)', :todo<feature>;

#?pugs todo 'feature'
is %hash.keys.sort, <Alpha Bravo Charlie Delta Echo>, '...and the right keys are assigned';

#?pugs todo 'feature'
{'fraction_non_alphanumeric': 0.18372827804107425, 'fraction_numerical': 0.01800947867298578, 'mean_word_length': 3.7853363567649283, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 75, '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': '4095237', 'n_tokens_mistral': 2389, 'n_tokens_neox': 2210, 'n_words': 915}