Mercurial > hg > octave-terminal
changeset 10707:69c5f5ec55d7
fix invalid sort tests
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 16 Jun 2010 12:54:38 +0200 |
parents | 6f34e781aed2 |
children | 2786b7ae3f80 |
files | src/ChangeLog src/data.cc |
diffstat | 2 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-06-16 Jaroslav Hajek <highegg@gmail.com> + + * data.cc (Fsort): Fix invalid tests. + 2010-06-15 Rik <octave@nomad.inbox5.com> * pr-output.cc: Second try at removing extra newlines from NDArrays
--- a/src/data.cc +++ b/src/data.cc @@ -5354,7 +5354,7 @@ %!assert (sort ([NaN, 1, -1, 2, Inf]), [-1, 1, 2, Inf, NaN]) %!assert (sort ([NaN, 1, -1, 2, Inf], 1), [NaN, 1, -1, 2, Inf]) %!assert (sort ([NaN, 1, -1, 2, Inf], 2), [-1, 1, 2, Inf, NaN]) -%!error (sort ([NaN, 1, -1, 2, Inf], 3)) +%!assert (sort ([NaN, 1, -1, 2, Inf], 3), [NaN, 1, -1, 2, Inf]) %!assert (sort ([NaN, 1, -1, 2, Inf], "ascend"), [-1, 1, 2, Inf, NaN]) %!assert (sort ([NaN, 1, -1, 2, Inf], 2, "ascend"), [-1, 1, 2, Inf, NaN]) %!assert (sort ([NaN, 1, -1, 2, Inf], "descend"), [NaN, Inf, 2, 1, -1]) @@ -5373,7 +5373,7 @@ %!assert (sort ([NaN, 1i, -1, 2, Inf]), [1i, -1, 2, Inf, NaN]) %!assert (sort ([NaN, 1i, -1, 2, Inf], 1), [NaN, 1i, -1, 2, Inf]) %!assert (sort ([NaN, 1i, -1, 2, Inf], 2), [1i, -1, 2, Inf, NaN]) -%!error (sort ([NaN, 1i, -1, 2, Inf], 3)) +%!assert (sort ([NaN, 1i, -1, 2, Inf], 3), [NaN, 1i, -1, 2, Inf]) %!assert (sort ([NaN, 1i, -1, 2, Inf], "ascend"), [1i, -1, 2, Inf, NaN]) %!assert (sort ([NaN, 1i, -1, 2, Inf], 2, "ascend"), [1i, -1, 2, Inf, NaN]) %!assert (sort ([NaN, 1i, -1, 2, Inf], "descend"), [NaN, Inf, 2, -1, 1i]) @@ -5392,7 +5392,7 @@ %!assert (sort (single([NaN, 1, -1, 2, Inf])), single([-1, 1, 2, Inf, NaN])) %!assert (sort (single([NaN, 1, -1, 2, Inf]), 1), single([NaN, 1, -1, 2, Inf])) %!assert (sort (single([NaN, 1, -1, 2, Inf]), 2), single([-1, 1, 2, Inf, NaN])) -%!error (sort (single([NaN, 1, -1, 2, Inf]), 3)) +%!assert (sort (single([NaN, 1, -1, 2, Inf]), 3), single([NaN, 1, -1, 2, Inf])) %!assert (sort (single([NaN, 1, -1, 2, Inf]), "ascend"), single([-1, 1, 2, Inf, NaN])) %!assert (sort (single([NaN, 1, -1, 2, Inf]), 2, "ascend"), single([-1, 1, 2, Inf, NaN])) %!assert (sort (single([NaN, 1, -1, 2, Inf]), "descend"), single([NaN, Inf, 2, 1, -1])) @@ -5411,7 +5411,7 @@ %!assert (sort (single([NaN, 1i, -1, 2, Inf])), single([1i, -1, 2, Inf, NaN])) %!assert (sort (single([NaN, 1i, -1, 2, Inf]), 1), single([NaN, 1i, -1, 2, Inf])) %!assert (sort (single([NaN, 1i, -1, 2, Inf]), 2), single([1i, -1, 2, Inf, NaN])) -%!error (sort (single([NaN, 1i, -1, 2, Inf]), 3)) +%!assert (sort (single([NaN, 1i, -1, 2, Inf]), 3), single([NaN, 1i, -1, 2, Inf])) %!assert (sort (single([NaN, 1i, -1, 2, Inf]), "ascend"), single([1i, -1, 2, Inf, NaN])) %!assert (sort (single([NaN, 1i, -1, 2, Inf]), 2, "ascend"), single([1i, -1, 2, Inf, NaN])) %!assert (sort (single([NaN, 1i, -1, 2, Inf]), "descend"), single([NaN, Inf, 2, -1, 1i])) @@ -5430,7 +5430,7 @@ %!assert (sort ([true, false, true, false]), [false, false, true, true]) %!assert (sort ([true, false, true, false], 1), [true, false, true, false]) %!assert (sort ([true, false, true, false], 2), [false, false, true, true]) -%!error (sort ([true, false, true, false], 3)) +%!assert (sort ([true, false, true, false], 3), [true, false, true, false]) %!assert (sort ([true, false, true, false], "ascend"), [false, false, true, true]) %!assert (sort ([true, false, true, false], 2, "ascend"), [false, false, true, true]) %!assert (sort ([true, false, true, false], "descend"), [true, true, false, false]) @@ -5446,7 +5446,7 @@ %!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf])), sparse ([-1, 0, 0, 1, 2, Inf, NaN])) %!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), 1), sparse ([0, NaN, 1, 0, -1, 2, Inf])) %!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), 2), sparse ([-1, 0, 0, 1, 2, Inf, NaN])) -%!error (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), 3)) +%!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), 3), sparse ([0, NaN, 1, 0, -1, 2, Inf])) %!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), "ascend"), sparse ([-1, 0, 0, 1, 2, Inf, NaN])) %!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), 2, "ascend"), sparse ([-1, 0, 0, 1, 2, Inf, NaN])) %!assert (sort (sparse ([0, NaN, 1, 0, -1, 2, Inf]), "descend"), sparse ([NaN, Inf, 2, 1, 0, 0, -1])) @@ -5468,7 +5468,7 @@ %!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf])), sparse ([0, 0, 1i, -1, 2, Inf, NaN])) %!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), 1), sparse ([0, NaN, 1i, 0, -1, 2, Inf])) %!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), 2), sparse ([0, 0, 1i, -1, 2, Inf, NaN])) -%!error (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), 3)) +%!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), 3), sparse ([0, NaN, 1i, 0, -1, 2, Inf])) %!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), "ascend"), sparse ([0, 0, 1i, -1, 2, Inf, NaN])) %!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), 2, "ascend"), sparse ([0, 0, 1i, -1, 2, Inf, NaN])) %!assert (sort (sparse ([0, NaN, 1i, 0, -1, 2, Inf]), "descend"), sparse ([NaN, Inf, 2, -1, 1i, 0, 0])) @@ -5491,7 +5491,7 @@ %!assert (sort (sparse ([true, false, true, false])), sparse ([false, false, true, true])) %!assert (sort (sparse([true, false, true, false]), 1), sparse ([true, false, true, false])) %!assert (sort (sparse ([true, false, true, false]), 2), sparse ([false, false, true, true])) -%!error (sort (sparse ([true, false, true, false], 3))) +%!assert (sort (sparse ([true, false, true, false]), 3), sparse ([true, false, true, false])) %!assert (sort (sparse ([true, false, true, false]), "ascend"), sparse([false, false, true, true])) %!assert (sort (sparse ([true, false, true, false]), 2, "ascend"), sparse([false, false, true, true])) %!assert (sort (sparse ([true, false, true, false]), "descend"), sparse ([true, true, false, false])) @@ -5510,7 +5510,7 @@ %!assert (sort (a), b); %!assert (sort (a, 1), a) %!assert (sort (a, 2), b) -%!error (sort (a, 3)) +%!assert (sort (a, 3), a) %!assert (sort (a, "ascend"), b) %!assert (sort (a, 2, "ascend"), b) %!assert (sort (a, "descend"), c)