From af73b54c1b2e425f17e65715a767174ba46606da Mon Sep 17 00:00:00 2001 From: mfacchinelli Date: Tue, 14 Jan 2025 11:24:51 +0000 Subject: [PATCH] test: more diagnostics --- tests/system/analyze/tIMAPAnalysis.m | 33 +++++++++++++++++++++------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/tests/system/analyze/tIMAPAnalysis.m b/tests/system/analyze/tIMAPAnalysis.m index 297102b..2c9ed96 100644 --- a/tests/system/analyze/tIMAPAnalysis.m +++ b/tests/system/analyze/tIMAPAnalysis.m @@ -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