Mercurial > octave-nkf
comparison src/ov-fcn-inline.cc @ 14429:eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
* data.cc, defaults.cc, dirfns.cc, file-io.cc, graphics.cc, mappers.cc,
oct-map.cc, octave.cc, ov-base.cc, ov-bool-mat.cc, ov-cell.cc,
ov-fcn-handle.cc, ov-fcn-inline.cc, ov-flt-re-mat.cc, ov-int16.cc, ov-int32.cc,
ov-int64.cc, ov-int8.cc, ov-null-mat.cc, ov-oncleanup.cc, ov-range.cc,
ov-re-mat.cc, ov-struct.cc, ov-typeinfo.cc, ov-uint16.cc, ov-uint32.cc,
ov-uint64.cc, ov-uint8.cc, ov.cc, pr-output.cc, pt-binop.cc, pt-eval.cc,
pt-idx.cc, pt-mat.cc, sighandlers.cc, strfns.cc, symtab.cc, syscalls.cc,
sysdep.cc, toplev.cc, utils.cc, variables.cc: Update %!tests in src/ directory
with Octave coding conventions.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 04 Mar 2012 12:21:10 -0800 |
parents | 5a25a51146a1 |
children |
comparison
equal
deleted
inserted
replaced
14428:099bd779466c | 14429:eff4a5933e28 |
---|---|
823 /* | 823 /* |
824 %!shared fn | 824 %!shared fn |
825 %! fn = inline ("x.^2 + 1"); | 825 %! fn = inline ("x.^2 + 1"); |
826 %!assert (feval (fn, 6), 37) | 826 %!assert (feval (fn, 6), 37) |
827 %!assert (fn (6), 37) | 827 %!assert (fn (6), 37) |
828 %% FIXME: Need tests for other 2 calling forms of inline() | 828 ## FIXME: Need tests for other 2 calling forms of inline() |
829 | 829 |
830 %% Test input validation | 830 ## Test input validation |
831 %!error inline () | 831 %!error inline () |
832 %!error <STR argument must be a string> inline (1) | 832 %!error <STR argument must be a string> inline (1) |
833 %!error <N must be an integer> inline ("2", ones (2,2)) | 833 %!error <N must be an integer> inline ("2", ones (2,2)) |
834 %!error <N must be a positive integer> inline ("2", -1) | 834 %!error <N must be a positive integer> inline ("2", -1) |
835 %!error <expecting string arguments> inline ("2", "x", -1, "y") | 835 %!error <expecting string arguments> inline ("2", "x", -1, "y") |
865 | 865 |
866 /* | 866 /* |
867 %!assert (formula (fn), "x.^2 + 1") | 867 %!assert (formula (fn), "x.^2 + 1") |
868 %!assert (formula (fn), char (fn)) | 868 %!assert (formula (fn), char (fn)) |
869 | 869 |
870 %% Test input validation | 870 ## Test input validation |
871 %!error formula () | 871 %!error formula () |
872 %!error formula (1, 2) | 872 %!error formula (1, 2) |
873 %!error <FUN must be an inline function> formula (1) | 873 %!error <FUN must be an inline function> formula (1) |
874 */ | 874 */ |
875 | 875 |
912 /* | 912 /* |
913 %!assert (argnames (fn), {"x"}) | 913 %!assert (argnames (fn), {"x"}) |
914 %!assert (argnames (inline ("1e-3*y + 2e4*z")), {"y"; "z"}) | 914 %!assert (argnames (inline ("1e-3*y + 2e4*z")), {"y"; "z"}) |
915 %!assert (argnames (inline ("2", 2)), {"x"; "P1"; "P2"}) | 915 %!assert (argnames (inline ("2", 2)), {"x"; "P1"; "P2"}) |
916 | 916 |
917 %% Test input validation | 917 ## Test input validation |
918 %!error argnames () | 918 %!error argnames () |
919 %!error argnames (1, 2) | 919 %!error argnames (1, 2) |
920 %!error <FUN must be an inline function> argnames (1) | 920 %!error <FUN must be an inline function> argnames (1) |
921 */ | 921 */ |
922 | 922 |
1010 %!assert (char (vectorize (inline ("2**x^5"))), "2.**x.^5") | 1010 %!assert (char (vectorize (inline ("2**x^5"))), "2.**x.^5") |
1011 %!assert (vectorize ("x.^2 + 1"), "x.^2 + 1") | 1011 %!assert (vectorize ("x.^2 + 1"), "x.^2 + 1") |
1012 %!assert (vectorize ("1e-3*y + 2e4*z"), "1e-3.*y + 2e4.*z") | 1012 %!assert (vectorize ("1e-3*y + 2e4*z"), "1e-3.*y + 2e4.*z") |
1013 %!assert (vectorize ("2**x^5"), "2.**x.^5") | 1013 %!assert (vectorize ("2**x^5"), "2.**x.^5") |
1014 | 1014 |
1015 %% Test input validation | 1015 ## Test input validation |
1016 %!error vectorize () | 1016 %!error vectorize () |
1017 %!error vectorize (1, 2) | 1017 %!error vectorize (1, 2) |
1018 %!error <FUN must be a string or inline function> vectorize (1) | 1018 %!error <FUN must be a string or inline function> vectorize (1) |
1019 */ | 1019 */ |
1020 |