60 likes | 191 Views
Verificare şi Validarea Sistemelor Soft Temă L aborator 1. Tools for JML jmlc & jmlrac D at ă primire laborator : Lab 1 D at ă predare laborator : Lab 2. Verificare şi Validarea Sistemelor Soft. Tools for JML. Extended static checking with ESC/Java.
E N D
Verificare şi Validarea Sistemelor Soft Temă Laborator1 Tools for JML jmlc & jmlrac Dată primire laborator: Lab 1 Dată predare laborator: Lab 2
Verificareşi Validarea Sistemelor Soft Tools for JML Extended static checking with ESC/Java Runtime assertion checking with jmlc/jmlrac Special compiler inserts runtime tests for all JML assertions.Any assertion violation results in a special exception. checks specs at run-time. only tests correctness of specs. Find violations at runtime. • Automatically tries to prove simple JML assertions at compile time. • checks specs at compile-time • proves correctness of specs. • Warn about likely runtime exceptions and violations.
Verificareşi Validarea Sistemelor Soft Runtime assertion checking • Normally • Compile using javac to get A.class • Execute A.class using javac • To do JML runtime assertion checking • Compile using jmlc to get A.class (compiles an instrumented version of the code where JML-assertions are explicitly checked) • Execute A.class using jmlrac (translates JML assertions into runtime checks:during execution, all assertions are tested and any violation of an assertion produces an Error) • Actually, jmlc is a preprocessor for javac, and jmlrac a wrapper for java. • Typically, you use jmlc/jmlrac when testing code. • Benefit (we hope) : More errors detected, with less effort.
Verificareşi Validarea Sistemelor Soft Method specification Specifying Exceptions • normal_behavior keyword notes that method should finish normally. • behavior keyword notes that there can be an exception thrown. • exceptional_behavior states that the method must always terminate with an exception. • signals clause can be used to describe under what condition an exception can be thrown.
jmlc and jmlrac– by example jmlc and jmlrac - Demo 01: Factorial Exception – Demo02: Integer sqrt
Verificare şi Validarea Sistemelor Soft Temă Laborator 1 • Tools for JML • jmlc & jmlrac • Dată primire laborator: Lab 1 • Dată predare laborator: Lab 2 • A se vedea fişierul TemaLab01_JML.pdf