Skip to content

Commit

Permalink
tests/TestOperationRiseTime: Adapt it
Browse files Browse the repository at this point in the history
  • Loading branch information
t-b committed Dec 18, 2024
1 parent 33adb09 commit 0b05e3b
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions Packages/tests/Basic/UTF_SweepFormula_PSX.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -3262,46 +3262,58 @@ static Function TestBlockIndexLogic()
CHECK_EQUAL_TEXTWAVES(dispTracesRef, dispTraces)
End

static Function [variable lowerThreshold, variable upperThreshold] TestRiseTimeContainer(WAVE/WAVE dataWref)
static Function [variable lowerThreshold, variable upperThreshold, variable diffThreshold] TestRiseTimeContainer(WAVE/WAVE dataWref)

CHECK_WAVE(dataWref, WAVE_WAVE)
CHECK_EQUAL_VAR(DimSize(dataWref, ROWS), 1)
WAVE/Z data = dataWref[0]
CHECK_WAVE(data, NUMERIC_WAVE)
CHECK_EQUAL_VAR(DimSize(data, ROWS), 2)
CHECK_EQUAL_VAR(DimSize(data, ROWS), 3)

upperThreshold = data[%$"Upper Threshold"]
CHECK(BetweenZeroAndOneExc(upperThreshold))
lowerThreshold = data[%$"Lower Threshold"]
CHECK(BetweenZeroAndOneExc(lowerThreshold))
diffThreshold = data[%$"Differentiate Threshold"]
CHECK(BetweenZeroAndOneExc(lowerThreshold))

return [lowerThreshold, upperThreshold]
return [lowerThreshold, upperThreshold, diffThreshold]
End

static Function TestOperationRiseTime()

string win, str
variable lowerThreshold, upperThreshold
variable lowerThreshold, upperThreshold, diffThreshold

win = SetupDatabrowserWithSomeData()

str = "psxRiseTime()"
WAVE/WAVE dataWref = SF_ExecuteFormula(str, win, useVariables = 0)
[lowerThreshold, upperThreshold] = TestRiseTimeContainer(dataWref)
[lowerThreshold, upperThreshold, diffThreshold] = TestRiseTimeContainer(dataWref)
CHECK_EQUAL_VAR(lowerThreshold, 0.2)
CHECK_EQUAL_VAR(upperThreshold, 0.8)
CHECK_EQUAL_VAR(diffThreshold, 0.05)

str = "psxRiseTime(10)"
WAVE/WAVE dataWref = SF_ExecuteFormula(str, win, useVariables = 0)
[lowerThreshold, upperThreshold] = TestRiseTimeContainer(dataWref)
[lowerThreshold, upperThreshold, diffThreshold] = TestRiseTimeContainer(dataWref)
CHECK_EQUAL_VAR(lowerThreshold, 0.1)
CHECK_EQUAL_VAR(upperThreshold, 0.8)
CHECK_EQUAL_VAR(diffThreshold, 0.05)

str = "psxRiseTime(10, 90)"
WAVE/WAVE dataWref = SF_ExecuteFormula(str, win, useVariables = 0)
[lowerThreshold, upperThreshold] = TestRiseTimeContainer(dataWref)
[lowerThreshold, upperThreshold, diffThreshold] = TestRiseTimeContainer(dataWref)
CHECK_EQUAL_VAR(lowerThreshold, 0.1)
CHECK_EQUAL_VAR(upperThreshold, 0.9)
CHECK_EQUAL_VAR(diffThreshold, 0.05)

str = "psxRiseTime(10, 90, 45)"
WAVE/WAVE dataWref = SF_ExecuteFormula(str, win, useVariables = 0)
[lowerThreshold, upperThreshold, diffThreshold] = TestRiseTimeContainer(dataWref)
CHECK_EQUAL_VAR(lowerThreshold, 0.1)
CHECK_EQUAL_VAR(upperThreshold, 0.9)
CHECK_EQUAL_VAR(diffThreshold, 0.45)

// checks parameters
try
Expand Down

0 comments on commit 0b05e3b

Please sign in to comment.