Mercurial > octave
changeset 26593:ec3c4f31823b
assert.m: Check sparsity of logical values.
* scripts/testfun/assert.m: Check sparsity of logical values. For example
"assert (sparse (true), true)" is *not* the same. The first argument occupies
25 bytes, while the latter just occupies a single byte.
In Matlab this test would be treated by
"verifyEqual (testCase, sparse (true), true);" which also fails.
Checking for semantic equivalence are done by "isequal (sparse (true), true)",
which is true for Octave and Matlab.
author | Kai T. Ohlhus <k.ohlhus@gmail.com> |
---|---|
date | Tue, 22 Jan 2019 07:27:03 +0100 |
parents | c0fa4a9eef95 |
children | a7d56e0a5c8c |
files | scripts/testfun/assert.m |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/testfun/assert.m Tue Jan 22 07:06:37 2019 +0100 +++ b/scripts/testfun/assert.m Tue Jan 22 07:27:03 2019 +0100 @@ -225,7 +225,7 @@ err.observed{end+1} = "O"; err.expected{end+1} = "E"; err.reason{end+1} = ["Class " class(cond) " != " class(expected)]; - elseif (isnumeric (cond)) + elseif (isnumeric (cond) || islogical (cond)) if (issparse (cond) != issparse (expected)) err.index{end+1} = "()"; err.observed{end+1} = "O";