Skip to content

Commit 25be31d

Browse files
authored
Merge pull request #2623 from AllenInstitute/copilot/add-unit-tests-for-utf-utils
Add unit tests for 22 utility functions in UTF_Utils_WaveHandling.ipf
2 parents 9ada449 + ed26a88 commit 25be31d

File tree

2 files changed

+1205
-26
lines changed

2 files changed

+1205
-26
lines changed

Packages/MIES/MIES_Utilities_WaveHandling.ipf

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,13 @@ End
389389
/// @sa AddEntryIntoWaveNoteAsList()
390390
Function HasEntryInWaveNoteList(WAVE wv, string key, string value)
391391

392-
return GrepString(note(wv), "\\Q" + key + "\\E\\s*=\\s*\\Q" + value + "\\E\\s*;")
392+
string wvNote = note(wv)
393+
394+
if(IsEmpty(value))
395+
return GrepString(wvNote, "\\Q" + key + "\\E\\s*;")
396+
endif
397+
398+
return GrepString(wvNote, "\\Q" + key + "\\E\\s*=\\s*\\Q" + value + "\\E\\s*;")
393399
End
394400

395401
/// @brief Returns a wave name not used in the given datafolder
@@ -857,7 +863,7 @@ Function [WAVE/T withSuffix, WAVE/T woSuffix] SplitTextWaveBySuffix(WAVE/T sourc
857863

858864
variable i, numElems
859865

860-
if(IsNull(suffix))
866+
if(IsEmpty(suffix))
861867
Make/FREE/T woSuffix = {""}
862868
return [source, woSuffix]
863869
endif
@@ -1216,12 +1222,16 @@ End
12161222
/// @returns wave reference to the permanent wave
12171223
Function/WAVE ConvertFreeWaveToPermanent(WAVE freeWave, DFREF dfr, string wName)
12181224

1225+
ASSERT(!IsFreeDatafolder(dfr), "dfr must be a global datafolder")
1226+
12191227
Duplicate/O freeWave, dfr:$wName/WAVE=permWave
12201228
return permWave
12211229
End
12221230

12231231
Function/WAVE MoveFreeWaveToPermanent(WAVE freeWave, DFREF dfr, string wvName)
12241232

1233+
ASSERT(!IsFreeDatafolder(dfr), "dfr must be a global datafolder")
1234+
12251235
wvName = UniqueWaveName(dfr, wvName)
12261236
MoveWave freeWave, dfr:$wvName
12271237
WAVE/SDFR=dfr permWave = $wvName

0 commit comments

Comments
 (0)