Skip to content

Commit 515573f

Browse files
authored
Merge pull request #34 from ukos-git/fix/null_wave_comparison
Null Wave comparison
2 parents 2bf4653 + 21ffc93 commit 515573f

4 files changed

Lines changed: 17 additions & 7 deletions

File tree

internal_dev/TestWaveType.ipf

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "unit-testing"
55

66
Function run_IGNORE()
7-
RunTest("TestWaveType.ipf", name="Test different Wave Types", testCase="testWaveTypes")
7+
RunTest("TestWaveType.ipf", name="Test different Wave Types", testCase="testWaveTypes;testNullType")
88
End
99

1010
Function testWaveTypes()
@@ -19,10 +19,18 @@ Function testWaveTypes()
1919

2020
Make/O/U/I root:wv2/WAVE=wv2
2121
CHECK_WAVE(wv2, NORMAL_WAVE | NUMERIC_WAVE, minorType = UNSIGNED_WAVE | INT32_WAVE)
22-
CHECK_WAVE(wv2, FREE_WAVE | NUMERIC_WAVE, minorType = UNSIGNED_WAVE | INT32_WAVE) // ! not a free wave
22+
WARN_WAVE(wv2, FREE_WAVE | NUMERIC_WAVE, minorType = UNSIGNED_WAVE | INT32_WAVE) // !fails: not a free wave
2323
End
2424

25-
Function checkWaveType()
25+
Function testNullType()
26+
WAVE/Z wv
27+
REQUIRE_WAVE(wv, NULL_WAVE)
28+
29+
Make/FREE wv
30+
WARN_WAVE(wv, NULL_WAVE) // !fails: not a null wave
31+
End
32+
33+
Function checkWaveType_IGNORE()
2634
WAVE/Z wv
2735
printWaveType(wv)
2836

internal_dev/TestWaveType.pxp

100644100755
-50.8 KB
Binary file not shown.

procedures/unit-testing-comparators.ipf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,15 +480,17 @@ static Function TEST_WAVE_WRAPPER(wv, majorType, flags, [minorType])
480480

481481
type2 = WaveType(wv, 2)
482482
type1 = WaveType(wv, 1)
483-
if(type1 == NULL_WAVE && type2 == NULL_WAVE)
484-
type = NULL_WAVE
485-
endif
486483
if(type1 > 0 && type1 <= 4)
487484
type = type | 2^(type1 - 1)
488485
endif
489486
if(type2 > 0 && type2 <= 2)
490487
type = type | 2^(type2 + 3)
491488
endif
489+
490+
if((type1 == 0 && type2 == 0) || !WaveExists(wv))
491+
type = NULL_WAVE
492+
endif
493+
492494
result = (type & majorType) == majorType
493495

494496
sprintf str, "Assumption that the wave's main type is %d", majorType

procedures/unit-testing-constants.ipf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Constant REQUIRE_MODE = 0x07 // == OUTPUT_MESSAGE | INCREASE_ERROR | ABORT_FUN
3232

3333
/// @addtogroup testWaveFlagsGeneral
3434
///@{
35-
Constant NULL_WAVE = 0x00
35+
Constant NULL_WAVE = 0x1000
3636
///@}
3737

3838
/// @addtogroup testWaveFlagsMinor

0 commit comments

Comments
 (0)