bugGNU Octave - Bugs: bug #54338, New org.octave.BoxingTester Java...

 
 

bug #54338: New org.octave.BoxingTester Java class to help testing

Submitter:  Andrew Janke <apjanke>
Submitted:  Thu 19 Jul 2018 08:18:52 AM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 21 Jul 2018 02:30:50 AM UTC, comment #3: 

Sure. Give me a little time to get more familiar with Octave's BIST syntax, and I'll include that in this patch.

Andrew Janke <apjanke>
Sat 21 Jul 2018 12:34:51 AM UTC, comment #2: 

I think this is a really good idea.

Can you look at turning some of the example uses that you have posted here into a new test suite entry, say test/java.tst?

Tests might look like


%!testif HAVE_JAVA; usejava ("jvm")
%! assert (jobj.getStringAsString (), "Hello, world!")
%!testif HAVE_JAVA; usejava ("jvm")
%! assert (jobj.getInt (), int32 (42))
...


Mike Miller <mtmiller>
Group Member
Thu 19 Jul 2018 08:46:56 AM UTC, comment #1: 

Updated to a new file #44592:  java-BoxingTester-v02.patch. This one includes public member fields on BoxingObject so field access/boxing can be tested as well as method calls.

Andrew Janke <apjanke>
Thu 19 Jul 2018 08:18:52 AM UTC, original submission:  

There are a few outstanding bugs related to Octave/Java value boxing behavior.


Many of these are having to provide their own example Java code, which you need to download and compile if you want to reproduce their use case.

It might be useful to have a canonical Java value-boxing test that provides a bunch of example method signatures to run tests against, so you can have a shared agreed-upon test context, and not have to bother compiling custom Java code to reproduce test cases.

I've attached a changeset which defines a new org.octave.BoxingTester class that provides several permutations of Java method signatures that you can use to exercise the Octave/Java value boxing behavior.

Example:


octave:1> tst = javaObject ("org.octave.BoxingTester")
tst =

<Java object: org.octave.BoxingTester>

octave:2> tst.foo(42)
foo(double): (42.0)
ans = [](0x0)
octave:3> tst.foo ([42, 43])
foo(double[]): ([D@27f674d)
ans = [](0x0)
octave:4> tst.foo("Hello, world!")
foo(String): (Hello, world!)
ans = [](0x0)
octave:5> tst.getStringAsString
ans = Hello, world!
octave:6> class(ans)
ans = char
octave:7> tst.getStringAsObject
ans = Hello, world!
octave:8> class(ans)
ans = char


Andrew Janke <apjanke>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #44592:  java-BoxingTester-v02.patch added by apjanke (12KiB - application/octet-stream - new version with member fields also)
file #44591:  java-BoxingTester.patch added by apjanke (11KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by apjanke (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-07-19 apjanke Attached File- Added java-BoxingTester-v02.patch, #44592
    2018-07-19 apjanke Attached File- Added java-BoxingTester.patch, #44591

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code