Cody

Problem 964. McCabe Complexity

Solution 585671

Submitted on 20 Feb 2015 by goc3
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
assert(isequal(McCabe('polyval.m'),19)); % polyval %message: 'The McCabe complexity of 'polyval' is 19.'

txt = 2x1 struct array with fields: message fix line column str = The McCabe complexity of 'polyval' is 19. str = 'The' 'McCabe' 'complexity' 'of' ''polyval'' 'is' '19.' str = '19' ans = 19

2   Pass
%% assert(isequal(McCabe('residue.m'),21)); %2x1 struct array with fields:

txt = 4x1 struct array with fields: message fix line column str = The McCabe complexity of 'residue' is 21. str = 'The' 'McCabe' 'complexity' 'of' ''residue'' 'is' '21.' str = '21' ans = 21

3   Pass
%% assert(isequal(McCabe('polyeig.m'),18));

txt = 2x1 struct array with fields: message fix line column str = The McCabe complexity of 'polyeig' is 18. str = 'The' 'McCabe' 'complexity' 'of' ''polyeig'' 'is' '18.' str = '18' ans = 18

4   Pass
%% assert(isequal(McCabe('roots.m'),7)); % message: 'The McCabe complexity of 'roots' is 7.'

txt = 4x1 struct array with fields: message fix line column str = The McCabe complexity of 'roots' is 7. str = 'The' 'McCabe' 'complexity' 'of' ''roots'' 'is' '7.' str = '7' ans = 7

5   Pass
%% assert(isequal(McCabe('decic.m'),14)); %3x1 struct array with fields:

txt = 3x1 struct array with fields: message fix line column str = The McCabe complexity of 'decic' is 14. str = 'The' 'McCabe' 'complexity' 'of' ''decic'' 'is' '14.' str = '14' ans = 14

Suggested Problems

More from this Author246

Community Treasure Hunt

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

Start Hunting!