<commit_before>use v6;
use Test;

use Tardis;

my Tardis::Debugger $debugger .= new(program => AST::Node::Statementlist.new());
$debugger.run;

is +$debugger.ticks, 1, 'empty program has 1 tick';
is +$debugger.ticks[0].pad.variables, 0,
   'there are no variables in the current pad';

$debugger .= new(
    program => AST::Node::Statementlist.new(
        AST::Node::Assignment.new(
            AST::Node::Declaration.new(
                'my',
                AST::Node::Variable.new('$a')
            ),
            AST::Node::Literal.new(42)
        )
    )
);
$debugger.run;

is +$debugger.ticks, 2, 'single-assignment program has 2 ticks';

{
    my @ticks = $debugger.ticks;
    is +@ticks[0].pad.variables, 1,
       'there is one variable in the current pad';
    is @ticks[0].pad.variables<$a>, 'Any',
       'before assignment, var is undefined';
    is @ticks[1].pad.variables<$a>, '42',
       'after assignment, var is 42';
}

$debugger .= new(
    program => AST::Node::Statementlist.new(
        AST::Node::Assignment.new(
            AST::Node::Declaration.new(
                'my',
                AST::Node::Variable.new('$a')
            ),
            AST::Node::Op.new(
                'postfix:<++>',
                AST::Node::Variable.new('$a')
            )
        )
    )
);
$debugger.run;

is +$debugger.ticks, 3, 'assignment with ++ has 3 ticks';

{
    my @ticks = $debugger.ticks;
    is @ticks[0].pad.variables<$a>, 'Any',
       'at start, var is undefined';
    is @ticks[1].pad.variables<$a>, 1,
       'after postfix:<++>, var is 1';
    is @ticks[2].pad.variables<$a>, 'Any',
       'after assignment, var is undefined';
}<commit_msg>[t/examples.t] added missing done_testing call<commit_after>use v6;
use Test;

use Tardis;

my Tardis::Debugger $debugger .= new(program => AST::Node::Statementlist.new());
$debugger.run;

is +$debugger.ticks, 1, 'empty program has 1 tick';
is +$debugger.ticks[0].pad.variables, 0,
   'there are no variables in the current pad';

$debugger .= new(
    program => AST::Node::Statementlist.new(
        AST::Node::Assignment.new(
            AST::Node::Declaration.new(
                'my',
                AST::Node::Variable.new('$a')
            ),
            AST::Node::Literal.new(42)
        )
    )
);
$debugger.run;

is +$debugger.ticks, 2, 'single-assignment program has 2 ticks';

{
    my @ticks = $debugger.ticks;
    is +@ticks[0].pad.variables, 1,
       'there is one variable in the current pad';
    is @ticks[0].pad.variables<$a>, 'Any',
       'before assignment, var is undefined';
    is @ticks[1].pad.variables<$a>, '42',
       'after assignment, var is 42';
}

$debugger .= new(
    program => AST::Node::Statementlist.new(
        AST::Node::Assignment.new(
            AST::Node::Declaration.new(
                'my',
                AST::Node::Variable.new('$a')
            ),
            AST::Node::Op.new(
                'postfix:<++>',
                AST::Node::Variable.new('$a')
            )
        )
    )
);
$debugger.run;

is +$debugger.ticks, 3, 'assignment with ++ has 3 ticks';

{
    my @ticks = $debugger.ticks;
    is @ticks[0].pad.variables<$a>, 'Any',
       'at start, var is undefined';
    is @ticks[1].pad.variables<$a>, 1,
       'after postfix:<++>, var is 1';
    is @ticks[2].pad.variables<$a>, 'Any',
       'after assignment, var is undefined';
}

done_testing;
{'fraction_non_alphanumeric': 0.17648791985857396, 'fraction_numerical': 0.014142604596346494, 'mean_word_length': 2.364717542120912, 'pattern_counts': {'":': 0, '<': 17, '<?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': '3337723', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1154, 'n_words': 257}