bugGNU Octave - Bugs: bug #42150, [N,MAX] = test(...) always returns...

 
 

bug #42150: [N,MAX] = test(...) always returns [0,0] if a test fails

Submitted by:  Colin Macdonald <cbm>
Submitted on:  Sun 20 Apr 2014 03:02:07 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: InvalidAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 29 May 2014 07:34:54 AM UTC, comment #3:

Yes! Sorry for not replying. Meant to submit patch for the doc text but didn't get around to it.

Colin Macdonald <cbm>
Thu 29 May 2014 02:15:12 AM UTC, comment #2:

Closing as invalid with no reply from OP. Assuming that my comment #1 is a reasonable workaround to get the requested behavior.

Mike Miller <mtmiller>
Project Administrator
Wed 23 Apr 2014 11:15:35 PM UTC, comment #1:

Thanks for the report. I think you do misunderstand though. The first paragraph of the help for test says:

> the tests are run interactively and stop
> after the first error is encountered.


It doesn't explicitly say this, but the return values seem to always be zero if the test function is not run in "batch" mode, meaning you have given it a file descriptor as the third argument. But since test stops on the first failing test, there's no point in reporting the number of tests passed or the total number, since it may not have run all of them.

If you want to run all tests in a function, try

It's a little clunky, but that forces it into batch mode and runs all tests, not stopping at the first failure. Does that do what you want?

Mike Miller <mtmiller>
Project Administrator
Sun 20 Apr 2014 03:02:07 PM UTC, original submission:

doc text sounds like it should be number passed and total number, unless I misunderstand?

Testing on 3.6.4, 3.8.1 and recent hg (yesterday-ish).

minimal examples attached.

Colin Macdonald <cbm>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #31217:  test_return_works.m added by cbm (65B - text/x-objcsrc)
file #31218:  test_return_bug.m added by cbm (64B - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by cbm (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 29 May 2014 02:15:12 AM UTCmtmillerStatusNeed Info=>Invalid
      Open/ClosedOpen=>Closed
    Wed 23 Apr 2014 11:15:35 PM UTCmtmillerStatusNone=>Need Info
    Sun 20 Apr 2014 03:02:07 PM UTCcbmAttached File-=>Added test_return_works.m, #31217
      Attached File-=>Added test_return_bug.m, #31218

    Back to the top


    Powered by Savane 3.1-cleanup1