<commit_before>#!/bin/bash

TESTS=./tests

SQLITE=$(which sqlite3)
TESTDB=temp.db

function cleanup {
  rm -f $TESTDB
}

function run_test {
  echo -n Running $1 ...

  OUT=$($SQLITE $TESTDB < $1)

  if [[ $? -ne 0 ]]; then
    echo error!
    echo $OUT
    exit 1
  fi

  if [ "$OUT" == "FAIL" ]; then
    echo failed!
  else
    echo passed.
  fi

}

for T in $(find $TESTS -type f); do

  run_test $T

done<commit_msg>remove db on exit and between tests<commit_after>#!/bin/bash

TESTS=./tests

SQLITE=$(which sqlite3)
TESTDB=temp.db

function cleanup {
  rm -f $TESTDB
}

function run_test {
  echo -n Running $1 ...

  OUT=$($SQLITE $TESTDB < $1)

  if [[ $? -ne 0 ]]; then
    echo error!
    echo $OUT
    exit 1
  fi

  if [ "$OUT" == "FAIL" ]; then
    echo failed!
  else
    echo passed.
  fi
  
  cleanup

}

trap cleanup EXIT

for T in $(find $TESTS -type f); do

  run_test $T

done
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.011160714285714286, 'mean_word_length': 2.3849056603773584, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1297473', 'n_tokens_mistral': 371, 'n_tokens_neox': 352, 'n_words': 111}