I am in the process of grading student assignments, and wish to automatically run queries on the students database, and print the results of those queries to a file. The issue that I am running into is that I wish to run the multiple queries, but cannot find a way to just add all the queries I wish as a command line argument.
Relevant Files
Student Submission of Prolog file:
I cannot show you this code, but the students had to solve 4 problems using Prolog, and I have access to those files.
hw4_autograde.sh NOTE: The compiler was changed to SWI-prolog, not gprolog.
testcases.txt: These are the test cases I wish to run. They consist of various calls to the 4 rules/'functions' the students solved.
I am able to create and append to the output files, but I need to get my bash script working first, then can add the required code to do that. Any assistance or a point in the right direction would be most helpful.
I have tried to scrutinize this post, but am struggling to get this working:
https://lists.gnu.org/archive/html/users-prolog/2013-12/msg00004.html
Thank you.
EDIT:
The solution described by Paulo Moura in the comments solves this problem, however, in using the logtalk tester, I am coming across issues of using multiple prolog files in subdirectories from within submissions. I used to get output with the student files working, but now all the tests say crashed, when I used to get passed or failed: Here is a screen shot of what I am currently getting when running logtalk_tester -p swi -t 60:
Below is a screen shot of what is within a student's subdirectory:
Here is tests.lgt:
:- object(tests,
extends(lgtunit)).
%Tests for shuffle
%--------------------------------------------------------
test(shuff_working) :-
{shuffle([a,b,c],[d,e,f],[a,d,b,e,c,f])}.
test(shuff_wrong, false) :-
{shuffle([a,b,d],[d,e,f],[a,d,b,e,c,f])}.
test(shuff_wrong_2, false) :-
{shuffle([d,e,f],[a,b,d],[a,d,b,e,c,f])}.
test(shuff_wrong_3, false) :-
{shuffle([a,b,c,e],[d,e,f],[a,d,b,e,c,f])}.
test(shuff_var) :-
{shuffle(X,Y,[1,2,3,4,5,6])}.
%--------------------------------------------------------
%Tests for double
test(doub_working) :-
{double([a,b,c],[a,a,b,b,c,c])}.
test(doub_wrong, false) :-
{double([a,b,c],[a,b,c,a,b,c])}.
test(doub_var_1) :-
{double(X,[a,a,b,b,c,c])}.
test(doub_var_2) :-
{double([a,b,c],X)}.
%--------------------------------------------------------
%Part 2: Sudoku Solver
test(sudoku, false) :-
{test0}.
:- end_object.
Here is tester.lgt
:- initialization((
% minimize output to the essential
set_logtalk_flag(report, warnings),
% load the student submissions
logtalk_load(['hw4.pl','sudoku.pl']),
% load the testing tool
logtalk_load(lgtunit(loader)),
% load the tests and run them
logtalk_load(tests, [hook(lgtunit)]),
tests::run
)).



