Skip to content

Commit

Permalink
Add test for [[B
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Marie Mineau committed Apr 23, 2024
1 parent 1e23abb commit 428619d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/config.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ANDROID_SDK_ROOT ?= $(shell echo ~/Android/Sdk)
ANDROID_NDK_ROOT ?= $(shell echo ~/.local/opt/android-ndk-r25b
ANDROID_NDK_ROOT ?= $(shell echo ~/.local/opt/android-ndk-r25b)
ANDROID_ARCH ?= arm64
ANDROID_ABI ?= arm64-v8a
ANDROID_API_LEVEL ?= 33
Expand Down
18 changes: 18 additions & 0 deletions test/re/frida/MethodTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ public void primitiveArrayCanBePassed() {
assertEquals("12", script.getNextMessage());
}

@Test
public void primitive2DArrayCanBePassed() {
loadScript("var Buffinator = Java.use('re.frida.Buffinator');" +
"var buffinator = Buffinator.$new();" +
"send(buffinator.sum2d([[ 1, 2, 3 ], [4, 5, 6], [7, 8, 9]]));");
assertEquals("45", script.getNextMessage());
}

@Test
public void primitiveArrayCanBeModified() {
loadScript("var Buffinator = Java.use('re.frida.Buffinator');" +
Expand Down Expand Up @@ -620,6 +628,16 @@ public int sum(byte[] values) {
return result;
}

public int sum2d(byte[][] values) {
int result = 0;
for (byte[] array: values) {
for (byte value : array) {
result += value;
}
}
return result;
}

public void bump(int[] values) {
for (int i = 0; i != values.length; i++) {
values[i] += 1000;
Expand Down

0 comments on commit 428619d

Please sign in to comment.