-
Notifications
You must be signed in to change notification settings - Fork 62
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
Showing
34 changed files
with
225 additions
and
182 deletions.
There are no files selected for viewing
71 changes: 35 additions & 36 deletions
71
partiql-cli/src/test/kotlin/org/partiql/cli/functions/PowTest.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 |
---|---|---|
@@ -1,36 +1,35 @@ | ||
|
||
package org.partiql.cli.functions | ||
|
||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Disabled | ||
import org.junit.jupiter.api.Test | ||
import org.partiql.cli.makeCliAndGetResult | ||
import org.partiql.cli.pipeline.AbstractPipeline | ||
import org.partiql.cli.utils.ServiceLoaderUtil | ||
import java.nio.file.Paths | ||
|
||
/** | ||
* Class `PowTest` is used to test the 'test_power' function, which calculates the base to the power of exponent. | ||
* It is a plugin mockdb functions loaded by Java Service Loader. | ||
* | ||
* @property pipeline Creates a pipeline using service loaded functions. It allows to process a stream of records. | ||
* | ||
* @constructor Creates an instance of `PowTest`. | ||
*/ | ||
@Disabled | ||
class PowTest { | ||
|
||
val pluginPath = Paths.get(System.getProperty("testingPluginDirectory")) | ||
|
||
private val pipeline = AbstractPipeline.create( | ||
AbstractPipeline.PipelineOptions( | ||
functions = ServiceLoaderUtil.loadFunctions(pluginPath) | ||
) | ||
) | ||
|
||
@Test | ||
fun PowTest() { | ||
val result = makeCliAndGetResult(query = "test_power(2,3)", pipeline = pipeline) | ||
assertEquals(8.0, result.toDouble()) | ||
} | ||
} | ||
// | ||
// package org.partiql.cli.functions | ||
// | ||
// import org.junit.jupiter.api.Assertions.assertEquals | ||
// import org.junit.jupiter.api.Disabled | ||
// import org.junit.jupiter.api.Test | ||
// import org.partiql.cli.makeCliAndGetResult | ||
// import org.partiql.cli.pipeline.AbstractPipeline | ||
// import java.nio.file.Paths | ||
// | ||
// /** | ||
// * Class `PowTest` is used to test the 'test_power' function, which calculates the base to the power of exponent. | ||
// * It is a plugin mockdb functions loaded by Java Service Loader. | ||
// * | ||
// * @property pipeline Creates a pipeline using service loaded functions. It allows to process a stream of records. | ||
// * | ||
// * @constructor Creates an instance of `PowTest`. | ||
// */ | ||
// @Disabled | ||
// class PowTest { | ||
// | ||
// val pluginPath = Paths.get(System.getProperty("testingPluginDirectory")) | ||
// | ||
// private val pipeline = AbstractPipeline.create( | ||
// AbstractPipeline.PipelineOptions( | ||
// functions = ServiceLoaderUtil.loadFunctions(pluginPath) | ||
// ) | ||
// ) | ||
// | ||
// @Test | ||
// fun PowTest() { | ||
// val result = makeCliAndGetResult(query = "test_power(2,3)", pipeline = pipeline) | ||
// assertEquals(8.0, result.toDouble()) | ||
// } | ||
// } |
80 changes: 40 additions & 40 deletions
80
partiql-cli/src/test/kotlin/org/partiql/cli/functions/TrimLeadTest.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 |
---|---|---|
@@ -1,40 +1,40 @@ | ||
|
||
package org.partiql.cli.functions | ||
|
||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Disabled | ||
import org.junit.jupiter.api.Test | ||
import org.partiql.cli.makeCliAndGetResult | ||
import org.partiql.cli.pipeline.AbstractPipeline | ||
import org.partiql.cli.utils.ServiceLoaderUtil | ||
import java.nio.file.Paths | ||
|
||
/** | ||
* Class `TrimLeadTest` is used to test the 'trim_lead' function, which is used to trim the leading whitespace characters | ||
* from the string it processes. It is a plugin mockdb functions loaded by Java Service Loader. | ||
* | ||
* @property pipeline Creates a pipeline using service loaded functions. It allows to process a stream of records. | ||
* | ||
* @constructor Creates an instance of `TrimLeadTest`. | ||
*/ | ||
@Disabled | ||
class TrimLeadTest { | ||
|
||
val pluginPath = Paths.get(System.getProperty("testingPluginDirectory")) | ||
|
||
private val pipeline = AbstractPipeline.create( | ||
AbstractPipeline.PipelineOptions( | ||
functions = ServiceLoaderUtil.loadFunctions(pluginPath) | ||
) | ||
) | ||
|
||
@Test | ||
fun TrimTest() { | ||
val input = "' hello'" | ||
val expected = "\"hello\"" | ||
|
||
val result = makeCliAndGetResult(query = "trim_lead($input)", pipeline = pipeline) | ||
|
||
assertEquals(expected, result.trim()) | ||
} | ||
} | ||
// | ||
// package org.partiql.cli.functions | ||
// | ||
// import org.junit.jupiter.api.Assertions.assertEquals | ||
// import org.junit.jupiter.api.Disabled | ||
// import org.junit.jupiter.api.Test | ||
// import org.partiql.cli.makeCliAndGetResult | ||
// import org.partiql.cli.pipeline.AbstractPipeline | ||
// import org.partiql.cli.utils.ServiceLoaderUtil | ||
// import java.nio.file.Paths | ||
// | ||
// /** | ||
// * Class `TrimLeadTest` is used to test the 'trim_lead' function, which is used to trim the leading whitespace characters | ||
// * from the string it processes. It is a plugin mockdb functions loaded by Java Service Loader. | ||
// * | ||
// * @property pipeline Creates a pipeline using service loaded functions. It allows to process a stream of records. | ||
// * | ||
// * @constructor Creates an instance of `TrimLeadTest`. | ||
// */ | ||
// @Disabled | ||
// class TrimLeadTest { | ||
// | ||
// val pluginPath = Paths.get(System.getProperty("testingPluginDirectory")) | ||
// | ||
// private val pipeline = AbstractPipeline.create( | ||
// AbstractPipeline.PipelineOptions( | ||
// functions = ServiceLoaderUtil.loadFunctions(pluginPath) | ||
// ) | ||
// ) | ||
// | ||
// @Test | ||
// fun TrimTest() { | ||
// val input = "' hello'" | ||
// val expected = "\"hello\"" | ||
// | ||
// val result = makeCliAndGetResult(query = "trim_lead($input)", pipeline = pipeline) | ||
// | ||
// assertEquals(expected, result.trim()) | ||
// } | ||
// } |
40 changes: 20 additions & 20 deletions
40
partiql-cli/src/test/kotlin/org/partiql/cli/utils/ServiceLoaderUtilTest.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 |
---|---|---|
@@ -1,20 +1,20 @@ | ||
|
||
import org.junit.jupiter.api.Assertions.assertTrue | ||
import org.junit.jupiter.api.Disabled | ||
import org.junit.jupiter.api.Test | ||
import org.partiql.cli.utils.ServiceLoaderUtil | ||
import org.partiql.lang.eval.ExprFunction | ||
import java.nio.file.Paths | ||
|
||
@Disabled | ||
class ServiceLoaderUtilTest { | ||
@Test | ||
fun `loadPlugins loads the correct plugins`() { | ||
|
||
val pluginPath = Paths.get(System.getProperty("testingPluginDirectory")) | ||
val functions: List<ExprFunction> = ServiceLoaderUtil.loadFunctions(pluginPath) | ||
|
||
assertTrue(functions.map { it.signature.name }.contains("trim_lead")) | ||
assertTrue(functions.map { it.signature.name }.contains("test_power")) | ||
} | ||
} | ||
// | ||
// import org.junit.jupiter.api.Assertions.assertTrue | ||
// import org.junit.jupiter.api.Disabled | ||
// import org.junit.jupiter.api.Test | ||
// import org.partiql.cli.utils.ServiceLoaderUtil | ||
// import org.partiql.lang.eval.ExprFunction | ||
// import java.nio.file.Paths | ||
// | ||
// @Disabled | ||
// class ServiceLoaderUtilTest { | ||
// @Test | ||
// fun `loadPlugins loads the correct plugins`() { | ||
// | ||
// val pluginPath = Paths.get(System.getProperty("testingPluginDirectory")) | ||
// val functions: List<ExprFunction> = ServiceLoaderUtil.loadFunctions(pluginPath) | ||
// | ||
// assertTrue(functions.map { it.signature.name }.contains("trim_lead")) | ||
// assertTrue(functions.map { it.signature.name }.contains("test_power")) | ||
// } | ||
// } |
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
Oops, something went wrong.