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 02:36:11 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 SeaMonkey/2.15

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

I revamped things a bit and created a table format output.  There is probably
some tweaking to do, but it is close to what I think we are converging on.

With regards to what we discussed, this patch achieves:

1) Accumulating errors in one test depth and across multiple recursion depths.
 Waiting until the very end to print out results and give just one single
error message indicating either "general errors" or the error message if there
was only a single error message.

2) Displaying only the associated values that are different and related info
in what I think is a nicely formatted table.  If the compared items are an
array, the index is one dimensional.  If the compared items are a matrix, the
index is two dimensional.  If the compared items are cells, the index is '{}'.
 If the compared items are a structure, the index is '.'.  Something like
that.

3) Multiple tables for recursions.

If one does "test assert", all the results where there was a fail will be
displayed.  Here are some that are more noteworthy:


octave:226> test assert

ASSERT errors for:  assert (zeros (3, 0),zeros (0, 2))

  Location  |  Expected  |  Observed  |  Reason
     .            E            O         Dimensions don't match


ASSERT errors for:  assert (3 + 2 * eps,3,eps)

  Location  |  Expected  |  Observed  |  Reason
     1            3            3         Exceeds abs tol 2.2204e-16 by
2.2204e-16


ASSERT errors for:  assert ([2; 2; 3],[1; 2; 3])

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


ASSERT errors for:  assert (100 + 300 * eps,100,-2 * eps)

  Location  |  Expected  |  Observed  |  Reason
     ()           E            O         Max rel err 7.10543e-16 exceeds tol
4.44089e-16


ASSERT errors for:  assert (NaN,1)

  Location  |  Expected  |  Observed  |  Reason
     1           NaN           1         'NaN' mismatch


ASSERT errors for:  assert (NA,1)

  Location  |  Expected  |  Observed  |  Reason
     1            NA           1         'NA' mismatch
     1            NA           1         'NaN' mismatch


ASSERT errors for:  assert (-Inf,Inf)

  Location  |  Expected  |  Observed  |  Reason
     1           -Inf         Inf        'Inf' mismatch


ASSERT errors for:  assert ("dog","cat")

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


ASSERT errors for:  assert (3,"dog")

  Location  |  Expected  |  Observed  |  Reason
     []          dog           3         Expected string, but observed number


ASSERT errors for:  assert (cellstr ("dog"),"dog")

  Location  |  Expected  |  Observed  |  Reason
     []          dog           {}        Expected string, but observed cell


ASSERT errors for:  assert (cell2struct ({"dog"; 3}, {"pet", "age"},
1),"dog")

  Location  |  Expected  |  Observed  |  Reason
     []          dog           []        Expected string, but observed struct


ASSERT errors for:  assert (x,3)

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


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

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


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

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


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

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


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

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


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

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


ASSERT errors for:  assert (y1,y2 + eps * 1e-70,eps (y1))

  Location  |  Expected  |  Observed  |  Reason
     1          1e-80        1e-80       Exceeds abs tol 1.8727e-96 by
2.2204e-86
     2          1e-78        1e-78       Exceeds abs tol 1.1985e-94 by
2.2204e-86
     3          1e-76        1e-76       Exceeds abs tol 1.5341e-92 by
2.2204e-86
     4          1e-74        1e-74       Exceeds abs tol 1.9636e-90 by
2.2201e-86
     5          1e-72        1e-72       Exceeds abs tol 1.2567e-88 by
2.2244e-86

PASSES 60 out of 60 tests


Let me know what you think and we'll improve the formatting some.

Dan


(file #28761)
    _______________________________________________________

Additional Item Attachment:

File name: octave-assert_vector_tolerance-2013aug04.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]