Create a calculated question using a simple equation like
{x}+0.012345 set the response to 2 decimals
generate a {x}
value between 10 and 90 (no decimal) say 45.
The good response should 45.01 and the same value should show when looking at the wild card value.
Attempt the saved question, the fill correct response should display the same value and on submit and finish the correct answer should also agree.
Repeat the tets with 1 decimals. The correct answer should be 45.0 .
Add a unit say cm and the numerical value displayed should remain the same.
Add another unit say m multiplier 0.01 and try with the two options for unit (multiple choice or drop-down list)
The decimal should remain the same either when filling the corect response or in the correct response at the end.
Do some test with calculated simple.
The set the option to 4 significant figures. The values displayed should be
the same as when setting to significant figures.
Do the tests ( looking at the values for the wild cards values as when doing the previews.
The https://tracker.moodle.org/secure/attachment/31662/questions-CHI0310_100-test%20MDL-31680-20130313-1325.xml
contains many questions that illustrate various cases most of them are reproduced in the php test unit.
The https://tracker.moodle.org/secure/attachment/32775/questions-T1-IMPORT%20MDL-31680-20130515-2347.xml contains three questions with long answers that illustrate their rendering when editing at the datasetitems_form.php for calculated and calculatedmulti
you should see something like for
- datasetitems_form.php for calculated or in edit_calculated_simple_form.php
Set 1 {x}+{x}+{x}+{x}+{...
|
123456789+123456789+123456789+123456789+123456789+1234567... = 9.88e8
|
Additional validation has been added when entering new param values:
error will appear on
- adding a , in a number : 1,2 gives The , cannot be used, use . as in 0.013 or 1.3e-2
- adding a non valid number : E-12cm gives Wild card value is not a valid number
- adding an hexadecimal : 0X13D gives Dataset hexadecimal format value 0X13D is not allowed
An additional test is done if the formula give a NAN result which result is a non valid number.
These validation will appears if after entering one of these error in a wildcard value
you click on the Add item or on save button for
- datasetitems_form.php for calculated and calculatedmulti
- and in edit_calculated_simple_form.php.