-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes parsing of signed numeric literals
- Loading branch information
Showing
4 changed files
with
142 additions
and
55 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
74 changes: 74 additions & 0 deletions
74
partiql-lang/src/test/kotlin/org/partiql/lang/syntax/PartiQLParserLiteralTests.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,74 @@ | ||
package org.partiql.lang.syntax | ||
|
||
import org.junit.jupiter.api.parallel.Execution | ||
import org.junit.jupiter.api.parallel.ExecutionMode | ||
import org.junit.jupiter.params.ParameterizedTest | ||
import org.junit.jupiter.params.provider.MethodSource | ||
|
||
class PartiQLParserLiteralTests : PartiQLParserTestBase() { | ||
|
||
override val targets: Array<ParserTarget> = arrayOf(ParserTarget.EXPERIMENTAL) | ||
|
||
@ParameterizedTest | ||
@MethodSource("cases") | ||
@Execution(ExecutionMode.CONCURRENT) | ||
fun testAll(case: Case) { | ||
assertExpression( | ||
source = case.input, | ||
expectedPigAst = case.expect, | ||
) | ||
Long.MAX_VALUE | ||
} | ||
|
||
companion object { | ||
|
||
@JvmStatic | ||
fun cases() = listOf( | ||
Case( | ||
input = "1", | ||
expect = "(lit 1)" | ||
), | ||
Case( | ||
input = "+-1", | ||
expect = "(lit -1)" | ||
), | ||
Case( | ||
input = "-+1", | ||
expect = "(lit -1)" | ||
), | ||
Case( | ||
input = "-+-1", | ||
expect = "(lit 1)" | ||
), | ||
Case( | ||
input = "+++1", | ||
expect = "(lit 1)" | ||
), | ||
Case( | ||
input = "-1", | ||
expect = "(lit -1)" | ||
), | ||
Case( | ||
input = "+1", | ||
expect = "(lit 1)" | ||
), | ||
Case( | ||
input = "9223372036854775808", // Long.MAX_VALUE + 1 | ||
expect = "(lit 9223372036854775808)" | ||
), | ||
Case( | ||
input = "-9223372036854775809", // Long.MIN_VALUE - 1 | ||
expect = "(lit -9223372036854775809)" | ||
), | ||
Case( | ||
input = "+9223372036854775808", | ||
expect = "(lit 9223372036854775808)" | ||
), | ||
) | ||
} | ||
|
||
class Case( | ||
@JvmField val input: String, | ||
@JvmField val expect: String, | ||
) | ||
} |
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