Fixed EQUALITY to deal with incorrect size

release/4.3a0
Frank Dellaert 2012-06-21 15:56:22 +00:00
parent 282dc6d788
commit 2db389b8cb
1 changed files with 13 additions and 8 deletions

View File

@ -3,12 +3,17 @@ function EQUALITY(name,expected,actual,tol)
if nargin<4,tol=1e-9;end
assertion = size(expected)==size(actual);
if assertion
assertion = all(abs(expected-actual)<tol);
end
if (assertion~=1)
sameSize = size(expected)==size(actual);
if all(sameSize)
equal = abs(expected-actual)<tol;
if ~all(equal)
warning(['EQUALITY ' name ' fails']);
expected
actual
abs(expected-actual)
end
else
warning(['EQUALITY ' name ' fails: non-matching size']);
size(expected)
size(actual)
end