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: Dan Sebald
Subject: [Octave-patch-tracker] [patch #8119] Allow variable tolerance and improve error messages for assert.m script
Date: Mon, 05 Aug 2013 23:12:37 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 SeaMonkey/2.15

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

OK, I get it now.  There was actually a bug or two still in the script. 
Attached is a new version with all output packed into the error message so
that test.m's try/catch can handle the display.


>> test clf
  ***** xtest
 hf = figure ("visible", "off");
 unwind_protect
   plot (1:10);
   set (hf, "papertype", "tabloid");
   clf (hf);
   assert (isempty (get (gcf, "children")));
   assert (get (hf, "papertype"), "tabloid");
   plot (1:10);
   clf (hf, "reset");
   kids = get (hf, "children");
   assert (isempty (get (gcf, "children")));
   assert (get (hf, "papertype"), "usletter");
 unwind_protect_cleanup
   close (hf);
 end_unwind_protect
!!!!! known failure
ASSERT errors for:  assert (get (hf, "papertype"),"usletter")

  Location  |  Observed  |  Expected  |  Reason
     []        tabloid      usletter     Strings don't match
PASSES 3 out of 3 tests (1 expected failures)


So that's an incremental step in the right direction.  I did find what seems
like a bug in test.m.  I'll submit a new report for that.

The one thing I can think of to do would be something more descriptive for the
recursive assert calls.  For example, here is the output of a recursive cell
test:


>> assert (x, y)
error: ASSERT errors for:  assert (cond {i},expected {i},tol)

  Location  |  Observed  |  Expected  |  Reason
     1            3            2         Exceeds abs tol 0 by 1

ASSERT errors for:  assert (cond {i},expected {i},tol)

  Location  |  Observed  |  Expected  |  Reason
     1           100          101        Exceeds abs tol 0 by 1

ASSERT errors for:  assert (cond {i},expected {i},tol)

  Location  |  Observed  |  Expected  |  Reason
     1            1            0         Exceeds abs tol 0 by 1

ASSERT errors for:  assert (cond {i},expected {i},tol)

  Location  |  Observed  |  Expected  |  Reason
     []          dog          cat        Strings don't match


Notice how the arguments of the "assert" command are generic cell contents. 
One could parse the original command for the variable names and either:

1) Create local variables with names similar to input... problematic if the
variable matches something in the local space.

2) Temporarily redefine the "in" string... problematic if more than one level
of recursion because original contents of "in" is lost.

We'll leave that for later.


(file #28770)
    _______________________________________________________

Additional Item Attachment:

File name: octave-assert_vector_tolerance-2013aug05.patch Size:14 KB


    _______________________________________________________

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]