Skip to content

Commit

Permalink
test: more diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
mfacchinelli committed Jan 14, 2025
1 parent 59e513a commit af73b54
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions tests/system/analyze/tIMAPAnalysis.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,35 @@ function fullAnalysis(testCase)

function findDifference(testCase, expected, actual)

md = metaclass(expected);
mc = metaclass(expected);

for mp = md.PropertyList'

if isequal(mp.GetAccess, "public")
if mc.Enumeration

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

if ~isequal(expected.(mp.Name), actual.(mp.Name))
for mp = mc.PropertyList'

testCase.log(compose("Property ""%s"" is different.", mp.Name));
if isequal(mp.GetAccess, "public") && ~isequal(expected.(mp.Name), actual.(mp.Name))

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

if ~isequal(expected, actual)

if isa(expected, "string") || isa(expected, "char")
disp(compose("String property:\n Exp: %s\n Act: %s"), expected, actual);
elseif isa(expected, "numeric")
disp(compose("Numeric property:\n Exp: %.3g\n Act: %.3g\n Diff: %.3g"), expected(1), actual(1), expected(1) - actual(1));
elseif isa(expected, "logical")
disp(compose("Logical property:\n Exp: %d\n Act: %d"), expected, actual);
elseif isa(expected, "datetime") || isa(expected, "duration")
disp(compose("Date/Time property:\n Exp: %s\n Act: %s\n Diff: %s"), expected(1), actual(1), expected(1) - actual(1));
end
end
end
Expand Down

0 comments on commit af73b54

Please sign in to comment.