You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuweni.apache.org by to...@apache.org on 2022/06/01 05:22:18 UTC
[incubator-tuweni] branch main updated: add a test for creating some code
This is an automated email from the ASF dual-hosted git repository.
toulmean pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git
The following commit(s) were added to refs/heads/main by this push:
new 23c71236 add a test for creating some code
new 6c6f1668 Merge pull request #411 from atoulme/add_code_test
23c71236 is described below
commit 23c71236f5a35a36ae7ae20bbf198438e556a110
Author: Antoine Toulme <an...@lunar-ocean.com>
AuthorDate: Tue May 31 21:51:29 2022 -0700
add a test for creating some code
---
.../src/test/kotlin/org/apache/tuweni/evmdsl/CodeTest.kt | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/evm-dsl/src/test/kotlin/org/apache/tuweni/evmdsl/CodeTest.kt b/evm-dsl/src/test/kotlin/org/apache/tuweni/evmdsl/CodeTest.kt
index 31f5dfeb..dcdd6485 100644
--- a/evm-dsl/src/test/kotlin/org/apache/tuweni/evmdsl/CodeTest.kt
+++ b/evm-dsl/src/test/kotlin/org/apache/tuweni/evmdsl/CodeTest.kt
@@ -18,6 +18,7 @@ package org.apache.tuweni.evmdsl
import org.apache.tuweni.bytes.Bytes
import org.junit.jupiter.api.Assertions.assertEquals
+import org.junit.jupiter.api.Assertions.assertNull
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertDoesNotThrow
@@ -98,4 +99,19 @@ class CodeTest {
assertEquals(1024, err.index)
assertEquals(Error.STACK_OVERFLOW, err.error)
}
+
+ @Test
+ fun testCreateASimpleReturn() {
+ val code = Code(
+ buildList {
+ this.add(Push(Bytes.wrap("hello world".toByteArray())))
+ this.add(Push(Bytes.fromHexString("0x00")))
+ this.add(Mstore)
+ this.add(Push(Bytes.of("hello world".toByteArray().size)))
+ this.add(Push(Bytes.of(32 - "hello world".toByteArray().size)))
+ this.add(Return)
+ }
+ )
+ assertNull(code.validate()?.error)
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tuweni.apache.org
For additional commands, e-mail: commits-help@tuweni.apache.org