MDL-46148 qtype_calculated: unit tests + fixes for validation