Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.5.0 - Português

Change language to:
English - Français - 日本語 - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Ajuda do Scilab >> Ferramentas de Desenvolvimento > Assert > assert_checkequal

assert_checkequal

Check that computed and expected are equal.

Calling Sequence

assert_checkequal ( computed , expected )
flag = assert_checkequal ( computed , expected )
[flag,errmsg] = assert_checkequal ( computed , expected )

Parameters

computed:

the computed result

expected :

the expected result

flag :

a 1-by-1 matrix of boolean, %t if computed is equal to expected, %f if not

errmsg :

a 1-by-1 matrix of strings, the error message. If flag==%t, then errormsg=="". If flag==%f, then errmsg contains the error message.

Description

Performs silently if computed and expected are equal.

If the type of both input arguments is 1 (i.e. a real matrix), we check that non-nan values are equal.

We compare first the real parts. In case of equality, we compare the imaginary parts.

If the comparison shows that computed is equal to expected,

  • if the errmsg output variable is not used, an error is generated,

  • if the errmsg output variable is used, no error is generated.

Examples

// Tests with success
assert_checkequal ( %T , %T );
flag = assert_checkequal ( list() , list() );
[flag , errmsg] = assert_checkequal ( [%T %F], [%T %F] );
assert_checkequal ( %nan , %nan );

// Tests with failure
assert_checkequal ( %F , %T );
flag = assert_checkequal ( %F , %T );
// No error produced :
[flag , errmsg] = assert_checkequal ( %F , %T )
assert_checkequal ( [1 2], [3 4] )
assert_checkequal ( 1 , [2 3] )
assert_checkequal ( 1 , "b" )

History

VersãoDescrição
5.4.0 Function introduced

Bibliography

"Automated Software Testing for Matlab", Steven Eddins, 2009

Report an issue
<< assert_checkalmostequal Assert assert_checkerror >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Fri Apr 11 14:18:24 CEST 2014