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

 
 

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

Submitted by:  Rik <rik5>
Submitted on:  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

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project 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)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project 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.5