~ubuntu-branches/ubuntu/raring/scilab/raring-proposed

« back to all changes in this revision

Viewing changes to modules/elementary_functions/tests/unit_tests/abs.dia.ref

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2012-08-30 14:42:38 UTC
  • mfrom: (1.4.7)
  • Revision ID: package-import@ubuntu.com-20120830144238-c1y2og7dbm7m9nig
Tags: 5.4.0-beta-3-1~exp1
* New upstream release
* Update the scirenderer dep
* Get ride of libjhdf5-java dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// =============================================================================
2
2
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3
3
// Copyright (C) 2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr>
 
4
// Copyright (C) 2012 - Scilab Enterprises - Cedric Delamarre
4
5
//
5
6
//  This file is distributed under the same license as the Scilab package.
6
7
// =============================================================================
7
8
// <-- CLI SHELL MODE -->
8
9
// unit tests for abs() function (absolute value, magnitude)
9
10
// =============================================================================
10
 
if execstr("abs()"   ,"errcatch") == 0 then bugmes();quit;end
11
 
if execstr("abs(1,2)","errcatch") == 0 then bugmes();quit;end
12
 
if abs(10)     <> 10  then bugmes();quit;end
13
 
if abs(-4.3)   <> 4.3 then bugmes();quit;end
14
 
if abs(6+8*%i) <> 10  then bugmes();quit;end
15
 
if abs(6-8*%i) <> 10  then bugmes();quit;end
16
 
if or(abs([ 7.6 , 8*%i ; 6+8*%i 6-8*%i ])   <> [7.6 , 8 ; 10 , 10 ]) then bugmes();quit;end
17
 
if or(abs([ 7.6 8*%i 6+8*%i 6-8*%i ])       <> [7.6 8 10 10 ])       then bugmes();quit;end
18
 
if or(abs([ 7.6 ; 8*%i ; 6+8*%i ; 6-8*%i ]) <> [7.6 ; 8 ; 10 ; 10 ]) then bugmes();quit;end
19
 
if ~isnan(abs(%nan)) then bugmes();quit;end
20
 
if ~isnan(abs(-%nan)) then bugmes();quit;end
21
 
if abs(%inf) <> %inf then bugmes();quit;end
22
 
if abs(-%inf) <> %inf then bugmes();quit;end
 
11
assert_checkfalse(execstr("abs()", "errcatch") == 0);
 
12
assert_checkfalse(execstr("abs(1,2)", "errcatch") == 0);
 
13
assert_checkequal(abs(10)     ,10);
 
14
assert_checkequal(abs(-4.3)   ,4.3);
 
15
assert_checkequal(abs(6+8*%i) ,10);
 
16
assert_checkequal(abs(6-8*%i) ,10);
 
17
assert_checkequal(abs([ 7.6 , 8*%i ; 6+8*%i 6-8*%i ]), [7.6 , 8 ; 10 , 10 ]);
 
18
assert_checkequal(abs([ 7.6 8*%i 6+8*%i 6-8*%i ]), [7.6 8 10 10 ]);
 
19
assert_checkequal(abs([ 7.6 ; 8*%i ; 6+8*%i ; 6-8*%i ]), [7.6 ; 8 ; 10 ; 10 ]);
 
20
assert_checktrue(isnan(abs(%nan)));
 
21
assert_checktrue(isnan(abs(-%nan)));
 
22
assert_checkequal(abs(%inf), %inf);
 
23
assert_checkequal(abs(-%inf), %inf);