<commit_before>. ./test/helper.sh

test_verify()
{
	local data="hello world"
	local md5="6f5902ac237024bdd0c176cb93063dc4"
	local path="./test/file.txt"

	echo "$data" > $path

	verify "$path" "$md5" >/dev/null

	assertEquals "did not return the correct MD5" 0 $?
	rm "$path"
}

test_verify_with_bad_md5()
{
	local data="hello world"
	local md5="4101bef8794fed986e95dfb54850c68b"
	local path="./test/file.txt"

	echo "$data" > $path

	verify "$path" "$md5" >/dev/null 2>/dev/null

	assertEquals "did not reject the incorrect MD5" 1 $?
	rm "$path"
}

SHUNIT_PARENT=$0 . $SHUNIT2<commit_msg>Test verify with md5sum and md5 (if available).<commit_after>. ./test/helper.sh

DATA="hello world"
MD5="6f5902ac237024bdd0c176cb93063dc4"
FILE="./test/file.txt"

setUp()
{
	echo "$DATA" > "$FILE"
}

test_verify()
{
	verify "$FILE" "$MD5" >/dev/null

	assertEquals "did not return the correct MD5" 0 $?
}

test_verify_using_md5sum()
{
	[[ $(type -t md5sum) ]] || return

	MD5SUM="md5sum" verify "$FILE" "$MD5" >/dev/null

	assertEquals "did not return the correct MD5" 0 $?
}

test_verify_using_md5()
{
	if [[ ! $(type -t md5) ]] || return

	MD5SUM="md5" verify "$FILE" "$MD5" >/dev/null

	assertEquals "did not return the correct MD5" 0 $?
}

test_verify_with_bad_md5()
{
	verify "$FILE" "4101bef8794fed986e95dfb54850c68b" >/dev/null 2>/dev/null

	assertEquals "did not reject the incorrect MD5" 1 $?
}

tearDown()
{
	rm "$FILE"
}

SHUNIT_PARENT=$0 . $SHUNIT2
{'fraction_non_alphanumeric': 0.16149068322981366, 'fraction_numerical': 0.08281573498964803, 'mean_word_length': 4.451127819548872, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '5069135', 'n_tokens_mistral': 665, 'n_tokens_neox': 600, 'n_words': 140}