Skip to content

Commit

Permalink
Tests: Adapt TestEpochRecreationRemoveUnsupportedUserEpochs to use ne…
Browse files Browse the repository at this point in the history
…w functions

- use ConvertListToRegexpWithAlternations and PROP_NOT option of FindIndizes
  • Loading branch information
MichaelHuth committed May 7, 2024
1 parent 28d09b6 commit cf8dbdd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Packages/tests/UTF_HelperFunctions.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -1146,16 +1146,14 @@ static Function TestEpochRecreationRemoveUnsupportedUserEpochs(WAVE/T epochChann
if(type == PSQ_CHIRP)
Concatenate/FREE/T/NP {psqChirpEpochs}, supportedUserEpochs
endif
supportedUserEpochsRegExp = TextWaveToList(supportedUserEpochs, "|")
supportedUserEpochsRegExp = RemoveEnding(supportedUserEpochsRegExp, "|")
supportedUserEpochsRegExp = "^(?![\s\S]*" + supportedUserEpochsRegExp + ")[\s\S]*$"
supportedUserEpochsRegExp = ConvertListToRegexpWithAlternations(RemoveEnding(TextWaveToList(supportedUserEpochs, ";"), ";"), literal = 0)
Make/FREE/T/N=(DimSize(epochChannel, ROWS)) shortnames = EP_GetShortName(epochChannel[p][EPOCH_COL_TAGS])
WAVE/Z userEpochIndices = FindIndizes(shortNames, str = regexpUserEpochs, prop = PROP_GREP)
if(!WaveExists(userEpochIndices))
return NaN
endif
Make/FREE/T/N=(DimSize(userEpochIndices, ROWS)) userEpochShortNames = shortnames[userEpochIndices[p]]
WAVE/Z matches = FindIndizes(userEpochShortNames, str = supportedUserEpochsRegExp, prop = PROP_GREP)
WAVE/Z matches = FindIndizes(userEpochShortNames, str = supportedUserEpochsRegExp, prop = PROP_GREP | PROP_NOT)
if(!WaveExists(matches))
return NaN
endif
Expand Down

0 comments on commit cf8dbdd

Please sign in to comment.