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

testing weird cases that causes issues with xlang

parent b55ae300
No related branches found
No related tags found
No related merge requests found
Showing
with 182 additions and 0 deletions
package test.resources.regression.verification.xlang.invalid
/* Copyright 2009-2015 EPFL, Lausanne */
object Assert1 {
def foo(): Int = {
var a = 0
a += 1
assert(a == 0)
a
}
}
/* Copyright 2009-2015 EPFL, Lausanne */
object Assert2 {
def foo(): Int = {
var a = 0
assert(a == 1)
a += 1
a
}
}
/* Copyright 2009-2015 EPFL, Lausanne */
object Assert1 {
def foo(): Int = {
var a = 0
a += 1
assert(a == 1)
a
}
}
/* Copyright 2009-2015 EPFL, Lausanne */
object Assert2 {
def foo(): Int = {
var a = 0
assert(a == 0)
a += 1
a
}
}
/* Copyright 2009-2015 EPFL, Lausanne */
import leon.lang._
object Assert3 {
def test(i: Int): Int = {
var j = i
assert(j == i)
j += 1
assert(j == i + 1)
j += 2
assert(j == i + 2)
j
}
}
object Sequencing1 {
def test(): Int = {
var x = 0
x += 1
x *= 2
x
} ensuring(x => x == 2)
}
object Sequencing2 {
def test(): Int = {
var x = 0
x += 5
x *= 10
x
} ensuring(x => x == 50)
}
object Sequencing3 {
def f(x: Int): Int = {
require(x < 10)
x
}
def test(): Int = {
var x = 0
f(x)
x += 5
f(x)
x += 5
x
}
}
object Sequencing4 {
def test(): Int = {
var x = 5
{x = x + 1; x} + {x = x * 2; x}
} ensuring(res => res == 18)
}
object Sequencing5 {
def test(): (Int, Int, Int) = {
var x = 5
(
{x = x + 1; x},
{x = x * 2; x},
{x = x - 1; x}
)
} ensuring(res => res._1 == 6 && res._2 == 12 && res._3 == 11)
}
object Sequencing6 {
def f(x1: Int, x2: Int, x3: Int): Int = {
require(x1 == 6 && x2 == 12 && x3 == 11)
x3
}
def test(): Int = {
var x = 5
f(
{x = x + 1; x},
{x = x * 2; x},
{x = x - 1; x}
)
x
} ensuring(res => res == 11)
}
package test.resources.regression.verification.xlang.valid
object Sequencing7 {
def test(): Int = {
var x = 5
{x = x + 1; x}
{x = x * 2; x}
{x = x - 1; x}
x
} ensuring(res => res == 11)
}
object Sequencing8 {
def test(): Int = {
var x = 5
(x = x + 1, (x = x * 2, (x = x - 1, x = x * 2)))
x
} ensuring(res => res == 22)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment