Skip to content

Commit

Permalink
update tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseth committed Oct 20, 2020
1 parent 771c055 commit 3b99ed9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/libsolidity/semanticTests/types/mapping_enum_key.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ contract test {
}
// ====
// EVMVersion: >=byzantium
// ABIEncoderV1Only: true
// compileViaYul: false
// ----
// get(uint8): 0 -> 0
// get(uint8): 0x01 -> 0
Expand Down
32 changes: 32 additions & 0 deletions test/libsolidity/semanticTests/types/mapping_enum_key_v2.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
pragma experimental ABIEncoderV2;
enum E { A, B, C }
contract test {
mapping(E => uint8) table;
function get(E k) public returns (uint8 v) {
return table[k];
}
function set(E k, uint8 v) public {
table[k] = v;
}
}
// ====
// compileViaYul: also
// EVMVersion: >=byzantium
// ----
// get(uint8): 0 -> 0
// get(uint8): 0x01 -> 0
// get(uint8): 0x02 -> 0
// get(uint8): 0x03 -> FAILURE
// get(uint8): 0xa7 -> FAILURE
// set(uint8,uint8): 0x01, 0xa1 ->
// get(uint8): 0 -> 0
// get(uint8): 0x01 -> 0xa1
// get(uint8): 0xa7 -> FAILURE
// set(uint8,uint8): 0x00, 0xef ->
// get(uint8): 0 -> 0xef
// get(uint8): 0x01 -> 0xa1
// get(uint8): 0xa7 -> FAILURE
// set(uint8,uint8): 0x01, 0x05 ->
// get(uint8): 0 -> 0xef
// get(uint8): 0x01 -> 0x05
// get(uint8): 0xa7 -> FAILURE

0 comments on commit 3b99ed9

Please sign in to comment.