Unit testing tools

Version 1.0.0.0 (5.56 KB) by Kit Ng
This is a unit testing framework for MATLAB functions.
1.9K Downloads
Updated 12 Apr 2005

No License

MatUnit is a unit testing framework for MATLAB. Much like it's Java counterpart JUnit, it allows the programmer to easily run many tests and report its results for MATLAB functions.

-We want to be able to teach students how to test numerical software.

- Many of them will have seen JUnit or similar frameworks, so a MATLAB testing framework should imitate it.

- Even if they haven't seen JUnit, it's a good framework, so MATLAB's should imitate it anyway.

- We compromised a solution of testing a list of functions, rather than creating a test class (since many users won't have seen classes)

- We created a function 'funcList' to list the names of the tests or subfunctions of an m-file. We would be grateful if someone can suggest a cleaner way.

Functions:
MatUnit --Performs each test and report the results
TestNorm--Creates list of tests that is passed to MatUnit to execute
funcList--Runs through the test file and return the subfunction/test names
norm2 --Computes the Euclidean norm

--------------------------------
Copyright (c) 2005 Kit-Sun Ng

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom theSoftware is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

Cite As

Kit Ng (2024). Unit testing tools (https://www.mathworks.com/matlabcentral/fileexchange/7404-unit-testing-tools), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R12
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Testing Frameworks in Help Center and MATLAB Answers
Acknowledgements

Inspired: MATUnit

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0