<commit_before>#!/usr/bin/env bash

n_tests=0
n_tests_failed=0
n_tests_passed=0

TLDATABASE="tl_test.db"

if [ -f "$TLDATABASE" ] ; then
  echo "tl db file $TLDATABASE exists. Cannot run tests." 1>&2
  exit 1
fi

n_tests=$(( $n_tests + 1 ))
./bin/tl create -f "$TLDATABASE" 2>/dev/null
if [ $? -ne 0 ] ; then
  echo 'Test: Create named tl database. Failed.' 1>&2
  n_tests_failed=$(( $n_tests_failed + 1 ))
else
  n_tests_passed=$(( $n_tests_passed + 1 ))
fi

n_tests=$(( $n_tests + 1 ))
if [ ! -f "$TLDATABASE" ] ; then
  echo 'Test: Created named tl database file. Failed.' 1>&2
  n_tests_failed=$(( $n_tests_failed + 1 ))
else
  n_tests_passed=$(( $n_tests_passed + 1 ))
fi

n_tests=$(( $n_tests + 1 ))
./bin/tl 2>/dev/null
if [ $? -eq 0 ] ; then
  echo 'Test: No command provided #1. Failed.' 1>&2
  n_tests_failed=$(( $n_tests_failed + 1 ))
else
  n_tests_passed=$(( $n_tests_passed + 1 ))
fi

n_tests=$(( $n_tests + 1 ))
./bin/tl -f "$TLDATABASE" 2>/dev/null
if [ $? -eq 0 ] ; then
  echo 'Test: No command provided #2. Failed.' 1>&2
  n_tests_failed=$(( $n_tests_failed + 1 ))
else
  n_tests_passed=$(( $n_tests_passed + 1 ))
fi
<commit_msg>Add test for failure to fail create existing database.<commit_after>#!/usr/bin/env bash

n_tests=0
n_tests_failed=0
n_tests_passed=0

TLDATABASE="tl_test.db"

if [ -f "$TLDATABASE" ] ; then
  echo "tl db file $TLDATABASE exists. Cannot run tests." 1>&2
  exit 1
fi

n_tests=$(( $n_tests + 1 ))
./bin/tl create -f "$TLDATABASE" 2>/dev/null
if [ $? -ne 0 ] ; then
  echo 'Test: Create named tl database. Failed.' 1>&2
  n_tests_failed=$(( $n_tests_failed + 1 ))
else
  n_tests_passed=$(( $n_tests_passed + 1 ))
fi

n_tests=$(( $n_tests + 1 ))
./bin/tl create -f "$TLDATABASE" 2>/dev/null
if [ $? -eq 0 ] ; then
  echo 'Test: Create existing named tl database. Failed.' 1>&2
  n_tests_failed=$(( $n_tests_failed + 1 ))
else
  n_tests_passed=$(( $n_tests_passed + 1 ))
fi

n_tests=$(( $n_tests + 1 ))
if [ ! -f "$TLDATABASE" ] ; then
  echo 'Test: Created named tl database file. Failed.' 1>&2
  n_tests_failed=$(( $n_tests_failed + 1 ))
else
  n_tests_passed=$(( $n_tests_passed + 1 ))
fi

n_tests=$(( $n_tests + 1 ))
./bin/tl 2>/dev/null
if [ $? -eq 0 ] ; then
  echo 'Test: No command provided #1. Failed.' 1>&2
  n_tests_failed=$(( $n_tests_failed + 1 ))
else
  n_tests_passed=$(( $n_tests_passed + 1 ))
fi

n_tests=$(( $n_tests + 1 ))
./bin/tl -f "$TLDATABASE" 2>/dev/null
if [ $? -eq 0 ] ; then
  echo 'Test: No command provided #2. Failed.' 1>&2
  n_tests_failed=$(( $n_tests_failed + 1 ))
else
  n_tests_passed=$(( $n_tests_passed + 1 ))
fi

{'fraction_non_alphanumeric': 0.17817200154261473, 'fraction_numerical': 0.028924026224450443, 'mean_word_length': 3.742230347349177, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '3117824', 'n_tokens_mistral': 1150, 'n_tokens_neox': 1073, 'n_words': 293}