mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Tests for denominations in array sizes
This commit is contained in:
parent
fc7cd54849
commit
66fcd542bc
@ -0,0 +1,25 @@
|
||||
contract C {
|
||||
uint[2 wei] a;
|
||||
uint[2 gwei] b;
|
||||
uint[2 ether] c;
|
||||
uint[2 seconds] d;
|
||||
uint[2 minutes] e;
|
||||
uint[2 hours] f;
|
||||
uint[2 days] g;
|
||||
uint[2 weeks] h;
|
||||
|
||||
function lengths() public returns (uint, uint, uint, uint, uint, uint, uint, uint) {
|
||||
return (
|
||||
a.length,
|
||||
b.length,
|
||||
c.length,
|
||||
d.length,
|
||||
e.length,
|
||||
f.length,
|
||||
g.length,
|
||||
h.length
|
||||
);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// lengths() -> 2, 2000000000, 2000000000000000000, 2, 120, 7200, 172800, 1209600
|
@ -0,0 +1,12 @@
|
||||
contract C {
|
||||
uint[42 wei] a;
|
||||
uint[42 gwei] b;
|
||||
uint[42 ether] c;
|
||||
uint[42 seconds] d;
|
||||
uint[42 minutes] e;
|
||||
uint[42 hours] f;
|
||||
uint[42 days] g;
|
||||
uint[42 weeks] h;
|
||||
}
|
||||
// ----
|
||||
// Warning 7325: (58-72): Type uint256[42000000000000000000] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
|
Loading…
Reference in New Issue
Block a user