<commit_before>#!/bin/bash

read-0() {
    while [ "$1" ]; do
        IFS=$'\0' read -r -d '' "$1" || return 1
        shift
    done
}

for file in *.yml
do
    base=$(basename $file .yml)
    cat ${file} | shyaml get-value when > ${base}.s
    echo "bkpt" >> ${base}.s
    arm-none-eabi-gcc -nostdlib -Ttext=0x0 -mcpu=cortex-m0 ${base}.s -o ${base}.elf > ${base}.build 2>&1
    arm-none-eabi-objcopy ${base}.elf -O binary test.bin >> ${base}.build 2>&1
    cat ${file} | shyaml key-values given | ../src/core-test > ${base}.output
    cat ${file} | shyaml key-values-0 then |
    	while read-0 key value; do
	    grep "${key} ${value}" ${base}.output > /dev/null ||
	        echo "FAILED:" $(shyaml get-value name ${file} < ${file})
	done
done<commit_msg>Print a count of  tests run.<commit_after>#!/bin/bash

read-0() {
    while [ "$1" ]; do
        IFS=$'\0' read -r -d '' "$1" || return 1
        shift
    done
}

count=0

for file in *.yml
do
    base=$(basename $file .yml)
    cat ${file} | shyaml get-value when > ${base}.s
    echo "bkpt" >> ${base}.s
    arm-none-eabi-gcc -nostdlib -Ttext=0x0 -mcpu=cortex-m0 ${base}.s -o ${base}.elf > ${base}.build 2>&1
    arm-none-eabi-objcopy ${base}.elf -O binary test.bin >> ${base}.build 2>&1
    cat ${file} | shyaml key-values given | ../src/core-test > ${base}.output
    cat ${file} | shyaml key-values-0 then |
    	while read-0 key value; do
	    grep "${key} ${value}" ${base}.output > /dev/null ||
	        echo "FAILED:" $(shyaml get-value name ${file} < ${file})
	done

    let count=count+1
done

echo Ran ${count} tests.
{'fraction_non_alphanumeric': 0.20163831127914303, 'fraction_numerical': 0.01890359168241966, 'mean_word_length': 2.5367483296213806, 'pattern_counts': {'":': 0, '<': 5, '<?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': '203677', 'n_tokens_mistral': 620, 'n_tokens_neox': 592, 'n_words': 167}