<commit_before>#! perl -w
# Copyright: 2005 The Perl Foundation.  All Rights Reserved.
# $Id: opcode-doc.t 6741 2004-10-01 21:16:56Z jrieks $

=head1 NAME

t/src/opcode-doc.t - check opcode documentation

=head1 SYNOPSIS

        % perl t/src/opcode-doc.t

=head1 DESCRIPTION

Checks whether all opcodes are documentated.

=cut

use strict;
use Test::More tests => 1;
my @docerr;

sub slurp {
    my ($filename) = @_;
    open FILE, "< $filename" or die "can't open '$filename' for reading";
    my @file = <FILE>;
    close FILE;
    return @file;
}

sub analyse {
    my ($filename, $ops) = @_;
    my %file;

    foreach my $op ( keys %$ops ) {
        my $args = $ops->{$op};
        next if $op =~ /^DELETED/;
        foreach my $arg ( keys %$args ) {
            my $e = $args->{$arg};
            my $val = $e->{status};
            next if $val == 3; # doc & impl
            $file{$e->{def}} = "no documentation for $op($arg)" if exists $e->{def};
            $file{$e->{doc}} = "no definition of $op($arg)" if exists $e->{doc};
        }
    }

    foreach my $line ( sort {$a<=>$b} keys %file ) {
            push @docerr, "$filename:$line: $file{$line}\n";
    }<commit_msg>update opcode-doc.t<commit_after>#! perl -w
# Copyright: 2005 The Perl Foundation.  All Rights Reserved.
# $Id: opcode-doc.t 6741 2004-10-01 21:16:56Z jrieks $

=head1 NAME

t/src/opcode-doc.t - check opcode documentation

=head1 SYNOPSIS

        % perl t/src/opcode-doc.t

=head1 DESCRIPTION

Checks whether all opcodes are documentated.

=cut

use strict;
use Test::More tests => 1;
my @docerr;

sub slurp {
    my ($filename) = @_;
    open FILE, "< $filename" or die "can't open '$filename' for reading";
    my @file = <FILE>;
    close FILE;
    return @file;
}

sub analyse {
    my ($filename, $ops) = @_;
    my %file;

    foreach my $op ( keys %$ops ) {
        my $args = $ops->{$op};
        next if $op =~ /^DELETED/;
        next if $op =~ /^isgt/;	# doced but rewritten
        next if $op =~ /^isge/;
        foreach my $arg ( keys %$args ) {
            my $e = $args->{$arg};
            my $val = $e->{status};
            next if $val == 3; # doc & impl
            $file{$e->{def}} = "no documentation for $op($arg)" if exists $e->{def};
            $file{$e->{doc}} = "no definition of $op($arg)" if exists $e->{doc};
        }
    }

    foreach my $line ( sort {$a<=>$b} keys %file ) {
            push @docerr, "$filename:$line: $file{$line}\n";
    }
{'fraction_non_alphanumeric': 0.17248376623376624, 'fraction_numerical': 0.021915584415584416, 'mean_word_length': 2.2605820105820107, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 23, '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': '4358201', 'n_tokens_mistral': 940, 'n_tokens_neox': 883, 'n_words': 268}