Support multiple properties being tested by GOTO dispatch

Currently, the Batch Script track expects a single property to be implemented in a single .bat file. That works pretty well when an exercise only has a single property being tested like in Leap Year, but some exercises have multiple ones like Difference of Squares. In that exercise, the tests only test the final difference of squares, not the square of sums or sum of squares.

I’d like to propose a new convention where the test runner passes the property name as the first argument to :Assert like CALL :Assert squareOfSums 5. That argument gets passed to the student’s solution and then they can use GOTO to direct program execution to the appropriate section. Then they can either define the appropriate sections there if they want to keep everything as a single file or call out to helper Batch files as needed.

This would break existing solutions unfortunately, but it’d allow for much more flexibility and thorough testing.

How might this look?

CALL :Assert add 1 2
CALL :Assert subtract 4 3 

calls out to

<slug>.bat

@echo off
GOTO :%~1

:add
set /a result=%~2 + %~3
echo %result%
exit /b 0

:subtract
set /a result=%~2 - %~3
echo %result%
exit /b 0

Then the code goes to the appropriate GOTO label, echoes the result, and exits the file.

A student may also do it as a series of files submitted all together.

<slug>.bat

@echo off
CALL %~1.bat %~2 %~3 %~4 %~5 %~6 %~7 %~8 %~9

which calls out to …

add.bat

@echo off
set /a result=%~1 + %~2
echo %result%
exit /b 0

subtract.bat

@echo off
set /a result=%~1 - %~2
echo %result%
exit /b 0