Assertions

variable CHECK(variable var)

Tests if var is true (1).

Parameters
  • var: variable to test

variable CHECK_CLOSE_CMPLX(variable/c var1, variable/c var2, variable tol = defaultValue, variable strong_or_weak = 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_or_weak: (optional) type of condition, can be 0 for weak or 1 for strong (default)

variable CHECK_CLOSE_VAR(variable var1, variable var2, variable tol = defaultValue, variable strong_or_weak = 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_or_weak: (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_STR(string *str1, string *str2, variable case_sensitive = defaultValue)

Compares two strings for equality.

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_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_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.

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_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_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_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
testWaveFlags
Parameters
  • wv: wave reference
  • majorType: major wave type
  • minorType: (optional) minor wave type

variable FAIL()

Force the test case to fail.

variable PASS()

Increase the assertion counter only.

variable REQUIRE(variable var)
variable REQUIRE_CLOSE_CMPLX(variable/c var1, variable/c var2, variable tol = defaultValue, variable strong_or_weak = defaultValue)
variable REQUIRE_CLOSE_VAR(variable var1, variable var2, variable tol = defaultValue, variable strong_or_weak = defaultValue)
variable REQUIRE_EMPTY_FOLDER()
variable REQUIRE_EMPTY_STR(string *str)
variable REQUIRE_EQUAL_STR(string *str1, string *str2, variable case_sensitive = defaultValue)
variable REQUIRE_EQUAL_TEXTWAVES(WaveText wv1, WaveText wv2, variable mode = defaultValue)
variable REQUIRE_EQUAL_VAR(variable var1, variable var2)
variable REQUIRE_EQUAL_WAVES(WaveOrNull wv1, WaveOrNull wv2, variable mode = defaultValue, variable tol = defaultValue)
variable REQUIRE_NEQ_STR(string *str1, string *str2, variable case_sensitive = defaultValue)
variable REQUIRE_NEQ_VAR(variable var1, variable var2)
variable REQUIRE_NON_EMPTY_STR(string *str)
variable REQUIRE_NON_NULL_STR(string *str)
variable REQUIRE_NULL_STR(string *str)
variable REQUIRE_PROPER_STR(string *str)
variable REQUIRE_SMALL_CMPLX(variable/c var, variable tol = defaultValue)
variable REQUIRE_SMALL_VAR(variable var, variable tol = defaultValue)
variable REQUIRE_WAVE(WaveOrNull wv, variable majorType, variable minorType = defaultValue)
variable WARN(variable var)
variable WARN_CLOSE_CMPLX(variable/c var1, variable/c var2, variable tol = defaultValue, variable strong_or_weak = defaultValue)
variable WARN_CLOSE_VAR(variable var1, variable var2, variable tol = defaultValue, variable strong_or_weak = defaultValue)
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)
variable WARN_EQUAL_STR(string *str1, string *str2, variable case_sensitive = defaultValue)
variable WARN_EQUAL_TEXTWAVES(WaveText wv1, WaveText wv2, variable mode = defaultValue)
variable WARN_EQUAL_VAR(variable var1, variable var2)
variable WARN_EQUAL_WAVES(WaveOrNull wv1, WaveOrNull wv2, variable mode = defaultValue, variable tol = defaultValue)
variable WARN_NEQ_STR(string *str1, string *str2, variable case_sensitive = defaultValue)
variable WARN_NEQ_VAR(variable var1, variable var2)
variable WARN_NON_EMPTY_STR(string *str)
variable WARN_NON_NULL_STR(string *str)
variable WARN_NULL_STR(string *str)
variable WARN_PROPER_STR(string *str)
variable WARN_SMALL_CMPLX(variable/c var, variable tol = defaultValue)
variable WARN_SMALL_VAR(variable var, variable tol = defaultValue)
variable WARN_WAVE(WaveOrNull wv, variable majorType, variable minorType = defaultValue)