Add syntax tests for bytesM

This commit is contained in:
Alex Beregszaszi 2018-04-30 12:58:33 +01:00
parent e0b178e1c5
commit c44294d02d
5 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,11 @@
contract C {
function f() {
var a = "";
bytes1 b = bytes1(a);
bytes memory c = bytes(a);
string memory d = string(a);
}
}
// ----
// Warning: (34-39): Use of the "var" keyword is deprecated.
// TypeError: (61-70): Explicit type conversion not allowed from "string memory" to "bytes1".

View File

@ -0,0 +1,5 @@
contract C {
bytes0 b0 = 1;
}
// ----
// DeclarationError: (15-21): Identifier not found or not unique.

View File

@ -0,0 +1,5 @@
contract C {
bytes256 b256 = 1;
}
// ----
// DeclarationError: (15-23): Identifier not found or not unique.

View File

@ -0,0 +1,5 @@
contract C {
bytes33 b33 = 1;
}
// ----
// DeclarationError: (15-22): Identifier not found or not unique.

View File

@ -0,0 +1,36 @@
contract C {
byte b = byte(1);
bytes1 b1 = b;
bytes2 b2 = b1;
bytes3 b3 = b2;
bytes4 b4 = b3;
bytes5 b5 = b4;
bytes6 b6 = b5;
bytes7 b7 = b6;
bytes8 b8 = b7;
bytes9 b9 = b8;
bytes10 b10 = b9;
bytes11 b11 = b10;
bytes12 b12 = b11;
bytes13 b13 = b12;
bytes14 b14 = b13;
bytes15 b15 = b14;
bytes16 b16 = b15;
bytes17 b17 = b16;
bytes18 b18 = b17;
bytes19 b19 = b18;
bytes20 b20 = b19;
bytes21 b21 = b20;
bytes22 b22 = b21;
bytes23 b23 = b22;
bytes24 b24 = b23;
bytes25 b25 = b24;
bytes26 b26 = b25;
bytes27 b27 = b26;
bytes28 b28 = b27;
bytes29 b29 = b28;
bytes30 b30 = b29;
bytes31 b31 = b30;
bytes32 b32 = b31;
}
// ----