mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
new tests with address state variables
This commit is contained in:
parent
ff01c7275c
commit
98930344e8
@ -0,0 +1,23 @@
|
||||
contract D {
|
||||
uint public x;
|
||||
}
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
address d;
|
||||
}
|
||||
S[] ss;
|
||||
constructor() {
|
||||
ss.push(S(address(new D())));
|
||||
assert(D(ss[0].d).x() == 0); // should hold
|
||||
}
|
||||
function f() public view {
|
||||
assert(D(ss[0].d).x() == 0); // should hold, but fails because we havoc the state
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTEngine: chc
|
||||
// SMTExtCalls: trusted
|
||||
// SMTTargets: assert
|
||||
// ----
|
||||
// Warning 6328: (210-237): CHC: Assertion violation happens here.
|
||||
@ -0,0 +1,24 @@
|
||||
contract D {
|
||||
uint public x;
|
||||
function setD(uint _x) public { x = _x; }
|
||||
}
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
address d;
|
||||
}
|
||||
S[] ss;
|
||||
constructor() {
|
||||
ss.push(S(address(new D())));
|
||||
assert(D(ss[0].d).x() == 0); // should hold
|
||||
}
|
||||
function f() public view {
|
||||
assert(D(ss[0].d).x() == 0); // should fail
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTEngine: chc
|
||||
// SMTExtCalls: trusted
|
||||
// SMTTargets: assert
|
||||
// ----
|
||||
// Warning 6328: (253-280): CHC: Assertion violation happens here.
|
||||
@ -0,0 +1,21 @@
|
||||
contract D {
|
||||
uint public x;
|
||||
function setD(uint _x) public { x = _x; }
|
||||
}
|
||||
|
||||
contract C {
|
||||
address[] ds;
|
||||
constructor() {
|
||||
ds.push(address(new D()));
|
||||
assert(D(ds[0]).x() == 0); // should hold
|
||||
}
|
||||
function f() public view {
|
||||
assert(D(ds[0]).x() == 0); // should fail
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTEngine: chc
|
||||
// SMTExtCalls: trusted
|
||||
// SMTTargets: assert
|
||||
// ----
|
||||
// Warning 6328: (226-251): CHC: Assertion violation happens here.\nCounterexample:\nds = [0x0]\n\nTransaction trace:\nC.constructor()\nState: ds = [0x0]\nC.f()
|
||||
@ -0,0 +1,20 @@
|
||||
contract D {
|
||||
uint public x;
|
||||
}
|
||||
|
||||
contract C {
|
||||
address[] ds;
|
||||
constructor() {
|
||||
ds.push(address(new D()));
|
||||
assert(D(ds[0]).x() == 0); // should hold
|
||||
}
|
||||
function f() public view {
|
||||
assert(D(ds[0]).x() == 0); // should hold, but fails because we havoc the state
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTEngine: chc
|
||||
// SMTExtCalls: trusted
|
||||
// SMTTargets: assert
|
||||
// ----
|
||||
// Warning 6328: (183-208): CHC: Assertion violation happens here.\nCounterexample:\nds = [0x0]\n\nTransaction trace:\nC.constructor()\nState: ds = [0x0]\nC.f()
|
||||
@ -0,0 +1,24 @@
|
||||
contract D {
|
||||
uint public x;
|
||||
function setD(uint _x) public { x = _x; }
|
||||
}
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
address d;
|
||||
}
|
||||
S s;
|
||||
constructor() {
|
||||
s.d = address(new D());
|
||||
assert(D(s.d).x() == 0); // should hold
|
||||
}
|
||||
function f() public view {
|
||||
assert(D(s.d).x() == 0); // should fail
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTEngine: chc
|
||||
// SMTExtCalls: trusted
|
||||
// SMTTargets: assert
|
||||
// ----
|
||||
// Warning 6328: (240-263): CHC: Assertion violation happens here.\nCounterexample:\ns = {d: 0x5039}\n\nTransaction trace:\nC.constructor()\nState: s = {d: 0x5039}\nC.f()
|
||||
@ -0,0 +1,23 @@
|
||||
contract D {
|
||||
uint public x;
|
||||
}
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
address d;
|
||||
}
|
||||
S s;
|
||||
constructor() {
|
||||
s.d = address(new D());
|
||||
assert(D(s.d).x() == 0); // should hold
|
||||
}
|
||||
function f() public view {
|
||||
assert(D(s.d).x() == 0); // should hold, but fails because we havoc the state
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTEngine: chc
|
||||
// SMTExtCalls: trusted
|
||||
// SMTTargets: assert
|
||||
// ----
|
||||
// Warning 6328: (197-220): CHC: Assertion violation happens here.\nCounterexample:\ns = {d: 0x5039}\n\nTransaction trace:\nC.constructor()\nState: s = {d: 0x5039}\nC.f()
|
||||
@ -0,0 +1,26 @@
|
||||
contract D {
|
||||
uint public x;
|
||||
}
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
address d;
|
||||
}
|
||||
struct T {
|
||||
S s;
|
||||
}
|
||||
T t;
|
||||
constructor() {
|
||||
t.s.d = address(new D());
|
||||
assert(D(t.s.d).x() == 0); // should hold
|
||||
}
|
||||
function f() public view {
|
||||
assert(D(t.s.d).x() == 0); // should hold, but fails because we havoc the state
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTEngine: chc
|
||||
// SMTExtCalls: trusted
|
||||
// SMTTargets: assert
|
||||
// ----
|
||||
// Warning 6328: (223-248): CHC: Assertion violation happens here.
|
||||
@ -0,0 +1,27 @@
|
||||
contract D {
|
||||
uint public x;
|
||||
function setD(uint _x) public { x = _x; }
|
||||
}
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
address d;
|
||||
}
|
||||
struct T {
|
||||
S s;
|
||||
}
|
||||
T t;
|
||||
constructor() {
|
||||
t.s.d = address(new D());
|
||||
assert(D(t.s.d).x() == 0); // should hold
|
||||
}
|
||||
function f() public view {
|
||||
assert(D(t.s.d).x() == 0); // should fail
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTEngine: chc
|
||||
// SMTExtCalls: trusted
|
||||
// SMTTargets: assert
|
||||
// ----
|
||||
// Warning 6328: (266-291): CHC: Assertion violation happens here.\nCounterexample:\nt = {s: {d: 0x5039}}\n\nTransaction trace:\nC.constructor()\nState: t = {s: {d: 0x5039}}\nC.f()
|
||||
Loading…
Reference in New Issue
Block a user