Tolerance use in verifyEqual for unit tests
47 次查看(过去 30 天)
显示 更早的评论
Hello, I am having a problem when defining a tolerance to be checked while using the verifyEqual function for a unit test. My code has a line that's similar to the following:
verifyEqual(testCase, 0.3589, 0.3588, "AbsTol", 0.0001)
The condition doesn't seem to go throguh, in fact, the code stops there with an error message. Can anyone help with this?
0 个评论
采纳的回答
Steven Lord
2022-3-8
testCase = matlab.unittest.TestCase.forInteractiveUse;
verifyEqual(testCase, 0.3589, 0.3588, "AbsTol", 0.0001)
Can you show us the full and exact text of the error and/or failure message you're seeing? Can you also tell us which release of MATLAB you're using?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Run Unit Tests 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!