Scilab Home Page | Wiki | Bug Tracker | Forge | Mailing List Archives | Scilab Online Help | File Exchange
ATOMS : Assert details
Login with GitLab


A collection of predicate functions
(1284 downloads for this version - 18411 downloads for all versions)
A more recent valid version with binaries for Scilab 5.2 exists: 1.3
Michael Baudin
Owner Organization
Michael BAUDIN
Creation Date
December 22, 2010
Source created on
Scilab 5.2.x
Binaries available on
Scilab 5.2.x:
Windows 64-bit Windows 32-bit Linux 64-bit Linux 32-bit macOS
Install command
--> atomsInstall("assert")

The goal of this toolbox is to provide functions to make testing easier. 
We emphasize the use of consistent tools for testing numerical issues,
with the goal of testing numerical algorithms more easily.
In particular, we provide a comparison function for two floating
point numbers, which allows to check that two numbers are "numerically almost
i.e. that the relative error is small.

The function of the assert module are designed to be used in Scilab unit tests
files (.tst files).

The functions allows to:
 * assert for true, equal statements,
 * assert that two floating point numbers are "close" (using a relative or
absolute tolerance).

Additionnaly, we can sort doubles complex numbers with a mixed relative/absolute
tolerance criteria.

The toolbox is based on macros.

To get an overview of the functions in this module, 
use :

help assert_overview


The following is a list of the current assert functions :
 * assert_checkalmostequal : Check that computed and expected are numerically
 * assert_checkequal : Check that computed and expected are equal.
 * assert_checktrue : Check that condition is true.
 * assert_checkfalse : Check that condition is false.
 * assert_checkfilesequal : Check two files are equal.
 * assert_checkerror : Check that the function has produced the correct error.
 * assert_generror : Generates an error.

and sorting functions :
 * assert_compare : The default comparison function used in the sort-merge.
 * assert_comparecomplex : Compare complex numbers with a tolerance.
 * assert_sort : A flexible sorting function.
 * assert_sortcomplex : Compare complex numbers with a tolerance.

and support functions :
 * assert_computedigits : Returns the number of significant digits in computed
 * assert_cond2reltol : Suggests a relative error, computed from the condition
 * assert_cond2reqdigits : Suggests the number of required digits, given the
condition number.
 * assert_csvread : Read data from a file or a string.
 * assert_csvwrite : Write data into a file or a string.

Files (2)
[218.61 kB]
Source code archive

[356.63 kB]
OS-independent binary for Scilab 5.2.x
Binary version
Automatically generated by the ATOMS compilation chain

News (0)
Comments (5)     Leave a comment 
Comment -- January 6, 2011, 09:29:58 AM    
The version 1.2 works has no known issue.

   TMPDIR = C:\Users\baudin\AppData\Local\Temp\SCI_TMP_7548_

   001/018 - [SCIHOME\atoms\assert\1.2-1] checkalmostequal.........passed 
   002/018 - [SCIHOME\atoms\assert\1.2-1] checkequal...............passed 
   003/018 - [SCIHOME\atoms\assert\1.2-1] checkerror...............passed 
   004/018 - [SCIHOME\atoms\assert\1.2-1] checkfalse...............passed 
   005/018 - [SCIHOME\atoms\assert\1.2-1] checkfilesequal..........passed 
   006/018 - [SCIHOME\atoms\assert\1.2-1] checktrue................passed 
   007/018 - [SCIHOME\atoms\assert\1.2-1] compare..................passed 
   008/018 - [SCIHOME\atoms\assert\1.2-1] comparecomplex...........passed 
   009/018 - [SCIHOME\atoms\assert\1.2-1] computedigits............passed 
   010/018 - [SCIHOME\atoms\assert\1.2-1] cond2reltol..............passed 
   011/018 - [SCIHOME\atoms\assert\1.2-1] cond2reqdigits...........passed 
   012/018 - [SCIHOME\atoms\assert\1.2-1] csvread..................passed 
   013/018 - [SCIHOME\atoms\assert\1.2-1] csvwrite.................passed 
   014/018 - [SCIHOME\atoms\assert\1.2-1] expandvar................passed 
   015/018 - [SCIHOME\atoms\assert\1.2-1] generror.................passed 
   016/018 - [SCIHOME\atoms\assert\1.2-1] sort.....................passed 
   017/018 - [SCIHOME\atoms\assert\1.2-1] sortcomplex..............passed 
   018/018 - [SCIHOME\atoms\assert\1.2-1] sortgraph................passed 


   tests                       18 - 100 % 
   passed                      18 - 100 % 
   failed                       0 -   0 % 
   skipped                      0 -   0 % 
   length                          20.98 sec 
