CSC/ECE 517 Fall 2007/wiki3 1 sa: Difference between revisions
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
=Introduction= | =Introduction= | ||
<blockquote> "''In computer programming, an '''assertion''' is a predicate (i.e., a true–false statement) placed in a program to indicate that the developer thinks that the predicate is always true at that place.''"[1]</blockquote> | <blockquote> "''In computer programming, an '''assertion''' is a predicate (i.e., a true–false statement) placed in a program to indicate that the developer thinks that the predicate is always true at that place. Assertions are used to help specify programs and to reason about program correctness. For example, a precondition — an assertion placed at the beginning of a section of code — determines the set of states under which the code is expected to be executed. A postcondition — placed at the end — describes the expected state at the end of execution. | ||
''"[1]</blockquote> | |||
Assertions are a way to implement testing in computer programming specified by the programmer to check for correctness in a program. Assertions are a systematic way to check that the internal state of a program is as the programmer expected, with the goal of catching bugs. In particular, they are good for catching false assumptions that were made while writing the code. | Assertions are a way to implement testing in computer programming specified by the programmer to check for correctness in a program. Assertions are a systematic way to check that the internal state of a program is as the programmer expected, with the goal of catching bugs. In particular, they are good for catching false assumptions that were made while writing the code. |
Revision as of 16:49, 19 November 2007
Support for assertions in various o-o programming languages
Topic :Compare the support for assertions in various o-o programming languages. How well is it integrated with the language (instead of being supplied by libraries)? How many kinds of assertions are supported? How are assertions used in the various flavors of XUnit testing frameworks?
Introduction
"In computer programming, an assertion is a predicate (i.e., a true–false statement) placed in a program to indicate that the developer thinks that the predicate is always true at that place. Assertions are used to help specify programs and to reason about program correctness. For example, a precondition — an assertion placed at the beginning of a section of code — determines the set of states under which the code is expected to be executed. A postcondition — placed at the end — describes the expected state at the end of execution. "[1]
Assertions are a way to implement testing in computer programming specified by the programmer to check for correctness in a program. Assertions are a systematic way to check that the internal state of a program is as the programmer expected, with the goal of catching bugs. In particular, they are good for catching false assumptions that were made while writing the code.
Depending on the programming language, assertions can either be a part of the design process or they could be statements which are checked at runtime.
Support for assertions on various o-o programming languages
Java
C++
Ruby
Python
SmallTalk
Eiffel
XUnit testing frameworks and assertions
References
[1] Wikipedia Page Assertions