<commit_before>#!/bin/sh -e

set -e


echo "test => $0"

rm -f ${KC_DB} ${KC_PASSFILE}

PASSWORD='<PASSWORD>'

# create a random database
if printf "${PASSWORD}\n${PASSWORD}\n" |./kc -b -k ${KC_DB};then
	echo "$0 test ok (create random db)!"
else
	echo "$0 test failed (create random db)!"
	exit 1
fi

echo ${PASSWORD} > ${KC_PASSFILE}
if echo "" |./kc -b -k ${KC_DB} -p ${KC_PASSFILE};then
	echo "$0 test ok (open random db)!"
else
	echo "$0 test failed (open random db)!"
	exit 1
fi

rm -f ${KC_DB}


# create our sample database
echo '*]duY3#42y/qA8}%~e5T3,~[+sj+i@hSoTvN+zSFDyrnv4qupDxDaq13YJ0NQmn4xQfPkOD7TE1Ow4T9iAvu+niN+yiYsdwJ
oVJQPieg3J5TzwuWo4LAF+9ynn7DGll8+YqUCpVUqv0GwSJrPBU70CvPeWZnxCzr
I5pynbW1Hy/YW+R3uLhTYpbXB5JC2GDsWB4PZKDOm5ekKCLnb8vD4A62r1H/hNS2
e0N6m8dUXtgbJ6EFZ2g6txHEX3YXi+WsNJGCaBW36t1KMJ+O85GatfqD7FpjOLr2
Sbvp5n2E1O4lSkopNDXuUdgoB9Xp3E5VSP4bjLZVMXEwli0wyl/8Z8tawTwvUJ2W
w7bXPUQNgXFH23KK3E9NWxRIY1+sfIR54Ew2539GTsPsAfGQEXVURU<KEY> > ${KC_DB}

if [ ! -r "${KC_DB}" ];then
	echo "$0 test failed (read sample db)!"
	exit 1
fi

if printf "${PASSWORD}" |./kc -b -k ${KC_DB};then
	echo "$0 test ok (create and open sample db)!"
else
	echo "$0 test failed (create and open sample db)!"
	exit 1
fi

exit 0
<commit_msg>Check for empty variables in create_db regression test script.<commit_after>#!/bin/sh -e

set -e


echo "test => $0"

if [ -z "${KC_DB}" ]  ||  [ -z ${KC_PASSFILE} ];then
	echo "No database or password file specified!";
	exit 1;
fi

rm -f ${KC_DB} ${KC_PASSFILE}

PASSWORD='<PASSWORD>'

# create a random database
if printf "${PASSWORD}\n${PASSWORD}\n" |./kc -b -k ${KC_DB};then
	echo "$0 test ok (create random db)!"
else
	echo "$0 test failed (create random db)!"
	exit 1
fi

echo ${PASSWORD} > ${KC_PASSFILE}
if echo "" |./kc -b -k ${KC_DB} -p ${KC_PASSFILE};then
	echo "$0 test ok (open random db)!"
else
	echo "$0 test failed (open random db)!"
	exit 1
fi

rm -f ${KC_DB}


# create our sample database
echo '*]duY3#42y/qA8}%~e5T3,~[+sj+i@hSoTvN+zSFDyrnv4qupDxDaq13YJ0NQmn4xQfPkOD7TE<KEY> > ${KC_DB}

if [ ! -r "${KC_DB}" ];then
	echo "$0 test failed (read sample db)!"
	exit 1
fi

if printf "${PASSWORD}" |./kc -b -k ${KC_DB};then
	echo "$0 test ok (create and open sample db)!"
else
	echo "$0 test failed (create and open sample db)!"
	exit 1
fi

exit 0

{'fraction_non_alphanumeric': 0.1542483660130719, 'fraction_numerical': 0.04967320261437908, 'mean_word_length': 4.669135802469135, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '4783142', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1076, 'n_words': 279}