-
Notifications
You must be signed in to change notification settings - Fork 294
Open
Description
I have this code that works on OSX:
NSMeasurement *measurement = [[NSMeasurement alloc] initWithDoubleValue:value unit:fromUnit];
if ([measurement canBeConvertedToUnit:toUnit]) {
return [measurement measurementByConvertingToUnit:toUnit].doubleValue;
}but for GNUstep I have to do instead:
if ([fromUnit isKindOfClass:[NSDimension class]] && [toUnit isKindOfClass:[NSDimension class]]) {
NSUnitConverter *fromConv = [(NSDimension *)fromUnit converter];
NSUnitConverter *toConv = [(NSDimension *)toUnit converter];
double baseValue = [fromConv baseUnitValueFromValue:value];
return [toConv valueFromBaseUnitValue:baseValue];
}The code is here. You can comment out the GNUSTEP segment and run XCTest and you'll find that UDUnitConverter fails without the workaround.
I'll probably submit a PR for this, if you think it's worth fixing.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels