Table of Verifications, Assertions, and Other Qualifications - MATLAB & Simulink (original) (raw)

Main Content

There are four types of qualifications for testing values and responding to failures: verifications, assumptions, assertions, and fatal assertions.

These qualification types have parallel methods for the same types of tests. The methods use a common naming convention. For instance, the methods that test for a true value use the form <qualify>True, where_<qualify>_ can be verify,assume, assert, orfatalAssert. That is:

General Purpose

Type of Test Form of Method Name Example
Value is true. __True verifyTrue
Value is false. __False verifyFalse
Value is equal to the specified value. __Equal verifyEqual
Value is not equal to the specified value. __NotEqual verifyNotEqual
Two values are handles to the same instance. __SameHandle verifySameHandle
Value is not a handle to the specified instance. __NotSameHandle verifyNotSameHandle
Function returns true. __ReturnsTrue verifyReturnsTrue
Test produces an unconditional failure. __Fail verifyFail
Value meets the specified constraint. __That verifyThat

Errors and Warnings

Type of Test Form of Method Name Example
Function throws the specified exception. __Error verifyError
Function issues the specified warning. __Warning verifyWarning
Function issues no warnings. __WarningFree verifyWarningFree

Inequalities

Type of Test Form of Method Name Example
Value is greater than the specified value. __GreaterThan verifyGreaterThan
Value is greater than or equal to the specified value. __GreaterThanOrEqual verifyGreaterThanOrEqual
Value is less than the specified value. __LessThan verifyLessThan
Value is less than or equal to the specified value. __LessThanOrEqual verifyLessThanOrEqual

Type

Type of Test Form of Method Name Example
Class of value is the specified class. __Class verifyClass
Value is an instance of the specified class. __InstanceOf verifyInstanceOf

Strings

Type of Test Form of Method Name Example
Value contains the specified string. __Substring verifySubstring
Value matches the specified regular expression. __Matches verifyMatches

See Also

matlab.unittest.qualifications.Verifiable | matlab.unittest.qualifications.Assumable | matlab.unittest.qualifications.Assertable | matlab.unittest.qualifications.FatalAssertable | matlab.unittest.qualifications