Comment -- January 6, 2011, 09:30:15 AM    
Here are the CHANGES for the version 1.2.

assert (1.2)
    * Fixed check equal on empty matrix [] - Ticket #193 :
    * In assert_csvread, added example of block-by-block read.
Comment -- January 6, 2011, 09:30:38 AM    
Here are the CHANGES for the version 1.1.

assert (1.1)
    * Moved condition number functions into a separate module.
    * Removed help pages for condition number.
    * Removed assert_expandvar from public API.
    * Removed assert_benchfun - it is in the scibench module (backward compatibility 
    * Updated printtable: replaced %inf, %nan in output by Inf, Nan (backward 
compatibility lost).
    * Updated help page of assert_checkalmostequal for complex numbers.
    * Created cond2reqdigits.
    * Renamed condition2reltol into cond2reltol (backward compatibility lost).
    * Inverted the sign of offset in cond2reltol and cond2reqdigits, for simplicity.
    * Shortened the name of the files in unit tests for speed of development.
    * In assert_sort, added optional arguments to the callback.
    * Updated datasetwrite, datasetread to correspond.
    * Renamed printtable into datasetwrite (backward compatibility lost).
    * Added dec option to datasetwrite and datasetread.
    * Added string format to datasetwrite.
    * Renamed datasetwrite, datasetread into csvwrite, csvread.
    * Added conversion to double into csvread.
    * Added irange option to csvread.
    * Added header option to csvwrite.
    * Vectorized csvwrite.
    * Vectorized csvread as much as possible.
Comment -- January 6, 2011, 09:30:58 AM    
Here are the CHANGES for the version 1.0.

assert (1.0)
    * Added assert_printtable
    * Added assert_condnum
    * Added assert_computedigits
    * Added assert_condition2reltol
    * Updated assert_almostequal to manage complex matrices (internally refactored)
    * Updated assert_comparecomplex to manage IEEE values
    * Updated assert_comparecomplex to remove output argument msg
    * Refactored assert_comparecomplex 
    * Added a collection of elementary functions condition numbers
    * updated header of assert_almostequal: backward compatibility lost
    * updated criteria of assert_almostequal to |c-e| <= reltol * max(|c|,|e|) + abstol
    * updated header of assert_comparecomplex: backward compatibility lost
    * updated header of assert_sortcomplex: backward compatibility lost
    * rename assert_equal > assert_checkequal (backward compatibility lost)
    * rename assert_almostequal > assert_checkalmostequal (backward compatibility lost)
    * rename assert_true > assert_checktrue (backward compatibility lost)
    * rename assert_false > assert_checkfalse (backward compatibility lost)
    * rename assert_filesequal > assert_checkfilesequal (backward compatibility lost)
    * create a assert_checkerror with to test the error cases much more easily.
    * add unit tests for assert_compare
    * add unit tests for assert_comparecomplex
    * fix examples in assert_comparecomplex
    * add unit tests for assert_sort
    * add unit tests for assert_sortcomplex
    * assert_sort. : added a consistent callback
    * assert_sort : added increasing/decreasing direction
    * created assert_benchfun, to check performances easily
    * created assert_generror, to redefine the error handler if necessary.
Comment -- January 6, 2011, 09:31:26 AM    
Here are the CHANGES for the version 0.2.

assert (0.2)
    * Added assert_filesequal function, with a comparison function.
    * Added assert_false function.
    * Added elementwise comparison for assert_almostequal.
    * Fixed bug for %inf in almostequal.
    * Renamed close to almostequal (backward compatibility lost).
    * Fixed bug #133: example of assert_sort did not work.
 -- Michael Baudin   September 2010
Leave a comment
You must register and log in before leaving a comment.
Login with GitLab
Email notifications
Send me email when this toolbox has changes, new files or a new release.
You must register and log in before setting up notifications.