Add test cases.

This commit is contained in:
Daniel Kirchner 2018-07-12 15:10:08 +02:00
parent f6f8fe6450
commit faa55f6544
12 changed files with 139 additions and 0 deletions

View File

@ -0,0 +1,7 @@
contract Test {
struct MyStructName {
address addr;
MyStructName[] x;
}
}
// ----

View File

@ -0,0 +1,8 @@
contract Test {
struct MyStructName {
address addr;
MyStructName[1] x;
}
}
// ----
// TypeError: (20-96): Recursive struct definition.

View File

@ -0,0 +1,18 @@
contract Test {
struct MyStructName1 {
address addr;
uint256 count;
MyStructName4[1] x;
}
struct MyStructName2 {
MyStructName1 x;
}
struct MyStructName3 {
MyStructName2[1] x;
}
struct MyStructName4 {
MyStructName3 x;
}
}
// ----
// TypeError: (20-121): Recursive struct definition.

View File

@ -0,0 +1,11 @@
contract Test {
struct MyStructName1 {
address addr;
uint256 count;
MyStructName2[] x;
}
struct MyStructName2 {
MyStructName1 x;
}
}
// ----

View File

@ -0,0 +1,11 @@
contract Test {
struct MyStructName1 {
address addr;
uint256 count;
MyStructName2 x;
}
struct MyStructName2 {
MyStructName1[] x;
}
}
// ----

View File

@ -0,0 +1,11 @@
contract Test {
struct MyStructName1 {
address addr;
uint256 count;
MyStructName2[] x;
}
struct MyStructName2 {
MyStructName1[] x;
}
}
// ----

View File

@ -0,0 +1,21 @@
contract Test {
struct S1 {
S2[1][] x;
}
struct S2 {
S1 x;
}
struct T1 {
T2[][1] x;
}
struct T2 {
T1 x;
}
struct R1 {
R2[][] x;
}
struct R2 {
R1 x;
}
}
// ----

View File

@ -0,0 +1,12 @@
contract Test {
struct MyStructName1 {
address addr;
uint256 count;
MyStructName2[1] x;
}
struct MyStructName2 {
MyStructName1 x;
}
}
// ----
// TypeError: (20-121): Recursive struct definition.

View File

@ -0,0 +1,12 @@
contract Test {
struct MyStructName1 {
address addr;
uint256 count;
MyStructName2 x;
}
struct MyStructName2 {
MyStructName1[1] x;
}
}
// ----
// TypeError: (20-118): Recursive struct definition.

View File

@ -0,0 +1,12 @@
contract Test {
struct MyStructName1 {
address addr;
uint256 count;
MyStructName2[1] x;
}
struct MyStructName2 {
MyStructName1[1] x;
}
}
// ----
// TypeError: (20-121): Recursive struct definition.

View File

@ -0,0 +1,12 @@
contract Test {
struct MyStructName1 {
address addr;
uint256 count;
MyStructName2[1][1] x;
}
struct MyStructName2 {
MyStructName1 x;
}
}
// ----
// TypeError: (20-124): Recursive struct definition.

View File

@ -0,0 +1,4 @@
contract Test {
struct S1 { uint a; }
struct S2 { S1[1] x; S1[1] y; }
}