Assertions¶
-
variable CHECK(variable var)¶
Tests if var is non-zero and not “Not a Number” (NaN).
- Parameters
var – variable to test
-
variable CHECK_CLOSE_CMPLX(variable/c var1, variable/c var2, variable tol = defaultValue, variable strong = defaultValue)¶
Compares two variables and determines if they are close.
Based on the implementation of “Floating-point comparison algorithms” in the C++ Boost unit testing framework.
Literature:
The art of computer programming (Vol II). Donald. E. Knuth. 0-201-89684-2. Addison-Wesley Professional; 3 edition, page 234 equation (34) and (35).
Variant for complex numbers.
- Parameters
var1 – first variable
var2 – second variable
tol – (optional) tolerance, defaults to 1e-8
strong – (optional) type of condition, can be 0 for weak or 1 for strong (default)
-
variable CHECK_CLOSE_INT64(int64 var1, int64 var2, int64 tol = defaultValue)¶
Compares two int64 and determines if they are close.
- Parameters
var1 – first int64 variable
var2 – second int64 variable
tol – (optional) int64 tolerance, defaults to 16
-
variable CHECK_CLOSE_UINT64(uint64 var1, uint64 var2, uint64 tol = defaultValue)¶
Compares two uint64 and determines if they are close.
- Parameters
var1 – first uint64 variable
var2 – second uint64 variable
tol – (optional) uint64 tolerance, defaults to 16
-
variable CHECK_CLOSE_VAR(variable var1, variable var2, variable tol = defaultValue, variable strong = defaultValue)¶
Compares two variables and determines if they are close.
Based on the implementation of “Floating-point comparison algorithms” in the C++ Boost unit testing framework.
Literature:
The art of computer programming (Vol II). Donald. E. Knuth. 0-201-89684-2. Addison-Wesley Professional; 3 edition, page 234 equation (34) and (35).
- Parameters
var1 – first variable
var2 – second variable
tol – (optional) tolerance, defaults to 1e-8
strong – (optional) type of condition, can be 0 for weak or 1 for strong (default)
-
variable CHECK_EMPTY_FOLDER()¶
Tests if the current data folder is empty.
Counted are objects with type waves, strings, variables and folders
-
variable CHECK_EMPTY_STR(string *str)¶
Tests if str is empty.
A null string is never empty.
- Parameters
str – string to test
-
variable CHECK_EQUAL_INT64(int64 var1, int64 var2)¶
Tests two int64 for equality.
- Parameters
var1 – first variable
var2 – second variable
-
variable CHECK_EQUAL_STR(string *str1, string *str2, variable case_sensitive = defaultValue)¶
Compares two strings for byte-wise equality. (no encoding considered, no unicode normalization)
- Parameters
str1 – first string
str2 – second string
case_sensitive – (optional) should the comparison be done case sensitive (1) or case insensitive (1, the default)
-
variable CHECK_EQUAL_TEXTWAVES(WaveText wv1, WaveText wv2, variable mode = defaultValue)¶
Tests two text waves for equality.
- Parameters
wv1 – first text wave, can be invalid for Igor Pro 7 or later
wv2 – second text wave, can be invalid for Igor Pro 7 or later
mode – (optional) features of the waves to compare, defaults to all modes, defined at EqualWaveFlags
-
variable CHECK_EQUAL_UINT64(uint64 var1, uint64 var2)¶
Tests two uint64 for equality.
- Parameters
var1 – first variable
var2 – second variable
-
variable CHECK_EQUAL_VAR(variable var1, variable var2)¶
Tests two variables for equality.
For variables holding floating point values it is often more desirable use CHECK_CLOSE_VAR instead. To fullfill semantic correctness this assertion treats two variables with both holding NaN as equal.
- Parameters
var1 – first variable
var2 – second variable
-
variable CHECK_EQUAL_WAVES(WaveOrNull wv1, WaveOrNull wv2, variable mode = defaultValue, variable tol = defaultValue)¶
Tests two waves for equality. If one wave has a zero size and the other one does not then properties like DIMENSION_UNITS are compared to unequal as a property for a non-existing dimension is always unequal to a property of an existing dimension. This function won’t throw an assert if both waves have the same reference, because they are considered as equal.
- Parameters
wv1 – first wave
wv2 – second wave
mode – (optional) features of the waves to compare, defaults to all modes, defined at EqualWaveFlags
tol – (optional) tolerance for comparison, by default 0.0 which does byte-by-byte comparison (relevant only for mode=WAVE_DATA)
-
variable CHECK_GE_VAR(variable var1, variable var2)¶
Tests that var1 is greather or equal than var2.
- Parameters
var1 – first variable
var2 – second variable
-
variable CHECK_GT_VAR(variable var1, variable var2)¶
Tests that var1 is greather than var2.
- Parameters
var1 – first variable
var2 – second variable
-
variable CHECK_LE_VAR(variable var1, variable var2)¶
Tests that var1 is less or equal than var2.
- Parameters
var1 – first variable
var2 – second variable
-
variable CHECK_LT_VAR(variable var1, variable var2)¶
Tests that var1 is less than var2.
- Parameters
var1 – first variable
var2 – second variable
-
variable CHECK_NEQ_INT64(int64 var1, int64 var2)¶
Tests two int64 for unequality.
- Parameters
var1 – first variable
var2 – second variable
-
variable CHECK_NEQ_STR(string *str1, string *str2, variable case_sensitive = defaultValue)¶
Compares two strings for unequality.
- Parameters
str1 – first string
str2 – second string
case_sensitive – (optional) should the comparison be done case sensitive (1) or case insensitive (0, the default)
-
variable CHECK_NEQ_UINT64(uint64 var1, uint64 var2)¶
Tests two uint64 for unequality.
- Parameters
var1 – first variable
var2 – second variable
-
variable CHECK_NEQ_VAR(variable var1, variable var2)¶
Tests two variables for inequality.
- Parameters
var1 – first variable
var2 – second variable
-
variable CHECK_NON_EMPTY_STR(string *str)¶
Tests if str is not empty.
A null string is a non empty string too.
- Parameters
str – string to test
-
variable CHECK_NON_NULL_STR(string *str)¶
Tests if str is not null.
An empty string is always non null.
- Parameters
str – string to test
-
variable CHECK_NULL_STR(string *str)¶
Tests if str is null.
An empty string is never null.
- Parameters
str – string to test
-
variable CHECK_PROPER_STR(string *str)¶
Tests if str is a “proper” string, i.e. a string with a length larger than zero.
Neither null strings nor empty strings are proper strings.
- Parameters
str – string to test
-
variable CHECK_SMALL_CMPLX(variable/c var, variable tol = defaultValue)¶
Tests if a variable is small using the inequality \( | var | < | tol | \).
Variant for complex numbers
- Parameters
var – variable
tol – (optional) tolerance, defaults to 1e-8
-
variable CHECK_SMALL_INT64(int64 var, int64 tol = defaultValue)¶
Tests if a int64 variable is small using the inequality \( | var | < | tol | \).
- Parameters
var – int64 variable
tol – (optional) int64 tolerance, defaults to 16
-
variable CHECK_SMALL_UINT64(uint64 var, uint64 tol = defaultValue)¶
Tests if a uint64 variable is small using the inequality \( var < tol \).
- Parameters
var – uint64 variable
tol – (optional) uint64 tolerance, defaults to 16
-
variable CHECK_SMALL_VAR(variable var, variable tol = defaultValue)¶
Tests if a variable is small using the inequality \( | var | < | tol | \).
- Parameters
var – variable
tol – (optional) tolerance, defaults to 1e-8
-
variable CHECK_WAVE(WaveOrNull wv, variable majorType, variable minorType = defaultValue)¶
Tests a wave for existence and its type.
See also
testWaveFlags
- Parameters
wv – wave reference
majorType – major wave type
minorType – (optional) minor wave type
-
variable FAIL()¶
Force the test case to fail.
-
variable INFO(string format, WaveText s = defaultValue, wave n = defaultValue, string s0 = defaultValue, string s1 = defaultValue, string s2 = defaultValue, string s3 = defaultValue, string s4 = defaultValue, variable n0 = defaultValue, variable n1 = defaultValue, variable n2 = defaultValue, variable n3 = defaultValue, variable n4 = defaultValue)¶
Append information to the next assertion to print if failed.
-
variable PASS()¶
Increase the assertion counter only.
-
variable REQUIRE(variable var)¶
Tests if var is non-zero and not “Not a Number” (NaN).
- Parameters
var – variable to test
-
variable REQUIRE_CLOSE_CMPLX(variable/c var1, variable/c var2, variable tol = defaultValue, variable strong = defaultValue)¶
Compares two variables and determines if they are close.
Based on the implementation of “Floating-point comparison algorithms” in the C++ Boost unit testing framework.
Literature:
The art of computer programming (Vol II). Donald. E. Knuth. 0-201-89684-2. Addison-Wesley Professional; 3 edition, page 234 equation (34) and (35).
Variant for complex numbers.
- Parameters
var1 – first variable
var2 – second variable
tol – (optional) tolerance, defaults to 1e-8
strong – (optional) type of condition, can be 0 for weak or 1 for strong (default)
-
variable REQUIRE_CLOSE_INT64(int64 var1, int64 var2, int64 tol = defaultValue)¶
Compares two int64 and determines if they are close.
- Parameters
var1 – first int64 variable
var2 – second int64 variable
tol – (optional) int64 tolerance, defaults to 16
-
variable REQUIRE_CLOSE_UINT64(uint64 var1, uint64 var2, uint64 tol = defaultValue)¶
Compares two uint64 and determines if they are close.
- Parameters
var1 – first uint64 variable
var2 – second uint64 variable
tol – (optional) uint64 tolerance, defaults to 16
-
variable REQUIRE_CLOSE_VAR(variable var1, variable var2, variable tol = defaultValue, variable strong = defaultValue)¶
Compares two variables and determines if they are close.
Based on the implementation of “Floating-point comparison algorithms” in the C++ Boost unit testing framework.
Literature:
The art of computer programming (Vol II). Donald. E. Knuth. 0-201-89684-2. Addison-Wesley Professional; 3 edition, page 234 equation (34) and (35).
- Parameters
var1 – first variable
var2 – second variable
tol – (optional) tolerance, defaults to 1e-8
strong – (optional) type of condition, can be 0 for weak or 1 for strong (default)
-
variable REQUIRE_EMPTY_FOLDER()¶
Tests if the current data folder is empty.
Counted are objects with type waves, strings, variables and folders
-
variable REQUIRE_EMPTY_STR(string *str)¶
Tests if str is empty.
A null string is never empty.
- Parameters
str – string to test
-
variable REQUIRE_EQUAL_INT64(int64 var1, int64 var2)¶
Tests two int64 for equality.
- Parameters
var1 – first variable
var2 – second variable
-
variable REQUIRE_EQUAL_STR(string *str1, string *str2, variable case_sensitive = defaultValue)¶
Compares two strings for byte-wise equality. (no encoding considered, no unicode normalization)
- Parameters
str1 – first string
str2 – second string
case_sensitive – (optional) should the comparison be done case sensitive (1) or case insensitive (1, the default)
-
variable REQUIRE_EQUAL_TEXTWAVES(WaveText wv1, WaveText wv2, variable mode = defaultValue)¶
Tests two text waves for equality.
- Parameters
wv1 – first text wave, can be invalid for Igor Pro 7 or later
wv2 – second text wave, can be invalid for Igor Pro 7 or later
mode – (optional) features of the waves to compare, defaults to all modes, defined at EqualWaveFlags
-
variable REQUIRE_EQUAL_UINT64(uint64 var1, uint64 var2)¶
Tests two uint64 for equality.
- Parameters
var1 – first variable
var2 – second variable
-
variable REQUIRE_EQUAL_VAR(variable var1, variable var2)¶
Tests two variables for equality.
For variables holding floating point values it is often more desirable use CHECK_CLOSE_VAR instead. To fullfill semantic correctness this assertion treats two variables with both holding NaN as equal.
- Parameters
var1 – first variable
var2 – second variable
-
variable REQUIRE_EQUAL_WAVES(WaveOrNull wv1, WaveOrNull wv2, variable mode = defaultValue, variable tol = defaultValue)¶
Tests two waves for equality. If one wave has a zero size and the other one does not then properties like DIMENSION_UNITS are compared to unequal as a property for a non-existing dimension is always unequal to a property of an existing dimension. This function won’t throw an assert if both waves have the same reference, because they are considered as equal.
- Parameters
wv1 – first wave
wv2 – second wave
mode – (optional) features of the waves to compare, defaults to all modes, defined at EqualWaveFlags
tol – (optional) tolerance for comparison, by default 0.0 which does byte-by-byte comparison (relevant only for mode=WAVE_DATA)
-
variable REQUIRE_GE_VAR(variable var1, variable var2)¶
Tests that var1 is greather or equal than var2.
- Parameters
var1 – first variable
var2 – second variable
-
variable REQUIRE_GT_VAR(variable var1, variable var2)¶
Tests that var1 is greather than var2.
- Parameters
var1 – first variable
var2 – second variable
-
variable REQUIRE_LE_VAR(variable var1, variable var2)¶
Tests that var1 is less or equal than var2.
- Parameters
var1 – first variable
var2 – second variable
-
variable REQUIRE_LT_VAR(variable var1, variable var2)¶
Tests that var1 is less than var2.
- Parameters
var1 – first variable
var2 – second variable
-
variable REQUIRE_NEQ_INT64(int64 var1, int64 var2)¶
Tests two int64 for unequality.
- Parameters
var1 – first variable
var2 – second variable
-
variable REQUIRE_NEQ_STR(string *str1, string *str2, variable case_sensitive = defaultValue)¶
Compares two strings for unequality.
- Parameters
str1 – first string
str2 – second string
case_sensitive – (optional) should the comparison be done case sensitive (1) or case insensitive (0, the default)
-
variable REQUIRE_NEQ_UINT64(uint64 var1, uint64 var2)¶
Tests two uint64 for unequality.
- Parameters
var1 – first variable
var2 – second variable
-
variable REQUIRE_NEQ_VAR(variable var1, variable var2)¶
Tests two variables for inequality.
- Parameters
var1 – first variable
var2 – second variable
-
variable REQUIRE_NON_EMPTY_STR(string *str)¶
Tests if str is not empty.
A null string is a non empty string too.
- Parameters
str – string to test
-
variable REQUIRE_NON_NULL_STR(string *str)¶
Tests if str is not null.
An empty string is always non null.
- Parameters
str – string to test
-
variable REQUIRE_NULL_STR(string *str)¶
Tests if str is null.
An empty string is never null.
- Parameters
str – string to test
-
variable REQUIRE_PROPER_STR(string *str)¶
Tests if str is a “proper” string, i.e. a string with a length larger than zero.
Neither null strings nor empty strings are proper strings.
- Parameters
str – string to test
-
variable REQUIRE_SMALL_CMPLX(variable/c var, variable tol = defaultValue)¶
Tests if a variable is small using the inequality \( | var | < | tol | \).
Variant for complex numbers
- Parameters
var – variable
tol – (optional) tolerance, defaults to 1e-8
-
variable REQUIRE_SMALL_INT64(int64 var, int64 tol = defaultValue)¶
Tests if a int64 variable is small using the inequality \( | var | < | tol | \).
- Parameters
var – int64 variable
tol – (optional) int64 tolerance, defaults to 16
-
variable REQUIRE_SMALL_UINT64(uint64 var, uint64 tol = defaultValue)¶
Tests if a uint64 variable is small using the inequality \( var < tol \).
- Parameters
var – uint64 variable
tol – (optional) uint64 tolerance, defaults to 16
-
variable REQUIRE_SMALL_VAR(variable var, variable tol = defaultValue)¶
Tests if a variable is small using the inequality \( | var | < | tol | \).
- Parameters
var – variable
tol – (optional) tolerance, defaults to 1e-8
-
variable REQUIRE_WAVE(WaveOrNull wv, variable majorType, variable minorType = defaultValue)¶
Tests a wave for existence and its type.
See also
testWaveFlags
- Parameters
wv – wave reference
majorType – major wave type
minorType – (optional) minor wave type
-
variable WARN(variable var)¶
Tests if var is non-zero and not “Not a Number” (NaN).
- Parameters
var – variable to test
-
variable WARN_CLOSE_CMPLX(variable/c var1, variable/c var2, variable tol = defaultValue, variable strong = defaultValue)¶
Compares two variables and determines if they are close.
Based on the implementation of “Floating-point comparison algorithms” in the C++ Boost unit testing framework.
Literature:
The art of computer programming (Vol II). Donald. E. Knuth. 0-201-89684-2. Addison-Wesley Professional; 3 edition, page 234 equation (34) and (35).
Variant for complex numbers.
- Parameters
var1 – first variable
var2 – second variable
tol – (optional) tolerance, defaults to 1e-8
strong – (optional) type of condition, can be 0 for weak or 1 for strong (default)
-
variable WARN_CLOSE_INT64(int64 var1, int64 var2, int64 tol = defaultValue)¶
Compares two int64 and determines if they are close.
- Parameters
var1 – first int64 variable
var2 – second int64 variable
tol – (optional) int64 tolerance, defaults to 16
-
variable WARN_CLOSE_UINT64(uint64 var1, uint64 var2, uint64 tol = defaultValue)¶
Compares two uint64 and determines if they are close.
- Parameters
var1 – first uint64 variable
var2 – second uint64 variable
tol – (optional) uint64 tolerance, defaults to 16
-
variable WARN_CLOSE_VAR(variable var1, variable var2, variable tol = defaultValue, variable strong = defaultValue)¶
Compares two variables and determines if they are close.
Based on the implementation of “Floating-point comparison algorithms” in the C++ Boost unit testing framework.
Literature:
The art of computer programming (Vol II). Donald. E. Knuth. 0-201-89684-2. Addison-Wesley Professional; 3 edition, page 234 equation (34) and (35).
- Parameters
var1 – first variable
var2 – second variable
tol – (optional) tolerance, defaults to 1e-8
strong – (optional) type of condition, can be 0 for weak or 1 for strong (default)
-
variable WARN_EMPTY_FOLDER()¶
Tests if the current data folder is empty.
Counted are objects with type waves, strings, variables and folders
-
variable WARN_EMPTY_STR(string *str)¶
Tests if str is empty.
A null string is never empty.
- Parameters
str – string to test
-
variable WARN_EQUAL_INT64(int64 var1, int64 var2)¶
Tests two int64 for equality.
- Parameters
var1 – first variable
var2 – second variable
-
variable WARN_EQUAL_STR(string *str1, string *str2, variable case_sensitive = defaultValue)¶
Compares two strings for byte-wise equality. (no encoding considered, no unicode normalization)
- Parameters
str1 – first string
str2 – second string
case_sensitive – (optional) should the comparison be done case sensitive (1) or case insensitive (1, the default)
-
variable WARN_EQUAL_TEXTWAVES(WaveText wv1, WaveText wv2, variable mode = defaultValue)¶
Tests two text waves for equality.
- Parameters
wv1 – first text wave, can be invalid for Igor Pro 7 or later
wv2 – second text wave, can be invalid for Igor Pro 7 or later
mode – (optional) features of the waves to compare, defaults to all modes, defined at EqualWaveFlags
-
variable WARN_EQUAL_UINT64(uint64 var1, uint64 var2)¶
Tests two uint64 for equality.
- Parameters
var1 – first variable
var2 – second variable
-
variable WARN_EQUAL_VAR(variable var1, variable var2)¶
Tests two variables for equality.
For variables holding floating point values it is often more desirable use CHECK_CLOSE_VAR instead. To fullfill semantic correctness this assertion treats two variables with both holding NaN as equal.
- Parameters
var1 – first variable
var2 – second variable
-
variable WARN_EQUAL_WAVES(WaveOrNull wv1, WaveOrNull wv2, variable mode = defaultValue, variable tol = defaultValue)¶
Tests two waves for equality. If one wave has a zero size and the other one does not then properties like DIMENSION_UNITS are compared to unequal as a property for a non-existing dimension is always unequal to a property of an existing dimension. This function won’t throw an assert if both waves have the same reference, because they are considered as equal.
- Parameters
wv1 – first wave
wv2 – second wave
mode – (optional) features of the waves to compare, defaults to all modes, defined at EqualWaveFlags
tol – (optional) tolerance for comparison, by default 0.0 which does byte-by-byte comparison (relevant only for mode=WAVE_DATA)
-
variable WARN_GE_VAR(variable var1, variable var2)¶
Tests that var1 is greather or equal than var2.
- Parameters
var1 – first variable
var2 – second variable
-
variable WARN_GT_VAR(variable var1, variable var2)¶
Tests that var1 is greather than var2.
- Parameters
var1 – first variable
var2 – second variable
-
variable WARN_LE_VAR(variable var1, variable var2)¶
Tests that var1 is less or equal than var2.
- Parameters
var1 – first variable
var2 – second variable
-
variable WARN_LT_VAR(variable var1, variable var2)¶
Tests that var1 is less than var2.
- Parameters
var1 – first variable
var2 – second variable
-
variable WARN_NEQ_INT64(int64 var1, int64 var2)¶
Tests two int64 for unequality.
- Parameters
var1 – first variable
var2 – second variable
-
variable WARN_NEQ_STR(string *str1, string *str2, variable case_sensitive = defaultValue)¶
Compares two strings for unequality.
- Parameters
str1 – first string
str2 – second string
case_sensitive – (optional) should the comparison be done case sensitive (1) or case insensitive (0, the default)
-
variable WARN_NEQ_UINT64(uint64 var1, uint64 var2)¶
Tests two uint64 for unequality.
- Parameters
var1 – first variable
var2 – second variable
-
variable WARN_NEQ_VAR(variable var1, variable var2)¶
Tests two variables for inequality.
- Parameters
var1 – first variable
var2 – second variable
-
variable WARN_NON_EMPTY_STR(string *str)¶
Tests if str is not empty.
A null string is a non empty string too.
- Parameters
str – string to test
-
variable WARN_NON_NULL_STR(string *str)¶
Tests if str is not null.
An empty string is always non null.
- Parameters
str – string to test
-
variable WARN_NULL_STR(string *str)¶
Tests if str is null.
An empty string is never null.
- Parameters
str – string to test
-
variable WARN_PROPER_STR(string *str)¶
Tests if str is a “proper” string, i.e. a string with a length larger than zero.
Neither null strings nor empty strings are proper strings.
- Parameters
str – string to test
-
variable WARN_SMALL_CMPLX(variable/c var, variable tol = defaultValue)¶
Tests if a variable is small using the inequality \( | var | < | tol | \).
Variant for complex numbers
- Parameters
var – variable
tol – (optional) tolerance, defaults to 1e-8
-
variable WARN_SMALL_INT64(int64 var, int64 tol = defaultValue)¶
Tests if a int64 variable is small using the inequality \( | var | < | tol | \).
- Parameters
var – int64 variable
tol – (optional) int64 tolerance, defaults to 16
-
variable WARN_SMALL_UINT64(uint64 var, uint64 tol = defaultValue)¶
Tests if a uint64 variable is small using the inequality \( var < tol \).
- Parameters
var – uint64 variable
tol – (optional) uint64 tolerance, defaults to 16
-
variable WARN_SMALL_VAR(variable var, variable tol = defaultValue)¶
Tests if a variable is small using the inequality \( | var | < | tol | \).
- Parameters
var – variable
tol – (optional) tolerance, defaults to 1e-8
-
variable WARN_WAVE(WaveOrNull wv, variable majorType, variable minorType = defaultValue)¶
Tests a wave for existence and its type.
See also
testWaveFlags
- Parameters
wv – wave reference
majorType – major wave type
minorType – (optional) minor wave type