#!/usr/local/bin/tcsh -f

# ISE test script 21

# Decrypt_File Function with Output File Name Not Set
rm decrypted_images/*.jpg

set key = "enterthekey"
foreach ise_file (ise_images/*.ise)
	ise_test_21 $key $ise_file
	if ($status != 0) then
		echo "Test 21: Decrypt failed for " $ise_file
	endif
end

mv ise_images/*.jpg decrypted_images/
chmod 777 decrypted_images/*.jpg

set failure_count = 0
set image_count = 0

foreach jpeg (images/*.jpg)
    set decrypted = decrypted_$jpeg
    cmp -s $jpeg $decrypted
    if($status != 0) then 
	echo "$decrypted failed to decrypt properly."
	@ failure_count += 1
    endif
    @ image_count += 1
end

if ($failure_count != 0)then
    echo "Test 21 failed to decrypt properly for $failure_count images."
    echo "Test 21 passed for all others out of $image_count images."
else
    echo "Test 21 passed for all $image_count images being tested."
endif

exit 0

###############
# END OF FILE #
###############
