Skip to content

Commit

Permalink
test update
Browse files Browse the repository at this point in the history
  • Loading branch information
bosborn committed Jan 6, 2023
1 parent da68329 commit 041e633
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1410"
LastUpgradeVersion = "1420"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
44 changes: 39 additions & 5 deletions geopackage-iosTests/geom/GPKGGeoPackageGeometryDataUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,53 @@ +(void) compareGeometryDataWithExpected: (GPKGGeometryData *) expected andActual
// Compare header bytes
[self compareByteArrayWithExpected:[expected headerData] andActual:[actual headerData]];

SFGeometry *expectedGeometry = expected.geometry;
SFGeometry *actualGeometry = actual.geometry;

NSData *expectedWKB = [expected wkb];
NSData *actualWKB = [actual wkb];

NSData *expectedData = [expected data];
NSData *actualData = [actual data];

if(expectedGeometry != nil && actualGeometry != nil && expectedGeometry.geometryType == SF_MULTILINESTRING){
if(!([actualGeometry isKindOfClass:[SFMultiLineString class]])){
SFGeometryCollection *geomCollection = (SFGeometryCollection *) actualGeometry;
SFMultiLineString *multiLineString = [SFMultiLineString multiLineString];
[multiLineString addGeometries:geomCollection.geometries];
actualGeometry = multiLineString;
int wkbLocation;
int dataLocation;
if(actual.byteOrder == CFByteOrderBigEndian){
wkbLocation = 4;
dataLocation = 12;
}else{
wkbLocation = 1;
dataLocation = 9;
}
int code = [SFWBGeometryCodes codeFromGeometryType:SF_MULTICURVE];
NSMutableData *actualWKBMutable = [[NSMutableData alloc] initWithData:actualWKB];
NSMutableData *actualDataMutable = [[NSMutableData alloc] initWithData:actualData];
[actualWKBMutable replaceBytesInRange:NSMakeRange(wkbLocation, 1) withBytes:(char*) &code];
[actualDataMutable replaceBytesInRange:NSMakeRange(dataLocation, 1) withBytes:(char*) &code];
actualWKB = actualWKBMutable;
actualData = actualDataMutable;
}
}

// Compare geometries
[self compareGeometriesWithExpected:expected.geometry andActual:actual.geometry andDelta:.00000001];
[self compareGeometriesWithExpected:expectedGeometry andActual:actualGeometry andDelta:.00000001];

// Compare well-known binary geometries
[GPKGTestUtils assertEqualIntWithValue:(int)[expected wkb].length andValue2:(int)[actual wkb].length];
[GPKGTestUtils assertEqualIntWithValue:(int)expectedWKB.length andValue2:(int)actualWKB.length];
if(compareGeometryBytes){
[self compareByteArrayWithExpected:[expected wkb] andActual:[actual wkb]];
[self compareByteArrayWithExpected:expectedWKB andActual:actualWKB];
}

// Compare all bytes
[GPKGTestUtils assertEqualIntWithValue:(int)[expected data].length andValue2:(int)[actual data].length];
[GPKGTestUtils assertEqualIntWithValue:(int)expectedData.length andValue2:(int)actualData.length];
if(compareGeometryBytes){
[self compareByteArrayWithExpected:[expected data] andActual:[actual data]];
[self compareByteArrayWithExpected:expectedData andActual:actualData];
}
}

Expand Down

0 comments on commit 041e633

Please sign in to comment.