diff --git a/Packages/MIES/MIES_SweepFormula_Helpers.ipf b/Packages/MIES/MIES_SweepFormula_Helpers.ipf index a9b1820cf4..57e8a506f3 100644 --- a/Packages/MIES/MIES_SweepFormula_Helpers.ipf +++ b/Packages/MIES/MIES_SweepFormula_Helpers.ipf @@ -38,11 +38,17 @@ End /// Here `numBottles` is argument number 0 and mandatory as `defValue` is not present. /// /// The second argument `size` is optional with 0.5 as default and also defines a list of valid values. -Function SFH_GetArgumentAsNumeric(variable jsonId, string jsonPath, string graph, string opShort, variable argNum, [variable defValue, WAVE/Z allowedValues, FUNCREF SFH_NumericChecker_Prototype checkFunc]) +Function SFH_GetArgumentAsNumeric(variable jsonId, string jsonPath, string graph, string opShort, variable argNum, [variable defValue, WAVE/Z allowedValues, FUNCREF SFH_NumericChecker_Prototype checkFunc, variable checkDefault]) string msg, sep, allowedValuesAsStr variable checkExist, numArgs, result, idx, ret + if(ParamIsDefault(checkDefault)) + checkDefault = 1 + else + checkDefault = !!checkDefault + endif + if(ParamIsDefault(defValue)) checkExist = 1 else @@ -68,6 +74,10 @@ Function SFH_GetArgumentAsNumeric(variable jsonId, string jsonPath, string graph SFH_ASSERT(!checkExist, msg) result = defValue + + if(!checkDefault) + return result + endif endif if(!ParamIsDefault(allowedValues)) @@ -112,11 +122,17 @@ End /// The second argument `type` is optional with `steam train` as default and a list of allowed values. /// /// The text argument can be abbreviated as long as it is unique, the unabbreviated result is returned in all cases. -Function/S SFH_GetArgumentAsText(variable jsonId, string jsonPath, string graph, string opShort, variable argNum, [string defValue, WAVE/T/Z allowedValues, FUNCREF SFH_StringChecker_Prototype checkFunc]) +Function/S SFH_GetArgumentAsText(variable jsonId, string jsonPath, string graph, string opShort, variable argNum, [string defValue, WAVE/T/Z allowedValues, FUNCREF SFH_StringChecker_Prototype checkFunc, variable checkDefault]) string msg, result, sep, allowedValuesAsStr variable checkExist, numArgs, idx, ret + if(ParamIsDefault(checkDefault)) + checkDefault = 1 + else + checkDefault = !!checkDefault + endif + if(ParamIsDefault(defValue)) checkExist = 1 else @@ -150,6 +166,10 @@ Function/S SFH_GetArgumentAsText(variable jsonId, string jsonPath, string graph, SFH_ASSERT(!checkExist, msg) result = defValue + + if(!checkDefault) + return result + endif endif if(!ParamIsDefault(allowedValues)) diff --git a/Packages/MIES/MIES_SweepFormula_PSX.ipf b/Packages/MIES/MIES_SweepFormula_PSX.ipf index e758c6e2f9..ca9b6a5c65 100644 --- a/Packages/MIES/MIES_SweepFormula_PSX.ipf +++ b/Packages/MIES/MIES_SweepFormula_PSX.ipf @@ -406,11 +406,11 @@ end /// - deconvolution /// - histogram of deconvolution /// - gaussian fit of histogram -static Function [WAVE sweepDataFiltOff, WAVE sweepDataFiltOffDeconv] PSX_Analysis(WAVE sweepData, WAVE psxKernelFFT, variable filterLow, variable filterHigh) +static Function [WAVE sweepDataFiltOff, WAVE sweepDataFiltOffDeconv] PSX_Analysis(WAVE sweepData, WAVE psxKernelFFT, variable sweepFilterLow, variable sweepFilterHigh) variable offset - WAVE sweepDataFilt = PSX_FilterSweepData(sweepData, filterLow, filterHigh) + WAVE sweepDataFilt = PSX_FilterSweepData(sweepData, sweepFilterLow, sweepFilterHigh) WAVE/ZZ sweepDataFiltOff [sweepDataFiltOff, offset] = PSX_OffsetSweepData(sweepDataFilt) @@ -696,7 +696,7 @@ static Function/WAVE PSX_CreateOverrideResults(variable numEvents, WAVE/T combos return wv End -static Function PSX_OperationSweepGathering(string graph, WAVE/WAVE psxKernelDataset, variable parameterJsonID, variable filterLow, variable filterHigh, variable index, WAVE/WAVE output) +static Function PSX_OperationSweepGathering(string graph, WAVE/WAVE psxKernelDataset, variable parameterJsonID, variable sweepFilterLow, variable sweepFilterHigh, variable index, WAVE/WAVE output) string key, comboKey, psxParametersAnalyzePeaks, cacheKey @@ -717,7 +717,7 @@ static Function PSX_OperationSweepGathering(string graph, WAVE/WAVE psxKernelDat WAVE sweepDataFiltOff = psxAnalyzePeaksFromCache[%sweepDataFiltOff] WAVE sweepDataFiltOffDeconv = psxAnalyzePeaksFromCache[%sweepDataFiltOffDeconv] else - [WAVE sweepDataFiltOff, WAVE sweepDataFiltOffDeconv] = PSX_Analysis(sweepData, psxKernelFFT, filterLow, filterHigh) + [WAVE sweepDataFiltOff, WAVE sweepDataFiltOffDeconv] = PSX_Analysis(sweepData, psxKernelFFT, sweepFilterLow, sweepFilterHigh) Make/FREE/WAVE/N=(2) psxAnalyzePeaks SetDimensionLabels(psxAnalyzePeaks, "sweepDataFiltOff;sweepDataFiltOffDeconv", ROWS) @@ -4090,7 +4090,7 @@ End // ... Function/WAVE PSX_Operation(variable jsonId, string jsonPath, string graph) - variable numberOfSDs, filterLow, filterHigh, parameterJsonID, numCombos, i, addedData, kernelAmp + variable numberOfSDs, sweepFilterLow, sweepFilterHigh, parameterJsonID, numCombos, i, addedData, kernelAmp variable maxTauFactor, peakThresh string parameterPath, id, psxParameters, dataUnit @@ -4100,8 +4100,8 @@ Function/WAVE PSX_Operation(variable jsonId, string jsonPath, string graph) try numberOfSDs = SFH_GetArgumentAsNumeric(jsonID, jsonPath, graph, SF_OP_PSX, 2, defValue = PSX_NUMBER_OF_SDS_DEFAULT, checkFunc = IsStrictlyPositiveAndFinite) - filterLow = SFH_GetArgumentAsNumeric(jsonID, jsonPath, graph, SF_OP_PSX, 3, defValue = PSX_DEFAULT_FILTER_LOW) - filterHigh = SFH_GetArgumentAsNumeric(jsonID, jsonPath, graph, SF_OP_PSX, 4, defValue = PSX_DEFAULT_FILTER_HIGH) + sweepFilterLow = SFH_GetArgumentAsNumeric(jsonID, jsonPath, graph, SF_OP_PSX, 3, defValue = PSX_DEFAULT_FILTER_LOW) + sweepFilterHigh = SFH_GetArgumentAsNumeric(jsonID, jsonPath, graph, SF_OP_PSX, 4, defValue = PSX_DEFAULT_FILTER_HIGH) maxTauFactor = SFH_GetArgumentAsNumeric(jsonID, jsonPath, graph, SF_OP_PSX, 5, defValue = PSX_DEFAULT_MAX_TAU_FACTOR, checkFunc = IsStrictlyPositiveAndFinite) WAVE riseTime = SFH_GetArgumentAsWave(jsonID, jsonPath, graph, SF_OP_PSX, 6, defOp = "psxRiseTime()", singleResult = 1) ASSERT(IsNumericWave(riseTime), "Invalid return from psxRiseTime") @@ -4111,8 +4111,8 @@ Function/WAVE PSX_Operation(variable jsonId, string jsonPath, string graph) JSON_AddTreeObject(parameterJsonID, parameterPath) JSON_AddString(parameterJsonID, parameterPath + "/id", id) JSON_AddVariable(parameterJsonID, parameterPath + "/numberOfSDs", numberOfSDs) - JSON_AddVariable(parameterJsonID, parameterPath + "/filterLow", filterLow) - JSON_AddVariable(parameterJsonID, parameterPath + "/filterHigh", filterHigh) + JSON_AddVariable(parameterJsonID, parameterPath + "/sweepFilterLow", sweepFilterLow) + JSON_AddVariable(parameterJsonID, parameterPath + "/sweepFilterHigh", sweepFilterHigh) JSON_AddVariable(parameterJsonID, parameterPath + "/maxTauFactor", maxTauFactor) parameterPath = SF_META_USER_GROUP + PSX_JWN_PARAMETERS + "/" + SF_OP_PSX_RISETIME JSON_AddTreeObject(parameterJsonID, parameterPath) @@ -4138,7 +4138,7 @@ Function/WAVE PSX_Operation(variable jsonId, string jsonPath, string graph) endfor for(i = 0; i < numCombos; i += 1) - PSX_OperationSweepGathering(graph, psxKernelDataset, parameterJsonID, filterLow, filterHigh, i, output) + PSX_OperationSweepGathering(graph, psxKernelDataset, parameterJsonID, sweepFilterLow, sweepFilterHigh, i, output) endfor [WAVE hist, WAVE fit, peakThresh, dataUnit] = PSX_CalculatePeakThreshold(output, numCombos, numberOfSDs) diff --git a/Packages/MIES/MIES_Utilities.ipf b/Packages/MIES/MIES_Utilities.ipf index f8e2e26370..4ea5fb1e01 100644 --- a/Packages/MIES/MIES_Utilities.ipf +++ b/Packages/MIES/MIES_Utilities.ipf @@ -3424,35 +3424,6 @@ Function/WAVE ExtractFromSubrange(listOfRanges, dim) return ranges End -/// @brief Check if a name for an object adheres to the strict naming rules -/// -/// @see `DisplayHelpTopic "Standard Object Names"` -/// -/// UTF_NOINSTRUMENTATION -threadsafe Function IsValidObjectName(string name) - return NameChecker(name, 0) -End - -/// UTF_NOINSTRUMENTATION -threadsafe Function IsStrictlyPositiveAndFinite(variable var) - - return var > 0 && var < inf -End - -/// @brief Check if a name for an object adheres to the liberal naming rules -/// -/// @see `DisplayHelpTopic "Liberal Object Names"` -/// -/// UTF_NOINSTRUMENTATION -threadsafe Function IsValidLiberalObjectName(string name) - return NameChecker(name, 1) -End - -/// UTF_NOINSTRUMENTATION -threadsafe static Function NameChecker(string name, variable liberal) - return !cmpstr(name, CleanupName(name, !!liberal, MAX_OBJECT_NAME_LENGTH_IN_BYTES)) -End - /// @brief Find an integer `x` which is larger than `a` but the /// smallest possible power of `p`. /// @@ -6770,26 +6741,6 @@ Function GetDayOfWeek(variable seconds) return str2num(dayOfWeek) End -/// @brief Return the truth if `val` is in the range `]0, 1[` -threadsafe Function BetweenZeroAndOneExc(variable val) - return val > 0.0 && val < 1.0 -End - -/// @brief Return the truth if `val` is in the range `[0, 1]` -threadsafe Function BetweenZeroAndOne(variable val) - return val >= 0.0 && val <= 1.0 -End - -/// @brief Return the truth if `val` is in the range `]0, 100[` -threadsafe Function BetweenZeroAndOneHoundredExc(variable val) - return val > 0.0 && val < 100.0 -End - -/// @brief Return the truth if `val` is in the range `[0, 100]` -threadsafe Function BetweenZeroAndOneHoundred(variable val) - return val >= 0.0 && val <= 100.0 -End - /// @brief Upper case the first character in an ASCII string threadsafe Function/S UpperCaseFirstChar(string str) diff --git a/Packages/MIES/MIES_Utilities_Checks.ipf b/Packages/MIES/MIES_Utilities_Checks.ipf new file mode 100644 index 0000000000..e890997041 --- /dev/null +++ b/Packages/MIES/MIES_Utilities_Checks.ipf @@ -0,0 +1,73 @@ +#pragma TextEncoding = "UTF-8" +#pragma rtGlobals=3 // Use modern global access method and strict wave access. +#pragma rtFunctionErrors=1 + +#ifdef AUTOMATED_TESTING +#pragma ModuleName=MIES_Checks +#endif + +/// @file MIES_Utilities_Checks.ipf +/// @brief Threadsafe check functions which comply with either SFH_NumericChecker_Prototype or SFH_StringChecker_Prototype + +/// @brief Check if a name for an object adheres to the strict naming rules +/// +/// @see `DisplayHelpTopic "Standard Object Names"` +/// +/// UTF_NOINSTRUMENTATION +threadsafe Function IsValidObjectName(string name) + return NameChecker(name, 0) +End + +/// @brief Check if a name for an object adheres to the liberal naming rules +/// +/// @see `DisplayHelpTopic "Liberal Object Names"` +/// +/// UTF_NOINSTRUMENTATION +threadsafe Function IsValidLiberalObjectName(string name) + return NameChecker(name, 1) +End + +/// UTF_NOINSTRUMENTATION +threadsafe static Function NameChecker(string name, variable liberal) + return !cmpstr(name, CleanupName(name, !!liberal, MAX_OBJECT_NAME_LENGTH_IN_BYTES)) +End + +/// UTF_NOINSTRUMENTATION +threadsafe Function IsStrictlyPositiveAndFinite(variable var) + + return var > 0 && var < inf +End + +/// UTF_NOINSTRUMENTATION +threadsafe Function IsNullOrPositiveAndFinite(variable var) + + return var >= 0 && var < inf +End + +/// @brief Return the truth if `val` is in the range `]0, 1[` +/// +/// UTF_NOINSTRUMENTATION +threadsafe Function BetweenZeroAndOneExc(variable val) + return val > 0.0 && val < 1.0 +End + +/// @brief Return the truth if `val` is in the range `[0, 1]` +/// +/// UTF_NOINSTRUMENTATION +threadsafe Function BetweenZeroAndOne(variable val) + return val >= 0.0 && val <= 1.0 +End + +/// @brief Return the truth if `val` is in the range `]0, 100[` +/// +/// UTF_NOINSTRUMENTATION +threadsafe Function BetweenZeroAndOneHoundredExc(variable val) + return val > 0.0 && val < 100.0 +End + +/// @brief Return the truth if `val` is in the range `[0, 100]` +/// +/// UTF_NOINSTRUMENTATION +threadsafe Function BetweenZeroAndOneHoundred(variable val) + return val >= 0.0 && val <= 100.0 +End diff --git a/Packages/MIES_Include.ipf b/Packages/MIES_Include.ipf index c053768bae..6b616d7f0d 100644 --- a/Packages/MIES_Include.ipf +++ b/Packages/MIES_Include.ipf @@ -234,6 +234,7 @@ End #include "MIES_TestPulse_Multi" #include "MIES_TraceUserData" #include "MIES_Utilities" +#include "MIES_Utilities_Checks" #include "MIES_WaveBuilder" #include "MIES_WaveBuilderPanel" #include "MIES_WaveBuilder_Macro" diff --git a/Packages/tests/Basic/UTF_Basic.ipf b/Packages/tests/Basic/UTF_Basic.ipf index a3577379b7..6fa7f9074e 100644 --- a/Packages/tests/Basic/UTF_Basic.ipf +++ b/Packages/tests/Basic/UTF_Basic.ipf @@ -26,6 +26,7 @@ #include "UTF_UpgradeDataFolderLocation" #include "UTF_UpgradeWaveLocationAndGetIt" #include "UTF_Utils" +#include "UTF_UtilsChecks" #include "UTF_WaveAveraging" #include "UTF_WaveBuilder" #include "UTF_WaveBuilderRegression" @@ -115,6 +116,7 @@ Function RunWithOpts([string testcase, string testsuite, variable allowdebug, va list = AddListItem("UTF_UpgradeDataFolderLocation.ipf", list, ";", inf) list = AddListItem("UTF_UpgradeWaveLocationAndGetIt.ipf", list, ";", inf) list = AddListItem("UTF_Utils.ipf", list, ";", inf) + list = AddListItem("UTF_UtilsChecks.ipf", list, ";", inf) list = AddListItem("UTF_WaveAveraging.ipf", list, ";", inf) list = AddListItem("UTF_WaveBuilder.ipf", list, ";", inf) list = AddListItem("UTF_WaveBuilderRegression.ipf", list, ";", inf) diff --git a/Packages/tests/Basic/UTF_Utils.ipf b/Packages/tests/Basic/UTF_Utils.ipf index d54eef2d45..6ef3190dec 100644 --- a/Packages/tests/Basic/UTF_Utils.ipf +++ b/Packages/tests/Basic/UTF_Utils.ipf @@ -3690,17 +3690,6 @@ Function FLW_RequiresNumericWave() endtry End -Function/WAVE InfiniteValues() - - Make/FREE wv = {NaN, Inf, -Inf} - - SetDimLabel ROWS, 0, $"NaN", wv - SetDimLabel ROWS, 1, $"Inf", wv - SetDimLabel ROWS, 2, $"-Inf", wv - - return wv -End - // UTF_TD_GENERATOR InfiniteValues Function FLW_RequiresFiniteLevel([var]) variable var @@ -7142,58 +7131,6 @@ static Function GetDayOfWeekTest() endtry End -static Function BetweenZeroAndOneX() - - FUNCREF SFH_NumericChecker_Prototype f = BetweenZeroAndOne - CHECK(FuncRefIsAssigned(FuncRefInfo(f))) - - CHECK_EQUAL_VAR(BetweenZeroAndOne(-2.0), 0) - CHECK_EQUAL_VAR(BetweenZeroAndOne(0.0), 1) - CHECK_EQUAL_VAR(BetweenZeroAndOneExc(0 + 1e-15), 1) - CHECK_EQUAL_VAR(BetweenZeroAndOne(0.1), 1) - CHECK_EQUAL_VAR(BetweenZeroAndOneExc(1.0 - 1e-14), 1) - CHECK_EQUAL_VAR(BetweenZeroAndOne(1.0), 1) - CHECK_EQUAL_VAR(BetweenZeroAndOne(2.0), 0) - - FUNCREF SFH_NumericChecker_Prototype f = BetweenZeroAndOneExc - CHECK(FuncRefIsAssigned(FuncRefInfo(f))) - - // excluding the borders - CHECK_EQUAL_VAR(BetweenZeroAndOneExc(-2.0), 0) - CHECK_EQUAL_VAR(BetweenZeroAndOneExc(0), 0) - CHECK_EQUAL_VAR(BetweenZeroAndOneExc(0 + 1e-15), 1) - CHECK_EQUAL_VAR(BetweenZeroAndOneExc(0.1), 1) - CHECK_EQUAL_VAR(BetweenZeroAndOneExc(1.0 - 1e-14), 1) - CHECK_EQUAL_VAR(BetweenZeroAndOneExc(1.0), 0) - CHECK_EQUAL_VAR(BetweenZeroAndOneExc(2.0), 0) -End - -static Function BetweenZeroAndOneHoundredX() - - FUNCREF SFH_NumericChecker_Prototype f = BetweenZeroAndOneHoundred - CHECK(FuncRefIsAssigned(FuncRefInfo(f))) - - CHECK_EQUAL_VAR(BetweenZeroAndOneHoundred(-2.0), 0) - CHECK_EQUAL_VAR(BetweenZeroAndOneHoundred(0.0), 1) - CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(0 + 1e-15), 1) - CHECK_EQUAL_VAR(BetweenZeroAndOneHoundred(0.1), 1) - CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(100.0 - 1e-14), 1) - CHECK_EQUAL_VAR(BetweenZeroAndOneHoundred(1.0), 1) - CHECK_EQUAL_VAR(BetweenZeroAndOneHoundred(102.0), 0) - - FUNCREF SFH_NumericChecker_Prototype f = BetweenZeroAndOneHoundredExc - CHECK(FuncRefIsAssigned(FuncRefInfo(f))) - - // excluding the borders - CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(-2.0), 0) - CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(0), 0) - CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(0 + 1e-15), 1) - CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(0.1), 1) - CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(100.0 - 1e-14), 1) - CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(100.0), 0) - CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(102.0), 0) -End - static Function TestUpperCaseFirstChar() string ret = UpperCaseFirstChar("") diff --git a/Packages/tests/Basic/UTF_UtilsChecks.ipf b/Packages/tests/Basic/UTF_UtilsChecks.ipf new file mode 100644 index 0000000000..6eecc2a534 --- /dev/null +++ b/Packages/tests/Basic/UTF_UtilsChecks.ipf @@ -0,0 +1,82 @@ +#pragma TextEncoding = "UTF-8" +#pragma rtGlobals=3 // Use modern global access method and strict wave access. +#pragma rtFunctionErrors=1 +#pragma ModuleName=UtilsChecksTest + +static Function BetweenZeroAndOneX() + + FUNCREF SFH_NumericChecker_Prototype f = BetweenZeroAndOne + CHECK(FuncRefIsAssigned(FuncRefInfo(f))) + + CHECK_EQUAL_VAR(BetweenZeroAndOne(-2.0), 0) + CHECK_EQUAL_VAR(BetweenZeroAndOne(0.0), 1) + CHECK_EQUAL_VAR(BetweenZeroAndOneExc(0 + 1e-15), 1) + CHECK_EQUAL_VAR(BetweenZeroAndOne(0.1), 1) + CHECK_EQUAL_VAR(BetweenZeroAndOneExc(1.0 - 1e-14), 1) + CHECK_EQUAL_VAR(BetweenZeroAndOne(1.0), 1) + CHECK_EQUAL_VAR(BetweenZeroAndOne(2.0), 0) + + FUNCREF SFH_NumericChecker_Prototype f = BetweenZeroAndOneExc + CHECK(FuncRefIsAssigned(FuncRefInfo(f))) + + // excluding the borders + CHECK_EQUAL_VAR(BetweenZeroAndOneExc(-2.0), 0) + CHECK_EQUAL_VAR(BetweenZeroAndOneExc(0), 0) + CHECK_EQUAL_VAR(BetweenZeroAndOneExc(0 + 1e-15), 1) + CHECK_EQUAL_VAR(BetweenZeroAndOneExc(0.1), 1) + CHECK_EQUAL_VAR(BetweenZeroAndOneExc(1.0 - 1e-14), 1) + CHECK_EQUAL_VAR(BetweenZeroAndOneExc(1.0), 0) + CHECK_EQUAL_VAR(BetweenZeroAndOneExc(2.0), 0) +End + +static Function BetweenZeroAndOneHoundredX() + + FUNCREF SFH_NumericChecker_Prototype f = BetweenZeroAndOneHoundred + CHECK(FuncRefIsAssigned(FuncRefInfo(f))) + + CHECK_EQUAL_VAR(BetweenZeroAndOneHoundred(-2.0), 0) + CHECK_EQUAL_VAR(BetweenZeroAndOneHoundred(0.0), 1) + CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(0 + 1e-15), 1) + CHECK_EQUAL_VAR(BetweenZeroAndOneHoundred(0.1), 1) + CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(100.0 - 1e-14), 1) + CHECK_EQUAL_VAR(BetweenZeroAndOneHoundred(1.0), 1) + CHECK_EQUAL_VAR(BetweenZeroAndOneHoundred(102.0), 0) + + FUNCREF SFH_NumericChecker_Prototype f = BetweenZeroAndOneHoundredExc + CHECK(FuncRefIsAssigned(FuncRefInfo(f))) + + // excluding the borders + CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(-2.0), 0) + CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(0), 0) + CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(0 + 1e-15), 1) + CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(0.1), 1) + CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(100.0 - 1e-14), 1) + CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(100.0), 0) + CHECK_EQUAL_VAR(BetweenZeroAndOneHoundredExc(102.0), 0) +End + +static Function TestIsStrictlyPositiveAndFinite() + + CHECK(IsStrictlyPositiveAndFinite(1)) + CHECK(!IsStrictlyPositiveAndFinite(0)) + CHECK(!IsStrictlyPositiveAndFinite(-1)) +End + +// UTF_TD_GENERATOR InfiniteValues +static Function TestIsStrictlyPositiveAndFiniteInfinite([variable var]) + + CHECK(!IsStrictlyPositiveAndFinite(var)) +End + +static Function TestIsNullOrPositiveAndFinite() + + CHECK(IsNullOrPositiveAndFinite(1)) + CHECK(IsNullOrPositiveAndFinite(0)) + CHECK(!IsNullOrPositiveAndFinite(-1)) +End + +// UTF_TD_GENERATOR InfiniteValues +static Function TestIsNullOrPositiveAndFiniteInfinite([variable var]) + + CHECK(!IsNullOrPositiveAndFinite(var)) +End diff --git a/Packages/tests/UTF_DataGenerators.ipf b/Packages/tests/UTF_DataGenerators.ipf index b40f1b9bf7..69fff5cccc 100644 --- a/Packages/tests/UTF_DataGenerators.ipf +++ b/Packages/tests/UTF_DataGenerators.ipf @@ -283,3 +283,14 @@ static Function/WAVE EpochTestTTL_OD_Gen() return w End + +Function/WAVE InfiniteValues() + + Make/FREE wv = {NaN, Inf, -Inf} + + SetDimLabel ROWS, 0, $"NaN", wv + SetDimLabel ROWS, 1, $"Inf", wv + SetDimLabel ROWS, 2, $"-Inf", wv + + return wv +End