-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91071ae
commit b70c8ef
Showing
8 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/test/kotlin/org/sheinbergon/dremio/udf/gis/STIsSimpleTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.sheinbergon.dremio.udf.gis | ||
|
||
import org.apache.arrow.vector.holders.NullableBitHolder | ||
import org.apache.arrow.vector.holders.NullableVarBinaryHolder | ||
import org.sheinbergon.dremio.udf.gis.spec.GeometryAccessorFunSpec | ||
|
||
internal class STIsSimpleTests : GeometryAccessorFunSpec<STIsSimple, NullableBitHolder>() { | ||
|
||
init { | ||
testGeometryAccessor( | ||
"Calling ST_IsSimple on a self-intersecting Polygon", | ||
"POLYGON((1 2, 3 4, 5 6, 1 2))", | ||
false | ||
) | ||
|
||
testGeometryAccessor( | ||
"Calling ST_IsSimple on a simple LineString", | ||
"LINESTRING(2 1, 1 3, 6 6, 5 7, 5 6)", | ||
true | ||
) | ||
|
||
testNullGeometryAccessor( | ||
"Calling ST_IsSimple on null input returns false", | ||
) | ||
} | ||
|
||
override val function = STIsSimple().apply { | ||
binaryInput = NullableVarBinaryHolder() | ||
output = NullableBitHolder() | ||
} | ||
|
||
override val STIsSimple.wkbInput: NullableVarBinaryHolder get() = function.binaryInput | ||
override val STIsSimple.output: NullableBitHolder get() = function.output | ||
} |
37 changes: 37 additions & 0 deletions
37
src/test/kotlin/org/sheinbergon/dremio/udf/gis/STSimplifyTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.sheinbergon.dremio.udf.gis | ||
|
||
import org.apache.arrow.vector.holders.Float8Holder | ||
import org.apache.arrow.vector.holders.NullableVarBinaryHolder | ||
import org.sheinbergon.dremio.udf.gis.spec.GeometryProcessingFunSpec | ||
import org.sheinbergon.dremio.udf.gis.util.allocateBuffer | ||
import org.sheinbergon.dremio.udf.gis.util.reset | ||
|
||
internal class STSimplifyTests : GeometryProcessingFunSpec<STSimplify>() { | ||
|
||
init { | ||
|
||
beforeEach { | ||
function.toleranceInput.reset() | ||
} | ||
|
||
testGeometryProcessing( | ||
name = "Calling ST_Simplify on a LINESTRING with a tolerance of 1000", | ||
wkt = "LINESTRING(-122.306067 37.55412,-122.32328 37.561801,-122.325879 37.586852)", | ||
expected = "LINESTRING (-122.30607 37.55412, -122.32588 37.58685)" | ||
) { function.toleranceInput.value = 1000.0 } | ||
|
||
testNullGeometryProcessing( | ||
"Calling ST_Simplify on a NULL input" | ||
) | ||
} | ||
|
||
override val function = STSimplify().apply { | ||
binaryInput = NullableVarBinaryHolder() | ||
toleranceInput = Float8Holder() | ||
binaryOutput = NullableVarBinaryHolder() | ||
buffer = allocateBuffer() | ||
} | ||
|
||
override val STSimplify.wkbInput: NullableVarBinaryHolder get() = function.binaryInput | ||
override val STSimplify.wkbOutput: NullableVarBinaryHolder get() = function.binaryOutput | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters