Scala seems to define 3 kinds of assertions: assert
, require
and assume
.
As far as I can understand, the difference (compared to a
I second Adams answer, here are just some small additions:
When assume
is violated, the verification tool silently prunes the path, i.e. does not follow the path any deeper.
Hence assume
is often used to formulate pre-conditions, assert
to formulate post-conditions.
These concepts are used by many tools, e.g. the concolic testing tool KLEE, software bounded model checking tools like CBMC and LLBMC, and partly also by static code analysis tools based on abstract interpretation. The article Finding common ground: Choose, Assert, Assume introduces these concepts and tries to standardize them.