Mercurial > hg > octave-lyh
comparison src/data.cc @ 11435:20f53b3a558f
Add tests for sparse forms of logical matrices to islogical, isnumeric.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Mon, 03 Jan 2011 18:36:49 -0800 |
parents | 0d9640d755b1 |
children | fd0a3ac60b0e |
comparison
equal
deleted
inserted
replaced
11434:1f54ee6760b5 | 11435:20f53b3a558f |
---|---|
2521 %!assert (islogical(1i), false) | 2521 %!assert (islogical(1i), false) |
2522 %!assert (islogical([1,1]), false) | 2522 %!assert (islogical([1,1]), false) |
2523 %!assert (islogical(single(1)), false) | 2523 %!assert (islogical(single(1)), false) |
2524 %!assert (islogical(single(1i)), false) | 2524 %!assert (islogical(single(1i)), false) |
2525 %!assert (islogical(single([1,1])), false) | 2525 %!assert (islogical(single([1,1])), false) |
2526 %!assert (islogical(sparse ([true, false])), true) | |
2527 %!assert (islogical(sparse ([1, 0])), false) | |
2526 | 2528 |
2527 */ | 2529 */ |
2528 | 2530 |
2529 DEFUN (isinteger, args, , | 2531 DEFUN (isinteger, args, , |
2530 "-*- texinfo -*-\n\ | 2532 "-*- texinfo -*-\n\ |
2926 else | 2928 else |
2927 print_usage (); | 2929 print_usage (); |
2928 | 2930 |
2929 return retval; | 2931 return retval; |
2930 } | 2932 } |
2933 | |
2934 /* | |
2935 | |
2936 %!assert (isnumeric(1), true) | |
2937 %!assert (isnumeric(1i), true) | |
2938 %!assert (isnumeric([1,1]), true) | |
2939 %!assert (isnumeric(single(1)), true) | |
2940 %!assert (isnumeric(single(1i)), true) | |
2941 %!assert (isnumeric(single([1,1])), true) | |
2942 %!assert (isnumeric(int8(1)), true) | |
2943 %!assert (isnumeric(uint8([1,1])), true) | |
2944 %!assert (isnumeric("Hello World"), false) | |
2945 %!assert (isnumeric(true), false) | |
2946 %!assert (isnumeric(false), false) | |
2947 %!assert (isnumeric([true, false]), false) | |
2948 %!assert (isnumeric(sparse ([true, false])), false) | |
2949 | |
2950 */ | |
2931 | 2951 |
2932 DEFUN (ismatrix, args, , | 2952 DEFUN (ismatrix, args, , |
2933 "-*- texinfo -*-\n\ | 2953 "-*- texinfo -*-\n\ |
2934 @deftypefn {Built-in Function} {} ismatrix (@var{a})\n\ | 2954 @deftypefn {Built-in Function} {} ismatrix (@var{a})\n\ |
2935 Return true if @var{a} is a numeric, logical, or character matrix.\n\ | 2955 Return true if @var{a} is a numeric, logical, or character matrix.\n\ |