bugGNU Octave - Bugs: bug #48875, java integration: function isequal

 
 

bug #48875: java integration: function isequal

Submitter:  Ernst Reissner <ernstreissner>
Submitted:  Tue 23 Aug 2016 05:42:03 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Patch Submitted 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
   

Tue 23 Aug 2016 07:25:45 PM UTC, comment #1: 

This patch takes only java into account.
I consider it ok if the first element is java or []
representing null in java.
I did not check the other cases
and thus this patch does not include documentation.

Add it if my fix is ok.
Please keep me informed.

My private tests (i am interested mostly in java)
are based on OctaveInterfaceTester i also provide.

my equality tests are also implemented in java.
I give you just the source:

   // the tests performed here, compare just java objects including null
    void testIsequal() {
        this.oct.eval("tester = javaObject(" + TESTER_NAME + ");");

        // tests including null
        this.oct.eval("b=isequal([], tester);");
        assertTrue(!this.oct.getBool("b"));
        this.oct.eval("b=isequal(tester, []);");
        assertTrue(!this.oct.getBool("b"));

        // test with different classes
        this.oct.eval("bd=javaObject('java.math.BigDecimal',4.2);");
        this.oct.eval("b=isequal(tester, bd);");
        assertTrue(!this.oct.getBool("b"));

        // tests with same classes but not equal
        this.oct.eval("bd1=javaObject('java.math.BigDecimal',4.2);");
        this.oct.eval("bd2=javaObject('java.math.BigDecimal',4.3);");
        this.oct.eval("b=isequal(bd1, bd2);");
        assertTrue(!this.oct.getBool("b"));

        // tests with same classes and equal
        this.oct.eval("bd1=javaObject('java.math.BigDecimal',4.2);");
        this.oct.eval("bd2=javaObject('java.math.BigDecimal',4.2);");
        this.oct.eval("b=isequal(bd1, bd2);");
        assertTrue(this.oct.getBool("b"));

        // tests including the tester: test of specific equals method
        this.oct.eval("t1 = javaObject(" + TESTER_NAME + ");");
        this.oct.eval("t2 = javaObject(" + TESTER_NAME + ");");
        this.oct.eval("b=isequal(t1, t2);");
        assertTrue(this.oct.getBool("b"));

        this.oct.eval("t1 = javaObject(" + TESTER_NAME + ");");
        this.oct.eval("t2 = javaObject(" + TESTER_NAME + ");");
        this.oct.eval("t1.bdVal = javaObject('java.math.BigDecimal',4.2);");
        this.oct.eval("b=isequal(t1, t2);");
        assertTrue(!this.oct.getBool("b"));

        this.oct.eval("t1 = javaObject(" + TESTER_NAME + ");");
        this.oct.eval("t2 = javaObject(" + TESTER_NAME + ");");
        this.oct.eval("t1.bVal = 42;");
        this.oct.eval("t1.bdVal = javaObject('java.math.BigDecimal',4.2);");
        this.oct.eval("t2.bVal = 42;");
        this.oct.eval("t2.bdVal = javaObject('java.math.BigDecimal',4.2);");
        this.oct.eval("b=isequal(t1, t2);");
        assertTrue(this.oct.getBool("b"));
    }



(file #38333, file #38334)

Ernst Reissner <ernstreissner>
Tue 23 Aug 2016 05:42:03 PM UTC, original submission:  
Ernst Reissner <ernstreissner>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #38333:  patchBug448875.patch added by ernstreissner (2KiB - text/x-patch)
file #38334:  OctaveInterfaceTester.java added by ernstreissner (6KiB - application/x-java)

 

Carbon-Copy List
  • -email is unavailable- added by siko1056 (Updated the item)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by ernstreissner (Submitted the item)
  • -email is unavailable- added by ernstreissner
  •  

    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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-08-11 rik5 Dependencies- bugs #61029 is dependent
    2020-02-28 siko1056 Assigned tosiko1056 None
    2017-02-23 siko1056 Item GroupNone Feature Request
        Assigned toNone siko1056
    2017-02-23 siko1056 Dependencies- Depends on bugs #42453
    2016-11-18 mtmiller CategoryNone Octave Function
        StatusNone Patch Submitted
    2016-08-23 ernstreissner Attached File- Added patchBug448875.patch, #38333
        Attached File- Added OctaveInterfaceTester.java, #38334
    2016-08-23 ernstreissner Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code