<commit_before>#!/bin/bash



## Check that Pig is nearby
if [ ! -f "../src/Pig" ]
then
    echo "Pig is absent. Please 'make' it."
    exit
fi

## Make a clean cache directory 
if [ -d ".tests" ]
then
    rm -fR ".tests"
fi
mkdir ".tests"

## Run the test cases
for script in `ls *.pig`
do
    # echo -n "Running test $script..."
    ../src/Pig --check "$script" > ".tests/$script.log"
    # echo " Done."
    if [ ! -f "results/$script.log" ]
    then
	echo -e "\e[00;34m[UNDEFINED]\e[00m Please provide the desired output for $script"
    else
	if ! diff -u "results/$script.log" ".tests/$script.log" > ".tests/$script.diff"
	then
	    echo -e "\e[00;31m[FAILED]\e[00m $script does not match the expected output"
	    cat ".tests/$script.diff"
	else
	    echo -e "\e[00;32m[PASSED]\e[00m $script looks alright!"
	fi
    fi
done<commit_msg>test: emacs-friendly coloring<commit_after>#!/bin/bash

failed="[FAILED]"
undefined="[UNDEFINED]"
passed="[PASSED]"

case ${TERM} in
        dumb*) # emacs shell is "dumb"
	# no color for the dumbs
        ;;
        *)
	# otherwise, assume that we have colors
	failed="\e[00;31m${failed}\e[00m"
	undefined="\e[00;34m${undefined}\e[00m"
	passed="\e[00;32m${passed}\e[00m"
        ;;
esac

## Check that Pig is nearby
if [ ! -f "../src/Pig" ]
then
    echo "Pig is absent. Please 'make' it."
    exit
fi

## Make a clean cache directory 
if [ -d ".tests" ]
then
    rm -fR ".tests"
fi
mkdir ".tests"

## Run the test cases
for script in `ls *.pig`
do
    # echo -n "Running test $script..."
    ../src/Pig --check "$script" > ".tests/$script.log"
    # echo " Done."
    if [ ! -f "results/$script.log" ]
    then
	echo -e "$undefined Please provide the desired output for $script"
    else
	if ! diff -u "results/$script.log" ".tests/$script.log" > ".tests/$script.diff"
	then
	    echo -e "\e[00;31m[FAILED]\e[00m $script does not match the expected output"
	else
	    echo -e "$passed $script looks alright!"
	fi
    fi
done
{'fraction_non_alphanumeric': 0.17022357723577236, 'fraction_numerical': 0.021341463414634148, 'mean_word_length': 2.6941838649155723, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1719609', 'n_tokens_mistral': 771, 'n_tokens_neox': 713, 'n_words': 223}