Note that there are some explanatory texts on larger screens.

plurals
  1. POAny standard techniques, mechanisms,tools for generating exceptions for use with test code to thoroughly test C++?
    primarykey
    data
    text
    <p>With Symbian's version of C++ it is possible to precisely control simulation of low memory conditions and thus deterministically generate a leave (a leave is Symbian C++'s equivalent to a throw) for all possible combinations of execution paths through your code based on allocation failure.</p> <p>This is incredibly useful for testing purposes, as the vast majority of leaves/exceptions within Symbian (i.e. on a constrained device) are as a consequence of low memory, it effectively means you can thoroughly test your code for exception safety. This invariably reveals many, many defects, including many not related to exception handling.</p> <p>For those of you who have a copy of Exceptional C++ to hand, refer to item 18 - imagine being able to generate conditions quite easily to test all 23 paths of execution through that code and the consequent benefit that has.</p> <p>So my question is, are there any mechanisms or techniques or tools that will enable you within test code to generate exceptions to thoroughly test the exception handling of code?</p> <p>Suppose you had to white box test the code in item 18 of Exceptional C++ (and please lets not get into discussions saying the code should be re-written, suppose it can't be) how could you test it to ensure all 23 paths of execution are being executed within test code?</p> <hr> <p>This question is not about Symbian, I use use it to provide some context to illustrate from experience the incredible benefit of being able to deterministically control the generation of exceptions for testing purposes, and thus wondering how to achieve the same in standard C++.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload