bugGNU Octave - Bugs: bug #44382, test fieldnames fails in MXE-octave

 
 

bug #44382: test fieldnames fails in MXE-octave

Submitter:  Avinoam Kalma <avinoam>
Submitted:  Fri 27 Feb 2015 11:27:23 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Avinoam Open/Closed:  * Closed
Release:  * dev Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 28 Feb 2015 03:44:24 PM UTC, comment #6: 

At least it's an easy fix.  Apparently even a very basic Java class like a double value is still changing between versions.  Java 1.8 adds a BYTES field which then means that setxor returns one extra field.

I changed the BIST tests to look for just the stable properties present in past and future versions of java (http://hg.savannah.gnu.org/hgweb/octave/rev/f799bf70350f).

Rik <rik5>
Group administrator
Sat 28 Feb 2015 09:11:00 AM UTC, comment #5: 

Under Ubuntu I get


>>  names = fieldnames (javaObject ("java.lang.Double", 10))
names =
{
  [1,1] = POSITIVE_INFINITY
  [1,2] = NEGATIVE_INFINITY
  [1,3] = NaN
  [1,4] = MAX_VALUE
  [1,5] = MIN_NORMAL
  [1,6] = MIN_VALUE
  [1,7] = MAX_EXPONENT
  [1,8] = MIN_EXPONENT
  [1,9] = SIZE
  [1,10] = TYPE
}


Avinoam Kalma <avinoam>
Group Member
Sat 28 Feb 2015 09:10:11 AM UTC, comment #4: 


names =
{
  [1,1] = POSITIVE_INFINITY
  [1,2] = NEGATIVE_INFINITY
  [1,3] = NaN
  [1,4] = MAX_VALUE
  [1,5] = MIN_NORMAL
  [1,6] = MIN_VALUE
  [1,7] = MAX_EXPONENT
  [1,8] = MIN_EXPONENT
  [1,9] = SIZE
  [1,10] = BYTES
  [1,11] = TYPE
}
>> setxor (names(:),
                          {"POSITIVE_INFINITY", "NEGATIVE_INFINITY", ...
                           "NaN", "MAX_VALUE", "MIN_NORMAL", "MIN_VALUE", ...
                           "MAX_EXPONENT", "MIN_EXPONENT", "SIZE", "TYPE"})
ans =
{
  [1,1] = BYTES
}


The BYTES is missing.
Under Ubuntu I get


>>  names = fieldnames (javaObject ("java.lang.Double", 10))
names =
{
  [1,1] = POSITIVE_INFINITY
  [1,2] = NEGATIVE_INFINITY
  [1,3] = NaN
  [1,4] = MAX_VALUE
  [1,5] = MIN_NORMAL
  [1,6] = MIN_VALUE
  [1,7] = MAX_EXPONENT
  [1,8] = MIN_EXPONENT
  [1,9] = SIZE
  [1,10] = TYPE
}
-verbatim

Avinoam Kalma <avinoam>
Group Member
Fri 27 Feb 2015 10:51:27 PM UTC, comment #3: 

That's correct.  It means Octave created a java object.  You can use


methods (x)


to see what functions the particular object supports.  Try, for example,


x.toString ()


to see the value of pi printed out.

Try executing the failing test line by line and see where it fails.



x = javaObject ("java.lang.Double", 10)
names = fieldnames (x)
strcmp (names, "MAX_VALUE")
any (strcmp (names, "MAX_VALUE"))
setxor (names(:), {"POSITIVE_INFINITY", "NEGATIVE_INFINITY", ...
                   "NaN", "MAX_VALUE", "MIN_NORMAL", "MIN_VALUE", ...
                   "MAX_EXPONENT", "MIN_EXPONENT", "SIZE", "TYPE"})));


If I had to guess, I bet there is a difference in upper/lower case for "NaN".

Rik <rik5>
Group administrator
Fri 27 Feb 2015 10:38:46 PM UTC, comment #2: 


>> x = javaObject ("java.lang.Double", pi)
x =

<Java object: java.lang.Double>

What does it mean?

Avinoam Kalma <avinoam>
Group Member
Fri 27 Feb 2015 06:13:19 PM UTC, comment #1: 

Do you have a Java VM installed on the Windows side, and does it work within Octave?

For example, does this succeed?


x = javaObject ("java.lang.Double", pi)


Rik <rik5>
Group administrator
Fri 27 Feb 2015 11:27:23 AM UTC, original submission:  



>> test fieldnames
***** testif HAVE_JAVA
 names = fieldnames (javaObject ("java.lang.Double", 10));
 assert (any (strcmp (names, "MAX_VALUE")));
 assert (isempty (setxor (names(:),
                          {"POSITIVE_INFINITY", "NEGATIVE_INFINITY", ...
                           "NaN", "MAX_VALUE", "MIN_NORMAL", "MIN_VALUE", ...
                           "MAX_EXPONENT", "MIN_EXPONENT", "SIZE", "TYPE"})));
!!!!! test failed
assert (isempty (setxor (names (:), {"POSITIVE_INFINITY", "NEGATIVE_INFINITY", "NaN", "MAX_
VALUE", "MIN_NORMAL", "MIN_VALUE", "MAX_EXPONENT", "MIN_EXPONENT", "SIZE", "TYPE"}))) failed

In Linux (Ubuntu) it pass the test

Avinoam Kalma <avinoam>
Group Member

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by avinoam (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-02-28 rik5 StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2015-02-27 rik5 StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code