Skip to content

Commit b9e0c3e

Browse files
committed
add test
1 parent f4f5065 commit b9e0c3e

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Samples/SwiftJavaExtractJNISampleApp/Sources/MySwiftLibrary/MySwiftLibrary.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ public func echoUnsignedInt(i: UInt32, j: UInt64) -> UInt64 {
5252
return UInt64(i) + j
5353
}
5454

55+
public func returnUnsignedByte(b: UInt8) -> UInt8 {
56+
return b
57+
}
58+
59+
public func returnLargestUnsignedByte() -> UInt8 {
60+
return UInt8.max
61+
}
62+
5563
// ==== Internal helpers
5664

5765
func p(_ msg: String, file: String = #fileID, line: UInt = #line, function: String = #function) {

Samples/SwiftJavaExtractJNISampleApp/src/test/java/com/example/swift/MySwiftLibraryTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,14 @@ void globalUnsignedIntEcho() {
6868
long l = 1200;
6969
assertEquals(1212, MySwiftLibrary.echoUnsignedInt(12, 1200));
7070
}
71+
72+
@Test
73+
void returnUnsignedByte_negative() {
74+
assertEquals(-50, MySwiftLibrary.returnUnsignedByte((byte) -50));
75+
}
76+
77+
@Test
78+
void returnLargestUnsignedByte() {
79+
assertEquals(-1, MySwiftLibrary.returnLargestUnsignedByte());
80+
}
7181
}

0 commit comments

Comments
 (0)