%ASSERT_EQUAL Compares two matrices and prints an error message if
%necessary
%
%Function compares the first two parameters, which can be any type
%of matrix, vector or scalar of same type and prints the error message in
%the third parameter if they differ too much. An optional fourth parameter
%can be passed which has to be a message which will be printed on success.
%
%synopsis
%  ASSERT_EQUAL(A, B, error)
%  ASSERT_EQUAL(A, B, error, success)
%
%arguments
%  A: correct result
%  B: asserted result
%  error: error message to be shown if A is not equal to B
%  success: (optional) message to be shown if A is equal to B
%
%usage
%  ASSERT_EQUAL(A, B, 'error message')
%
%author
%  saputra@cs.tu-berlin.de

function [] = assert_equal(A, B, error, success)

if max(max(abs(A - B))) > 1e-10
    %keyboard;
    fprintf(['Error: ' error '\n']);
else
    if nargin > 3
        fprintf(['OK: ' success '\n']);
    end
end
