Search code examples
prologswi-prologlogtalk

Logtalk test returning failed when it passes under SWI interpreter


I am having an issue in which a specific test returns false when I put it in a test suite and pass it through logtalk, but returns true (which is the desired behavior) when I run it through an interpreter using the same backend compiler (SWI-Prolog). Here is the relevant piece of the logtalk tests results, a snapshot of what the test looks like within the student directory, and the output when I pass the identical test through the SWI interpreter.

Test results:

enter image description here

Test case in tests.lgt:

enter image description here

Results from running through swipl:

enter image description here

Any assistance would be greatly appreciated.

Thank you.


Solution

  • As a side note, the "repeated test identifier found" errors must be fixed for accurate test results. Test identifiers must be unique as documented.

    There's not enough information in your question for diagnosing the issue. The use of the {}/1 control construct in the definition of the test to wrap the test goal means that the goal is called as-is. My suggestion is for you to cd to a student directory where you see the issue, and run the tests manually and then also call the test goal at the top-level. Something like:

    $ cd student_id_xyz
    $ swilgt
    ...
    ?- {tester}.
    ...
    ?- no_duplicates(..., ...).
    ...
    

    Do this without restarting so that we guarantee that both tests (from the tests file and typed at the top-level) occur with the same exact context. Let us know if you get the same results.

    The solution I suggested for your student grading task assumes that the student Prolog files are plain Prolog files (i.e. no module definitions). If that's not the case for some of the student submissions, try changing the loading of the student Prolog files in the tester.lgt driver files from using the logtalk_load/1 predicate (which was selected for portability) by the Prolog backend specific predicate (e.g. consult/1).