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

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

[Octave-patch-tracker] [patch #8119] Allow variable tolerance and improv


From: Rik
Subject: [Octave-patch-tracker] [patch #8119] Allow variable tolerance and improve error messages for assert.m script
Date: Fri, 02 Aug 2013 00:35:49 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0

Follow-up Comment #2, patch #8119 (project octave):

I took a look at this patch.  It seems generally like a good idea, although I
see a need for some tweaking before applying.

I benchmarked it and it doesn't slow down the test suite, so performance is
not a concern.

Two things I had a trouble with
1) With matrices, not vectors or scalars, I have a hard time seeing what is
different
2) There are now two levels of stack trace reported.

For the first issue, try 


obs = [1 3; 2 4];
exp = [1 2; 3 4];

assert (obs, exp)
error: assert (obs,exp) expected
   2
   3
but got
   3
   2
values do not match
error: called from:
error:   /home/rik/wip/Projects_Mine/octave-dev/scripts/testfun/assert.m at
line 356, column 5
error:   /home/rik/wip/Projects_Mine/octave-dev/scripts/testfun/assert.m at
line 202, column 9


With the old code this results in


error: assert (obs, exp) expected
   1   3
   2   4
but got
   1   2
   3   4
values do not match
error: called from:
error:   /home/rik/downloads/local/share/octave/3.7.5/m/testfun/assert.m at
line 235, column 5


Maybe there is a way to pretty print the matrix with an '*' or some other
character by the values which are mismatching.  Another possibility would be
to print out a matrix of zeros, sized the same as obs and exp, with entries
only in positions where a mismatch was found.  Thinking about it, this sounds
easier.

The extra stack on the backtrace is only slightly annoying, but I'd still like
to get rid of it.  Often tests are already buried pretty deeply in the call
stack and it all gets reported when assert errors out.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?8119>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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