<commit_before>
# this is the test program for the forth implementation targeting parrot.
# this script can be passed the names of any number of test files. each test is
# a series of input/output pairs, with optional comments that start with #s.
#
# the first non-blank, non-comment line is considered the first input. the line
# immediately following that is the first output line. the output can be either
# the stack (where the elements are joined by a space) or the message of a
# thrown exception.

.sub main :main
    .param pmc args
    .local int argc
    $P0  = shift args
    argc = elements args

    load_bytecode 'languages/forth/forth.pir'

    .local pmc iter
    iter = new 'Iterator', args
next_file:
    unless iter goto done
    $S0 = shift iter
    test($S0)
    goto next_file
done:
    end
.end

#
#   test(filename)
#
# Test a particular filename: read it, parse it, compare the input/output.
#<commit_msg>[forth] use the opcode 'iter' instead of a instantiation of 'Iterator'<commit_after>
# this is the test program for the forth implementation targeting parrot.
# this script can be passed the names of any number of test files. each test is
# a series of input/output pairs, with optional comments that start with #s.
#
# the first non-blank, non-comment line is considered the first input. the line
# immediately following that is the first output line. the output can be either
# the stack (where the elements are joined by a space) or the message of a
# thrown exception.

.sub main :main
    .param pmc args
    .local int argc
    $P0  = shift args
    argc = elements args

    load_bytecode 'languages/forth/forth.pir'

    .local pmc it
    it = iter args
next_file:
    unless it goto done
    $S0 = shift it
    test($S0)
    goto next_file
done:
    end
.end

#
#   test(filename)
#
# Test a particular filename: read it, parse it, compare the input/output.
#
{'fraction_non_alphanumeric': 0.06691253951527924, 'fraction_numerical': 0.003161222339304531, 'mean_word_length': 3.182819383259912, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6448593', 'n_tokens_mistral': 557, 'n_tokens_neox': 544, 'n_words': 273}