Skip to content

Commit b8e710e

Browse files
committed
add multiple arguments test
1 parent 9aa4dca commit b8e710e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Samples/JExtractJNISampleApp/Sources/MySwiftLibrary/Closures.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,12 @@ public func closureWithInt(input: Int64, closure: (Int64) -> Int64) -> Int64 {
2020
return closure(input)
2121
}
2222

23+
public func closureMultipleArguments(
24+
input1: Int64,
25+
input2: Int64,
26+
closure: (Int64, Int64) -> Int64
27+
) -> Int64 {
28+
return closure(input1, input2)
29+
}
30+
2331

Samples/JExtractJNISampleApp/src/test/java/com/example/swift/ClosuresTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,10 @@ void closureWithInt() {
3535
long result = MySwiftLibrary.closureWithInt(10, (value) -> value * 2);
3636
assertEquals(20, result);
3737
}
38+
39+
@Test
40+
void closureMultipleArguments() {
41+
long result = MySwiftLibrary.closureMultipleArguments(5, 10, (a, b) -> a + b);
42+
assertEquals(15, result);
43+
}
3844
}

0 commit comments

Comments
 (0)