Mercurial > hg > octave-nkf
changeset 15825:9854666df787
ov-java.cc: tests added for javaObject and javaMethod
author | Philip Nienhuis <prnienhuis@users.sf.net> |
---|---|
date | Fri, 21 Dec 2012 22:09:51 +0100 |
parents | abc9e5f3c661 |
children | 93516992ee34 |
files | libinterp/octave-value/ov-java.cc |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-java.cc +++ b/libinterp/octave-value/ov-java.cc @@ -1978,6 +1978,14 @@ #endif } +/* +%!testif HAVE_JAVA +%% The tests below merely check if javaObject works at all. Whether it works +%% properly, i.e. creates the right values, is a matter of Java itself +%% Create a Short and check if it really is a short, i.e. whether it overflows +%! assert (javaObject ("java.lang.Short", 40000).doubleValue < 0); +*/ + DEFUN (javaMethod, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{ret} =} javaMethod (@var{methodname}, @var{obj})\n\ @@ -2046,6 +2054,13 @@ #endif } +/* +%!testif HAVE_JAVA +%% Check for valid first two Java version numbers +%! jver = strsplit (javaMethod ('getProperty', 'java.lang.System', 'java.version'), '.'); +%! assert (isfinite (str2double (jver{1})) && isfinite (str2double (jver{2}))); +*/ + DEFUN (__java_get__, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{val} =} __java_get__ (@var{obj}, @var{name})\n\