<commit_before># http://perl6advent.wordpress.com/2009/12/08/day-8-comb-your-constraints/

use v6;
use Test;
<commit_msg>[t/spec] Added initial tests for Perl 6 Advent Calendar Day 8: .comb your constraints<commit_after># http://perl6advent.wordpress.com/2009/12/08/day-8-comb-your-constraints/

use v6;
use Test;

plan 6;

multi sub very_odd(Int $odd where {$odd % 2}) { Bool::True }
multi sub very_odd(Int $odd) { Bool::False }

ok very_odd(1), 'Type constraint - odd number';
nok very_odd(2), 'Type constraint - even number';

is "Perl 6 Advent".comb(/<alpha>/).join('|'), 'P|e|r|l|A|d|v|e|n|t', 'Comb for <alpha> and join on |';
is "Perl 6 Advent".comb(/<alpha>+/).join('|'), 'Perl|Advent', 'Comb for <alpha>+ and join on |';
is "5065726C36".comb(/<xdigit>**2/)».fmt("0x%s")».chr.join, 'Perl6', 'Comb ASCII hex chars with hyperop to convert to ASCII equivalent';
is ("5065726C36".comb(/<xdigit>**2/).map: { chr "0x" ~ $_ }).join, 'Perl6', 'Comb ASCII hex chars using map to convert to ASCII equivalent';

{'fraction_non_alphanumeric': 0.19543650793650794, 'fraction_numerical': 0.05357142857142857, 'mean_word_length': 4.832369942196531, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4126903', 'n_tokens_mistral': 428, 'n_tokens_neox': 378, 'n_words': 109}