Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Conditionally check for honor code
Fixes #1
  • Loading branch information
Brandon committed Nov 29, 2018
1 parent 4e08602 commit 6ded700
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions genericTester.sh
@@ -1,7 +1,20 @@
#!/bin/bash

# Constants
PLEDGE="I confirm that my submitted solutions are the result of my own intellectual effort, and comply with the 1729 honor code and the UConn standards for academic integrity"

# Default arguments
CHECK_PLEDGE=false
testOutputTransform=${testOutputTransform:-(lambda (x) x)}

# Parse command line flags
while true; do
case "$1" in
--check-pledge ) CHECK_PLEDGE=true; shift ;;
* ) break ;;
esac
done

# Get first file with .rkt extension.
studentAnswersFile="$(ls | grep ".rkt" | head -n 1)"
stdinToGenericTester="
Expand All @@ -14,6 +27,21 @@ RESULT=`echo -e $stdinToGenericTester | plt-r5rs genericTester.scm 2>> DEBUG`
# Treat the last line of the output as a fake exit status
EXITSTATUS=`echo "$RESULT" | tail -n 1`

if [ "$CHECK_PLEDGE" = true ] ; then
# Check if pledge appears in the students answer
# file. The sed replacement generates a RegExp
# that allows us to find the statement if it
# spans multiple lines.
#
# Every student has to include the pledge in their code

if ! echo $PLEDGE | sed -e 's/ /[\\n\\s;]+/g' | grep -Pziq -f - "$studentAnswersFile" ; then
echo "Error: Statement to uphold 1729 honor code was not found." >> DEBUG
echo "false" > OUTPUT
exit 0
fi
fi

if [ "$EXITSTATUS" = "#t" ] ; then
echo "true" > OUTPUT
else
Expand Down

0 comments on commit 6ded700

Please sign in to comment.