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

# ISE test script 18

# Decrypt_File Function Normal Use

set key = "enterthekey"
set jpg = ".jpg"
foreach ise_file (ise_images/*.ise)
    set jpg_file = $ise_file$jpg
    ise_test_18 $key $ise_file $jpg_file
    if ($status != 0) then
	echo "Test 18: 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
set isejpg = ".ise.jpg"
foreach jpeg (images/*.jpg)
    set decrypted = decrypted_$jpeg:r$isejpg
    cmp -s $jpeg $decrypted
    if($status != 0) then
	echo "$decrypted failed to decrypt properly."
	@ failure_count += 1
    endif
    @ image_count += 1
end

echo "Test 18: failed to decrypt properly for $failure_count images"
echo "Test 18: passed for all others out of $image_count images."

exit 0

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