SerpentCompileTest fix
This commit is contained in:
parent
d2b3a48464
commit
ab702f8d8c
|
@ -1258,7 +1258,7 @@ public class SerpentCompileTest {
|
||||||
String code = "c = 2\n" +
|
String code = "c = 2\n" +
|
||||||
"d = 3\n" +
|
"d = 3\n" +
|
||||||
"a = [11, 22, 33]" ;
|
"a = [11, 22, 33]" ;
|
||||||
String expected = "0 63 MSTORE8 2 0 MSTORE 3 32 MSTORE MSIZE DUP DUP 32 ADD 11 SWAP MSTORE DUP 64 ADD 22 SWAP MSTORE DUP 96 ADD 33 SWAP MSTORE 128 SWAP MSTORE";
|
String expected = "0 63 MSTORE8 2 0 MSTORE 3 32 MSTORE MSIZE 32 ADD MSIZE DUP 32 ADD 11 SWAP MSTORE DUP 64 ADD 22 SWAP MSTORE DUP 96 ADD 33 SWAP MSTORE 128 SWAP MSTORE";
|
||||||
|
|
||||||
String asmResult = SerpentCompiler.compile(code);
|
String asmResult = SerpentCompiler.compile(code);
|
||||||
Assert.assertEquals(expected, asmResult);
|
Assert.assertEquals(expected, asmResult);
|
||||||
|
@ -1269,7 +1269,7 @@ public class SerpentCompileTest {
|
||||||
public void test46(){
|
public void test46(){
|
||||||
String code = "a = [11, 22, 33]\n" +
|
String code = "a = [11, 22, 33]\n" +
|
||||||
"a[ 2 ] = 3" ;
|
"a[ 2 ] = 3" ;
|
||||||
String expected = "MSIZE DUP DUP 32 ADD 11 SWAP MSTORE DUP 64 ADD 22 SWAP MSTORE DUP 96 ADD 33 SWAP MSTORE 128 SWAP MSTORE 3 32 2 MUL 32 ADD 0 ADD 0 ADD MSTORE";
|
String expected = "MSIZE 32 ADD MSIZE DUP 32 ADD 11 SWAP MSTORE DUP 64 ADD 22 SWAP MSTORE DUP 96 ADD 33 SWAP MSTORE 128 SWAP MSTORE 3 32 2 MUL 32 ADD 0 ADD 0 ADD MSTORE";
|
||||||
|
|
||||||
String asmResult = SerpentCompiler.compile(code);
|
String asmResult = SerpentCompiler.compile(code);
|
||||||
Assert.assertEquals(expected, asmResult);
|
Assert.assertEquals(expected, asmResult);
|
||||||
|
@ -1294,7 +1294,7 @@ public class SerpentCompileTest {
|
||||||
"b = [12, 14]\n" +
|
"b = [12, 14]\n" +
|
||||||
"c = [22, 24, 25]\n" +
|
"c = [22, 24, 25]\n" +
|
||||||
"c[ 0 ] = 3" ;
|
"c[ 0 ] = 3" ;
|
||||||
String expected = "MSIZE DUP DUP 32 ADD 2 SWAP MSTORE DUP 64 ADD 4 SWAP MSTORE DUP 96 ADD 6 SWAP MSTORE 128 SWAP MSTORE MSIZE DUP DUP 32 ADD 12 SWAP MSTORE DUP 64 ADD 14 SWAP MSTORE 96 SWAP MSTORE MSIZE DUP DUP 32 ADD 22 SWAP MSTORE DUP 64 ADD 24 SWAP MSTORE DUP 96 ADD 25 SWAP MSTORE 128 SWAP MSTORE 3 32 0 MUL 32 ADD 224 ADD 0 ADD MSTORE";
|
String expected = "MSIZE 32 ADD MSIZE DUP 32 ADD 2 SWAP MSTORE DUP 64 ADD 4 SWAP MSTORE DUP 96 ADD 6 SWAP MSTORE 128 SWAP MSTORE MSIZE 32 ADD MSIZE DUP 32 ADD 12 SWAP MSTORE DUP 64 ADD 14 SWAP MSTORE 96 SWAP MSTORE MSIZE 32 ADD MSIZE DUP 32 ADD 22 SWAP MSTORE DUP 64 ADD 24 SWAP MSTORE DUP 96 ADD 25 SWAP MSTORE 128 SWAP MSTORE 3 32 0 MUL 32 ADD 224 ADD 0 ADD MSTORE";
|
||||||
String asmResult = SerpentCompiler.compile(code);
|
String asmResult = SerpentCompiler.compile(code);
|
||||||
Assert.assertEquals(expected, asmResult);
|
Assert.assertEquals(expected, asmResult);
|
||||||
}
|
}
|
||||||
|
@ -1305,7 +1305,7 @@ public class SerpentCompileTest {
|
||||||
"c = 2\n" +
|
"c = 2\n" +
|
||||||
"a = [11, 22, 33]\n" +
|
"a = [11, 22, 33]\n" +
|
||||||
"a[ 2 ] = 3" ;
|
"a[ 2 ] = 3" ;
|
||||||
String expected = "0 63 MSTORE8 1 0 MSTORE 2 32 MSTORE MSIZE DUP DUP 32 ADD 11 SWAP MSTORE DUP 64 ADD 22 SWAP MSTORE DUP 96 ADD 33 SWAP MSTORE 128 SWAP MSTORE 3 32 2 MUL 32 ADD 0 ADD 64 ADD MSTORE";
|
String expected = "0 63 MSTORE8 1 0 MSTORE 2 32 MSTORE MSIZE 32 ADD MSIZE DUP 32 ADD 11 SWAP MSTORE DUP 64 ADD 22 SWAP MSTORE DUP 96 ADD 33 SWAP MSTORE 128 SWAP MSTORE 3 32 2 MUL 32 ADD 0 ADD 64 ADD MSTORE";
|
||||||
|
|
||||||
String asmResult = SerpentCompiler.compile(code);
|
String asmResult = SerpentCompiler.compile(code);
|
||||||
Assert.assertEquals(expected, asmResult);
|
Assert.assertEquals(expected, asmResult);
|
||||||
|
@ -1318,7 +1318,7 @@ public class SerpentCompileTest {
|
||||||
String code = "c = [5]\n" +
|
String code = "c = [5]\n" +
|
||||||
"a = [11, 22, 33]\n" +
|
"a = [11, 22, 33]\n" +
|
||||||
"b = a [0]" ;
|
"b = a [0]" ;
|
||||||
String expected = "0 31 MSTORE8 MSIZE DUP DUP 32 ADD 5 SWAP MSTORE 64 SWAP MSTORE MSIZE DUP DUP 32 ADD 11 SWAP MSTORE DUP 64 ADD 22 SWAP MSTORE DUP 96 ADD 33 SWAP MSTORE 128 SWAP MSTORE 32 0 MUL 96 ADD 32 ADD MLOAD 0 MSTORE";
|
String expected = "0 31 MSTORE8 MSIZE 32 ADD MSIZE DUP 32 ADD 5 SWAP MSTORE 64 SWAP MSTORE MSIZE 32 ADD MSIZE DUP 32 ADD 11 SWAP MSTORE DUP 64 ADD 22 SWAP MSTORE DUP 96 ADD 33 SWAP MSTORE 128 SWAP MSTORE 32 0 MUL 96 ADD 32 ADD MLOAD 0 MSTORE";
|
||||||
|
|
||||||
String asmResult = SerpentCompiler.compile(code);
|
String asmResult = SerpentCompiler.compile(code);
|
||||||
Assert.assertEquals(expected, asmResult);
|
Assert.assertEquals(expected, asmResult);
|
||||||
|
|
Loading…
Reference in New Issue