solidity/test/libsolidity/semanticTests/array/string_bytes_conversion.sol
Daniel Kirchner a8f7c69c47 Adjust tests.
2021-09-13 20:41:40 +02:00

21 lines
427 B
Solidity

contract Test {
string s;
bytes b;
function f(string memory _s, uint256 n) public returns (bytes1) {
b = bytes(_s);
s = string(b);
return bytes(s)[n];
}
function l() public returns (uint256) {
return bytes(s).length;
}
}
// ====
// requiresYulOptimizer: minimalStack
// compileViaYul: also
// ----
// f(string,uint256): 0x40, 0x02, 0x06, "abcdef" -> "c"
// l() -> 0x06