This is an automated email from the ASF dual-hosted git repository.

toulmean pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git


The following commit(s) were added to refs/heads/master by this push:
     new 4362d06  Add test to make sure slicing long inputs works well for 
Bytes32
4362d06 is described below

commit 4362d06e532079896e9498fcf82dfe5d05c238e2
Author: Antoine Toulme <[email protected]>
AuthorDate: Wed Mar 11 21:59:52 2020 -0700

    Add test to make sure slicing long inputs works well for Bytes32
---
 .../src/test/java/org/apache/tuweni/bytes/Bytes32Test.java  | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/bytes/src/test/java/org/apache/tuweni/bytes/Bytes32Test.java 
b/bytes/src/test/java/org/apache/tuweni/bytes/Bytes32Test.java
index c42aa9c..2fa3813 100644
--- a/bytes/src/test/java/org/apache/tuweni/bytes/Bytes32Test.java
+++ b/bytes/src/test/java/org/apache/tuweni/bytes/Bytes32Test.java
@@ -66,4 +66,17 @@ class Bytes32Test {
     Throwable exception = assertThrows(IllegalArgumentException.class, () -> 
Bytes32.rightPad(MutableBytes.create(33)));
     assertEquals("Expected at most 32 bytes but got 33", 
exception.getMessage());
   }
+
+  @Test
+  void testWrapSlicesCorrectly() {
+    Bytes input = Bytes.fromHexString(
+        
"0xA99A76ED7796F7BE22D5B7E85DEEB7C5677E88E511E0B337618F8C4EB61349B4BF2D153F649F7B53359FE8B94A38E44C00000000000000000000000000000000");
+    Bytes32 value = Bytes32.wrap(input, 0);
+    
assertEquals(Bytes.fromHexString("0xA99A76ED7796F7BE22D5B7E85DEEB7C5677E88E511E0B337618F8C4EB61349B4"),
 value);
+
+    Bytes32 secondValue = Bytes32.wrap(input, 32);
+    assertEquals(
+        
Bytes.fromHexString("0xBF2D153F649F7B53359FE8B94A38E44C00000000000000000000000000000000"),
+        secondValue);
+  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to