Mercurial > octave
changeset 25484:b7db401e1a99
Use "ascend"/"descend" for issorted direction (bug #54147).
* NEWS: Announce change in name of options to issorted.
* data.cc: (Fissorted): Change direction names to drop "ing". Change BIST
tests to pass with new names.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 19 Jun 2018 09:18:44 -0700 |
parents | 37dbf79c2297 |
children | 38a07d930ccd |
files | NEWS libinterp/corefcn/data.cc |
diffstat | 2 files changed, 20 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Tue Jun 19 09:37:03 2018 -0400 +++ b/NEWS Tue Jun 19 09:18:44 2018 -0700 @@ -5,6 +5,11 @@ or "skew" to calculate the symmetric or skew-symmetric property of a matrix. Performance has also been increased. + ** The issorted function now uses a direction option of "ascend" or + "descend" to make it compatible with both the sort function and + with Matlab. Change all uses of "ascending" and "descending" in + existing code to the new options. + ** Figure graphic objects have a new property "Number" which is read-only and will return the handle (number) of the figure. However, if the property "IntegerHandle" has been set to "off" then
--- a/libinterp/corefcn/data.cc Tue Jun 19 09:37:03 2018 -0400 +++ b/libinterp/corefcn/data.cc Tue Jun 19 09:18:44 2018 -0700 @@ -6756,14 +6756,14 @@ std::string mode = arg.xstring_value ("issorted: MODE must be a string"); - if (mode == "ascending") + if (mode == "ascend") smode = ASCENDING; - else if (mode == "descending") + else if (mode == "descend") smode = DESCENDING; else if (mode == "either") smode = UNSORTED; else - error (R"(issorted: MODE must be "ascending", "descending", or "either")"); + error (R"(issorted: MODE must be "ascend", "descend", or "either")"); return smode; } @@ -6847,18 +6847,18 @@ %!assert (! issorted (uv)) %!assert (issorted (sv')) %!assert (! issorted (uv')) -%!assert (issorted (sm, "rows", "ascending")) -%!assert (! issorted (um, "rows", "ascending")) -%!assert (issorted (sv, "ascending")) -%!assert (! issorted (uv, "ascending")) -%!assert (issorted (sv', "ascending")) -%!assert (! issorted (uv', "ascending")) -%!assert (! issorted (sm, "rows", "descending")) -%!assert (issorted (flipud (sm), "rows", "descending")) -%!assert (! issorted (sv, "descending")) -%!assert (issorted (fliplr (sv), "descending")) -%!assert (! issorted (sv', "descending")) -%!assert (issorted (fliplr (sv)', "descending")) +%!assert (issorted (sm, "rows", "ascend")) +%!assert (! issorted (um, "rows", "ascend")) +%!assert (issorted (sv, "ascend")) +%!assert (! issorted (uv, "ascend")) +%!assert (issorted (sv', "ascend")) +%!assert (! issorted (uv', "ascend")) +%!assert (! issorted (sm, "rows", "descend")) +%!assert (issorted (flipud (sm), "rows", "descend")) +%!assert (! issorted (sv, "descend")) +%!assert (issorted (fliplr (sv), "descend")) +%!assert (! issorted (sv', "descend")) +%!assert (issorted (fliplr (sv)', "descend")) %!assert (! issorted (um, "rows", "either")) %!assert (! issorted (uv, "either")) %!assert (issorted (sm, "rows", "either"))