mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[isoltest] Splits smoke test into separate files.
This commit is contained in:
parent
30483acc42
commit
18157f5a49
@ -26,3 +26,4 @@ contract D {
|
||||
// stateBytes() -> left(0x4200ef)
|
||||
// internalStateDecimal() -> 0x20
|
||||
// update(bool,uint256,bytes32): false, -23, left(0x2300ef) -> false, -23, left(0x2300ef)
|
||||
|
44
test/libsolidity/semanticTests/smoke/arrays.sol
Normal file
44
test/libsolidity/semanticTests/smoke/arrays.sol
Normal file
@ -0,0 +1,44 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C {
|
||||
struct T {
|
||||
uint a;
|
||||
uint b;
|
||||
string s;
|
||||
}
|
||||
bool[2][] flags;
|
||||
function r() public returns (bool[3] memory) {
|
||||
return [true, false, true];
|
||||
}
|
||||
function s() public returns (uint[2] memory, uint) {
|
||||
return ([uint(123), 456], 789);
|
||||
}
|
||||
function u() public returns (T[2] memory) {
|
||||
return [T(23, 42, "any"), T(555, 666, "any")];
|
||||
}
|
||||
function v() public returns (bool[2][] memory) {
|
||||
return flags;
|
||||
}
|
||||
function w1() public returns (string[1] memory) {
|
||||
return ["any"];
|
||||
}
|
||||
function w2() public returns (string[2] memory) {
|
||||
return ["any", "any"];
|
||||
}
|
||||
function w3() public returns (string[3] memory) {
|
||||
return ["any", "any", "any"];
|
||||
}
|
||||
function x() public returns (string[2] memory, string[3] memory) {
|
||||
return (["any", "any"], ["any", "any", "any"]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// r() -> true, false, true
|
||||
// s() -> 123, 456, 789
|
||||
// u() -> 0x20, 0x40, 0xE0, 23, 42, 0x60, 3, "any", 555, 666, 0x60, 3, "any"
|
||||
// v() -> 0x20, 0
|
||||
// w1() -> 0x20, 0x20, 3, "any"
|
||||
// w2() -> 0x20, 0x40, 0x80, 3, "any", 3, "any"
|
||||
// w3() -> 0x20, 0x60, 0xa0, 0xe0, 3, "any", 3, "any", 3, "any"
|
||||
// x() -> 0x40, 0x0100, 0x40, 0x80, 3, "any", 3, "any", 0x60, 0xa0, 0xe0, 3, "any", 3, "any", 3, "any"
|
||||
|
37
test/libsolidity/semanticTests/smoke/basic.sol
Normal file
37
test/libsolidity/semanticTests/smoke/basic.sol
Normal file
@ -0,0 +1,37 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C {
|
||||
function e() public payable returns (uint) {
|
||||
return msg.value;
|
||||
}
|
||||
function f(uint a) public pure returns (uint, uint) {
|
||||
return (a, a);
|
||||
}
|
||||
function g() public pure returns (uint, uint) {
|
||||
return (2, 3);
|
||||
}
|
||||
function h(uint x, uint y) public pure returns (uint) {
|
||||
return x - y;
|
||||
}
|
||||
function i(bool b) public pure returns (bool) {
|
||||
return !b;
|
||||
}
|
||||
function j(bytes32 b) public pure returns (bytes32, bytes32) {
|
||||
return (b, b);
|
||||
}
|
||||
function k() public pure returns (uint) {
|
||||
return msg.data.length;
|
||||
}
|
||||
function l(uint a) public pure returns (uint d) {
|
||||
return a * 7;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// e(), 1 ether -> 1
|
||||
// f(uint256): 3 -> 3, 3
|
||||
// g() -> 2, 3
|
||||
// h(uint256,uint256): 1, -2 -> 3
|
||||
// i(bool): true -> false
|
||||
// j(bytes32): 0x10001 -> 0x10001, 0x10001
|
||||
// k(): hex"4200efef" -> 8
|
||||
// l(uint256): 99 -> 693
|
22
test/libsolidity/semanticTests/smoke/bytes_and_strings.sol
Normal file
22
test/libsolidity/semanticTests/smoke/bytes_and_strings.sol
Normal file
@ -0,0 +1,22 @@
|
||||
contract C {
|
||||
function e(bytes memory b) public pure returns (bytes memory) {
|
||||
return b;
|
||||
}
|
||||
function f() public pure returns (string memory, string memory) {
|
||||
return ("any", "any");
|
||||
}
|
||||
function g() public pure returns (string memory, uint, string memory) {
|
||||
return ("any", 42, "any");
|
||||
}
|
||||
function h() public pure returns (string memory) {
|
||||
return "any";
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// e(bytes): 32, 3, hex"AB33BB" -> 32, 3, left(0xAB33BB)
|
||||
// e(bytes): 32, 32, 0x20 -> 32, 32, 0x20
|
||||
// e(bytes): 32, 3, hex"AB33FF" -> 32, 3, hex"ab33ff0000000000000000000000000000000000000000000000000000000000"
|
||||
// f() -> 0x40, 0x80, 3, "any", 3, "any"
|
||||
// g() -> 0x60, 0x2a, 0xa0, 3, "any", 3, "any"
|
||||
// h() -> 0x20, 3, "any"
|
||||
|
18
test/libsolidity/semanticTests/smoke/constructor.sol
Normal file
18
test/libsolidity/semanticTests/smoke/constructor.sol
Normal file
@ -0,0 +1,18 @@
|
||||
contract C {
|
||||
uint public state = 0;
|
||||
constructor(uint _state) public payable {
|
||||
state = _state;
|
||||
}
|
||||
function balance() public payable returns (uint256) {
|
||||
return address(this).balance;
|
||||
}
|
||||
function update(uint _state) public {
|
||||
state = _state;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// constructor(), 2 ether: 3 ->
|
||||
// state() -> 3
|
||||
// balance() -> 2
|
||||
// update(uint256): 4
|
||||
// state() -> 4
|
10
test/libsolidity/semanticTests/smoke/failure.sol
Normal file
10
test/libsolidity/semanticTests/smoke/failure.sol
Normal file
@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
function e() public {
|
||||
revert("Transaction failed.");
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >homestead
|
||||
// ----
|
||||
// _() -> FAILURE
|
||||
// e() -> FAILURE, hex"08c379a0", 0x20, 19, "Transaction failed."
|
@ -11,3 +11,4 @@ contract C {
|
||||
// g()
|
||||
// # g() does not exist #
|
||||
// -> FAILURE
|
||||
|
@ -17,3 +17,4 @@ contract C {
|
||||
// 1
|
||||
// -> 5
|
||||
// # Should return sum of all parameters. #
|
||||
|
22
test/libsolidity/semanticTests/smoke/structs.sol
Normal file
22
test/libsolidity/semanticTests/smoke/structs.sol
Normal file
@ -0,0 +1,22 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
uint a;
|
||||
uint b;
|
||||
}
|
||||
struct T {
|
||||
uint a;
|
||||
uint b;
|
||||
string s;
|
||||
}
|
||||
function s() public returns (S memory) {
|
||||
return S(23, 42);
|
||||
}
|
||||
function t() public returns (T memory) {
|
||||
return T(23, 42, "any");
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// s() -> 23, 42
|
||||
// t() -> 0x20, 23, 42, 0x60, 3, "any"
|
@ -1,127 +0,0 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C {
|
||||
struct S {
|
||||
uint a;
|
||||
uint b;
|
||||
}
|
||||
struct T {
|
||||
uint a;
|
||||
uint b;
|
||||
string s;
|
||||
}
|
||||
uint public state = 0;
|
||||
bool[2][] flags;
|
||||
constructor(uint _state) public payable {
|
||||
state = _state;
|
||||
}
|
||||
function balance() payable public returns (uint256) {
|
||||
return address(this).balance;
|
||||
}
|
||||
function d(uint a) public {
|
||||
state = a;
|
||||
}
|
||||
function e() public {
|
||||
revert("Transaction failed.");
|
||||
}
|
||||
function f() payable public returns (uint) {
|
||||
return 2;
|
||||
}
|
||||
function f(uint a) public returns (uint, uint) {
|
||||
return (a, a);
|
||||
}
|
||||
function g() public returns (uint, uint) {
|
||||
return (2, 3);
|
||||
}
|
||||
function h(uint x, uint y) public returns (uint) {
|
||||
return x - y;
|
||||
}
|
||||
function j(bool b) public returns (bool) {
|
||||
return !b;
|
||||
}
|
||||
function k(bytes32 b) public returns (bytes32, bytes32) {
|
||||
return (b, b);
|
||||
}
|
||||
function l() public returns (uint256) {
|
||||
return msg.data.length;
|
||||
}
|
||||
function m(bytes memory b) public returns (bytes memory) {
|
||||
return b;
|
||||
}
|
||||
function n() public returns (string memory) {
|
||||
return "any";
|
||||
}
|
||||
function o() public returns (string memory, string memory) {
|
||||
return ("any", "any");
|
||||
}
|
||||
function p() public returns (string memory, uint, string memory) {
|
||||
return ("any", 42, "any");
|
||||
}
|
||||
function q(uint a) public returns (uint d) {
|
||||
return a * 7;
|
||||
}
|
||||
function r() public returns (bool[3] memory) {
|
||||
return [true, false, true];
|
||||
}
|
||||
function s() public returns (uint[2] memory, uint) {
|
||||
return ([uint(123), 456], 789);
|
||||
}
|
||||
function t1() public returns (S memory) {
|
||||
return S(23, 42);
|
||||
}
|
||||
function t2() public returns (T memory) {
|
||||
return T(23, 42, "any");
|
||||
}
|
||||
function u() public returns (T[2] memory) {
|
||||
return [T(23, 42, "any"), T(555, 666, "any")];
|
||||
}
|
||||
function v() public returns (bool[2][] memory) {
|
||||
return flags;
|
||||
}
|
||||
function w1() public returns (string[1] memory) {
|
||||
return ["any"];
|
||||
}
|
||||
function w2() public returns (string[2] memory) {
|
||||
return ["any", "any"];
|
||||
}
|
||||
function w3() public returns (string[3] memory) {
|
||||
return ["any", "any", "any"];
|
||||
}
|
||||
function x() public returns (string[2] memory, string[3] memory) {
|
||||
return (["any", "any"], ["any", "any", "any"]);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >homestead
|
||||
// ----
|
||||
// constructor(), 2 ether: 3 ->
|
||||
// state() -> 3
|
||||
// balance() -> 2
|
||||
// _() -> FAILURE
|
||||
// d(uint256): 4
|
||||
// e() -> FAILURE, hex"08c379a0", 0x20, 19, "Transaction failed."
|
||||
// f() -> 2
|
||||
// f(uint256): 3 -> 3, 3
|
||||
// f(), 1 ether -> 2
|
||||
// g() -> 2, 3
|
||||
// g1() -> FAILURE
|
||||
// h(uint256,uint256): 1, -2 -> 3
|
||||
// j(bool): true -> false
|
||||
// k(bytes32): 0x10001 -> 0x10001, 0x10001
|
||||
// l(): hex"4200efef" -> 8
|
||||
// m(bytes): 32, 32, 0x20 -> 32, 32, 0x20
|
||||
// m(bytes): 32, 3, hex"AB33BB" -> 32, 3, left(0xAB33BB)
|
||||
// m(bytes): 32, 3, hex"AB33FF" -> 32, 3, hex"ab33ff0000000000000000000000000000000000000000000000000000000000"
|
||||
// n() -> 0x20, 3, "any"
|
||||
// o() -> 0x40, 0x80, 3, "any", 3, "any"
|
||||
// p() -> 0x60, 0x2a, 0xa0, 3, "any", 3, "any"
|
||||
// q(uint256): 99 -> 693
|
||||
// r() -> true, false, true
|
||||
// s() -> 123, 456, 789
|
||||
// t1() -> 23, 42
|
||||
// t2() -> 0x20, 23, 42, 0x60, 3, "any"
|
||||
// v() -> 32, 0
|
||||
// w1() -> 0x20, 0x20, 3, "any"
|
||||
// w2() -> 0x20, 0x40, 0x80, 3, "any", 3, "any"
|
||||
// w3() -> 0x20, 0x60, 0xa0, 0xe0, 3, "any", 3, "any", 3, "any"
|
||||
// x() -> 0x40, 0x0100, 0x40, 0x80, 3, "any", 3, "any", 0x60, 0xa0, 0xe0, 3, "any", 3, "any", 3, "any"
|
Loading…
Reference in New Issue
Block a user