Skip to content

Commit

Permalink
add few tests about bytearray filling.
Browse files Browse the repository at this point in the history
  • Loading branch information
tito committed Feb 7, 2015
1 parent d9cdbb7 commit 614e436
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/org/jnius/BasicsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,12 @@ public boolean methodParamsArrayByte(byte[] x) {
return false;
return (x[0] == 127 && x[1] == 127 && x[2] == 127);
}

public void fillByteArray(byte[] x) {
if (x.length != 3)
return;
x[0] = 127;
x[1] = 1;
x[2] = -127;
}
}
8 changes: 8 additions & 0 deletions tests/test_bytearray.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,11 @@ def test_string_arg_for_byte_array(self):
def test_string_arg_with_signed_char(self):
ByteBuffer = autoclass('java.nio.ByteBuffer')
self.assertIsNotNone(ByteBuffer.wrap('\x00\xffHello World\x7f'))

def test_fill_byte_array(self):
arr = [0, 0, 0]
Test = autoclass('org.jnius.BasicsTest')()
Test.fillByteArray(arr)
self.assertEquals(
arr,
[127, 1, -127])

0 comments on commit 614e436

Please sign in to comment.