Assert

Assert Commit Details

Date:2011-04-13 14:16:57 (7 years 2 months ago)
Author:Michael Baudin
Commit:123
Parents: 122
Message:Updated tests.
Changes:
M/tests/unit_tests/generror.dia.ref
M/tests/unit_tests/checkalmostequal.dia.ref
M/tests/unit_tests/generror.tst
M/tests/unit_tests/checkalmostequal.tst

File differences

tests/unit_tests/checkalmostequal.tst
11
2
2
33
44
55
......
8989
9090
9191
92
92
9393
9494
9595
9696
9797
9898
99
99
100100
101101
102102
......
110110
111111
112112
113
113
114114
115115
116116
......
238238
239239
240240
241
// Copyright (C) 2008 - INRIA - Michael Baudin
// Copyright (C) 2010 - DIGITEO - Michael Baudin
// Copyright (C) 2010-2011 - DIGITEO - Michael Baudin
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
ierr=execstr(instr,"errcatch");
MY_assert_equal ( ierr , 10000 );
errmsg = lasterror();
MY_assert_equal ( errmsg , "assert_checkalmostequal: Assertion failed: expected = 2 while computed = 1 with reltol=1.490D-08, abstol=0" );
MY_assert_equal ( errmsg , "assert_checkalmostequal: Assertion failed: expected = 2 while computed = 1" );
//
// Check that the error message is correctly handled.
instr = "assert_checkalmostequal ( 1 , 2 , %eps )";
ierr=execstr(instr,"errcatch");
MY_assert_equal ( ierr , 10000 );
errmsg = lasterror();
MY_assert_equal ( errmsg , "assert_checkalmostequal: Assertion failed: expected = 2 while computed = 1 with reltol=2.220D-16, abstol=0" );
MY_assert_equal ( errmsg , "assert_checkalmostequal: Assertion failed: expected = 2 while computed = 1" );
//
// Check that the error message is correctly handled.
instr = "assert_checkalmostequal ( 1 , 1 , %eps )";
ierr=execstr(instr,"errcatch");
MY_assert_equal ( ierr , 10000 );
errmsg = lasterror();
MY_assert_equal ( errmsg , "assert_checkalmostequal: Assertion failed: expected = [0 ...] while computed = [0.0001 ...] with reltol=0.00001, abstol=0" );
MY_assert_equal ( errmsg , "assert_checkalmostequal: Assertion failed: expected = [0 ...] while computed = [0.0001 ...]" );
//////////////////////////////////////////
//
//
[flag,errmsg] = assert_checkalmostequal ( 1+%i , 0 , [], 1.e-3 , "element" );
checkassert ( flag , errmsg , "failure" );
//
tests/unit_tests/generror.dia.ref
3131
3232
3333
34
34
3535
3636
3737
3838
3939
40
40
ierr=execstr(instr,"errcatch");
lerr = lasterror();
MY_assert_equal ( ierr , 10000 );
MY_assert_equal ( lerr , "assert_generror: Unexpected type of input argument #1 : variable errormsg has type constant while string is expected." );
MY_assert_equal ( lerr , "assert_generror: Wrong type for argument 1: Matrix of strings expected." );
//
instr = "assert_generror ( )";
ierr=execstr(instr,"errcatch");
lerr = lasterror();
MY_assert_equal ( ierr , 10000 );
MY_assert_equal ( lerr , "assert_generror: Unexpected number of input arguments : 0 provided while 1 to 2 are expected." );
MY_assert_equal ( lerr , "assert_generror: Wrong number of input arguments: 1 to 2 expected." );
tests/unit_tests/checkalmostequal.dia.ref
11
2
2
33
44
55
......
8282
8383
8484
85
85
8686
8787
8888
8989
9090
9191
92
92
9393
9494
9595
......
103103
104104
105105
106
106
107107
108108
109109
// Copyright (C) 2008 - INRIA - Michael Baudin
// Copyright (C) 2010 - DIGITEO - Michael Baudin
// Copyright (C) 2010-2011 - DIGITEO - Michael Baudin
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
ierr=execstr(instr,"errcatch");
MY_assert_equal ( ierr , 10000 );
errmsg = lasterror();
MY_assert_equal ( errmsg , "assert_checkalmostequal: Assertion failed: expected = 2 while computed = 1 with reltol=1.490D-08, abstol=0" );
MY_assert_equal ( errmsg , "assert_checkalmostequal: Assertion failed: expected = 2 while computed = 1" );
//
// Check that the error message is correctly handled.
instr = "assert_checkalmostequal ( 1 , 2 , %eps )";
ierr=execstr(instr,"errcatch");
MY_assert_equal ( ierr , 10000 );
errmsg = lasterror();
MY_assert_equal ( errmsg , "assert_checkalmostequal: Assertion failed: expected = 2 while computed = 1 with reltol=2.220D-16, abstol=0" );
MY_assert_equal ( errmsg , "assert_checkalmostequal: Assertion failed: expected = 2 while computed = 1" );
//
// Check that the error message is correctly handled.
instr = "assert_checkalmostequal ( 1 , 1 , %eps )";
ierr=execstr(instr,"errcatch");
MY_assert_equal ( ierr , 10000 );
errmsg = lasterror();
MY_assert_equal ( errmsg , "assert_checkalmostequal: Assertion failed: expected = [0 ...] while computed = [0.0001 ...] with reltol=0.00001, abstol=0" );
MY_assert_equal ( errmsg , "assert_checkalmostequal: Assertion failed: expected = [0 ...] while computed = [0.0001 ...]" );
//////////////////////////////////////////
//
//
tests/unit_tests/generror.tst
3535
3636
3737
38
38
3939
4040
4141
4242
4343
44
44
4545
ierr=execstr(instr,"errcatch");
lerr = lasterror();
MY_assert_equal ( ierr , 10000 );
MY_assert_equal ( lerr , "assert_generror: Unexpected type of input argument #1 : variable errormsg has type constant while string is expected." );
MY_assert_equal ( lerr , "assert_generror: Wrong type for argument 1: Matrix of strings expected." );
//
instr = "assert_generror ( )";
ierr=execstr(instr,"errcatch");
lerr = lasterror();
MY_assert_equal ( ierr , 10000 );
MY_assert_equal ( lerr , "assert_generror: Unexpected number of input arguments : 0 provided while 1 to 2 are expected." );
MY_assert_equal ( lerr , "assert_generror: Wrong number of input arguments: 1 to 2 expected." );

Archive Download the corresponding diff file

Revision: 123