<commit_before>use v6;

use Test;
plan *;

use Tardis;
use Yapsi;

my @programs-ticks =
    '',                                 1,    'empty program',
    'my $a',                            1,    'uninitialised variable',
    'my $a = 42',                       2,    'initalised variable',
    'my $a = 42; ++$a',                 3,    'pre-increment',
    'my $a = 42; my $b; { $b = 5 }',    4,    'immediate blocks',
    'my $a = 42; { my $b = 5 }',        4,    'variable initialisation in immediate blocks',
    '{}; my $a = 42; { my $b = 5 };',   5,    'multiple immediate blocks',
;


for @programs-ticks -> $program, $ticks, $message {
    my Yapsi::Compiler  $c .= new;
    my Tardis::Debugger $d .= new;

    my @sic = $c.compile($program);
    $d.run(@sic);

    is +$d.ticks, $ticks, $message;
}

done_testing;<commit_msg>Check the content of the ticks not just their number<commit_after>use v6;

use Test;
plan *;

use Tardis;

my @programs-ticks =
   '',
    "",
    'empty program',

   'my $a',
    "\$a = Any()",
    'uninitialised variable',

   'my $a = 42',
    "\$a = Any()\t\$a = 42",
    'initalised variable',

   'my $a = 42; ++$a',
    "\$a = Any()\t\$a = 42\t\$a = 43",
    'pre-increment',

   'my $a = 42; my $b; { $b = 5 }',
    "\$a = Any()\n\$b = Any()\t\$a = 42\n\$b = Any()\t\$a = 42\n\$b = Any()\t\$a = 42\n\$b = 5",
    'immediate blocks',

   'my $a = 42; { my $b = 5 }',
    "\$a = Any()\t\$a = 42\t\$b = Any()\n\$a = 42\t\$b = 5\n\$a = 42",
    'variable initialisation in immediate blocks',

   '{}; my $a = 42; { my $b = 5 };',
    "\$a = Any()\t\$a = Any()\t\$a = 42\t\$b = Any()\n\$a = 42\t\$b = 5\n\$a = 42",
    'multiple immediate blocks',

;

for @programs-ticks -> $program, $ticks, $message {
    my Yapsi::Compiler  $c .= new;
    my Tardis::Debugger $d .= new;

    my @sic = $c.compile($program);
    $d.run(@sic);

    my $result = $d.ticks.map({.fmt("%s = %s")}).join("\t");
    is $result , $ticks, $message;
}

done_testing;
{'fraction_non_alphanumeric': 0.22766279656739022, 'fraction_numerical': 0.031297324583543666, 'mean_word_length': 2.003030303030303, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '279936', 'n_tokens_mistral': 888, 'n_tokens_neox': 800, 'n_words': 206}