필터 지우기
필터 지우기

Is it possible to ignore certain lines in MATLAB coverage test?

조회 수: 4 (최근 30일)
Jianfei
Jianfei 2024년 3월 19일
댓글: Jianfei 2024년 3월 19일
If matlab version > a version
do something
else
do something else
end
I hope certain lines can be ignored based on current MATLAB version during coverage test. I'm looking for somthing similar to this post which is discussing test in Python:
  댓글 수: 2
Manikanta Aditya
Manikanta Aditya 2024년 3월 19일
Hey,
Looks like you can do Coverage Filtering for the Simulink models (Coverage Filtering - MATLAB & Simulink (mathworks.com))
For MATLAB Code, I feel there isn't built in way to ignore certain lines based on MATLAB version during a coverage test. The MATLAB code coverage tools will execute and consider all lines of code that are run during the test. If certain lines of code are not executed due to a version check, those lines would not be included in the coverage report.
If you want to exclude certain lines of code from the coverage report, you might need to structure your tests or code in such a way that those lines are not executed during testing.
Hope it helps!
Jianfei
Jianfei 2024년 3월 19일
Yes I'm looking for coverage filtering in MATLAB code. But I can't find a way to do it. Thanks for your comment.

댓글을 달려면 로그인하십시오.

답변 (1개)

Steven Lord
Steven Lord 2024년 3월 19일
See the isMATLABReleaseOlderThan function. If you're using an older release, you could use verLessThan instead.
  댓글 수: 1
Jianfei
Jianfei 2024년 3월 19일
Hi, I just added a few more description in my post. I'm not looking for version comparison but looking for ignoring lines in coverage test.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Address Missing Coverage에 대해 자세히 알아보기

태그

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by