Skip to content

Commit

Permalink
Fix test typing
Browse files Browse the repository at this point in the history
  • Loading branch information
dbwiddis committed Sep 12, 2019
1 parent 0662b64 commit 0806012
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
8 changes: 2 additions & 6 deletions contrib/platform/src/com/sun/jna/platform/mac/IOKit.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public interface IOKit extends Library {

MachPort MACH_PORT_NULL = new MachPort();



/**
* IOKitLib implements non-kernel task access to common IOKit object types -
* IORegistryEntry, IOService, IOIterator etc. These functions are generic -
Expand Down Expand Up @@ -322,8 +320,7 @@ CFTypeRef IORegistryEntryCreateCFProperty(IORegistryEntry entry, CFStringRef key
* @return 0 if successful, otherwise a {@code kern_return_t} error code.
*/
int IORegistryEntryCreateCFProperties(IORegistryEntry entry, PointerByReference properties,
CFAllocatorRef allocator,
int options);
CFAllocatorRef allocator, int options);

/**
* Create a CF representation of a registry entry's property.
Expand All @@ -348,8 +345,7 @@ int IORegistryEntryCreateCFProperties(IORegistryEntry entry, PointerByReference
* caller should release with CFRelease.
*/
CFTypeRef IORegistryEntrySearchCFProperty(IORegistryEntry entry, String plane, CFStringRef key,
CFAllocatorRef allocator,
int options);
CFAllocatorRef allocator, int options);

/**
* Returns an ID for the registry entry that is global to all tasks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class CoreFoundationTest {
public void testCFStringRef() {
String awesome = "ǝɯosǝʍɐ sı ∀Nſ"; // Unicode
CFStringRef cfAwesome = CFStringRef.createCFString(awesome);
assertEquals(awesome.length(), CF.CFStringGetLength(cfAwesome));
assertEquals(awesome.length(), CF.CFStringGetLength(cfAwesome).intValue());
assertEquals(awesome, cfAwesome.stringValue());

Memory mem = new Memory(awesome.getBytes().length + 1);
Expand Down Expand Up @@ -105,13 +105,13 @@ public void testCFRetainCount() {
DoubleByReference e = new DoubleByReference(Math.E);
CFNumberRef cfE = CF.CFNumberCreate(null, CFNumberType.kCFNumberDoubleType.typeIndex(), e);
CFNumberRef cfPi = CF.CFNumberCreate(null, CFNumberType.kCFNumberDoubleType.typeIndex(), pi);
assertEquals(1, CF.CFGetRetainCount(cfE));
assertEquals(1, CF.CFGetRetainCount(cfPi));
assertEquals(1, CF.CFGetRetainCount(cfE).intValue());
assertEquals(1, CF.CFGetRetainCount(cfPi).intValue());
cfE.retain();
cfPi.retain();
cfPi.retain();
assertEquals(2, CF.CFGetRetainCount(cfE));
assertEquals(3, CF.CFGetRetainCount(cfPi));
assertEquals(2, CF.CFGetRetainCount(cfE).intValue());
assertEquals(3, CF.CFGetRetainCount(cfPi).intValue());

List<CFTypeRef> irrationalReferences = new ArrayList<>();
irrationalReferences.add(cfE);
Expand All @@ -120,10 +120,10 @@ public void testCFRetainCount() {
value.release();
}

assertEquals(1, CF.CFGetRetainCount(cfE));
assertEquals(2, CF.CFGetRetainCount(cfPi));
assertEquals(1, CF.CFGetRetainCount(cfE).intValue());
assertEquals(2, CF.CFGetRetainCount(cfPi).intValue());
cfPi.release();
assertEquals(1, CF.CFGetRetainCount(cfPi));
assertEquals(1, CF.CFGetRetainCount(cfPi).intValue());
cfE.release();
cfPi.release();
}
Expand All @@ -140,7 +140,7 @@ public void testCFArray() {
}
CFArrayRef cfPtrArray = CF.CFArrayCreate(null, contiguousArray, new CFIndex(refArray.length), null);

assertEquals(refArray.length, CF.CFArrayGetCount(cfPtrArray));
assertEquals(refArray.length, CF.CFArrayGetCount(cfPtrArray).intValue());
for (int i = 0; i < refArray.length; i++) {
Pointer result = CF.CFArrayGetValueAtIndex(cfPtrArray, new CFIndex(i));
CFNumberRef numRef = new CFNumberRef(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public void testIteratorParentChild() {
// Iterate over USB Controllers. All devices are children of one of
// these controllers in the "IOService" plane
IOIterator iter = IOKitUtil.getMatchingServices("IOUSBController");
assertNotNull(iter);
IORegistryEntry controllerDevice = iter.next();
while (controllerDevice != null) {
LongByReference id = new LongByReference();
Expand Down

0 comments on commit 0806012

Please sign in to comment.