Skip to content

Commit

Permalink
Add test for $geoWithin with $centerSphere
Browse files Browse the repository at this point in the history
  • Loading branch information
murermader committed Aug 23, 2024
1 parent dce3e2a commit 7db722d
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions dbms/src/test/java/org/polypheny/db/mql/MqlGeoFunctionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public class MqlGeoFunctionsTest extends MqlTestTemplate {

@BeforeAll
public static void init() {
createMongoDbAdapter();
log.info( "Created Mongo adapter successfully." );
// createMongoDbAdapter();
// log.info( "Created Mongo adapter successfully." );
}


Expand Down Expand Up @@ -73,9 +73,6 @@ public void beforeEach() {

@Test
public void docGeoWithinTest() {
// TODO: Compare values with MongoDB, instead of with the values that I expect.
// Somehow possible to execute the commands once on mongodb, and once on
// hsqldb?
String insertDocuments = """
db.%s.insertMany([
{
Expand Down Expand Up @@ -127,6 +124,24 @@ public void docGeoWithinTest() {
""".formatted( collectionName );
result = execute( geoWithinGeometry );
assertEquals( result.data.length, 2 );

// TODO: This test does not make any sense, as 1.5 in radians is so big
// that it includes all three points.
// Create another test, with more sensible numbers...
String geoWithinCenterSphere = """
db.%s.find({
legacy: {
$geoWithin: {
$centerSphere: [
[ 0, 0 ],
1.5
]
}
}
})
""".formatted( collectionName );
result = execute( geoWithinCenterSphere );
assertEquals( 3, result.data.length );
}

}

0 comments on commit 7db722d

Please sign in to comment.