Add more tests for getters

This commit is contained in:
Alex Beregszaszi 2020-11-24 22:32:32 +00:00
parent ae34fba49b
commit 53b635a21f
3 changed files with 49 additions and 20 deletions

View File

@ -1,20 +0,0 @@
contract C {
uint8 public a;
uint16 public b;
uint128 public c;
uint public d;
constructor() {
a = 3;
b = 4;
c = 5;
d = 6;
}
}
// ====
// compileViaYul: also
// compileToEwasm: also
// ----
// a() -> 3
// b() -> 4
// c() -> 5
// d() -> 6

View File

@ -0,0 +1,14 @@
contract C {
string public a;
string public b;
bytes public c;
constructor() {
a = "hello world";
b = hex"41424344";
c = hex"ff077fff";
}
}
// ----
// a() -> 0x20, 11, "hello world"
// b() -> 0x20, 4, "ABCD"
// c() -> 0x20, 4, -439061522557375173052089223601630338202760422010735733633791622124826263552

View File

@ -0,0 +1,35 @@
contract C {
uint8 public a;
uint16 public b;
uint128 public c;
uint public d;
bytes1 public e;
bytes20 public f;
bytes32 public g;
bool public h;
address public i;
constructor() {
a = 3;
b = 4;
c = 5;
d = 6;
e = bytes1(uint8(0x7f));
f = bytes20(uint160(0x64656164626565663135646561640000000000000010));
g = bytes32(uint256(0x6465616462656566313564656164000000000000000000000000000000000010));
h = true;
i = address(type(uint160).max / 3);
}
}
// ====
// compileToEwasm: also
// compileViaYul: also
// ----
// a() -> 3
// b() -> 4
// c() -> 5
// d() -> 6
// e() -> 0x7f00000000000000000000000000000000000000000000000000000000000000
// f() -> 0x6164626565663135646561640000000000000010000000000000000000000000
// g() -> 0x6465616462656566313564656164000000000000000000000000000000000010
// h() -> true
// i() -> 0x5555555555555555555555555555555555555555