* isnum has been redesigned in native code. Up to 130x performance
[scilab.git] / scilab / modules / string / tests / unit_tests / isnum.tst
1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2007-2008 - INRIA - Pierre MARECHAL <pierre .marechal@inria.fr>
4 //
5 //  This file is distributed under the same license as the Scilab package.
6 // =============================================================================
7
8 // <-- CLI SHELL MODE -->
9
10 assert_checktrue(isnum('%pi'));
11
12 assert_checktrue(isnum('1'));
13 assert_checktrue(isnum('1.2'));
14 assert_checktrue(isnum('+1.2'));
15 assert_checktrue(isnum('-1.2'));
16
17 assert_checktrue(isnum('1e2'));
18 assert_checktrue(isnum('1d2'));
19 assert_checktrue(isnum('1E2'));
20 assert_checktrue(isnum('1D2'));
21
22 assert_checktrue(isnum('1e+2'));
23 assert_checktrue(isnum('1e-2'));
24 assert_checktrue(isnum('+1e+2'));
25 assert_checktrue(isnum('-1e+2'));
26
27 assert_checktrue(isnum('-12e+3'));
28
29 assert_checktrue(isnum('-1.2e+3'));
30 assert_checktrue(isnum('-1.2e+345'));
31
32 assert_checkfalse(isnum('a'));
33 assert_checkfalse(isnum('e'));
34 assert_checkfalse(isnum('d'));
35 assert_checkfalse(isnum('E'));
36 assert_checkfalse(isnum('e'));
37
38 assert_checkfalse(isnum('-1.2a+345'));
39 assert_checkfalse(isnum('-1.2e+3+45'));
40 assert_checkfalse(isnum('-1.2e+3-45'));
41
42 assert_checkerror("isnum(1)",[],999);