Skip to content

Commit

Permalink
test(try): improve comparison algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
mfacchinelli committed Jan 14, 2025
1 parent 3162461 commit 6666f6d
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions tests/system/analyze/tIMAPAnalysis.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,28 +68,27 @@ function findDifference(testCase, expected, actual)

if ~isequal(numel(expected), numel(actual))
disp("Wrong size.");
else
elseif ~isequal(expected, actual)

for i = 1:numel(expected)
if istable(expected) || istimetable(expected)
disp(compose("Table property:\n Exp: %s\n Act: %s", expected, actual));
else

if mc.Enumeration
for i = 1:numel(expected)

if ~isequal(expected(i), actual(i))
if mc.Enumeration
disp(compose("Enum property:\n Exp: %s\n Act: %s", expected(i), actual(i)));
end
elseif startsWith(mc.Name, "mag.")
elseif startsWith(mc.Name, "mag.")

for mp = mc.PropertyList'
for mp = mc.PropertyList'

if isequal(mp.GetAccess, "public") && ~isequal(expected(i).(mp.Name), actual(i).(mp.Name))
if isequal(mp.GetAccess, "public") && ~isequal(expected(i).(mp.Name), actual(i).(mp.Name))

disp(compose("Property ""%s"" is different.", mp.Name));
testCase.findDifference(expected(i).(mp.Name), actual(i).(mp.Name));
disp(compose("Property ""%s"" is different.", mp.Name));
testCase.findDifference(expected(i).(mp.Name), actual(i).(mp.Name));
end
end
end
else

if ~isequal(expected(i), actual(i))
else

if isa(expected, "string") || isa(expected, "char")
disp(compose("String property:\n Exp: %s\n Act: %s", expected(i), actual(i)));
Expand Down

0 comments on commit 6666f6d

Please sign in to comment.