solidity/test/libsolidity/smtCheckerTests/functions/getters/struct_3.sol
2021-10-26 11:30:30 +02:00

26 lines
515 B
Solidity

contract C {
struct S {
string s;
bytes b;
}
S public m;
constructor() {
m.s = "foo";
m.b = "bar";
}
function f() public view {
(string memory s, bytes memory b) = this.m();
assert(keccak256(bytes(s)) == keccak256(bytes(m.s))); // should hold
assert(b[0] == m.b[0]); // should hold
assert(b[0] == "t"); // should fail
}
}
// ====
// SMTEngine: all
// ----
// Warning 6328: (307-326): CHC: Assertion violation happens here.
// Info 1180: Contract invariant(s) for :C:\n!(m.b.length <= 2)\n