Your answer should be a decimal number, but it is not!

Your answer should be a decimal number, but it is not!

by Lillian Hueber -
Number of replies: 3
Hello. This is not a big deal but I was wondering whether anyone managed to get past the 

"Your answer should be a decimal number, but it is not!" problem. The comment arises because I put ta1*2 which ends up not being a decimal number. And at one point I had solved this problem by putting dispdp or something like that in the test inputs... but I must have imagined it, because now it just breaks the test. 

Any advice on how to get this test to work properly? I could (and have) put 0.00 as an incorrect answer, but it would be more satisfying to have this work. 

Thank you!
Average of ratings: -
In reply to Lillian Hueber

Re: Your answer should be a decimal number, but it is not!

by Lillian Hueber -
Oh good, right after fighting for this over the last year, I found one way. Using ev(ta1*10,simp). That does it. If anyone else has some good ideas, I wouldn't mind hearing of them though.
In reply to Lillian Hueber

Re: Your answer should be a decimal number, but it is not!

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Lillian,
There is some advice on test case construction, including using ev(.... , simp), in the docs: https://docs.stack-assessment.org/en/Authoring/Testing/
Chris
In reply to Christopher Sangwin

Re: Your answer should be a decimal number, but it is not!

by Lillian Hueber -
Found it, thank you.

"Test cases are always written assuming simp:false regardless of the option set elsewhere. If you want to construct a simplified test case then wrap this in ev(... , simp) to simplify the expression generating the test case. This behaviour is required to enable construction of unsimplified test cases."

Makes sense. I also see the advice of creating wrong answers in the question itself. That might make testing FT cases easier I think, trying to learn how to do that.