Mercurial > hg > octave-nkf
comparison libinterp/octave-value/ov-java.cc @ 20362:8187a66039e4 stable
Don't run Java BIST tests if HAVA_JAVA is false.
* ov-java.cc: use 'testif HAVE_JAVA' around BIST tests.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 01 May 2015 13:37:26 -0700 |
parents | 6ee26f894346 |
children | 075a5e2e1ba5 |
comparison
equal
deleted
inserted
replaced
20360:6446649e42c1 | 20362:8187a66039e4 |
---|---|
2134 return octave_value (); | 2134 return octave_value (); |
2135 #endif | 2135 #endif |
2136 } | 2136 } |
2137 | 2137 |
2138 /* | 2138 /* |
2139 ## The tests below merely check if javaObject() works at all. Whether it works | |
2140 ## properly, i.e., creates the right values, is a matter of Java itself. | |
2141 ## Create a Short and check if it really is a short, i.e., whether it overflows. | |
2139 %!testif HAVE_JAVA | 2142 %!testif HAVE_JAVA |
2140 %% The tests below merely check if javaObject works at all. Whether it works | |
2141 %% properly, i.e. creates the right values, is a matter of Java itself | |
2142 %% Create a Short and check if it really is a short, i.e. whether it overflows | |
2143 %! assert (javaObject ("java.lang.Short", 40000).doubleValue < 0); | 2143 %! assert (javaObject ("java.lang.Short", 40000).doubleValue < 0); |
2144 */ | 2144 */ |
2145 | 2145 |
2146 DEFUN (javaMethod, args, , | 2146 DEFUN (javaMethod, args, , |
2147 "-*- texinfo -*-\n\ | 2147 "-*- texinfo -*-\n\ |
2212 #endif | 2212 #endif |
2213 } | 2213 } |
2214 | 2214 |
2215 /* | 2215 /* |
2216 %!testif HAVE_JAVA | 2216 %!testif HAVE_JAVA |
2217 %% Check for valid first two Java version numbers | 2217 %! ## Check for valid first two Java version numbers |
2218 %! jver = strsplit (javaMethod ('getProperty', 'java.lang.System', 'java.version'), '.'); | 2218 %! jver = strsplit (javaMethod ("getProperty", "java.lang.System", "java.version"), "."); |
2219 %! assert (isfinite (str2double (jver{1})) && isfinite (str2double (jver{2}))); | 2219 %! assert (isfinite (str2double (jver{1})) && isfinite (str2double (jver{2}))); |
2220 */ | 2220 */ |
2221 | 2221 |
2222 DEFUN (__java_get__, args, , | 2222 DEFUN (__java_get__, args, , |
2223 "-*- texinfo -*-\n\ | 2223 "-*- texinfo -*-\n\ |
2468 | 2468 |
2469 return retval; | 2469 return retval; |
2470 } | 2470 } |
2471 | 2471 |
2472 /* | 2472 /* |
2473 ## Check automatic conversion of java primitive arrays into octave types | 2473 ## Check automatic conversion of java primitive arrays into octave types. |
2474 %!assert (javaObject ("java.lang.String", "hello").getBytes (), | 2474 %!testif HAVE_JAVA |
2475 %! int8 ([104 101 108 108 111]')) | 2475 %! assert (javaObject ("java.lang.String", "hello").getBytes (), |
2476 | 2476 %! int8 ([104 101 108 108 111]')); |
2477 ## Check automatic conversion of octave types into java primitive arrays | 2477 |
2478 ## Note that uint8 are casted into int8 | 2478 ## Check automatic conversion of octave types into java primitive arrays. |
2479 %!assert (javaMethod ("binarySearch", "java.util.Arrays", [90 100 255], 255), 2) | 2479 ## Note that uint8 is casted to int8. |
2480 %!assert (javaMethod ("binarySearch", "java.util.Arrays", uint8 ([90 100 255]), uint8 (255)) < 0) | 2480 %!testif HAVE_JAVA |
2481 %!assert (javaMethod ("binarySearch", "java.util.Arrays", uint8 ([90 100 128]), uint8 (128)) < 0) | 2481 %! assert (javaMethod ("binarySearch", "java.util.Arrays", [90 100 255], 255), 2); |
2482 %!assert (javaMethod ("binarySearch", "java.util.Arrays", uint8 ([90 100 127]), uint8 (127)), 2) | 2482 %! assert (javaMethod ("binarySearch", "java.util.Arrays", uint8 ([90 100 255]), uint8 (255)) < 0); |
2483 %!assert (javaMethod ("binarySearch", "java.util.Arrays", uint16 ([90 100 128]), uint16 (128)), 2) | 2483 %! assert (javaMethod ("binarySearch", "java.util.Arrays", uint8 ([90 100 128]), uint8 (128)) < 0); |
2484 | 2484 %! assert (javaMethod ("binarySearch", "java.util.Arrays", uint8 ([90 100 127]), uint8 (127)), 2); |
2485 ## Check we can create objects that wrap java literals (bug #38821) | 2485 %! assert (javaMethod ("binarySearch", "java.util.Arrays", uint16 ([90 100 128]), uint16 (128)), 2); |
2486 %!assert (class (javaObject ("java.lang.Byte", uint8 (1))), "java.lang.Byte"); | 2486 |
2487 %!assert (class (javaObject ("java.lang.Byte", int8 (1))), "java.lang.Byte"); | 2487 ## Check we can create objects that wrap java literals (bug #38821). |
2488 %!assert (class (javaObject ("java.lang.Short", uint16 (1))), "java.lang.Short"); | 2488 %!testif HAVE_JAVA |
2489 %!assert (class (javaObject ("java.lang.Short", int16 (1))), "java.lang.Short"); | 2489 %! assert (class (javaObject ("java.lang.Byte", uint8 (1))), "java.lang.Byte"); |
2490 %! assert (class (javaObject ("java.lang.Byte", int8 (1))), "java.lang.Byte"); | |
2491 %! assert (class (javaObject ("java.lang.Short", uint16 (1))), "java.lang.Short"); | |
2492 %! assert (class (javaObject ("java.lang.Short", int16 (1))), "java.lang.Short"); | |
2490 */ | 2493 */ |