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 if nargin<4,tol=1e-9;end
assertion = size(expected)==size(actual); sameSize = size(expected)==size(actual);
if assertion if all(sameSize)
assertion = all(abs(expected-actual)<tol); equal = abs(expected-actual)<tol;
end if ~all(equal)
if (assertion~=1) warning(['EQUALITY ' name ' fails']);
warning(['EQUALITY ' name ' fails']); expected
expected actual
actual abs(expected-actual)
end
else
warning(['EQUALITY ' name ' fails: non-matching size']);
size(expected)
size(actual)
end end