WeBWorK Problems

checking an answer checker accepts the correct answer

checking an answer checker accepts the correct answer

by Alex Jordan -
Number of replies: 1
If you have an answer checker hash...

Actually let me pause here, I'm not sure I am using the right vocabulary. What I mean is something like when $m is a math object, and the object $m->cmp().

So when you have that thing, how can you verify that it actually accepts $m as a correct answer? This is for situations where the answer checker is custom. Some random version of the problem may be buggy and not take $m. I'd like to wrap it all in a loop and check that if $m is not counted as correct, it should re-randomize.

I'm thinking it could be something like:
do {
...code...
until ($m->cmp($m) == 1);

but my experiments are suggesting that is not the right syntax.
In reply to Alex Jordan

Re: checking an answer checker accepts the correct answer

by Glenn Rice -
I think what you are looking for is

do {
...code...
} until ($m->cmp->evaluate($m)->{score} == 1);

Note that if you are using a custom checker you will need to pass that as an option to the cmp method here. Also note that the check if the score is equal to 1 may not be correct if your custom checker gives partial credit.