Tests for constraint propagation

This commit is contained in:
Tim Chevalier 2011-07-08 22:18:23 -07:00
parent 182c413af1
commit 9ec5e90608
5 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,21 @@
// error-pattern:Unsatisfied precondition constraint (for example, le(b, d
// xfail-stage0
use std;
import std::str::*;
import std::uint::*;
fn main() {
let uint a = 1u;
let uint b = 4u;
let uint c = 5u;
// make sure that the constraint le(b, a) exists...
check le(b, a);
// ...invalidate it...
b += 1u;
check le(c, a);
// ...and check that it doesn't get set in the poststate of
// the next statement, since it's not true in the
// prestate.
auto d <- a;
log (safe_slice("kitties", b, d));
}

View File

@ -0,0 +1,13 @@
// xfail-stage0
use std;
import std::str::*;
import std::uint::*;
fn main() {
let uint a = 1u;
let uint b = 4u;
let uint c = 17u;
check le(a, b);
c <- a;
log (safe_slice("kitties", c, b));
}

View File

@ -0,0 +1,12 @@
// xfail-stage0
use std;
import std::str::*;
import std::uint::*;
fn main() {
let uint a = 1u;
let uint b = 4u;
check le(a, b);
auto c <- a;
log (safe_slice("kitties", c, b));
}

View File

@ -0,0 +1,12 @@
// xfail-stage0
use std;
import std::str::*;
import std::uint::*;
fn main() {
let uint a = 4u;
let uint b = 1u;
check le(b, a);
b <-> a;
log (safe_slice("kitties", a, b));
}

View File

@ -0,0 +1,12 @@
// xfail-stage0
use std;
import std::str::*;
import std::uint::*;
fn main() {
let uint a = 1u;
let uint b = 4u;
check le(a, b);
auto c = b;
log (safe_slice("kitties", a, c));
}