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

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

[Octave-bug-tracker] [bug #37555] strsplit.m fails a test; fix proposed.


From: Arun Giridhar
Subject: [Octave-bug-tracker] [bug #37555] strsplit.m fails a test; fix proposed.
Date: Fri, 12 Oct 2012 00:34:45 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:16.0) Gecko/20100101 Firefox/16.0

URL:
  <http://savannah.gnu.org/bugs/?37555>

                 Summary: strsplit.m fails a test; fix proposed.
                 Project: GNU Octave
            Submitted by: arungiridhar
            Submitted on: Thu 11 Oct 2012 08:34:44 PM EDT
                Category: Libraries
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Inaccurate Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:

Data: Ubuntu 12.04 32bit on Intel Core i5, using Octave dev sources.

The function octave/scripts/strings/strsplit.m fails a test during "make
check". I'm not sure why this cropped up suddenly today. Here's the output
from test/fntests.log:

  ***** assert (strsplit (["a,bc";",de"], ","), {"a", "bc", ones(1,0), "de
"})
!!!!! test failed
assert (strsplit (["a,bc"; ",de"], ","),{"a", "bc", ones(1, 0), "de "})
expected
{
  [1,1] = a
  [1,2] = bc
  [1,3] = [](1x0)
  [1,4] = de
}
but got
{
  [1,1] = a
  [1,2] = bc
  [1,3] =
  [1,4] = de
}

It turns out that strsplit is returning a 1x0 *character* array, which doesn't
equate to the 1x0 numeric array specified in the assertion.

Fix: I eliminated the test error by changing "ones(1,0)" to "char(ones(1,0))"
in the assert statement. Alternatively "repmat(' ',1,0)" also works. Changing
the test to make the RHS be a 1x0 character array in any manner fixes the
test. My actual code that uses strsplit is unaffected by the bug.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?37555>

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




reply via email to

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