+FAILED=0
+if [ -n "$OPEN_DATA_PROBLEM" ] ; then
+ [ -n "$2" ] || die "You need to specify test number for open data problems."
+ TEST=$2
+ open-locate
+ syntax-check || FAILED=1
+else
+ [ -z "$2" ] || die "No test number should be specified for normal problems."
+ locate-source
+ compile
+ for TEST in $SAMPLE_TESTS ; do
+ pstart "Checking on sample input $TEST: "
+ if test-run && syntax-check && output-check ; then
+ pend "OK"
+ else
+ FAILED=$(($FAILED+1))
+ fi
+ done
+fi
+pstart "Submitting... "
+if [ $FAILED != 0 ] ; then
+ if [ $FORCE != 0 ] ; then
+ pcont "(tests failed, but --force given) "
+ else
+ pend "TESTS FAILED Use submit --force if you really want to submit a wrong solution."
+ exit 1
+ fi
+fi
+mkdir -p ~/.submit
+[ -z "$OPEN_DATA_PROBLEM" ] && rm -rf ~/.submit/$PROBLEM