<commit_before>#!/usr/bin/env perl

use strict;
use warnings;

use Test::More;
use FindBin qw($Bin);
use lib ("$Bin/../lib", "$Bin/../../lib");

use RUM::TestUtils;

my $unique_in     = "$SHARED_INPUT_DIR/RUM_Unique.sorted.1";
my $non_unique_in = "$SHARED_INPUT_DIR/RUM_NU.sorted.1";

my @files = ($unique_in, $non_unique_in);

my @tests = (
    {
        file => $unique_in,
        name => "test Unique Mappers",
        expected_cov => "RUM_Unique.cov",
        expected_footprint => qr/73771/
    },
    {
        file => $non_unique_in,
        name => "test Non-Unique Mappers",
        expected_cov => "RUM_NU.cov",
        expected_footprint => qr/66922/
    }
);

plan tests => 1 + 2 * scalar(@tests);

use_ok("RUM::Script::RumToCov");

for my $test (@tests) {
    my $name = $test->{name};
    my $file = $test->{file};
    my $expected_cov = "$EXPECTED_DIR/$test->{expected_cov}";
    my $expected_footprint = $test->{expected_footprint};
    my $cov_out = temp_filename(TEMPLATE => "coverage.XXXXXX", UNLINK => 0);
    my $stats_out = temp_filename(TEMPLATE => "footprint.XXXXXX", UNLINK => 0);

    $cov_out = "cov";
    @ARGV = ($file, "-o", $cov_out, "--name", $name, "--stats", $stats_out, "-q");
    RUM::Script::RumToCov->main();
    no_diffs($cov_out, $expected_cov, "Coverage diffs: $expected_cov");
    open my $in, "<", $stats_out;
    my $footprint = <$in>;    <commit_msg>Change footprint numbers<commit_after>#!/usr/bin/env perl

use strict;
use warnings;

use Test::More;
use FindBin qw($Bin);
use lib ("$Bin/../lib", "$Bin/../../lib");

use RUM::TestUtils;

my $unique_in     = "$SHARED_INPUT_DIR/RUM_Unique.sorted.1";
my $non_unique_in = "$SHARED_INPUT_DIR/RUM_NU.sorted.1";

my @files = ($unique_in, $non_unique_in);

my @tests = (
    {
        file => $unique_in,
        name => "test Unique Mappers",
        expected_cov => "RUM_Unique.cov",
        expected_footprint => qr/74381/
    },
    {
        file => $non_unique_in,
        name => "test Non-Unique Mappers",
        expected_cov => "RUM_NU.cov",
        expected_footprint => qr/67399/
    }
);

plan tests => 1 + 2 * scalar(@tests);

use_ok("RUM::Script::RumToCov");

for my $test (@tests) {
    my $name = $test->{name};
    my $file = $test->{file};
    my $expected_cov = "$EXPECTED_DIR/$test->{expected_cov}";
    my $expected_footprint = $test->{expected_footprint};
    my $cov_out = temp_filename(TEMPLATE => "coverage.XXXXXX", UNLINK => 0);
    my $stats_out = temp_filename(TEMPLATE => "footprint.XXXXXX", UNLINK => 0);

    $cov_out = "cov";
    @ARGV = ($file, "-o", $cov_out, "--name", $name, "--stats", $stats_out, "-q");
    RUM::Script::RumToCov->main();
    no_diffs($cov_out, $expected_cov, "Coverage diffs: $expected_cov");
    open my $in, "<", $stats_out;
    my $footprint = <$in>;    
{'fraction_non_alphanumeric': 0.19193721013200143, 'fraction_numerical': 0.011416339636104174, 'mean_word_length': 3.2420574886535554, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 41, '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': '6784952', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1069, 'n_words': 216}