<commit_before>#!/usr/bin/perl

use warnings;
use strict;

use Test::More;
use Test::Exception;
use File::Temp qw/ tempdir /;
use File::Copy qw/ copy /;

use LINZ::Bde;

my $dset;
my $datadir = "t/data";
my $tmpdir = tempdir( '/tmp/BdeDataset.t-data-XXXX', CLEANUP => 1 );
my $level;

throws_ok {
  $dset = new LINZ::BdeDataset
} qr/Invalid LINZ::BdeDataset path/, 'want a path';

throws_ok {
  $dset = new LINZ::BdeDataset('/this/directory/does/not/exist');
} qr/Invalid LINZ::BdeDataset path/, 'want an existing path';

throws_ok {
  $dset = new LINZ::BdeDataset($datadir)
} qr/Invalid LINZ::BdeDataset level/, 'want a level';

throws_ok {
  $dset = new LINZ::BdeDataset($datadir, 8)
} qr/Invalid LINZ::BdeDataset level/, 'want a level of 0 or 5';

ok ( $dset = new LINZ::BdeDataset($datadir, 0), 'can use $datadir as level 0 dataset' );
is( $dset->level, 0, 'trusts level to be the passed one (0)');
is_deeply(scalar $dset->files, ['pab1'], 'finds pab1 file in dataset (0)');

ok ( $dset = new LINZ::BdeDataset($datadir, 5), 'can use $datadir as level 5 dataset' );
is( $dset->level, 5, 'trusts level to be the passed one (5)');
is_deeply(scalar $dset->files, ['pab1'], 'finds pab1 file in dataset (5)');

copy($datadir.'/pab1.crs', $tmpdir.'/pab1.crs') or die "Copy failed: $!";
copy($datadir.'/pab1.crs', $tmpdir.'/pab2.crs') or die "Copy failed: $!";
ok ( $dset = new LINZ::BdeDataset($tmpdir, 5), 'can use $tmpdir as level 5 dataset' );<commit_msg>Add some semicolons<commit_after>#!/usr/bin/perl

use warnings;
use strict;

use Test::More;
use Test::Exception;
use File::Temp qw/ tempdir /;
use File::Copy qw/ copy /;

use LINZ::Bde;

my $dset;
my $datadir = "t/data";
my $tmpdir = tempdir( '/tmp/BdeDataset.t-data-XXXX', CLEANUP => 1 );
my $level;

throws_ok {
  $dset = new LINZ::BdeDataset;
} qr/Invalid LINZ::BdeDataset path/, 'want a path';

throws_ok {
  $dset = new LINZ::BdeDataset('/this/directory/does/not/exist');
} qr/Invalid LINZ::BdeDataset path/, 'want an existing path';

throws_ok {
  $dset = new LINZ::BdeDataset($datadir);
} qr/Invalid LINZ::BdeDataset level/, 'want a level';

throws_ok {
  $dset = new LINZ::BdeDataset($datadir, 8);
} qr/Invalid LINZ::BdeDataset level/, 'want a level of 0 or 5';

ok ( $dset = new LINZ::BdeDataset($datadir, 0), 'can use $datadir as level 0 dataset' );
is( $dset->level, 0, 'trusts level to be the passed one (0)');
is_deeply(scalar $dset->files, ['pab1'], 'finds pab1 file in dataset (0)');

ok ( $dset = new LINZ::BdeDataset($datadir, 5), 'can use $datadir as level 5 dataset' );
is( $dset->level, 5, 'trusts level to be the passed one (5)');
is_deeply(scalar $dset->files, ['pab1'], 'finds pab1 file in dataset (5)');

copy($datadir.'/pab1.crs', $tmpdir.'/pab1.crs') or die "Copy failed: $!";
copy($datadir.'/pab1.crs', $tmpdir.'/pab2.crs') or die "Copy failed: $!";
ok ( $dset = new LINZ::BdeDataset($tmpdir, 5), 'can use $tmpdir as level 5 dataset' );
{'fraction_non_alphanumeric': 0.18602261048304214, 'fraction_numerical': 0.01644398766700925, 'mean_word_length': 4.692007797270955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '2680023', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1201, 'n_words': 334}