mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -546,7 +546,7 @@ public class ArrayUtilTest {
|
||||
public void lastIndexOfSubTest2() {
|
||||
final Integer[] a = {0x12, 0x56, 0x78, 0x56, 0x21, 0x9A};
|
||||
final Integer[] b = {0x56, 0x78};
|
||||
final int i = ArrayUtil.indexOfSub(a, b);
|
||||
final int i = ArrayUtil.lastIndexOfSub(a, b);
|
||||
assertEquals(1, i);
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,46 @@
|
||||
package org.dromara.hutool.core.array;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class IssueIAQ16ETest {
|
||||
|
||||
@Test
|
||||
void lastIndexOfSubTest() {
|
||||
final Integer[] bigBytes = new Integer[]{1, 2, 2, 2, 3, 2, 2, 2, 3};
|
||||
final Integer[] subBytes = new Integer[]{2, 2};
|
||||
int i = ArrayUtil.lastIndexOfSub(bigBytes, subBytes);
|
||||
assertEquals(6, i);
|
||||
|
||||
i = ArrayUtil.lastIndexOfSub(bigBytes, 3, subBytes);
|
||||
assertEquals(2, i);
|
||||
}
|
||||
|
||||
@Test
|
||||
void lastIndexOfSubTest2() {
|
||||
final Integer[] bigBytes = new Integer[]{1, 2, 2, 2, 3, 2, 2, 2, 3, 4, 5};
|
||||
final Integer[] subBytes = new Integer[]{2, 2, 2, 3};
|
||||
final int i = ArrayUtil.lastIndexOfSub(bigBytes, subBytes);
|
||||
assertEquals(5, i);
|
||||
}
|
||||
|
||||
@Test
|
||||
void indexOfSubTest() {
|
||||
final Integer[] bigBytes = new Integer[]{1, 2, 2, 2, 3, 2, 2, 2, 3};
|
||||
final Integer[] subBytes = new Integer[]{2, 2};
|
||||
int i = ArrayUtil.indexOfSub(bigBytes, subBytes);
|
||||
assertEquals(1, i);
|
||||
|
||||
i = ArrayUtil.indexOfSub(bigBytes, 3, subBytes);
|
||||
assertEquals(5, i);
|
||||
}
|
||||
|
||||
@Test
|
||||
void indexOfSubTest2() {
|
||||
final Integer[] bigBytes = new Integer[]{1, 2, 2, 2, 3, 2, 2, 2, 3, 4, 5};
|
||||
final Integer[] subBytes = new Integer[]{2, 2, 2, 3};
|
||||
final int i = ArrayUtil.indexOfSub(bigBytes, subBytes);
|
||||
assertEquals(1, i);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user