@@ -207,18 +207,20 @@ def write_scalar_result(
207207 message = '{}: {}{}' .format (display_name , display_result , postfix )
208208
209209 if diff_with_ref and (diff_with_ref [0 ] or diff_with_ref [1 ]):
210- abs_error = diff_with_ref [0 ] * scale
211- rel_error = diff_with_ref [1 ]
212- error_text = "abs error = {:.4} | relative error = {:.4}" .format (abs_error , rel_error )
213-
214- if not abs_threshold or not rel_threshold :
215- result_message = "[RESULT: {}]" .format (error_text )
210+ if not abs_threshold :
211+ result_message = "[abs error = {:.4} | relative error = {:.4}]" .format (
212+ diff_with_ref [0 ] * scale , diff_with_ref [1 ]
213+ )
216214 message = "{} {}" .format (message , result_message )
217- elif abs_threshold <= diff_with_ref [0 ] or rel_threshold <= diff_with_ref [1 ]:
218- fail_message = "[FAILED: {}]" .format (error_text )
215+ elif abs_threshold <= diff_with_ref [0 ] or (rel_threshold and rel_threshold <= diff_with_ref [1 ]):
216+ fail_message = "FAILED: [abs error = {:.4} | relative error = {:.4}]" .format (
217+ diff_with_ref [0 ] * scale , diff_with_ref [1 ]
218+ )
219219 message = "{} {}" .format (message , color_format (fail_message , Color .FAILED ))
220220 else :
221- pass_message = "[PASS: {}]" .format (error_text )
221+ pass_message = "PASSED: [abs error = {:.4} | relative error = {:.4}]" .format (
222+ diff_with_ref [0 ] * scale , diff_with_ref [1 ]
223+ )
222224 message = "{} {}" .format (message , color_format (pass_message , Color .PASSED ))
223225
224226 print_info (message )
0 commit comments