Tolerance use in verifyEqual for unit tests

34 ビュー (過去 30 日間)
Mohamed AKI Ahmed
Mohamed AKI Ahmed 2022 年 3 月 8 日
コメント済み: Mohamed AKI Ahmed 2022 年 3 月 8 日
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?

採用された回答

Steven Lord
Steven Lord 2022 年 3 月 8 日
testCase = matlab.unittest.TestCase.forInteractiveUse;
verifyEqual(testCase, 0.3589, 0.3588, "AbsTol", 0.0001)
Verification passed.
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?
  1 件のコメント
Mohamed AKI Ahmed
Mohamed AKI Ahmed 2022 年 3 月 8 日
I found a mistake with the syntax but now it is solved. Thank you for your quick reply

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResults, Reporting, and Test File Management についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by