## Unit Testing for Arrays

version 1.0.1 (8.69 KB) by
Unit testing functions to test for the equality or inequality of arrays, to within some specified precision.

Updated 07 Dec 2021

From GitHub

# Unit Testing for Arrays

Unit testing functions to test for the equality or inequality of arrays, to within some specified precision.

# `TEST_EQUAL`

## Syntax

`TEST_EQUAL(actual,expected)`
`TEST_EQUAL(actual,expected,max_err)`

## Description

`TEST_EQUAL(actual,expected)` determines if the actual result, `actual`, is equal to the expected result, `expected`. The two arrays are considered equal if their individual elements are equal to within . An error is thrown if the two arrays are not equal.

`TEST_EQUAL(actual,expected,max_err)` determines if the actual result, `actual`, is equal to the expected result, `expected`. The two arrays are considered equal if their individual elements are equal to within a user-specified maximum error, `max_err`. An error is thrown if the two arrays are not equal.

# `TEST_UNEQUAL`

## Syntax

`TEST_UNEQUAL(actual,expected)`
`TEST_UNEQUAL(actual,expected,min_err)`

## Description

`TEST_UNEQUAL(actual,expected)` determines if the actual result, `actual`, is not equal to the expected result, `expected`. The two arrays are considered to not be equal if any of their individual elements differ by at least . An error is thrown if the two arrays are equal.

`TEST_UNEQUAL(actual,expected,min_err)` determines if the actual result, `actual`, is not equal to the expected result, `expected`. The two arrays are considered to not be equal if their individual elements differ by at least a user-specified minimum error, `min_err`. An error is thrown if the two arrays are equal.

# Examples

• See "EXAMPLES.mlx" or the "Examples" tab on the File Exchange page for examples.

### Cite As

Tamas Kis (2022). Unit Testing for Arrays (https://github.com/tamaskis/Unit_Testing_for_Arrays-MATLAB/releases/tag/v1.0.1), GitHub. Retrieved .

##### MATLAB Release Compatibility
Created with R2021b
Compatible with R2007a and later releases
##### Platform Compatibility
Windows macOS Linux