Contracts for C++precondition assertion post (w: w.index() == i); // postcondition assertion ## Proposal: add contract assertions to C++ // precondition assertion // postcondition assertion ## Proposal: add contract assertions Widget getWidget (index i) pre (i > 0) // precondition assertion post (w: w.index() == i) // postcondition assertion { auto* db = getDatabase(); contract_assert (db != nullptr); // assertion statement proposal includes syntax for specifying three kinds of contract assertions: precondition assertions, postcondition assertions, and assertion statements. In addition, we specify four evaluation semantics for these0 码力 | 181 页 | 4.44 MB | 1 年前3
Better Code: ContractsPreconditions and Postconditions $ \{P\}C\{Q\} $ If precondition P is met, executing C establishes postcondition Q  Tony Hoare Preconditions and Postconditions ## $ \{P\}C\{Q\} $ If precondition P is met, executing C establishes postcondition Q  Tony Hoare Preconditions and Postconditions $$ \{P\}C\{Q\} $$ If precondition P is met, executing C establishes postcondition Q  Tony Hoare0 码力 | 204 页 | 4.46 MB | 1 年前3
The Hitchhiker’s Guide to
Logical VerificationIf the precondition P is true before S is executed and the execution terminates normally, the postcondition Q is true at termination. This is a partial correctness statement: The program is correct if initially), but if it does escape, then the loop's condition must be false and hence we have the postcondition i = 10. The following triples are bizarre but interesting: $$ \begin{aligned}&\{false\ true of any statement S (and therefore pointless): The precondition is never satisfied, so any postcondition holds vacuously. The third triple is always true as well, regardless of S. The fourth triple is0 码力 | 215 页 | 1.95 MB | 2 年前3
Noexcept: Enabling Testing of Contract Checksbeen met Example contract for vector::pop_back() : Precondition: the vector is not empty • Postcondition: the last element of the vector has been removed ## Wide versus Narrow Contracts A function has have to hold – the contract is broken ## Contract Violations Failure to meet a precondition or postcondition is a bug in the code. • Catching contract violations early results in fewer bugs in released - 1); // Posterior } // Precondition check // Destroy last element // Postcondition check vectorv; Postcondition will always fail! v.pop_back(); // ASSERTION FAILURE: Precondition violation 0 码力 | 90 页 | 1.38 MB | 1 年前3
The Idris Tutorial Version 0.99action has a precondition (i.e. what the game state must be before carrying out the action) and a postcondition (i.e. how the action affects the game state). Informally, these actions with the pre- and postconditions running, and there must be both guesses still available, and letters still to be guessed. - Postcondition: If the guessed letter is in the word and not yet guessed, reduce the number of letters, otherwise still to be guessed. • Postcondition: The game is no longer running. Lost Accept defeat • Precondition: The game must be running, and there must be no guesses left. • Postcondition: The game is no longer0 码力 | 182 页 | 1.04 MB | 2 年前3
统一建模语言 UML 参考手册 - 基本概念版型 《invariant》 《precondition》 版型 |版型|定义|版型概念提供了区分(标识)元素的一种方法,它们的行为在某些方面好像它们是新的“虚拟”元构造的实例。实例具 次代表了水平切片。对比:层次(layer)。| |pattern|模式|模板协作。| |persistent object|持久对象|在创建此对象的进程或线索结束后继续存在的对象。| |postcondition|后置条件|在一个操作结束时必须为真的限制条件。| |precondition|前置条件|调用一个操作时必须为真的限制条件。| |primitive type|基本类型|无子结构的预定义基本类型,如整型,或字符串。| |关联类|association class| |关系|relationship| |过程|process| |孩子|child| |合并|combination| |后代|descendant| |后置条件|postcondition| |互斥子状态|disjoint substate| |汇合状态|junction state| |活动|activity| |活动视图|activity graph| |活动图|activity《postcondition》 0 码力 | 123 页 | 2.61 MB | 2 年前3
Idris 语言文档 Version 1.3.1态”的抽象表示。通过给定输入资源(in_res)和输出资源(out_res),我们可以描述允许函数执行的前提条件(Precondition)和描述了函数如何影响世界的所有状态的后置条件(Postcondition)。 本节以一些 STrans 函数的小例子开始,看看如何执行它们。我们还介绍了 ST,一个类型级的函数,它能让我们简明地描述带有状态的函数的状态转移。 ## 对示例进行类型检查 对于本节和整个教程,你需要 action has a precondition (i.e. what the game state must be before carrying out the action) and a postcondition (i.e. how the action affects the game state). Informally, these actions with the pre- and postconditions running, and there must be both guesses still available, and letters still to be guessed. - Postcondition: If the guessed letter is in the word and not yet guessed, reduce the number of letters, otherwise0 码力 | 224 页 | 2.06 MB | 2 年前3
The Idris Tutorial Version 2.3.0action has a precondition (i.e. what the game state must be before carrying out the action) and a postcondition (i.e. how the action affects the game state). Informally, these actions with the pre- and postconditions be running, and there must be both guesses still available, and letters still to be guessed. • Postcondition: If the guessed letter is in the word and not yet guessed, reduce the number of letters, otherwise still to be guessed. • Postcondition: The game is no longer running. Lost Accept defeat • Precondition: The game must be running, and there must be no guesses left. • Postcondition: The game is no longer0 码力 | 228 页 | 1.23 MB | 2 年前3
The Idris Tutorial Version 1.0.1action has a precondition (i.e. what the game state must be before carrying out the action) and a postcondition (i.e. how the action affects the game state). Informally, these actions with the pre- and postconditions running, and there must be both guesses still available, and letters still to be guessed. - Postcondition: If the guessed letter is in the word and not yet guessed, reduce the number of letters, otherwise still to be guessed. • Postcondition: The game is no longer running. Lost Accept defeat • Precondition: The game must be running, and there must be no guesses left. • Postcondition: The game is no longer0 码力 | 223 页 | 1.21 MB | 2 年前3
The Idris Tutorial Version 1.1.0action has a precondition (i.e. what the game state must be before carrying out the action) and a postcondition (i.e. how the action affects the game state). Informally, these actions with the pre- and postconditions running, and there must be both guesses still available, and letters still to be guessed. - Postcondition: If the guessed letter is in the word and not yet guessed, reduce the number of letters, otherwise still to be guessed. • Postcondition: The game is no longer running. Lost Accept defeat • Precondition: The game must be running, and there must be no guesses left. • Postcondition: The game is no longer0 码力 | 223 页 | 1.21 MB | 2 年前3
共 56 条
- 1
- 2
- 3
- 4
- 5
- 6
相关搜索词
ContractsC++contract assertionspreconditionpostcondition设计契约保证异常处理代码审查Leantheorem provingtacticHoare logicformal proofcontract checksnoexceptexceptionstestingannotationsIdris依赖类型函数式编程Vect类型Effects库统一建模语言类图用例图构件图配置图定理证明及早求值类型系统dependent typesinteractive environmentimplicit conversionsforeign function calls副作用处理纯函数副作用矢量类型













