<commit_before>use strict;
use Test::More;
use lib qw(./lib ./blib/lib);
use Sisimai::Order::JSON;

my $PackageName = 'Sisimai::Order::JSON';
my $MethodNames = {
    'class' => ['by', 'default', 'another', 'headers'],
    'object' => [],
};

use_ok $PackageName;
can_ok $PackageName, @{ $MethodNames->{'class'} };

MAKE_TEST: {
    my $default = $PackageName->default;
    my $another = $PackageName->another;
    my $headers = $PackageName->headers;
    my $orderby = $PackageName->by('keyname');

    isa_ok $default, 'ARRAY';
    isa_ok $another, 'ARRAY';
    isa_ok $headers, 'HASH';
    isa_ok $orderby, 'HASH';

    ok scalar @$default, scalar(@$default).' Modules';
    ok keys %$orderby, scalar(keys %$orderby).' Patterns';

    for my $v ( @$default ) {
        # Module name test
        like $v, qr/\ASisimai::CED::/, $v;
        use_ok $v;
    }

    for my $v ( keys %$orderby ) {
        # Pattern table for detecting CED
        ok $v, 'subject =~ '.$v;
        ok scalar @{ $orderby->{ $v } };
        for my $w ( @{ $orderby->{ $v } } ) {
            ok length $w;
            use_ok $w;
        }
    }
}

done_testing;<commit_msg>Test code improvement for the coverage: https://coveralls.io/builds/9252219/source?filename=lib%2FSisimai%2FOrder%2FJSON.pm<commit_after>use strict;
use Test::More;
use lib qw(./lib ./blib/lib);
use Sisimai::Order::JSON;

my $PackageName = 'Sisimai::Order::JSON';
my $MethodNames = {
    'class' => ['by', 'default', 'another', 'headers'],
    'object' => [],
};

use_ok $PackageName;
can_ok $PackageName, @{ $MethodNames->{'class'} };

MAKE_TEST: {
    my $default = $PackageName->default;
    my $another = $PackageName->another;
    my $headers = $PackageName->headers;
    my $orderby = $PackageName->by('keyname');

    isa_ok $default, 'ARRAY';
    isa_ok $another, 'ARRAY';
    isa_ok $headers, 'HASH';
    isa_ok $orderby, 'HASH';

    ok scalar @$default, scalar(@$default).' Modules';
    ok keys %$orderby, scalar(keys %$orderby).' Patterns';

    for my $v ( @$default ) {
        # Module name test
        like $v, qr/\ASisimai::CED::/, $v;
        use_ok $v;
    }

    for my $v ( keys %$orderby ) {
        # Pattern table for detecting CED
        ok $v, 'subject =~ '.$v;
        ok scalar @{ $orderby->{ $v } };
        for my $w ( @{ $orderby->{ $v } } ) {
            ok length $w;
            use_ok $w;
        }
    }

    isa_ok $PackageName->by('neko'), 'HASH';
    is scalar keys %{ $PackageName->by('neko') }, 0;
}

done_testing;
{'fraction_non_alphanumeric': 0.18627842042281612, 'fraction_numerical': 0.0043877143996808934, 'mean_word_length': 2.7488789237668163, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 1, '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': '4582092', 'n_tokens_mistral': 944, 'n_tokens_neox': 908, 'n_words': 221}