bugGNU Octave - Bugs: bug #56935, assert could produce more...

 
 

bug #56935: assert could produce more meaningful outputs for structs

Submitter:  Rik <rik5>
Submitted:  Mon 23 Sep 2019 05:49:02 PM UTC
   
 
Category:  Octave Function Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
Status:  Confirmed 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
   

Mon 23 Sep 2019 05:49:02 PM UTC, original submission:  

When assert compares two structs that differ it is difficult to determine to which field the differences belong.  Example script tst_assert.m


x = struct ("a", 1, "b", 2, "c", 3);
y = struct ("a", 1, "b", 3, "c", 4);
assert (x,y)


And when it is run


octave:1> tst_assert
error: ASSERT errors for:  assert (cond {i},expected {i},tol)

  Location  |  Observed  |  Expected  |  Reason
     ()           2            3         Abs err 1 exceeds tol 0 by 1

ASSERT errors for:  assert (cond {i},expected {i},tol)

  Location  |  Observed  |  Expected  |  Reason
     ()           3            4         Abs err 1 exceeds tol 0 by 1


It would be nice if assert could report something about where the difference lies such as


error: ASSERT errors for:  assert (y.b (observed), x.b (expected), tol)


or something similar.

Rik <rik5>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #47564:  tst_assert.m added by rik5 (87B - text/x-matlab)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (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.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-09-23 rik5 Attached File- Added tst_assert.m, #47564

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code