All these quotes are taken from Dan site, in true/false pattern. But I want to know what it is and how can we identify by seeing the code that assert has been used as to check control flow invairant/postcondition/precondition/class variant/internal variant
The assert statement is being used to check a control-flow invariant to verify that the control flow never reaches a point in the program.
The assert statement is being used to check a class invariant--something that must be true about each instance of the class
The assert statement is being used to check an internal invariant--something that the programmer assumes to be true at a particular point in the program
The assert statements are being used to check a precondition--something that must be true when the method is invoked.
The assert statement is being used to check a postcondition--something that must be true when the method completes successfully.
can anyone explain the above thing with coding? Whether assertion can be used to check control flow invariant, postcondition and precondition (all the three condition I don't know)
pls explain [ December 15, 2006: Message edited by: Micheal John ]
Post by:Parambir Singh
, Ranch Hand
Can you post the complete question?
Post by:Micheal John
, Ranch Hand
I have understood the precondition/postcondition and control flow invariant.
But still to check class variant and internal variant is not clear:
For Class Variant
For Internal Variant
My Understanding :Control Flow Invariant Example is: if assert statement is used in the default area of the switch or else in if/else construct.
Precondition Example: assert statement will be the first statement of the method, which means while invoking this method itself some thing needs to true..
Postcondition Example: the assert statement will be at the end of the method, which means while returning some thing that needs to true.
Need more clarification on checking on class variant and internal variant..
moose poop looks like football shaped elk poop. About the size of this tiny ad: