Skip to content
Snippets Groups Projects
Commit e7a5c6a6 authored by Regis Blanc's avatar Regis Blanc
Browse files

testcase for absolute value of array elements by reference

parent 46bf1166
No related branches found
No related tags found
No related merge requests found
import leon.lang._
object ArrayParamMutation9 {
def abs(a: Array[Int]) {
require(a.length > 0)
var i = 0;
(while (i < a.length) {
a(i) = if (a(i) < 0) -a(i) else a(i) // <-- this makes Leon crash
i = i + 1
}) invariant(i >= 0)
}
def main = {
val a = Array(0, -1, 2, -3)
abs(a)
a(0) + a(1) - 1 + a(2) - 2 + a(3) - 3 // == 0
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment