Verifying that students have used the public tests
This utilizes the algorithm described in
AssignmentZero to force students to run public tests more than once: first to obtain a secret number, and then to confirm they've submitted the secret number.
This script should be in a subdirectory where
(language external)
is being applied. The contents of test.exe can be as follows, with the string in the first line changed to something else:
#!/usr/bin/env bash
secNum=`(echo "a string that should be customized each term";echo $student) | md5sum - | cut -c-9 | tr 0a-f 1-7`
if [ -e "$submitdir/secret.txt" ]; then
if [ `grep $secNum $submitdir/secret.txt | wc -l` -gt 0 ]; then
echo '100' >&3
echo "The file secret.txt was submitted." >&4
else
echo '0' >&3
echo "secret.txt contains the wrong secret number. Your secret number is $secNum." >&4
fi
else
echo '0' >&3
echo "The file secret.txt was not submitted; your secret number is $secNum." >&4
fi