I study the unit testing literature. A question arose on the definition of the cyclomatic number of a program module for McCabe graphs. The fact is that he, McCabe, defines a number of constructions in which there is no exception handling block, and there is one in the module under test. Thus, only this is available:

Question

How to build this graph of the program module, in which there are blocks of exception handling?

Addition

The same question, just in case - for the Nass-Schneiderman diagram.

Addition

What do you think, this block of C ++ code ...

try { Operation1(); Operation2(); OperationN(); } catch(Exception1 &e1) { Handling1(); } catch(Exception2 &e2) { Handling2(); } catch(ExceptionM &em) { HandlingM(); } catch(...) { Handling(); } 

... is it possible, with some approximation, to interpret the following flowchart?

  • 2
    In fact, exception handling can be attributed to the if-then block. - rjhdby
  • @rjhdby, now I will add a question - I was just drawing)) - Majestio
  • The variant you have proposed is somewhat redundant, because it contains, in fact, all possible variants of the "operation-exception" pairs. In the meantime, not all operations can throw out exceptions at all, and those that can be thrown out, will throw out an exception of only one type. In general, the topic is complex and not without some simplifications. You can read about one of the approaches here (pp. 20-22): eclipsefcg.sourceforge.net/Documentation.pdf - andreycha
  • @andreycha, thanks - I will look. - Majestio
  • Although, on the other hand, on these graphs, it seems, all possible options are drawn, and with this so-called. you painted correctly. It remains only to determine how to count the complexity. Since there is no information about whether the exception will be and where it will be, you can only give a range. - andreycha

0