Tests for constraint propagation
This commit is contained in:
parent
182c413af1
commit
9ec5e90608
21
src/test/compile-fail/no-constraint-prop.rs
Normal file
21
src/test/compile-fail/no-constraint-prop.rs
Normal 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));
|
||||
}
|
13
src/test/run-pass/constraint-prop-expr-move.rs
Normal file
13
src/test/run-pass/constraint-prop-expr-move.rs
Normal 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));
|
||||
}
|
12
src/test/run-pass/constraint-prop-move.rs
Normal file
12
src/test/run-pass/constraint-prop-move.rs
Normal 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));
|
||||
}
|
12
src/test/run-pass/constraint-prop-swap.rs
Normal file
12
src/test/run-pass/constraint-prop-swap.rs
Normal 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));
|
||||
}
|
12
src/test/run-pass/constraint-prop.rs
Normal file
12
src/test/run-pass/constraint-prop.rs
Normal 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));
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user