Name

assert_checkfalse — Check that condition is true.

Calling Sequence

   flag = assert_checkfalse ( condition )
   flag = assert_checkfalse ( condition )
   [flag,errmsg] = assert_checkfalse ( condition )
   
   

Parameters

condition:

a matrix of booleans

flag :

a 1x1 matrix of boolean, %t if computed is close to expected, %f if not

errmsg :

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

Description

Performs silently if all entries in condition are false.

Generates an error if any entry in the condition matrix is true. Generates an error if the condition variable is not a boolean.

If any entry in condition is true,

  • 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 which pass
assert_checkfalse ( %f );
flag = assert_checkfalse ( %f )
[flag,errmsg] = assert_checkfalse ( %f )
[flag,errmsg] = assert_checkfalse ( [%f %f] );

// Tests which fail
assert_checkfalse ( [%t %f] );
flag = assert_checkfalse ( [%t %f] )
// No error generated
[flag,errmsg] = assert_checkfalse ( [%t %f] )

// Wrong calls
assert_checkfalse ( "a" )

   

Authors

Michael Baudin, 2010