From e238d53fd2eda96460738f5797b1a5b6bf5fd345 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 17 Sep 2024 14:38:05 +0200 Subject: [PATCH] SFH_ASSERT: Output error message when debugging tests The INFO function is only available when igortest is included. There are several ways to achieve the validity on compilation: 1. Check if the function exists with #ifdef (as done here) 2. Determining the function dynamically through FUNCREF 3. Conditionally recompile with dynamically added defines 4. Provide a "null" function in MIES with the same signature. Disadvantages: 1. does not scale well, only applies to a single function 2. needs a prototype function in MIES and will fail if function signature changes in igortest 3. Allows larger codeblocks with external functions but does not scale well and rather slow 4. needs like 2 a function with the same signature as in igortest We decided for 1 as it seems to impose the smallest disadvantages --- Packages/MIES/MIES_SweepFormula_Helpers.ipf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Packages/MIES/MIES_SweepFormula_Helpers.ipf b/Packages/MIES/MIES_SweepFormula_Helpers.ipf index da09149428..1832836bf0 100644 --- a/Packages/MIES/MIES_SweepFormula_Helpers.ipf +++ b/Packages/MIES/MIES_SweepFormula_Helpers.ipf @@ -306,7 +306,14 @@ Function SFH_ASSERT(variable condition, string message, [variable jsonId]) endif SVAR error = $GetSweepFormulaParseErrorMessage() error = message + #ifdef AUTOMATED_TESTING_DEBUGGING + +#ifdef AUTOMATED_TESTING +#if exists("INFO") + INFO("SFH_ASSERT: %s", s0 = error) +#endif +#endif Debugger #endif Abort