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

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

[Octave-bug-tracker] [bug #64351] Reporting from %!shared BIST tests is


From: Rik
Subject: [Octave-bug-tracker] [bug #64351] Reporting from %!shared BIST tests is odd
Date: Mon, 26 Jun 2023 14:06:58 -0400 (EDT)

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

                 Summary: Reporting from %!shared BIST tests is odd
                   Group: GNU Octave
               Submitter: rik5
               Submitted: Mon 26 Jun 2023 11:06:56 AM PDT
                Category: Octave Function
                Severity: 2 - Minor
                Priority: 5 - Normal
              Item Group: Other
                  Status: Confirmed
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Mon 26 Jun 2023 11:06:56 AM PDT By: Rik <rik5>
Code to demonstrate is attached as shared1.m and shared2.m.

Code for shared1.m is:


%!shared x,y
%! x = ones (2,2,0);
%! y = zeros (2,2);

%!test
%! assert (x, y);


And when run


test shared1.m
***** test
 assert (x, y);
!!!!! test failed
ASSERT errors for:  assert (x,y)

  Location  |  Observed  |  Expected  |  Reason
     .         O(2x2x0)      E(2x2)      Dimensions don't match
shared variables     x = [](2x2x0)
    y =

       0   0
       0   0


It seems a bit confusing to have the line for the variable 'x' on the same
line as "shared variables".  I think it would look better, and be less
confusing, to have a newline after shared variables.

Code for shared2.m:


%!shared x,y
%! x = ones (2,2,0);
%! y = zeros (2,2);
%! assert (x, y);


And when run,


test shared2.m
***** shared x,y
 x = ones (2,2,0);
 y = zeros (2,2);
 assert (x, y);
!!!!! test failed
ASSERT errors for:  assert (x,y)

  Location  |  Observed  |  Expected  |  Reason
     .         O(2x2x0)      E(2x2)      Dimensions don't match
shared variables     x = [](0x0)
    y = [](0x0)


The print out is incorrect.  The variable 'y' is a 2x2 matrix.  This only
happens because test statements (such as assert()) are used within a %!shared
block rather than being in a separate %!test block.  Either the processing of
%!shared blocks could be tweaked in test.m OR we make it a coding standard to
only have assignments in %!shared blocks.








    _______________________________________________________
File Attachments:


-------------------------------------------------------
Date: Mon 26 Jun 2023 11:06:56 AM PDT  Name: shared1.m  Size: 80B   By: rik5

<http://savannah.gnu.org/bugs/download.php?file_id=54875>
-------------------------------------------------------
Date: Mon 26 Jun 2023 11:06:56 AM PDT  Name: shared2.m  Size: 72B   By: rik5

<http://savannah.gnu.org/bugs/download.php?file_id=54876>

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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