<commit_before>#! perl
# Copyright (C) 2001-2005, The Perl Foundation.
# $Id$

use strict;
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
use Parrot::Test tests => 9;

use File::Temp;
use Parrot::Config;

=head1 NAME

t/native_pbc/header.t - PBC header format

=head1 SYNOPSIS

        % prove t/native_pbc/header.t

=head1 DESCRIPTION

Tests the layout of the PBC header.

=cut

# idea stolen from t/pmc/sub.t
my $tmppasm = File::Temp->new( UNLINK => 1, SUFFIX => '.pasm' );
print $tmppasm <<END;
set I0, 0
END
$tmppasm->flush;
my $out_f = File::Temp->new( UNLINK => 1, SUFFIX => '.pbc' );
my $path_to_parrot = Parrot::Test::path_to_parrot();
my $parrot = File::Spec->join( File::Spec->curdir(), 'parrot' . $PConfig{exe} );
my $args = $ENV{TEST_PROG_ARGS} || '';
Parrot::Test::run_command
  (
   qq{$parrot $args -o $out_f $tmppasm},
   CD     => $path_to_parrot,
   STDOUT => $out_f,
   STDERR => $out_f,
  );
my $pbc = slurp_file($out_f);

my @fields = qw(
    magic
    wordsize
    byteorder<commit_msg>t/native_pbc/header.t: fix hairy file-pointer overload problem in older perls: Operation eq: no method found string vs file-pointer<commit_after>#! perl
# Copyright (C) 2001-2005, The Perl Foundation.
# $Id$

use strict;
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
use Parrot::Test tests => 9;

use File::Temp;
use Parrot::Config;

=head1 NAME

t/native_pbc/header.t - PBC header format

=head1 SYNOPSIS

        % prove t/native_pbc/header.t

=head1 DESCRIPTION

Tests the layout of the PBC header.

=cut

# idea stolen from t/pmc/sub.t
my $tmppasm = File::Temp->new( UNLINK => 1, SUFFIX => '.pasm' );
print $tmppasm <<END;
set I0, 0
END
$tmppasm->flush;
my $out_f = File::Temp->new( UNLINK => 1, SUFFIX => '.pbc' );
my $path_to_parrot = Parrot::Test::path_to_parrot();
my $parrot = File::Spec->join( File::Spec->curdir(), 'parrot' . $PConfig{exe} );
my $args = $ENV{TEST_PROG_ARGS} || '';
Parrot::Test::run_command
  (
   qq{$parrot $args -o $out_f $tmppasm},
   CD     => $path_to_parrot
  );
my $pbc = slurp_file($out_f);

my @fields = qw(
    magic
    wordsize
    byteorder
{'fraction_non_alphanumeric': 0.1683075480543835, 'fraction_numerical': 0.015002344116268168, 'mean_word_length': 3.7422222222222223, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 27, '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': '3268533', 'n_tokens_mistral': 891, 'n_tokens_neox': 847, 'n_words': 227}