mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-08-02 00:31:24 +00:00
ScriptChunkTest: Use Guava for concatenating byte arrays.
This commit is contained in:
@@ -28,7 +28,8 @@ import static org.junit.Assert.assertTrue;
|
||||
import java.util.Random;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.spongycastle.util.Arrays;
|
||||
|
||||
import com.google.common.primitives.Bytes;
|
||||
|
||||
public class ScriptChunkTest {
|
||||
|
||||
@@ -75,7 +76,7 @@ public class ScriptChunkTest {
|
||||
for (byte len = 1; len < OP_PUSHDATA1; len++) {
|
||||
byte[] bytes = new byte[len];
|
||||
RANDOM.nextBytes(bytes);
|
||||
byte[] expected = Arrays.concatenate(new byte[] { len }, bytes);
|
||||
byte[] expected = Bytes.concat(new byte[] { len }, bytes);
|
||||
byte[] actual = new ScriptChunk(len, bytes).toByteArray();
|
||||
assertArrayEquals(expected, actual);
|
||||
}
|
||||
@@ -86,7 +87,7 @@ public class ScriptChunkTest {
|
||||
// OP_PUSHDATA1
|
||||
byte[] bytes = new byte[0xFF];
|
||||
RANDOM.nextBytes(bytes);
|
||||
byte[] expected = Arrays.concatenate(new byte[] { OP_PUSHDATA1, (byte) 0xFF }, bytes);
|
||||
byte[] expected = Bytes.concat(new byte[] { OP_PUSHDATA1, (byte) 0xFF }, bytes);
|
||||
byte[] actual = new ScriptChunk(OP_PUSHDATA1, bytes).toByteArray();
|
||||
assertArrayEquals(expected, actual);
|
||||
}
|
||||
@@ -96,7 +97,7 @@ public class ScriptChunkTest {
|
||||
// OP_PUSHDATA2
|
||||
byte[] bytes = new byte[0x0102];
|
||||
RANDOM.nextBytes(bytes);
|
||||
byte[] expected = Arrays.concatenate(new byte[] { OP_PUSHDATA2, 0x02, 0x01 }, bytes);
|
||||
byte[] expected = Bytes.concat(new byte[] { OP_PUSHDATA2, 0x02, 0x01 }, bytes);
|
||||
byte[] actual = new ScriptChunk(OP_PUSHDATA2, bytes).toByteArray();
|
||||
assertArrayEquals(expected, actual);
|
||||
}
|
||||
@@ -106,7 +107,7 @@ public class ScriptChunkTest {
|
||||
// OP_PUSHDATA4
|
||||
byte[] bytes = new byte[0x0102];
|
||||
RANDOM.nextBytes(bytes);
|
||||
byte[] expected = Arrays.concatenate(new byte[] { OP_PUSHDATA4, 0x02, 0x01, 0x00, 0x00 }, bytes);
|
||||
byte[] expected = Bytes.concat(new byte[] { OP_PUSHDATA4, 0x02, 0x01, 0x00, 0x00 }, bytes);
|
||||
byte[] actual = new ScriptChunk(OP_PUSHDATA4, bytes).toByteArray();
|
||||
assertArrayEquals(expected, actual);
|
||||
}
|
||||
|
Reference in New Issue
Block a user