フィルターのクリア

Show complete error table using verifyEqual (from Unit Testing)

2 ビュー (過去 30 日間)
Tim
Tim 2015 年 8 月 10 日
コメント済み: Tim 2015 年 8 月 11 日
Is there a way to get the failure table to display all the failures? I couldn't find any flags in the documentation to control that.
For example:
testCase = matlab.unittest.TestCase.forInteractiveUse; % Creates an interactive test object
verifyEqual(testCase,5,5) % Passes the test
verifyEqual(testCase,randn(50,1),randn(50,1)) % Fails the test, shows the complete error table
verifyEqual(testCase,randn(500,1),randn(500,1)) % Fails the tests, shows the first 50 of 500 failures.

採用された回答

Andy Campbell
Andy Campbell 2015 年 8 月 11 日
編集済み: Andy Campbell 2015 年 8 月 11 日
There is currently no way to show all the indices in the failure table when the array has more than 50 failing indices.
I am interested in hearing about when you want them. The output is trimmed because more than 50 failing indices (yes I know 50 is arbitrary) can be a burden to debug and printing a plethora of output is often not helpful.
Do you see yourself looking at all of them? What happens if you have a million element array and all indices failed by the same value e.g.
verifyEqual(ones(1,1e6), ones(1,1e6)+1)
Can you provide some details on the scenario you face where you would like all of this output?
Thanks, Andy
  1 件のコメント
Tim
Tim 2015 年 8 月 11 日
I'm working with a vector with around 500 elements, comparing a ground truth version to an experimental version. I set the relative tolerance quite low so I can see all of the issues, and was happy to see that the error rate was fairly low (~1e-5) in the failure table. However, I was only seeing the first 50 elements, and larger errors were hiding in the rest of the vector, which I was didn't detect due to the length of the failure table. I understand that in some situations it's easier to show a shorter failure table, but it would be helpful to have a user accessible parameter to control the length if needed.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRun Unit Tests についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by