# HG changeset patch # User Philip Nienhuis # Date 1356124191 -3600 # Node ID 9854666df787bca33dacabd759d49313817aaecf # Parent abc9e5f3c6613fbd1017fb131f463efa01e39cd8 ov-java.cc: tests added for javaObject and javaMethod diff -r abc9e5f3c661 -r 9854666df787 libinterp/octave-value/ov-java.cc --- a/libinterp/octave-value/ov-java.cc Fri Dec 21 10:18:38 2012 -0800 +++ b/libinterp/octave-value/ov-java.cc Fri Dec 21 22:09:51 2012 +0100 @@ -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\