<commit_before>#!/bin/bash

cd mini-parser
make
java Mini ../tests/1.mini > ../tests/1.json
java Mini ../tests/2.mini > ../tests/2.json
java Mini ../tests/ret.mini > ../tests/ret.json
java Mini ../tests/ret_bad.mini > ../tests/ret_bad.json
java Mini ../tests/ret_bad2.mini > ../tests/ret_bad2.json
cd ..

mlton mc.mlb
./mc tests/1.json
./mc tests/2.json
./mc tests/ret.json
./mc tests/ret_bad.json
./mc tests/ret_bad2.json
<commit_msg>Automatically test every file in the tests directory<commit_after>#!/bin/bash

NAME=""

get_file_name () {
    local IFS='/'
    arr=($1)
    NAME=${arr[2]}
    local IFS='.'
    arr=($NAME)
    NAME=${arr[0]}
}

cd mini-parser
make
for f in ../tests/*.mini; do
    get_file_name $f
    java Mini $f > "../tests/$NAME.json"
done
cd ..

mlton mc.mlb
for f in tests/*.json; do
    ./mc $f
done
{'fraction_non_alphanumeric': 0.1900726392251816, 'fraction_numerical': 0.014527845036319613, 'mean_word_length': 2.564655172413793, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2698017', 'n_tokens_mistral': 347, 'n_tokens_neox': 323, 'n_words': 81}