Skip to content

Commit

Permalink
Adds Kotlin test runner to verify ported tests are ported correctly (#34
Browse files Browse the repository at this point in the history
)
  • Loading branch information
alancai98 authored Sep 26, 2022
1 parent b8ddd15 commit 066da8f
Show file tree
Hide file tree
Showing 20 changed files with 1,465 additions and 51 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ jobs:
working-directory: ./partiql-tests-validator
run: gradle build

- name: Validate Ported Tests with Kotlin Test Runner
working-directory: ./partiql-tests-kotlin-test-runner
run: gradle build

6 changes: 3 additions & 3 deletions partiql-tests-data/eval-equiv/spec-tests.ion
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
]
},
{
name: "equiv tuple path navigation",
name: "equiv tuple path navigation with array notation",
statement: tuple_navigation_with_array_notation,
assert: {
evalMode: [EvalModeCoerce, EvalModeError],
Expand Down Expand Up @@ -172,7 +172,7 @@
},
{
name: "equiv of comma, cross join, and join",
statement: comma_cross_join_and_join,
statement: comma_cross_join_and_join_and_lateral,
env: {
customers: [
{id: 5, name: "Joe"},
Expand Down Expand Up @@ -540,7 +540,7 @@
]
},
{
name: "equiv group by with aggregates",
name: "equiv aliases from select clause",
statement: aliases_from_select_clause,
env: {
people: $bag::[{name: "zoe", age: 10, tag: "child"},
Expand Down
2 changes: 1 addition & 1 deletion partiql-tests-data/eval/primitives/basic.ion
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ basic::[
result:EvaluationSuccess,
output:$bag::[
null,
null,
$missing::null,
2
]
}
Expand Down
8 changes: 2 additions & 6 deletions partiql-tests-data/eval/query/select/projection.ion
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
assert:{
evalMode:[EvalModeCoerce, EvalModeError],
result:EvaluationSuccess,
output:$bag::[
{
someColumn:$missing::null
}
]
output:$bag::[{}]
}
},
{
Expand All @@ -36,7 +32,7 @@
result:EvaluationSuccess,
output:$bag::[
{
someColumn:$missing::null
_1:{}
}
]
}
Expand Down
5 changes: 3 additions & 2 deletions partiql-tests-data/eval/query/select/select.ion
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ envs::{
c:100
},
d:3.,
someAlias:"hello",
}

{
Expand Down Expand Up @@ -408,8 +409,8 @@ select_join::[
}
},
{
name:"selectNonCorrelatedJoin", // Note that the joined s is coming from the global scope without @-operator
statement:"SELECT s.id AS id, v AS title FROM stores AS s, s AS v",
name:"selectNonCorrelatedJoin", // Note that the joined someAlias is coming from the global scope without @-operator
statement:"SELECT someAlias.id AS id, v AS title FROM stores AS someAlias, someAlias AS v",
assert:{
evalMode:[EvalModeCoerce, EvalModeError],
result:EvaluationSuccess,
Expand Down
26 changes: 10 additions & 16 deletions partiql-tests-data/eval/query/undefined-variable-behavior.ion
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,15 @@ undefined_variable_behavior::[
{
name:"undefinedUnqualifiedVariableInSelectWithUndefinedVariableBehaviorMissing",
statement:"SELECT s.a, s.undefined_variable, s.b FROM `[{a:100, b:200}]` s",
assert:[
{
evalMode:EvalModeCoerce,
result:EvaluationSuccess,
output:$bag::[
{
a:100,
b:200
}
]
},
{
evalMode:EvalModeError,
result:EvaluationFail,
}
]
assert:{
evalMode:[EvalModeCoerce, EvalModeError],
result:EvaluationSuccess,
output:$bag::[
{
a:100,
b:200
}
]
}
}
]
34 changes: 11 additions & 23 deletions partiql-tests-data/eval/spec-tests.ion
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
assert: {
evalMode: [EvalModeCoerce, EvalModeError],
result: EvaluationSuccess,
output: $bag::[{price: 840.05, sym: "amzn"}, {price: 31.06, sym: "tdc"}]
output: $bag::[{price: 840.05, symbol: "amzn"}, {price: 31.06, symbol: "tdc"}]
}
}
]
Expand Down Expand Up @@ -388,32 +388,20 @@
{
name: "cast and operations with missing argument",
statement: "SELECT VALUE {'a':3*v.a, 'b':3*(CAST(v.b AS INTEGER))} FROM [{'a':1, 'b':'1'}, {'a':2}] v",
assert: [
{
evalMode: EvalModeCoerce,
result: EvaluationSuccess,
output: $bag::[{a:3, b:3}, {a:6}]
},
{
evalMode: EvalModeError,
result: EvaluationFail,
},
]
assert: {
evalMode: [EvalModeCoerce, EvalModeError],
result: EvaluationSuccess,
output: $bag::[{a:3, b:3}, {a:6}]
}
},
{
name: "missing value in arithmetic expression",
statement: "5 + missing",
assert: [
{
evalMode: EvalModeCoerce,
result: EvaluationSuccess,
output: $missing::null
},
{
evalMode: EvalModeError,
result: EvaluationFail,
},
]
assert: {
evalMode: [EvalModeCoerce, EvalModeError],
result: EvaluationSuccess,
output: $missing::null
}
},
{
name: "data type mismatch in comparison expression",
Expand Down
Loading

0 comments on commit 066da8f

Please sign in to comment.