octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #64057] assert.m: struct comparison skips type


From: Pantxo Diribarne
Subject: [Octave-bug-tracker] [bug #64057] assert.m: struct comparison skips type checking for field values
Date: Sun, 16 Apr 2023 15:49:04 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?64057>

                 Summary: assert.m: struct comparison skips type checking for
field values
                   Group: GNU Octave
               Submitter: pantxo
               Submitted: dim. 16 avril 2023 19:49:02
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Missed Error or Warning
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 8.1.0
         Discussion Lock: Any
        Operating System: Any
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: dim. 16 avril 2023 19:49:02    By: Pantxo Diribarne <pantxo>
I don't know if this is the expected behavior: `assert` correctly compares
struct fields values but skips type checking. E.g the followings structs


a.logical = true;
b.logical = false;
c.logical = 1;


are sometimes mistakenly considered equal


octave:11> assert (a, b)
error: ASSERT errors for:  assert (cond {i},expected {i},tol)

  Location  |  Observed  |  Expected  |  Reason
     ()           1            0         Abs err 1 exceeds tol 0 by 1
octave:12> assert (a, c)
octave:13> assert (a.logical, c.logical)
error: ASSERT errors for:  assert (a.logical,c.logical)

  Location  |  Observed  |  Expected  |  Reason
     ()           O            E         Class logical != double










    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64057>

_______________________________________________
Message posté via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]